0

Please help on below lines: i could not able to input 2 values. After getting value of N, throwing error at line 3

N = input("Entered First Number is: ") M = input("Entered Second Number is: ") if int(N) < int(M): print (N,"is less than", M) else : if int(N) == 100: print (N,"is equal to",M) else: print (N,"is greater than",M)

15th Nov 2017, 4:22 AM
Mohammed Farook
Mohammed Farook - avatar
2 Answers
0
N = int(input("Entered First Number is: ")) M = int(input("Entered Second Number is: ")) if N < M: print(N, "is less than", M) elif N == M: print(N, "is equal to", M) else: print(N, "is greater than", M) Well, since you didn't say what to help with, I'm just going to nit-pick and correct anything I see. First thing I did was undo all the int() calls all over, you can simply wrap your input calls in line 1 and 2, and it'll save you tons of extra work/issues. Second thing I did was correct your if/else statements. You can use something called "elif", which means it'll also try to match that condition. but not try it if the first if statement is true. The third thing was your EQUAL condition. You used 100. All I did was ask Python to compare N and M. If this wasn't what you wanted, perhaps some explanation?
15th Nov 2017, 4:33 AM
Sapphire
+ 2
we should help with what?
15th Nov 2017, 4:29 AM
᠌᠌Code X
᠌᠌Code X - avatar