+ 1
âBHâY Remove the while loop and it's good
+ 3
âBHâY
while True doesn't make sense here because it will run till infinite.
Try this
num = int(input())
sum = 0
while num > 0:
sum += num
num -= 1
print(sum)
+ 1
Well you got it right in the second attempt
Pay more attention to the condition given for the loop and learn the control flow of loops
0
Yes you can solve this question using while loops
Use a variable I and increase I by 1 and then add
0
âBHâY or you can replace the for loop with while and remove the inner while
0
try this.
def Suma_numeros (limite):
suma=0
nmro=0
Lista_numeros=[]
while nmro<limite:
Lista_numeros.append(nmro+1)
nmro+=1
for i in Lista_numeros:
suma+= i
return suma
N= int(input())
print(Suma_numeros(N))