Give the output of the following when num1 = 4, num2 = 3, num3 = 2

a) num1+=  num2 + num3
Ans: it will not display any output but value of num1 will become 9 because
b) print(num1)

Ans: Will display 9 which is value of num1.
c) num1 = num1 ** (num2 + num3)

Ans: it will not display any output but value of num1 will be updated to 59049 because num1 = num1 ** (num2 + num3) is
num1 = 9**(3+2)
num1 = 9**5
num1 = 9*9*9*9*9
num1 =59049
d) print(num1)
Ans: will display 59049 as num1.
e) num1**= num2 + c

Ans: it will generate error because c is undefined
f) num1 = ‘5’ +’5’

Ans: it will not display any output but num1 will be updated to 55 because
num1 = ‘5’ +’5’
num1 = 55 (because characters are concatenated always not added)
g) print(num1)

Ans: will display 55 as value of num1.
h) print(4.00/(2.0 + 2.0))

Ans: will display 1.0 because
4.00/(2.0 + 2.0)
= 4.00/(4.0)
= 1.0
i) num1 = 2 + 9*((3*12)-8)/10

Ans: will not display any output but num1 will be updated to 27.2 because
num1 = 2 + 9*((3*12)-8)/10
num1 = 2 + 9*(36-8)/10
num1 = 2 + 9*(28)/10
num1 = 2 + 252/10
num1 = 2 + 25.2
num1 = 27.2
j) print(num1)

Ans: will display 27.2 as value of num1.
k) num1 = float(10)

Ans: will not display output but num1 will be updated to 10.0 because
In num1 = float(10) 10 will be converted to 10.0 by float method.
float() is a method in python which returns a floating point value from a number or string.
l) print(num1)

Ans: will display 10.0
m) num1 = int(‘3.14’)

Ans: will not display output but  generate error because passing 3.14 as string literal will be unidentified by compiler.
n) print(num1)

Ans: display Error as mentioned in answer no n.
o) print(10!=9 and 20>=20)

Ans: Will display True as output because both conditions 10 != 0 and 20 >= 20 are True.
p) print(5 % 10 + 10 < 50 and 29 <= 29

Ans: will return True because
print (5 % 10 + 10 < 50 and 29 <= 29)
= print (5 + 10 <50 and 29 <=29)
= print (15 <50 and 29<=20)
= print (True and 29<=20)
= print (True and True)
= True

error: Content is protected !!