You have a program that checks for a user's age to determine the price of a movie ticket. How would you structure the conditional statements to determine if a user gets a discount based on their age?
- if age < 10 or age > 65:
- if age == 10 or age == 65:
- if age > 10 and age < 65:
- if age >= 10 and age <= 65:
To determine if a user gets a discount based on age, you should use 'if' statements with logical OR operators. This way, you can identify both children under 10 and seniors above 65 who are eligible for a discount.
Loading...
Related Quiz
- Which of the following is true regarding the mutability of tuples in Python?
- A context manager's _______ method should return a Boolean value to control whether or not exceptions should be suppressed.
- How can you prevent overfitting in a deep learning model developed with TensorFlow or PyTorch?
- Which Python web framework uses the “Don’t repeat yourself” principle?
- In Flask, what is the purpose of the route() decorator?