Assuming a user enters 30 55 and 10 as the input what is the

Assuming a user enters 30, 55, and 10 as the input, what is the output of the following code snippet?

num1 = int(input(\"Enter a number: \"))
num2 = int(input(\"Enter a number: \"))
num3 = int(input(\"Enter a number: \"))
if not (num1 > num2 and num1 > num3) :
print(num1)
elif not(num2 > num1 and num2 > num3) :
print(num2)
elif not (num3 > num1 and num3 > num2) :
print(num3)

A)    55

B)    10

C)    0

D)    30

Solution

Answer: 30

When we passs inputs 30, 55, and 10 as the inputs then num1 vaue is 30 and num2 value is 55 and num3 value is 10.

this is the first if condition

if not (num1 > num2 and num1 > num3) :

not(30 > 55 and 30 > 10) = not(false && true) = not(false) = true

So if condition will return true so inside if condition we are printing num1 value. So here num1 value is 30

so this code will print 30

Assuming a user enters 30, 55, and 10 as the input, what is the output of the following code snippet? num1 = int(input(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site