Logo

Python Questions Set 165:

Quiz Mode

 If a=(1,2,3,4), a[1:-1] is _________ 

1
2

Solution:

Deduce the output of the following code:


x=(22,45,12,76,26)

y=list(filter(lambda i: i%4==0,x))

print(y)

Solution:

What is the output of the following code?


dct = {"1": 0, "2": 1}

print(dct["2"] % dct["1"])

1
2
3
4

Solution:

Find the output of the following code:

a = 6
b = 7
c = a + b
while c <= 25:
print(c)
c = c + 15

1
2
3
4

Solution:

 

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

print('abcd'.translate({97: 98, 98: 99, 99: 100}))

1
2
3
4

Solution:

 

What will be the output of the following Python code?

print("Hello {name1} and {name2}".format('foo', 'bin'))

1
2

Solution:

What will be the output of the following Python code?


d = {0: 'a', 1: 'b', 2: 'c'}


for i in d:

    print(i)

1
2
3
4

Solution:

What will be the output of the following Python code?

a={1,2,3}
b={1,2,3}
c=a.issubset(b)
print(c)

1
2
3
4

Solution:

What is the output of the following code?


lst = ['abc', 'Abc', 'ABC', 'aBC']

l = lst.sort()

print(l)


1
2
3
4

Solution:

 

import turtle
t=turtle.Pen()
t.color(1,1,1)
t.begin_fill()
for i in range(0,3):
t.forward(100)
t.right(120)
             t.end_fill()

1
2
3
4

Solution: