+ 12

When I add for loop error occur, Could you explain me what mistake?

"""Example": x = 17 17 * 3 + 1 = 52 """ s = int(input("Enter number: ")) print(s) for i in range(5): a=s*3+1 print(a)

30th May 2020, 2:28 PM
Nisha Agrawal
Nisha Agrawal - avatar
4 odpowiedzi
+ 5
use this if you want to print a one time s = int(input("Enter number: ")) print(s) a=s*3+1 print(a) use this if 5 time s = int(input("Enter number: ")) print(s) for i in range(5): a=s*3+1 print(a) hope it helped. edited. thanks James Clark I. Vinarao. it was a mistake
30th May 2020, 2:33 PM
M Tamim
M Tamim - avatar
+ 7
You have to make an indent (a set of spaces) of the code in the loop. Refer to the lesson below on indentation: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2277/
30th May 2020, 2:31 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
I got it . I need to add space 5 times where I went to loop the code. Thank you so much all my friends for sharing your thoughts.
30th May 2020, 2:50 PM
Nisha Agrawal
Nisha Agrawal - avatar
+ 4
Indentation error spotted in a=s*3+1
30th May 2020, 2:32 PM
James Clark I. Vinarao
James Clark I. Vinarao - avatar