Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 1_sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
i=1;sum=0;
for i in range(1,500):
if(i%5==0 and i%7!=0):
sum=sum+i;
print("sum is:");
print(sum);
7 changes: 7 additions & 0 deletions 2_area.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
il=6;iw=8;ih=10;
fl=1.15*6;fw=1.15*8;fh=1.15*10;
sa=(2*fl*fw)+(2*fw*fh)+(2*fl*fh);
print("surface area:");
print(sa);


4 changes: 4 additions & 0 deletions 3_sortlists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
list=['Ron','Hermione','Harry','Professor','Dobby','List Items 2','The House Elf','Potter','Granger','Lockhart','Weasley'];
list2=sorted(list);
list3=['Potter','Fred','Greg','George','Voldemort','Sirius','Dumbledore'];
print(list2+list3);
9 changes: 9 additions & 0 deletions 4_triplet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
for i in range(1,1000):

for j in range(i+1,1000):

k=1000-(i+j)
if (i**2)+(j**2)==(k**2):
if i+j+k==1000:
print(i*j*k)
break
14 changes: 14 additions & 0 deletions 5_small20.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def gcd(a,b):
rem=0;
while(b>0):
rem=a%b;
a=b;
b=rem;
return a;
x=gcd(1,2);
y=(1*2)//x;
z=y;
for i in range(1,19):
k=i+2;
z=(z*k)//gcd(z,k);
print(z);
8 changes: 8 additions & 0 deletions 6_prime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
for i in range(1,99999):
c=0;
for j in range (1,i+1):
if(i%j==0):
c=c+1;
if(c==2):
print(i,' ',end='');

12 changes: 12 additions & 0 deletions 7_palindrome
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
s=input("string:");
le=len(s);
s1=list();
for i in range(0,le):
k=s[le-i-1];
s1.append(k);

s2=''.join(s1);
if(s==s2):
print("palindromes");
else:
print("not palindrome");