- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses_objects.py
More file actions
Latest commit
28 lines (25 loc) · 592 Bytes
/
Copy pathclasses_objects.py
File metadata and controls
28 lines (25 loc) · 592 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'''
This program is to practise the basic concepts of classes and objects in python
'''
classGame:
"""
[summary]: Game class to attack or to find the life left
"""
life=3
defattack(self):
"""
[summary]: This method will attack the gamer and reduce his life
"""
print("ouch!")
self.life-=1
deflife_count(self):
"""[summary]: This method returns the left life count of the gamer
"""
print(str(self.life) +"Lives left")
gamer1=Game()
gamer1.attack()
gamer1.attack()
gamer1.life_count()
gamer2=Game()
gamer2.attack()
gamer2.life_count()