0
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 som
7 Antworten
+ 8
Aleksei Radchenkov ,
as already mentioned:
please help us to keep sololearn what it is made for: It is a self-learning platform.
So this means, that we should avoid giving codes when people ask for this, before they have done a try by themselves and before they have present it here. It looks really helpful when you post a code as you did, but it does not help the OP. This will be a copy and paste - and the coding skills and problem solving ability will not grow.
What we should do is to give HINTS or COMMENTS how to solve the task.
thanks for your understanding.
+ 6
Harsha ,
your post is incomplete / truncated and we miss your attempt.
before we can help you, you should show us your attempt first. if you have not done a try by yourself upto now, please do so. Put your code in playground and link it here.
thanks!
+ 1
are you having trouble solving this?
+ 1
Something like that:
https://code.sololearn.com/cQ2tpMHmG44X/?ref=app
+ 1
Lothar , I was just quite sure this was some sort of very "unchallenging" challenge... (Because of the way this question is written)
+ 1
n = int(input())
Mathematical Solution
Ans= n*(n+1)/2
Brute forcing
Ans = sum(range(n+1))
0
I don't even know i posted this im new here sorry