Question: --------------------------------------------- Used the python program ---------------------------------------- please check the Program layout for each step ! OUTPUT: - The bold text is the user's input. *************************************************************************************
---------------------------------------------Used the python program ----------------------------------------
please check the Program layout for each step !


OUTPUT:
- The bold text is the user's input.
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number: Enter numbers: 8 a Incorrect Input. Please try again. Enter two positive integer numbers. First number must be less than the second number: Enter numbers:
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number: Enter numbers: a 8 Incorrect Input. Please try again. Enter two positive integer numbers. First number must be less than the second number: Enter numbers:
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number: Enter numbers: 8 2 First number must be less than the second number! Please try again. Enter two positive integer numbers. First number must be less than the second number: Enter numbers:
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number: Enter numbers: -2 8 No negative numbers! Please try again. Enter two positive integer numbers. First number must be less than the second number: Enter numbers:
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number you enter Enter numbers: 2 8 Odd integers between 2 and 8 are: 3 5 7 Sum of even integers between 2 and 8 = 20 Sum of the squares of odd integers between 2 and 8 = 83 Do you want to repeat this program? y > y
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number you enter Enter numbers: 1 9 Odd integers between 1 and 9 are: 1 3 5 7 9 Sum of even integers between 1 and 9 = 20 Sum of the squares of odd integers between 1 and 9 = 165 Do you want to repeat this program? y > y
*************************************************************************************
Enter two positive integer numbers. First number must be less than the second number you enter Enter numbers: 11 15 Odd integers between 11 and 15 are: 11 13 15 Sum of even integers between 11 and 15 = 26 Sum of the squares of odd integers between 11 and 15 = 515 Do you want to repeat this program? y > n Bye!
*************************************************************************************
2. Write a program that uses while loops to perform the following steps a. Prompt the user to input two positive integers. Variables: firstNum and secondNum (firstNum must be less than secondNum) (use while loop); create a user-defined function called validateUserlnput) to validate the user's input. validateUserlnput) is a value returning function; returns firstNum and secondNum. b. Output all odd numbers between firstNum and secondNum. (use while loop); create a user-defined function called oddNumbers). oddNumbers() is a void function; accepts firstNum and secondNum as arguments and return no values c. Output the sum of all even numbers between firstNum and secondNum. (use while loop); create a user-defined function called sumEvenNumbers). Declare a global variable called sumEven for the sumEvenNumbers0. sumEvenNumbers) is a value returning function; accepts firstNum and secondNum as arguments and returns the sum of all even numbers. Use sumEven to hold a returned value. d. Output the sum of the square of the odd numbers between firstNum and secondNum. (use while loop); create a user- defined function called sumSqureOddNumbers0. Declare a global variable called sumSquareOdd in the main, for the sumSqureOddNumbers). sumSqureOddNumbers) is a value returning function; accepts firstNum and secondNum as arguments and returns the sum of the square of the odd numbers. Use sumSquareOdd to hold a returned value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
