Quiz
Study the code below
a = 3
b = 20
if b > a:
print("hey")
What is the output from the above statement
What is the output of the given code?
a = 10
b = 40
if a = b:
print('equal')
else:
print('not equal')
What is the output of the given code?
a = 10
b = 40
if (a != b):
print(a)
else:
print(b)
What is the output of the given code?
a = 10
if a:
print(a)
else:
print('a')
What is the output of the given code?
x = 20
message = ''
if (x%2 == 0):
message += 'Nay'
if (x%5 == 0):
message += "dah!"
if (x%2 == 0 and x%5 == 0):
message += "Yay"
print(message)
How would you change the above code to print only 'Yay' if the number 'x' is a multiple of 2 and 5 and 'Nay' when it is multiple of only 2 and 'dah!' when it is a multiple of only 5?
What is the output when the below program is run?
a = 5; b = 2; c = 20; d = 5
if c / a > b:
b = b + c
else:
b = b + a
c = c * a - b / 2
if (b < c and d < a):
d = d / 2
else:
a = c - 3
if d % b == 0:
d = c + a
if (c / 2 > b or d - a == b):
d = d - 3
print(a, b, c, d)