Deduce the output of the following code:
def fun(n):
while(n<5):
n+=1
print(n)
fun(0)
Consider the following Python code:
values = [1, 2, 1]
a, b, c = values
print(a)
import datetime
dt_1 = datetime.datetime.today()
dt_2 = datetime.datetime.now()
print(dt_1)
print(dt_2)
Deduce the output of the following code:
n= {1,1,1,2,2,4,5,6,7,8}
n&={1,2,4,5}
print(list(list(filter(lambda x: x>1,n))))
What is the output of the code shown below?
def f(x):
yield x+1
print("test")
yield x+2
g = f(9)
What is the output of the given code?
def swap(x,y):
temp=x
x=y
y=temp
x=2
y=3
swap(x,y)
print(x)
print(y)
What is the output of the following code?
d={'a':1,'b':2,'c':3,'d':4}
for i in d:
print(i)
What is the output of the following code?
def numbers(x,y):
print(x)
return
print(y)
return
print(numbers(4,5))
What will be the output of the following Python code?
>>> a={5,6,7,8}
>>> b={7,8,10,11}
>>> a^b
What is the output of the following code?
a = {22, 26, 21, 29, 24}
a.add(25)
a.update([33, 31, 32])
print(a)
a.remove(21)
a.discard(26)
print(a)