-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path6_BuiltInAttibutes.py
51 lines (42 loc) · 1.58 KB
/
6_BuiltInAttibutes.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#C0d3 n0=6
#made By GuND0Wn151
class Valorant:
"""
Valorant class this class has attributes as health agent gun
"""
def __init__(self):
print("welcome to lobby")
self.health=100
def GetReady(self):
print("Entering the match")
print("Enteer the the agent u want to pick")
self.agent=input()
def BuyGun(self):
print("Enter the Gun u want to buy")
self.gun=input()
def UseUltimate(self):
print("Ultimate Attack!!!")
def display(self):
print(self.agent)
print(self.gun)
print(self.health)
"""
apart from some attributes like getattr and hasattr there are some usefull builtin attributes
which can be useful during solving problems they are
"""
player1=Valorant()
player1.GetReady()
player1.BuyGun()
player1.display()
#__doc__ gives the docmentation in the class if nthg is meantioned then it returns non
print(player1.__doc__,"\n")
#__name__ return name of the class
print(Valorant.__name__,"\n")
#this attributes returns a dictonary whihc has the all attributes of the class mentioned and also with their address
# and also the adress of variables used in the class
print(Valorant.__dict__,"\n")
# possibly empty tuple containing the base classes, in the order of their occurrence in the base class list.
print(Valorant.__bases__,"\n")
# Module name in which the class is defined. This attribute is "__main__" in interactive mode.
print(player1.__module__)
#this are the some useful builtin attributes of python classes and objects