0

Is the code correct?

x= input ("enter x ") y= input ("enter y") if x>y: print ("x is greater than y") else: print ("y is greater than x") is the code correct and if not what's the correct code? the output to the above is: y is greater than x no matter that the two inputs is

15th Dec 2016, 6:13 AM
Debanjona Nath
Debanjona Nath - avatar
6 Réponses
+ 3
Its working good. Input on Playground should be separed by a enter (another line) like this: //param x //param y 1 2
15th Dec 2016, 6:25 AM
Nahuel
Nahuel - avatar
+ 2
You are doing something wrong. you can paste it here and check it by yourself. Check if your inputs are in the correct order in visual studio. https://code.sololearn.com/#py
15th Dec 2016, 6:31 AM
Nahuel
Nahuel - avatar
0
It looks correct to me, and it appears to work in the sololearn code playground and my linux terminal. I have to separate the inputs by a line in the playground though.
15th Dec 2016, 6:26 AM
Antek
0
but here in visual studio the output is Y greater than X even if the if statement holds true
15th Dec 2016, 6:28 AM
Debanjona Nath
Debanjona Nath - avatar
0
when I executed it in solo learn playground the code runs perfectly but in VS it's giving an error
15th Dec 2016, 6:39 AM
Debanjona Nath
Debanjona Nath - avatar
0
aren't you comparing strings there? Looks to me like you should cast them to integers or floats
15th Dec 2016, 8:54 PM
Max Schlundt
Max Schlundt - avatar