- 2
33 lession stack
Can anyone help with this
10 Respostas
+ 4
Please tag the relevant programming language
+ 3
There are several Python courses. Which one do you mean?
+ 3
Read the box below the description carefully: It gives you a hint how to solve the task.
You can use a for-loop and range() to calculate the sum
+ 2
Read the box carefully: "Remember, range(a, b) does not include b"
+ 1
Re-read the full box below the task description. N is not in the range, the box tells you what could be done
0
Python beginners
Problem:
No one likes homework, but your math teacher has given you an assignment to find the sum of the first N numbers.
Let’s save some time by creating a program to do the calculation for you!
Take a number N as input and output the sum of all numbers from 1 to N (including N).
Sample Input
100
Sample Output
5050
0
N = int(input())
#your code goes here
sum = 0
for num in range(1,N):
sum += num
print(sum)
0
I did but not expected result shown
0
I don't understand