[Python]Use a repetitive statement to find the digits of the entered integer

Asked 2 years ago, Updated 2 years ago, 30 views

I want to code to find the number of digits of the integer when I enter the integer using the repetition sentence.

Let's put an integer in g I tried to print the (i+1) value by dividing g continuously by 10 and dividing it until the quotient was less than 1, but it didn't work fori in range(0,g//10!=0) doesn't seem to recognize the g//10!=0 part, so how should I modify it?

python python3

2022-09-22 19:20

1 Answers

Even if it is a repetitive sentence, it is not necessary to write only for, right? If I were you, I would use while infinite loop.

Try it!


2022-09-22 19:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.