← Back to challenges

Video Streaming Plans

PythonMediumclassesobjectslanguage_fundamentals

Instructions

Given a class for a BasicPlan, write the classes for StandardPlan and PremiumPlan which have class attributes of the following:

BasicPlan | StandardPlan | Premium Plan | --- | --- | --- | --- |✓|✓ |✓|can_stream |✓|✓|✓|can_download |✓|✓|✓|has_SD | |✓|✓|has_HD | | |✓|has_UHD |1|2|4|num_of_devices |$8.99|$12.99 |$15.99|price

Examples

BasicPlan.has_SD ➞ True

PremiumPlan.has_SD ➞ True

BasicPlan.has_UHD ➞ False

BasicPlan.price ➞ "$8.99"

PremiumPlan.num_of_devices ➞ 4

Notes

Try using Inheritance to complete the challenge!

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Back to Home?