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.8. (Pythons Logical and Operator)


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

2. The video looked at a program that implemented the following specification.
​
Specification
A bank will offer a customer a loan if they are 18 or over and have an annual  income of at least £15000. Write a program that will, based on a customers age and income, produce a decision on whether they will be offered a loan.

​The program, shown in the video, that implemented this specification is shown below (Exercise 3.8 Example 1
).

For this program produce a simple test plan based on boundary tests then copy and paste the program into your Python editor and test the program against the test plan.
Exercise 3.8 Example 1

    

3. For the following specification write a program and produce a test plan. Type your program into your Python editor and test its runtime against the test plan.

Specification
To enrol on an online course a prospective student has to be at least 21 and have passed their qualifying examination. The user will be asked the following questions:

How old are you?
Have you passed your qualifying examination (Y/N)?

In response to the questions the program will display one of the strings shown below:.

You can enrole on the course.
You cannot enrole on the course. 

END    Next Exercise >>

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