Jan-16-2018, 04:24 PM
Hi all, Im relatively new to the world of python. Im a Biotechnology major who is picking up coding in his own time. A seemingly very helpful pdf often teaches in pseudocode and there was one particular example which I am having trouble with. I will attach it below
GAUSS(n)
sum <- 0
for i <- to n
sum <- sum + i
return sum
The goal of the code is to create a function which adds your chosen number 'n' to every chronological number before it starting from zero. Below is my attempt
def GAUSS(n)
sum = 0
for i in range(0,n):
sum = sum + i
return sum
As I am learning python as a side hobby please feel free to let me know all things I am doing wrong. All because it is a hobby does not mean I dont want to do my best!
Thanks
ncp
GAUSS(n)
sum <- 0
for i <- to n
sum <- sum + i
return sum
The goal of the code is to create a function which adds your chosen number 'n' to every chronological number before it starting from zero. Below is my attempt
def GAUSS(n)
sum = 0
for i in range(0,n):
sum = sum + i
return sum
As I am learning python as a side hobby please feel free to let me know all things I am doing wrong. All because it is a hobby does not mean I dont want to do my best!
Thanks
ncp