Teacher: Ako Eyo Oku
Coding
Exercises
START NOW
Teacher: Ako Eyo Oku
Section 1
VARIABLES
Exercise 1
Write a program that uses input to prompt a user for
their name and then welcomes them.
Example Output
Teacher: Ako Eyo Oku
Section 2
ARITHMETIC
OPERATIONS
Exercise 2
Write a program to prompt the user for hours and rate
per hour to compute gross pay.
Example Output
Exercise 3
Write a program which prompts the user for a Celsius
temperature, convert the temperature to Fahrenheit,
and print out the converted temperature.
Example Output
Teacher: Ako Eyo Oku
Section 3
CONDITIONAL
STATEMENTS
Exercise 4
Rewrite your pay computation to give the employee
1.5 times the hourly rate for hours worked above 40
hours.
Example Output
Teacher: Ako Eyo Oku
Section 4
ERROR
HANDLING
Exercise 5
Rewrite your pay
program using try and Example Output
except so that your
program handles non-
numeric input
gracefully by printing a
message and exiting
the program.
Exercise 6
Grade Table
Write a program to prompt for a
score between 0.0 and 1.0. If the
score is out of range, print an
error message. If the score is
between 0.0 and 1.0, print a grade
using the following table:
Exercise 6
Example Output
Write a program to prompt for a
score between 0.0 and 1.0. If the
score is out of range, print an
error message. If the score is
between 0.0 and 1.0, print a grade
using the following table:
Teacher: Ako Eyo Oku
Section 5
FUNCTIONS
Exercise 7
Rewrite your pay computation with time-and-a-half
for over-time and create a function called
computepay which takes two parameters (hours and
rate).
Example Output
Exercise 8
Grade Table
Rewrite the grade program from
the previous exercise 6 using
a function called computegrade
that takes a score as its
parameter and
returns a grade as a string.
Exercise 6
Example Output
Rewrite the grade program from
the previous exercise 6 using
a function called computegrade
that takes a score as its
parameter and
returns a grade as a string.
You’ve completed
the Exercises!
GOOD JOB!