PythonByteSize
  • Home
  • Video Index
    • 1. The Basics
    • 2. Python Program Structures
    • 3. Python Operators
    • 4. Python Functions
    • 5. Introduction to Classes and Objects
    • 6. Python Strings
    • 7. User Defined Functions
    • 8. Classes and Objects
    • 9. Python Dictionaries
    • 10. Python tkinter
    • 11. Python Lists
    • 12. Python Namespaces
    • 13. Turtle Graphics
    • 14. Python Tips
    • 15. Complex Numbers
  • 1-Minute Videos
  • Exercise Index
    • 1. The Basics Exercises
    • 2. Python Program Structures Exercises
    • 3. Python Operators Exercises
    • 4. Python Functions Exercises
  • Donate
  • Computing Topics
  • Mathematics
  • Educators
  • Contact
  • About

Exercise 3.2 (Multiple Conditional Tests in Python)


1. Ensure you have viewed the video (associated with this exercise) at this link >> 

2. Consider the computer programs below. They are nonsense programs meaning they do not implement any algorithm they are just to test your understanding of relational operators and the elif clause. By reading the program (i.e. do not execute them to get the answers) write down on paper the output you would expect from each program.
 
You can check your own answer by copying the code and pasting it into your Python editor, and then executing the code.
Exercise 3.2 Example 1

    
Exercise 3.2 Example 2

    
Exercise 3.2 Example 3

    
Exercise 3.2 Example 4

    

3. Write a program that asks users to enter their percentage mark for a module of study.  The program prints the module grade as either distinction, merit, pass or fail depending on the percentage mark entered (try and avoid referring to the answer in the video).

​A mark of 70% and above is awarded a distinction.

A mark in the range of 60% through to 69% is awarded a merit.

A mark in the range of 40% through to 59% is awarded a pass.

Marks less than 40% are awarded a fail

 

4. Write a program that asks users to enter their percentage mark for a module of study.  The program prints the module grade as either A, B, C, D, E or F depending on the percentage mark entered.

​A mark of 80% and above is awarded an A.

A mark in the range of 70% through to 79% is awarded a B.

A mark in the range of 60% through to 69% is awarded a C.

A mark in the range of 50% through to 59% is awarded a D.

A mark in the range of 40% through to 49% is awarded a E.

Marks less than 40% are awarded an F.



END    Next Exercise >>

Please consider donating to help with the costs incurred in developing this website.             Donate >>