Practice Center – Module 8

Exercises to Practice (Module 8)

Expressions and Conditions

Exercise 1

Write a program that will read from the keyboard a number and examine whether it is a multiple of 7.

Exercise 2

Write a program that will read from the keyboard a number and examine whether its last digit is equal to 5.

Exercise 3

Write a program that will accept two numbers and examine whether the first number is a multiple of the second.

Exercise 4

An online store offers its products in the following ways:
A. Cash payment : 5% discount
B. Payment in 6 installments: Interest-free.
C. Payment in 12 installments at 5% interest.
Write a program that accepts the cost of the products purchased and the payment method (A, B or C) and displays the final cost. In the case of doses, it will also display the amount of each dose.

Exercise 5

Write a program that accepts the actual cost of a product for a company. The program also accepts the sale price of the product. Calculate and display the difference of the above two prices either as profit or loss for the business.

Exercise 6

Write a program that accepts the results of the exams in a student's English lesson. If the student got Grade A display the message "EXCELLENT ", B the message "WELL ", C the message "GOOD" and D the message "FAILED" .

Exercise 7

Read from keyboard three numbers and sort them in descending order.

Exercise 8

Write a program that reads K integers from the keyboard and displays the largest and the smallest of them.

Exercise 9

In a javelin throwing race, the participants are 14. The athletes that will achieve a throw of more than 80 meters will be qualified for the finals. Write a program that reads each athlete's performance and displays how many athletes have passed the threshold.

Exercise 10

Write a Python program to swap two variables.

Challenge

Write a program that accepts X numbers as input (X will be read from the keyboard). After you finish the program input, display the amount of even and odd numbers entered.