-
Notifications
You must be signed in to change notification settings - Fork 1
/
classes_1.py
43 lines (32 loc) · 1.41 KB
/
classes_1.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
###############################################
# #
# Created by Youssef Sully #
# Beginner python #
# classes 1 INSTANCE variables 1 #
# #
###############################################
# INSTANCE variables
# class: to initialize the class
# pass: to leave the class empty without pass (error)
class StudentType1:
pass
# assigning the class StudentType1 to a "Variable" and by doing that that Variable called INSTANCE
student_1 = StudentType1()
# f_name, l_name, courses and email called INSTANCE variables
student_1.f_name = 'Youssef'
student_1.l_name = 'Sully'
student_1.courses = ['CompSci', 'Telecom']
student_1.email = '[email protected]'
# student_2 called INSTANCE
student_2 = StudentType1()
# f_name, 2_name, courses and email called INSTANCE variables
student_2.f_name = 'Sully'
student_2.l_name = 'Youssef'
student_2.courses = ['Telecom', 'CompSci']
student_2.email = '[email protected]'
# <__main__.StudentType1 object at 0x00AE0FB8> ---> student_1 is an object located in 0x00AE0FB8 in memory
print(student_1)
# <__main__.StudentType1 object at 0x0107C028> ---> student_2 is an object located in 0x0107C028 in memory
print(student_2)
# student_1 and student_2 are different object
print(student_1.f_name, student_1.l_name, student_1.courses, student_1.email)