Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 17_class.py #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update 17_class.py
  • Loading branch information
QamalMaqsat authored Oct 24, 2023
commit dc864d1cb10aeded09d246df4524650fca57cf9c
6 changes: 1 addition & 5 deletions Basics/17_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ class Human:
def __init__(self, n, o):
self.name = n
self.occupation = o

def do_work(self):
if self.occupation == "tennis player":
print(self.name, "plays tennis")
elif self.occupation == "actor":
print(self.name, "shoots film")

def speaks(self):
print(self.name, "says how are you?")

tom = Human("tom cruise","actor")
tom.do_work()
tom.speaks()

maria = Human("maria sharapova","tennis player")
maria.do_work()
maria.speaks()
maria.speaks()