Menu

Question: 1- Write a program that computes the sum of the odd numbers and even numbers between a and b (both are included) inputted by the user and returns the results.For this, the function sum_number() receives ” a ” and ” b “, and returns sum of odd numbers and even numbers to the main body.Sample Run:Enter the starting number: 3Enter the ending number: 10The 1 – Write a program that computes the sum of the odd numbers and even numbers between a and b ( both are included ) inputted by the user and returns the results. For this, the function sum _ number ( ) receives ” a ” and ” b ” , and returns sum of odd numbers and even numbers to the main body. Sample Run: Enter the starting number: 3 Enter the ending number: 1 0 The odd numbers: 3 , 5 , 7 , 9 The even numbers: 4 , 6 , 8 , 1 0 Sum of odd numbers between 3 and 1 0 : 2 4 Sum of even numbers between 3 and 1 0 : 2 8 student submitted image, transcription available Here’s the best way to solve it. Solution Share Step 1 def sum_number(a, b): odd_sum = 0 even_sum = 0 for i in range(a, b+1): if i % 2 …

  • Question: 1- Write a program that computes the sum of the odd numbers and even numbers between a and b (both are included) inputted by the user and returns the results.For this, the function sum_number() receives ” a ” and ” b “, and returns sum of odd numbers and even numbers to the main body.Sample Run:Enter the starting number: 3Enter the ending number: 10The

    1- Write a program that computes the sum of the odd numbers and even numbers between a and b (both are included) inputted by the user and returns the results.
    For this, the function sum_number() receives ” a ” and ” b “, and returns sum of odd numbers and even numbers to the main body.
    Sample Run:
    Enter the starting number: 3
    Enter the ending number: 10
    The odd numbers: 3,5,7,9
    The even numbers: 4,6,8,10
    Sum of odd numbers between 3 and 10:24
    Sum of even numbers between 3 and 10:28

    student submitted image, transcription available

  • Chegg Logo

    Here’s the best way to solve it.

    Solution
    Step 1

    def sum_number(a, b): odd_sum = 0 even_sum = 0 for i in range(a, b+1): if i % 2 …

OR