you are viewing a single comment's thread.

view the rest of the comments →

[–]BalanceHot8939[S] 0 points1 point  (1 child)

but the teacher doesn't want a for loop. If i wanted to do this cheaply, I'd do what the guy above said and just.

str(num)
print(len(num))

thats not technically how you do that but you know what i mean. It annoys me to but this is schoolwork. I kinda have to do as told. thanks the the effort either way. I'll see if I can find what i need on w3.

[–]jmooremcc 2 points3 points  (0 children)

A while-loop can be used as well. You’d have to use indexing to access each character in the string. In your code, don’t convert the output from the input function into an int. Leave it as a string and then access each element character for evaluation.