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 RĂ©ponses
+ 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!