May-20-2020, 06:46 PM
This gets a little deep, but you need to read about inplace operators in the Python docs. The problem is that the assignment to Reverse (btw - don't use capitals for the first letter in variable names, see PEP 8) occurs BEFORE the addition. So, it stays 0. If you then separate the operations it works.
Number=123 Reverse = 0 while(Number > 0): Reminder = Number %10 Reverse*=10 Reverse+=Reminder print(Reverse) Number = Number //10 print(Reverse)
Output:3
32
321
321