-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoopOverView.py
More file actions
65 lines (55 loc) · 1.96 KB
/
Copy pathoopOverView.py
File metadata and controls
65 lines (55 loc) · 1.96 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
# # class Student:
# # def __init__(this,name,marks): # this is the reference variablle pointing to the current obj
# # # but generally we use self but we can write any valid name here
# # this.name = name
# # this.marks = marks
# # qasim = Student("Qasim",93)
# # print(qasim) # Reference variable to the obj
# # print(qasim.name,qasim.marks) # Attributes
# # class Student:
# # name = "Qasim" # Attributes
# # def __init__(self,name,rollNo):
# # self.name = name
# # self.rollNo = rollNo
# # def setNameMarks(self,rollNo,name):
# # self.name = name
# # self.rollNo = rollNo
# # # def getRollNo(self):
# # # return self.rollNo
# # # def getName(self):
# # # return self.name
# # a = Student("Abdullah",29)
# # #print(a.name," ",Student.name) # obj precedence > class precedence
# # a.setNameMarks(name="Ali",rollNo=55)
# # print(a.name,a.rollNo)
# class Student:
# name = "Anonymous"
# def __init__(self,name,marks):
# self.name = name
# self.marks = marks
# def avgCalculate(self):
# return sum(self.marks)/len(self.marks)
# @staticmethod # decurator
# def welcome():
# print(f"Hello Students!")
# q = Student("Qasim",[99,100,98])
# print(f"Your average marks are : {q.avgCalculate()}")
# Student.welcome()
# q.welcome()
# class Restaurant:
# def __init__(self,restaurantName,cuisineType):
# self.restaurantName = restaurantName
# self.cuisineType = cuisineType
# def describeRestaurant(self):
# print(self.restaurantName," ",self.cuisineType)
# def openRestaurant(self):
# print(f"{self.restaurantName} is now open!")
# restaurant = Restaurant("Royal","ABC")
# restaurant.describeRestaurant()
# restaurant.openRestaurant()
# a = Restaurant("A","A")
# b = Restaurant("B","B")
# c = Restaurant("C","C")
# a.describeRestaurant()
# b.describeRestaurant()
# c.describeRestaurant()