Logo

Python Questions Set 198:

Quiz Mode

a = [[3, 4, 5], 3]

a = sum(a)

print(a)

1
2
3
4

Solution:

Which method is used to add a entire list to a list.

1
2
3
4

Solution:

Which Python module supports regular expressions?

1
2
3
4

Solution:

What does the abbreviation 'WTF' stand for?

1
2
3
4

Solution:

 

What will be the output of the following Python code snippet?

print('ab cd ef'.title())

1
2
3

Solution:

Given the following code:

list1=[1,2,3,4]

list2=[5,6,7,8]

for a,b in zip(list1,list2):

     print(a,b)

1
2
3
4

Solution:

 What will be the output of the following Python code?

i = 1
while True:
   if i%2 == 0:
       break
   print(i)
   i += 2

1
2
3
4

Solution:

What is the output of the following code?


a = 11_22_33_44_55

b = 11,22,33,44,55

print(type(b))

print(type(a))

1
2
3
4
5

Solution:

What will be the output of the following code?

class sem:
pass

sem1 = sem()
sem2 = sem()
sem3 = sem()

sem1.am1 = 70
sem2.am2 = 80
sem3.am3 = 65

sem1.ap1 = 65
sem2.ap2 = 70
sem3.ds = 80

print(sem1.am1)
print(sem3.ds)

1
2
3
4

Solution:

 

Point out the error (if any) in the code shown below if the system date is 18th June, 2017?

tday=datetime.date.today()
bday=datetime.date(2017,9,18)
till_bday=bday-tday
print(till_bday)

1
2
3
4

Solution: