-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassObjects.py
More file actions
63 lines (47 loc) · 1.26 KB
/
ClassObjects.py
File metadata and controls
63 lines (47 loc) · 1.26 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
print("""
print('''
CLLASSES
CLLASSES
and
OBJECTS
and
OBJECTS
''')
print('''
Create your own data type to represt all type of data
With a class define your own data type
''')
print('''
class students: # Tocreate the student class, then use str, int,
float, bulleans to map out the class
''')
class student: # Tocreate the student class
def __init__(self, name, major, gpa, is_on_prob ):# Initialised function.
# this is the student data type
self.name = name
self.major = major
self.gpa = gpa
self.is_on_prob = is_on_prob # student class defined.
# This is a template
print('''
An Object is an actual student,
so that is an student with a name, a major, a gpa
''')
""")
print(''' TO create the actual object ant print or use ethat data ty class
we have to code
from student import student
student1 = student(" Jim", "CSE", 3.5, False)
student2 = student(" kim", "eee", 2.5, True)
print(student1)
print(student1.name)
print(student2.name)
print(student2.gpa)
''')
from student import student
student1 = student(" Jim", "CSE", 3.5, False)
student2 = student(" kim", "eee", 2.5, True)
print(student1)
print(student1.name)
print(student2.name)
print(student2.gpa)