Oct-31-2020, 12:01 PM
To simplify, the idea is to take the integer, convert it to a string of digits, reverse the string, then turn it back into an integer. The posted solutions do this great and are one line solutions. But let's take the steps one at a time:
my_number = 691 my_string = str(my_number) my_new_string = my_string[::-1] #slice notation, a good thing to learn my_new_number = int(my_new_string) print(my_new_number)
Output:196
We've all been beginners, but we really like to see your attempts at a problem and will help where you are stuck. Give a man a fish, teach a man to fish.