← Back to challenges

Movie Theatre Admittance

PythonMediumconditionsalgorithmsvalidation

Instructions

Write a function that checks whether a person can watch an MA15+ rated movie. One of the following two conditions is required for admittance:

  • The person is at least 15 years old.
  • They have parental supervision.

The function accepts two parameters, age and is_supervised. Return a boolean.

Examples

accept_into_movie(14, True) ➞ True

accept_into_movie(14, False) ➞ False

accept_into_movie(16, False) ➞ True

Notes

  • age is a decimal.
  • is_supervised is a boolean.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Recreating a len() Function