Skip to content

Commit 8663043

Browse files
committed
feat: Added .venv to gitignore file, and finished the exercise one.
1 parent 4350f48 commit 8663043

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
.venv

prep-exercises/classes_objects.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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) # Person class do not have address attribute.
10+
11+
eliza = Person("Eliza", 34, "Arch Linux")
12+
print(eliza.name)
13+
#print(eliza.address) # again here Person class do not have address attribute.
14+
15+
def is_adult(person: Person) -> bool:
16+
return person.age >= 18
17+
18+
print(is_adult(imran))
19+
20+
# This method will crash the program as there is no occupation attribute in the Person class
21+
#def is_student(person: Person) -> bool:
22+
# return person.occupation =="Software Engineer"

0 commit comments

Comments
 (0)