Question: 1. Write a Python function avgNum() that keeps prompting user to enter a positive number. Enter a non-positive number to terminate the loop. Calculate
1. Write a Python function avgNum() that keeps prompting user to enter a positive number. Enter a non-positive number to terminate the loop. Calculate & display the average of all positive numbers. Call your function with testing example (25 pts) Test case: Enter a positive number: 10 Enter a positive number: 50 Enter a positive number: 30 Enter a positive number: 0 30.0 2. Write a function named sumSequence (n) that receives a positive integer n as the argument and calculates the sum of sequence 1, 3, 5, 7 ... n. (25 pts) Test case: print (sumSequence (5)) 9 3. Using nested loop to write a function named pattern (n) to print n rows of full pyramid patterns. Call your function with testing example. (25 pts) Test case: pattern (5) * * * * * * * * 4. Write a function named convertDays (days) that receives days as its input arguments and then return the number of (years, months, and days). Assuming there are 365 days per year and 30 days per month. Call your function with testing example. (25 pts) Test case: print(convertDays (2000)) (5, 5, 25)
Step by Step Solution
There are 3 Steps involved in it
Here are Python functions for each of the ... View full answer
Get step-by-step solutions from verified subject matter experts
