+ 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)
3 Antworten
+ 5
i see two probs:
while must be lowercase
before while: global InNum
+ 3
nice!
+ 2
@Ada Thank you! I followed your advice and it's solved! ^~^