+ 1

Can anyone help debug this pls?

Rules of divisibility https://code.sololearn.com/cs8abCC1ohzs/?ref=app

11th Dec 2020, 3:35 PM
Mas'ud Saleh
Mas'ud Saleh - avatar
3 Réponses
+ 6
x = int(input()) #This is the correct format for getting user input rule = "enters any integer" print(str(x)+ rule+ " without remainder") #you can't add any integers with strings. if x == 1: print("output") elif x==2: print("output ") elif x==3: print("output") #If and elif should be aligned vertically to avoid indentation error
11th Dec 2020, 3:46 PM
Simba
Simba - avatar
+ 6
There are some issues in the code: - have a look at your indentation, "elif" has to be on the same level as if ( in general: indentation is too small, recommended is 4 spaces, but this does not cause an error) - input is not correct. int() has to be the outer part - your output is trying to concatenate int + string, this creates an error. you can use comma instead of "+" I did not really made a test run, so please check it yourself.
11th Dec 2020, 3:44 PM
Lothar
Lothar - avatar
+ 2
I have corrected the codes. Special thanks to Simba. Rules of divisibility https://code.sololearn.com/cs8abCC1ohzs/?ref=app
12th Dec 2020, 10:05 AM
Mas'ud Saleh
Mas'ud Saleh - avatar