0
Take a number N as input and output the sum of all numbers from 1 to N (including N).
````````
2 Answers
+ 3
Jay Matthews ,
i am quite sure that this exercise is not meant to be solved by using a formula đ. i guess that using a loop does help (more) for learning and growing in experience.
-> use input() function to get the max number for building the sum. store it in a variable. data format has to be integer
-> use a variable that can hold the running total
-> use a for loop and iterate through a range() using the required arguments. (keep in mind that the max value will not be included in the range)
add the values getting from loop to the total variable
-> after the loop is done, print the number from total
+ 1
Jay Matthews /2
lol thought JM meant something else in his response to my brief question "/2"(thanks)
I am kind of afraid of asking how //2 is same as >>, looking it up, "the bitwise right shift operator" seems đ
edit (about >>) : https://stackoverflow.com/questions/37535864/what-does-mean-in-JUMP_LINK__&&__python__&&__JUMP_LINK
https://stackoverflow.com/questions/54047100/why-are-bitwise-operators-slower-than-multiplication-division-modulo
https://en.m.wikipedia.org/wiki/Arbitrary-precision_arithmetic