1.

Write the python code to input a number and print the reverse of the number by using for loop (not while or any other loop)

Answer» PYTHON ProgramPython Programtry: n = int(INPUT('Enter a number : ')) reversed = 0 while(n!= 0): r=int(n%10) reversed = reversed*10 + r n=int(n/10) print(reversed) EXCEPT ValueError: print('Given input is not a number. ')Explanation:this is a code to WRITE the python code to input a number and print the reverse of the number by using for loop.


Discussion

No Comment Found