Well, as the title says, If you are programming in C # or Java I think you may use num ++ or num-.
Often for for and while loop conditions Specify num <= 10 etc. Is it like writing num ++ at the end of the executable statement?
Well, ++ or-is reducing or increasing by 1. Doing this with python throws an error
Simply because there are no increment or decrement operators It's simple to know If you rewrite it as num + = 1, it works normally I don't think it needs to be explained, but + = is It shortens the place where you have to write num = num + 1 It's a nice operator.
inc.py
num=0
while num<=10:
# YOUR CODE HERE #
num+=1
num-=1
Recommended Posts