Skip to content

Commit 6771d14

Browse files
committed
No error mesages. mypy infers that person has a property of age
1 parent 882b78f commit 6771d14

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Sprint5/classes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ def __init__(self, name: str, age: int, preferred_operating_system: str):
33
self.name = name
44
self.age = age
55
self.preferred_operating_system = preferred_operating_system
6-
76
imran = Person("Imran", 22, "Ubuntu")
87
print(imran.name)
9-
print(imran.address)
8+
#print(imran.address)
109

1110
eliza = Person("Eliza", 34, "Arch Linux")
1211
print(eliza.name)
13-
print(eliza.address)
14-
# error said person has no attribute "address" in line 9 and 13
12+
#print(eliza.address)
13+
14+
def is_adult(person: Person) -> bool:
15+
return person.age >= 18
16+
17+
print(is_adult(imran))

0 commit comments

Comments
 (0)