0

Hi guys, what`s wrong with this code? I get `No output`.

x = 55 if x > 56: print ('x > 56') if x < 56: print ('x <56') else: print ('x = 56')

18th Jan 2017, 7:07 PM
Anton Churakov
Anton Churakov - avatar
3 ответов
+ 4
You are identating wrong. The second if is inside your first if, so as the first condition is False, it never makes it to the second if
18th Jan 2017, 7:19 PM
Francisco
+ 1
because x is smaller than 56, so there is a break. try this: x = 55 if x > 56: print ('x > 56') elif x < 56: print ('x <56') else: print ('x = 56')
18th Jan 2017, 7:13 PM
Max_N
Max_N - avatar
0
Thank you guys, second if inside the first one, thats a mistake.
18th Jan 2017, 7:25 PM
Anton Churakov
Anton Churakov - avatar