-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputof.py
More file actions
42 lines (31 loc) · 948 Bytes
/
inputof.py
File metadata and controls
42 lines (31 loc) · 948 Bytes
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
class names:
def method2(self,name):
if (name=="morning"):
print("hello good morning")
elif(name=="afternoon"):
print("hello good evening")
else:
print("good night")
n2=names()
name1=input("enter string")
n2.method2(name1)
class evenorodd:
alist=(1,2,4,55,666,89)
def evenoroddmethod1(self):
for i in range(len(evenorodd.alist)):
if i%2==0:
print("even",evenorodd.alist[i])
else:
print("odd",evenorodd.alist[i])
n1=evenorodd()
n1.evenoroddmethod1()
class evenorodd:
alist=(1,2,4,55,666,89)
def evenoroddmethod1(self):
for i in range(len(evenorodd.alist)):
if evenorodd.alist[i]%2==0: #i is index
print("even",evenorodd.alist[i])
else:
print("odd",evenorodd.alist[i])
n1=evenorodd()
n1.evenoroddmethod1()