0
I’m stuck on this quiz - pls help!
Hi guys, I’m stuck on this quiz and can’t progress with my lessons ☹️... can anybody tell me why this is returning No Output? n = int(input()) length = 0 while n > 0 : n %= 10 length += n print(length) The goal is to calculate the sum of the individual digits in an integer input Thank you!! 🙏🏼
4 ответов
+ 6
Rewrite the while loop like this:
while n>0:
p=n%10
length+=p
n=n//10
+ 3
Thank you so much for the help, guys! I need to get some sleep and try with fresh eyes tomorrow, but now I’m confident i can get to the next lesson 🧡
0
Jan Markus there are a few elements in your suggestion i havent learned about yet, but ill come back and review your suggestion for practice when i get there!