I'm starting to learn Python and wrote this:
num1 = int(input('First number '))
num2 = int(input('second number '))
num3 = int(input('third number '))
if num1 > (num2 and num3):
print(f'{num1:2} is bigger')
if num2 > num3:
print(f'{num3:2} is smaller')
if num3 > num2:
print(f'{num2:2} is smaller')
if num2 > (num1 and num3):
print(f'{num2:2} is bigger')
if num1 > num3:
print(f'{num3:2} is smaller')
if num3 > num1:
print(f'{num1:2} is smaller')
if num3 > (num1 and num2):
print(f'{num3:2} is bigger')
if num1 > num2:
print(f'{num2:2} is smaller')
if num2 > num1:
print(f'{num1:2} is smaller')
If I enter "5" for the first number "4" for the second and "2" for the third it outputs:
"5 is bigger
2 is smaller
4 is bigger
2 is smaller"
Why does he reads the line with the false condition statment?
What did I miss?
Also another way to write it would be:
"if num2 > (num1 and num3) and (num1 < num3):
#print(f'{num2:2} is bigger and {num1:2} is smaller')"
but also didn't work.
Thanks everyone.