Increment operator issue in python code :
In following code :
n = eval(input ("enter the rows for pattern"))
temp =1
for i in range(1,n+1) :
temp =1
while temp <=i :
print("*", end = '')
temp++
print('')
The output is:
> File "C:\user\new\pattern.py" , line 7
> temp++ <p> ^ SyntaxError: invalid syntax </p>
also if I convert temp++
to ++temp
it is running in infinite loop
Can someone explain me what's wrong in it?
Edit 1 : AS increment operator don't work in python, so why ++temp is giving an infinte loop?