Last active
September 16, 2020 13:15
-
-
Save pavlenko-volodymyr/a9592b298b04f1963b29f3a3ef17f5e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def min_marriage_age(age): | |
| pass | |
| @min_marriage_age(22) | |
| class Person: | |
| first_name: str | |
| last_name: str | |
| age: int | |
| min_age: int | |
| john = Person("John", "Smith", 18) | |
| lili = Person("Lili", "Dou", 18) | |
| assert john.first_name == "John" | |
| assert john.last_name == "Smith" | |
| assert john.age == 18 | |
| assert lili.first_name == "Lili" | |
| assert lili.last_name == "Dou" | |
| assert lili.age == 18 | |
| married = john + lili | |
| assert not married | |
| john.age = 21 | |
| assert john.age == 21 | |
| john.age = 17 | |
| assert john.age == 21 | |
| john.age = 22 | |
| lili.age = 22 | |
| married = john + lili | |
| assert married | |
| assert lili.last_name == "Smith" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment