What's the problem in this code !? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the problem in this code !?

a = int(input("")) i=1 res=1 print(" mutiplication table of "+a+"is:\n") while i<10 res=a*i print(res) i++

27th Jul 2018, 11:21 AM
Khadija Onaceur
Khadija Onaceur - avatar
5 Answers
+ 2
Apart from these mentioned by hinanawi, there are 2 more bugs: 1. The i++ syntax is not available in Python. 2. a can't be concatenated with strings in this way as it is an int. Here is a working version of your code: https://code.sololearn.com/c50waTGCDFfN/?ref=app
27th Jul 2018, 11:57 AM
giannismach
giannismach - avatar
+ 3
i++ --> i+=1
27th Jul 2018, 12:00 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
various indentation issues and syntax errors: unindent every line after the first then add ":" after the "while i<10" then indent everything after that by one
27th Jul 2018, 11:28 AM
hinanawi
hinanawi - avatar
+ 2
Lucky Luke yes i forgot, the pluses on line 4 should be commas
27th Jul 2018, 11:58 AM
hinanawi
hinanawi - avatar
0
now it works ;thank you so much guys :))
27th Jul 2018, 12:12 PM
Khadija Onaceur
Khadija Onaceur - avatar