Logo

Python Questions Set 29:

Quiz Mode

Which is used in python to form a block of code?

Solution:

 The format function, when applied on a string returns ___________ 

1
2

Solution:

-----------  is a single expression anonymous function often used as an inline function. 

Solution:

Which of the following keywords in programming does not use the 'else' keyword?

1
2
3
4

Solution:

What is the output of the following Python code?

import math

print(math.copysign(1, -2))

1
2
3
4

Solution:

How is a switch-case statement typically implemented in Python?

1
2
3
4

Solution:

What will be the output of the following Python code?

s={1, 2, 3}
s.update(4)
s

1
2
3
4

Solution:

How do you append values to a list in Python?

1
2
3
4

Solution:

What is the output of the given code?


def evenodd(x):

    if x%2==0:

        print("even")

    else

        print("odd")


evenodd(3458)

1
2
3

Solution:

Find the output of the following code


string = "abcdefghijkl@pqrs.tuv wxyz"

x = string.find('@')

y = string.find(' ', x)

sub = string[x+1:y]

print(sub)

1
2
3
4
5

Solution: