2.4 Python, small case

Input a 3-digit integer from the keyboard, calculate and output its hundreds, tens, and ones digits. The specific implementation is shown in the example.
Insert picture description here
When the program is running, enter 356 from the keyboard, and the running result is shown in the figure.
Insert picture description here
In the above example, by using the // and% operators, you can get the numbers in the hundreds, tens, and ones digits of a 3-digit integer. After learning the map() function later, you can also use the following method to solve it, as shown in the example.
Insert picture description here
When the program is running, enter 356 from the keyboard, and the running result is shown in the figure.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43398418/article/details/110166488