Please explain why this code is executed.

if a> c:

If you enter the numbers 9, 5, 15? And this condition is also satisfied:

if b> c:

That is the answer I get is

9

five

15

9 15 5

5 15 9

How it enters the second if if a <c, as well as it enters the third if if b <c

a = input () b = input () c = input () if a > b: if a > c: print (a, c, b) else: print (c, a, b) if b > c: print (b, c, a) else: print (c, b, a)} 
  • Do you enter numbers, not strings? - PetSerAl

1 answer 1

The values ​​entered must be reduced to the numbers a = int(input())

Regardless, the logic is broken everywhere.

if b > c runs independently of the first.
And the possible outcomes should be 6, not 4

 if A > B: if A > C: if B > C: ABC else: ACB else: CAB else: if B > C: if C > A: BCA else: BAC else: CBA 
  • In your version also does not work - Decya
  • This is how it turns out 9 5 15 9 5 15 - Decya
  • Input 9 5 15 Conclusion 9 5 15 - Decya
  • In my version it works, but I have not seen your interpretation. - MBo
  • But no, sorry, it really works - Decya