Say s=”hello” what will be the return value of type(s)?
What is the type of each element in sys.argv?
>>>print('a'.maketrans('ABC', '123'))
Which of the following functions is used to identify the instance of a particular type?
What will be the output of the following Python code snippet?
print('abcdefcdghcd'.split('cd', 2))
What will be the output of the following code?
ch='A'
for i in range(2):
for j in range(0,i+1):
print(ch, end="")
ch=chr(ord(ch)+1)
print()
What will be the output of the following code?
def fun():
for i in range(3):
yield '#'
val = fun()
print(next(val))
print(next(val))
print(next(val))
What will happen when the following code is executed?
import os
os.system('shutdown')
The code snippet below checks the value of the variable number
and prints the corresponding output:
number = 20
if number
is:
10, it prints "10"
20, it prints "20"
anything else, it prints "30"
What will be the output of the following Python code?
a = [5,5,6,7,7,7] b = set(a)
def test(lst):
if lst in b:
return 1
else:
return 0
for i in filter(test, a):
print(i,end=" ")