Question
1.Write a Python program that reads in 3 numbers and displays the following:
a) the average of the three numbers
b) the maximum of the three numbers
A sample run is shown below:
Enter three numbers: 5 8 12
The average of 5,8, and 12 is: 8.333333333333334
The maximum of the three numbers is: 12
2.Write a Python program that reads in a string and determines whether the string is a palindrome or not.
Sample runs are shown below:
Enter a string: mom
“mom” is a palindrome
Enter a string: apple
“apple” is not a palindrome
3.Write a Python program that does the following:
a) Reads in a principal amount (a floating point number)
b) Reads in the annual percentage interest rate for the investment
c) Displays the number of years it will take for the investment to double
NOTE: DO NOT USE THE “RULE OF 72”
Sample runs are shown below:
Enter principal amount: 1000.00
Enter percentage annual interest rate: 6.25
It will take 12 years for the investment to double
Enter principal amount: 2000.00
Enter percentage annual interest rate: 4.5
It will take 16 years for the investment to double
4. Write a Python program that reads in a list of integers and displays the following:
a) The average of the numbers in the list
b) The median value of the numbers
c) The number of even numbers in the list
Sample runs are shown below:
Enter a list of integers: [12, 23, 32, 14, 18]
The average of numbers in the list is: 19.8
The median of the numbers in the list is: 18
The number of even numbers in the list is: 4
Enter a list of integers: [10, 20, 15, 25, 60, 45]
The average of numbers in the list is: 29.166666666666668
The median of the numbers in the list is: 22.5
The number of even numbers in the list is: 3
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
'''Write a Python program that reads in a list of integers and displays the following:
a) The average of the numbers in the list
b) The median value of the numbers
c) The number of even numbers in the list
'''
integers = eval(input("Enter a list of integers: "))
average = sum(integers)*1.0/len(integers)
print("T...