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!! 🙏🏼

27th Nov 2020, 5:02 AM
Jennywren
Jennywren - avatar
4 Respostas
+ 6
Rewrite the while loop like this: while n>0: p=n%10 length+=p n=n//10
27th Nov 2020, 5:15 AM
Souptik Nath
Souptik Nath - avatar
+ 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 🧡
27th Nov 2020, 5:28 AM
Jennywren
Jennywren - avatar
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!
29th Nov 2020, 10:55 PM
Jennywren
Jennywren - avatar