Why not correct? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
4th May 2018, 2:16 PM
Lil Shi
Lil Shi - avatar
5 Answers
+ 2
https://code.sololearn.com/cfkbWw5F0M5M/?ref=app
4th May 2018, 2:56 PM
TurtleShell
TurtleShell - avatar
+ 3
In addition to what TurtleShell stated, your if else logic is backwards for the use of (ad >= 50). more should be in the if statement and less in the else. You could also do a print statement like: print(ad, 'more than 50') without the explicit need to convert ad to a string first.
4th May 2018, 2:51 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Optional - The parameters a and d are useless since you gonna ask for input and then put that input into the variables so remove them - Have a better name for ad variable like sum or total To get the code working properly - Call your function - Put int(input()) instead of just input() so Python will turn the input from string to int - You have to turn the ad variable into a string or use string formating in the print() function like... print(str(ad) + " is less than 50")
4th May 2018, 2:31 PM
TurtleShell
TurtleShell - avatar
+ 1
Sorry, but I did not understand how to do it. Could you write How to write this code correctly?
4th May 2018, 2:44 PM
Lil Shi
Lil Shi - avatar
+ 1
thanks, guys :D
4th May 2018, 3:05 PM
Lil Shi
Lil Shi - avatar