Skip to content

String & List Problems

ZekeLabs Technologies Private Limited edited this page Dec 5, 2016 · 5 revisions
  • Given a list of strings, print all the words that start with 'a'.
  • Given a list of numbers, find all the numbers which are less than 0 & put them in different list
  • For a list containing numbers & string, create two lists - one containing numbers & other containing strings
  • Given a list of words( multiple words ) ['hello world','good lord','great friends'], find the longest word/sentence
  • Given a list of numbers, find all the numbers that are multiple of 2
  • Replace all the 'vowels from the text with space
  • Write a Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included).
  • Write a Python program to convert temperatures to and from celsius, fahrenheit [ Formula : c/5 = f-32/9 [ where c = temperature in celsius and f = temperature in fahrenheit ]
  • Write a Python program to count the number of even and odd numbers from a series of numbers.  Sample numbers : numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9)  Expected Output :  Number of even numbers : 5 Number of odd numbers : 4
  • How many times will the following code print "Welcome to Python"?

count = 0 while count < 10:     print("Welcome to Python")     count += 1

  • What is the output of the following code?

x = 0 while x < 4:     x = x + 1

print("x is", x)

  • What will be displayed when the following code is executed?

    number = 6     while number > 0:         number -= 3         print(number, end = ' ')

  • Write a Python program which iterates the integers from 1 to 50. For multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". Sample Output :  fizzbuzz 1 2 fizz 4  buzz
  • Write a Python program to calculate the sum and average of n integer numbers.
  • Write a Python program to get the Fibonacci series between 0 to 50.
  • What will be the output for : x = 'abcd' for i in range(len(x)): x = 'a' print(x)
Clone this wiki locally