Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 88d5f97

Browse files
authored
Add files via upload
1 parent c81a971 commit 88d5f97

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

set2/least_value.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def gcd(a,b):
2+
3+
# Everything divides 0
4+
if (a == 0 or b == 0):
5+
False
6+
# base case
7+
if (a == b):
8+
return a
9+
10+
# a is greater
11+
if (a > b):
12+
return gcd(a-b, b)
13+
return gcd(a, b-a)
14+
15+
16+
def lcm(n):
17+
ans = 1
18+
for i in range(1, n + 1):
19+
ans = (ans * i)/gcd(ans, i)
20+
return ans
21+
# main
22+
n = 20
23+
print(lcm(n));

set2/palindrome.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#check given string is palindrome or not
2+
3+
text=input("enter the string");
4+
text2=[];
5+
length=len(text);
6+
7+
for i in range(length):
8+
text2.append(text[length-1]);
9+
length=length-1;
10+
11+
text1="".join(str(i) for i in text2);
12+
13+
if(text==text1):
14+
print("palindrome");
15+
else:
16+
print("not a plaindrome");
17+
18+
19+
20+

set2/pythogorean.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def pythogorean():
2+
3+
for x in range(1,500):
4+
for y in range(1,500):
5+
6+
z=(1000-(x+y));
7+
8+
if(x**2+y**2==z**2):
9+
return int(x*y*z);
10+
print(pythogorean());
11+
12+
13+

0 commit comments

Comments
 (0)