Question: Python functions Problem 1 Create a Python function called sumofodds which takes one argument, an integer greater than or equal to 1, and returns the
Problem 1 Create a Python function called sumofodds which takes one argument, an integer greater than or equal to 1, and returns the result of adding the odd integers between 1 and the value of the given argument (inclusive). This function does not print. Do not use Python's sum() function. Do not build a list. You may assume that the argument is valid. Yes, this is almost the same question as in the previous programming assignment, except that you must use a for loop instead of a while loop, and you're adding odd numbers instead of even numbers. Here are some examples of how your function should behave: sumofodds (1) sumofodds (2) sumofodds (3) >sumofodds (5) sumofodds (100) 2500
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
