-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path093_Program_Object Oriented Programing.py
More file actions
38 lines (20 loc) · 1.05 KB
/
093_Program_Object Oriented Programing.py
File metadata and controls
38 lines (20 loc) · 1.05 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
# 00P : Object Oriented Programming
# A CLASS has some FEATURES
# Under the CLASS there remain METHOD and OBJECT
# The FEATURES of the CLASS are then used by the OBJECT
# OBJECT is also known as INSTANCE
class student_details : # Creating a class # 'student_details' is the name of the class
roll = ''
gpa = '' # 'roll', 'gpa' and 'standing' are some FEATURES of the CLASS
standing = ''
Rahim = student_details() # Creating an object # 'Rahim' is the name an object
Rahim.roll = 1001
Rahim.gpa = 3.76 # The object 'Rahim' is using the features of the class 'student_details'
Rahim.standing = '2nd'
print (f'Roll : {Rahim.roll}, Gpa : {Rahim.gpa}, Standing : {Rahim.standing}')
Shafiq = student_details() # Another object
Shafiq.roll = 2002
Shafiq.gpa = 3.85
Shafiq.standing = '1st'
print (f'Roll : {Shafiq.roll}, Gpa : {Shafiq.gpa}, Standing : {Shafiq.standing}')
# To understand the f'' see program-13 again