Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50e6bc4

Browse files
Python Training
Python Task During College Training Periods.
1 parent c79327e commit 50e6bc4

File tree

5 files changed

+126
-0
lines changed

5 files changed

+126
-0
lines changed

‎Training/AdamNumber.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'''
2+
3+
Adams Number
4+
5+
'''
6+
7+
a=int(input())
8+
s1=a*a
9+
b=0
10+
t=a
11+
while t>0:
12+
b=(b*10)+t%10;
13+
t//=10
14+
t=b*b
15+
s2=0
16+
while t>0:
17+
s2=s2*10+t%10
18+
t//=10
19+
if(s1==s2):
20+
print("Adam Number")
21+
else:
22+
print("Not Adam Number")

‎Training/AmicablePair.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'''
2+
3+
Amicable Pair
4+
5+
'''
6+
7+
a,b=map(int,input().split())
8+
s1=0
9+
s2=0
10+
for i in range(1,a):
11+
if(a%i==0):
12+
s1+=i
13+
for i in range(1,b):
14+
if(b%i==0):
15+
s2+=i
16+
if(a==s2 and b==s1):
17+
print("Amicable Pair")
18+
else:
19+
print("Not Amicable Pair")
20+

‎Training/AstrologyNumber.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'''
2+
3+
Astrology Number
4+
5+
'''
6+
7+
# Method 1
8+
# n=int(input())
9+
# while(n//10!=0):
10+
# t=n
11+
# s=0
12+
# while t>0:
13+
# s+=(t%10)
14+
# t//=10
15+
# n=s
16+
# print(n)
17+
18+
""" Method 2 (refer) """
19+
n=int(input())
20+
if(n%9==0):
21+
print("9")
22+
else:
23+
print(n%9)
24+
25+
# Method 3
26+
# n=int(input())
27+
# s=0
28+
# while(n>9):
29+
# s+=(n%9)
30+
# n//=10
31+
# print(s)
32+
33+
34+
# Method 4
35+
# n = int(input())
36+
# while n >= 10:
37+
# n = sum(int(digit) for digit in str(n))
38+
# print(n)
39+
40+

‎Training/PrimeDigit.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'''
2+
3+
Prime digits in a number
4+
5+
Eg-1:
6+
123456 -> 2 3 5
7+
8+
Eg-2:
9+
87546363 -> 7 5 3 3
10+
11+
'''
12+
13+
n=input()
14+
for i in range(len(n)):
15+
f=0
16+
a=int(n[i])
17+
if(a==1):
18+
continue
19+
for j in range(2,a):
20+
if a%j==0:
21+
f=1;
22+
break;
23+
if f==0:
24+
print(a,end=" ")
25+

‎Training/StrongNumber.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'''
2+
3+
Strong Number
4+
5+
'''
6+
7+
n=int(input())
8+
t=n
9+
res=0
10+
while(t>0):
11+
s=1
12+
for i in range(2,(t%10)+1):
13+
s*=i
14+
res+=s
15+
t//=10
16+
if res==n:
17+
print("Strong Number")
18+
else:
19+
print("Not Strong Number")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /