Skip to content

Commit 232223e

Browse files
committed
exercise 4 complete
1 parent fac816e commit 232223e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Person:
2+
def __init__(self, name: str, age: int, preferred_operating_system: str):
3+
self.name = name
4+
self.age = age
5+
self.preferred_operating_system = preferred_operating_system
6+
7+
imran = Person("Imran", 22, "Ubuntu")
8+
print(imran.name)
9+
print(imran.address)
10+
11+
eliza = Person("Eliza", 34, "Arch Linux")
12+
print(eliza.name)
13+
print(eliza.address)
14+
15+
# exercise_4.py:9: error: "Person" has no attribute "address" [attr-defined]
16+
# exercise_4.py:13: error: "Person" has no attribute "address" [attr-defined]
17+
# Found 2 errors in 1 file (checked 1 source file)
18+
19+
# There is no address attribute for a Person, only name, age and preferred operating system.

0 commit comments

Comments
 (0)