+ 3

[SOLVED] Why is there a syntax error in this code? (Python)

Hi I am rather new to coding and I need some help! :) I wrote the following code but it appears to have an error "SyntaxError: invalid syntax" which points to "While InNum>=0:". Can someone tell me where I have gone wrong? My input for InNum was 12. Thank you so much! InNum = int(input("Key a number less than 20:")) def Rfunc(Denominator): While InNum>= 0: Remainder = InNum%Denominator print(Remainder) InNum -= 1 Rfunc(3) print(InNum)

3rd Apr 2018, 10:13 AM
Jeanne Toh
3 Antworten
+ 5
i see two probs: while must be lowercase before while: global InNum
3rd Apr 2018, 10:35 AM
Oma Falk
Oma Falk - avatar
+ 3
nice!
3rd Apr 2018, 11:18 AM
Oma Falk
Oma Falk - avatar
+ 2
@Ada Thank you! I followed your advice and it's solved! ^~^
3rd Apr 2018, 11:01 AM
Jeanne Toh