what is the problem in this code??? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

what is the problem in this code???

x = int(input()) y = int(input()) if x+y>0 : print ('this number is positive') what is the problem in this code???

20th Jan 2018, 11:15 PM
Samuel Antoine
Samuel Antoine - avatar
4 Antworten
+ 4
I'm not familiar with the language but if x = -2 and y = -1, you will get the wrong output. you're just adding the inputs without considering if they are negative.
20th Jan 2018, 11:19 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
oh... thanks now I found the difference
20th Jan 2018, 11:35 PM
Samuel Antoine
Samuel Antoine - avatar
0
but sorry i didn't find any difference between your code and mine
20th Jan 2018, 11:26 PM
Samuel Antoine
Samuel Antoine - avatar
0
OK thanks for your observation
20th Jan 2018, 11:26 PM
Samuel Antoine
Samuel Antoine - avatar