-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass_sample.py
109 lines (92 loc) · 2.12 KB
/
class_sample.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# class sample:
# def hello(self,n):
# print('Hiii...... ',n)
#
# x=sample()
# name='Arun Sathyan'
# x.hello(name)
#--------------------------------------------------------
# class student:
# def __init__(self,name,age,place):
# self.name=name
# self.age=age
# self.place=place
# def print(self):
# print('My name is ',self.name,' and my age is',self.age,', I\'m living in ',self.place)
#
# x=input('Enter your name : ')
# y=int(input('Enter your age : '))
# z=input('Enter you place : ')
#
# o=student(x,y,z)
#
# o.print()
#------------------------------------------------------------
# class cons:
# def __init__(self):
# print('hoiiii')
# x=cons()
#==============================================================
# def check():
# def A():
# test='A'
# print('A test value : ',test)
# def B():
# nonlocal test
# test='B'
# def C():
# global test
# test='C'
#
# test='default'
# A()
# print('1st test value :',test)
# B()
# print('2nd test value :',test)
# C()
# print('3rd test value',test)
#
# check()
# print('outside test value',test)
#===========================================================
# class myclass:
#
# def __init__(self,name,age):
# self.name=name
# self.age=age
#
# def details(self):
# self.name=input('Enter your name : ')
# self.age=int(input('Enter your age : '))
#
# def printing(self):
# print('Name : ',self.name)
# print('Age : ',self.age)
#
# x=myclass('','')
#
# x.details()
# x.printing()
#=============================================================
# class sample:
# def hello(self,name):
# print('Hello..... ',name)
# def hi(self,name):
# print('Hiiii..... ',name)
#
# x=sample()
# x.hello('Arun')
# x.hi('Saranya')
#=============================================================
class sample:
def hello(self,name):
self.name=name
def print(self):
print(self.name)
x=sample()
name='Arun Sathyan'
x.hello(name)
x.print()
y=sample()
y.hello('Saranya J')
y.print()