1. Write a program that accepts an integer from the user and determines if the square of the integer is divisible by 8. If the square is not divisible by 8, nothing should be printed.
SAMPLE
Enter integer: 8
The number 64 is divisible by 8
2. Write a program that accepts a positive integer from the user and prints the first four multiples of that integer. Use a while loop.
SAMPLE
Enter integer: 5
0
5
10
15
3. Write a program that requests a positive four-digit integer from the user and prints the total of the digits. You are not allowed to use the string data type operations. The program should read it as an integer and process it as an integer. Use a while loop.
SAMPLE
Enter four digit integer: 1234
10
4. Write a program that requests four integers from the user. The program should compute the average of the first three numbers and compare the average to the fourth number. If they are equal, the program should print ’Equal’ on the screen. If they are not equal, the program should print ‘Not Equal’.
SAMPLE
Enter first integer: 1
Enter second integer: 2
Enter third number: 3
Enter fourth integer: 2
Equal
5. Write a program that calculates parking charges. The program will read in the hours to be charged and will calculate the charges as follows: The first hour is $5. Hours 2 – 5 are $3.50 each. Hours over 5 is $2.00 each. Print the total charges. Use an if/else structure.
SAMPLE
Enter hours: 4
The charge is $ 15.50
6. Write a program to calculate the monthly payment on a new car.
payment = a *![]()
n = number of payments made
r = monthly interest rate
a = amount borrowed
Note: interest rate per month is required for the calculation, but the user will enter the overall percentage.
SAMPLE
Enter number of payments: 60
Enter interest rate: .05
Enter amount borrowed: 20000
The monthly payment will be $ 377.42
7. Write a program that uses a sentinel while loop to enter the number of calories burned every day. The program will calculate and print the average number of calories burned per day.
SAMPLE
Enter calories for the day. Enter -999 to quit: 2200
Enter calories for the day. Enter -999 to quit 2800
Enter calories for the day. Enter -999 to quit 3600
Enter calories for the day. Enter -999 to quit 1200
Enter calories for the day. Enter -999 to quit -999
The average calorie count is 2450.0
SUBMISSION INSTRUCTIONS
Place all programs in the same file. Separate each program with a comment line stating what the next program will do. DO NOT PUT THE ENTIRE PROBLEM STATEMENT IN THE FILE.
Put your name at the top of the file as a comment.
Name the file HW1.py.
Upload the HW1.py into Canvas.
NOTE: Even though I gave a sample of the run/output, other input can be used. Be sure to test for all possible inputs.