Question: Write Python code for the following tasks a) A college professor collects books every day over a number of days. Write a program that asks

Write Python code for the following tasks

a) A college professor collects books every day over a number of days. Write a program that asks the professor for the number of days he wishes to collect books. For each of the days, ask the professor for the number of books he collected. Calculate and display the total number of books collected. Do not allow the professor to enter a negative value for number of days and the number of books collected (he just cant type!) (hint: use loops to validate entries). In all incorrect cases for input, display an appropriate message and allow the professor to enter a valid value. Clearly explain the output. Dont just display a value. For example, instead of displaying 800 for a given monetary value, display something like: value = $800.

b) Write a program to perform the following series of steps:

i. Prompt the user to enter 2 integers: first and second. Make sure the first is less than the second number and allow the user to enter a valid set of numbers. This is a simple loop.

ii. Display all the even numbers between first and second.

iii. Calculate and display the total of all even numbers between first and second.

iv. Display all the odd numbers between first and second.

v. Calculate and display the total of all odd numbers between first and second.

vi. Display the numbers, their squares and their cubes for all the numbers between first and second, with steps of 1. Clearly explain the output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!