It is showing syntax error plz help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1
25th Sep 2021, 5:51 PM
Mohan vashist
5 Answers
+ 2
It should be int(input()) Not just input() because input() takes the number you enter as a string whereas int changes it's datatype to integer. Correct code: n1=int(input("x")) n2=int(input('y')) sum=n1+n2 print("sum of the number=",sum) prod=n1*n2 print("product of the number=",prod)
25th Sep 2021, 6:20 PM
Aryan Silswal
Aryan Silswal - avatar
+ 1
Unfortunately there are a lot of issues with your code. You should start over with the Python for Beginners course to learn the basics of python.
25th Sep 2021, 5:57 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Yes, im beginner thanks
25th Sep 2021, 5:59 PM
Mohan vashist
+ 1
Or float(input()) if you want it to work for numbers with decimals.
25th Sep 2021, 7:14 PM
Simon Sauter
Simon Sauter - avatar
+ 1
If my guess is correct the code should take two inputs and print the sum and product. Try this instead: https://code.sololearn.com/cZV5eJZDf08L/?ref=app
25th Sep 2021, 10:23 PM
🌼Faith🌼
🌼Faith🌼 - avatar