python 提取数字
Here, we are going to use some mathematical base while programming. The problem is, when you ask a number from the user, the user would give input as multiple digit number (considering integer only). So it is easy to find the type of number but it’s not easy to find the number of digits in the number.
在这里,我们将在编程时使用一些数学基础。 问题是,当您向用户询问数字时,用户会将输入作为多位数字输入(仅考虑整数)。 因此,很容易找到数字的类型,但要找到数字中的数字并不容易。
So, in the following problem, we are going to use the mathematical trick of:
因此,在以下问题中,我们将使用以下数学技巧:
Subtracting the remainder after dividing it by 10 i.e. eliminating the last digit.
将其除以10后再减去,即消除最后一位。
Dividing an integer by 10 gives up an integer in computer programming (the above statement is only true when the variables are initialized as int only).
将整数除以10将在计算机编程中放弃整数(仅当变量仅初始化为int时,以上语句才成立)。 </