-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecktype.py
More file actions
67 lines (60 loc) · 1.34 KB
/
checktype.py
File metadata and controls
67 lines (60 loc) · 1.34 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
64
65
66
67
#check if number entered is odd, even, addom or palindrome number
x=int(input("Enter number - "))
print("Number -",x)
for a in range(0,x):
def palin(a):
b=''
b=str(a)
c=[]
c=[int(b[::-1])]
return c
def addom(a):
sqr=0
sqr=(a*a)
c=''
c=str(sqr)
d=int(c[::-1])
e=int(d**0.5)
f=str(e)
r=''
r=f[::-1]
rev=[]
rev=[int(r)]
return rev
global num
num=[]
num=palin(x)
global nums
nums=[]
nums=addom(x)
global list1
global list2
global list3
global list4
list1,list2,list3,list4=[],[],[],[]
global dictofnumbers
dictofnumbers={'odd':list1, 'even':list2, 'addom':list3, 'palin':list4}
if(x%2==0):
print("Number is even")
list2=[x]
if(num==x):
print("its a palindrome number")
list4=[x]
elif(nums==x):
print("its an addom number")
list3=[x]
else:
print("none of these")
elif(x%2==1):
print("Number is odd")
list1=[x]
if(num==x):
print("its a palindrome number")
list4=[x]
elif(nums==x):
print("its an addom number")
list3=[x]
else:
print("none of these")
dictofnumbers={'odd':list1, 'even':list2, 'addom':list3, 'palin':list4}
print(dictofnumbers)