0
I am phasing some problem in project at sololearn my code doesn't accept sololearn
# sum of N numbers N = int(input("Enter your number :")) if N < 0 : print ("Enter a positive number ") else : sum = 0 while (N > 0) : sum += sum N -= 1 print ("The sum is : ", sum)
4 Answers
0
Currently, you are adding the value in the sum variable to itself which is 0 and will remain 0.
Therefore change the line from:
sum += sum
to
sum += N
This will add the number N, instead of value in the variable sum.
0
your code itself isn't understandable then how can solo learn accept it đ„Č
0
oh ! yeah
so what wrong with it
help me to fix it
0
â Do not write anything inside input()
â Add N to sum not sum to sum
â Check the indentation of N -= 1
â Read the task description again and see that you should ONLY output the result