Python Forum

Full Version: help with understanding a program prompt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Prompt for a 3 digit number where the first and last digits differ by at least 2 and store the entered number in a variable named number. Note: For our purposes, assume that the user of the program can correctly choose a number.
These next four steps compute and store the reverse of the number. For example, if the user enters 123, you should compute 321.
Store the 100’s digit in a variable called digit1.
Store the 10’s digit in a variable called digit2. Hint: You can get this digit using this expression: (number//10)%10.
Store the 1’s digit in a variable called digit3.
Store the integer equal to these three digits in reverse order into a variable called rev_number.
As a challenge, you can try to do the preceding four steps all in one statement. It is possible to do it that way!
Store the difference between number and rev_number in a variable called difference. We want this result to always be positive, so use the abs function. e.g. abs(4 - 8) is 4.
Store the reverse of difference in a variable called rev_diff. Note that this requires you to do those four steps again, which this new number.
Print the sum of difference and rev_diff
Your program should always print a result of 1089.

I have no idea how to approach the reversing number part of this program I pretty much noob and just started learning python
It's a math problem, not a programming problem. You've got the three digits. What math formula with those three digits would produce the reversed number?
ik that but is the problem is how would I implement that into python
How would you implement math?

result = 1 + 2 * 3 - 4 / 5
i might not be explaining so well but
the line i dint get is
Store the integer equal to these three digits in reverse order into a variable called rev_number.

would the integer be referring to the number entered on prompted
If 123 is what is entered, you need to store 321.