Elements – sequence-series outputting

Write a program that prints the following elements: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19,
(hereto referred to as elements) etc., up till a user-entered value. The program should
not print more than 10 numbers per line. The last line printed may be less than 10.
Apart from the first number and the last number, there should be a “,” separating all
the numbers. The last number on every line should have a “.” after it. Before exiting
it should also prints the sum of all elements : Calculate the sum of the items and enter
the result. For instance if the user entered 76 your output should be as follows
A sample run of your program should be as follows:
Enter your number ( >= 1 and <= 100) : 76 
Your sequence is
1, 3, 5, 7, 9, 11, 13, 15, 17, 19.
21,23, 25, 27, 29, 31, 33, 35, 37, 39.
41,43, 45, 47, 49, 51, 53, 55, 57, 59.
61,63, 65, 67, 69, 71, 73, 75.
The sum of the above elements 1444
[25 pts.]

2 answers

what language?
def sum(number): # we are defining a function
a = 0 #defines a = 0 becuase we start at 0
in python
sum=0 # defines sum at zero
because we start at 0
while a<checked_input: #check everytime if the a is redefined if it still is true
sum = sum + (a+1)#combination of this line//gives the answer
a = a + 2 # and this line gives a odd number
return sum #sends answer