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

Commit 898fc33

Browse files
authored
Add files via upload
1 parent e3039eb commit 898fc33

6 files changed

+99
-0
lines changed

1_sum_57.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sum=0
2+
for i in range(0,500):
3+
if i%5==0 and i%7!=0:
4+
sum+=i
5+
6+
print(sum)

2_area_15.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
#area if c is height
3+
area_c=0
4+
#area if b is height
5+
area_b=0
6+
#area if a is height
7+
area_a=0
8+
9+
10+
def fu(a=6,b=8,c=10):
11+
global area_c,area_b,area_a
12+
area_a=(b*1.15)*(c*1.15)
13+
area_b=(c*1.15)*(a*1.15)
14+
area_c=(b*1.15)*(a*1.15)
15+
try:
16+
fu(float(input("enter a")),float(input("enter b")),float(input("enter c")))
17+
print("if a is height ",area_c,"\nif b is height ",area_b,"\nif c is height",area_a)
18+
19+
except:
20+
print("enter real numbers")

3_sort_concat.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
list_items_2=['Potter',
2+
'Fred',
3+
'Greg',
4+
'George',
5+
'Voldemort',
6+
'Sirius',
7+
'Dumbledore']
8+
9+
#SORTING WORDS PRESENT IN SET1
10+
11+
# IF LIST ITEM 2 IS IN LIST 1
12+
list_items_1=['Ron',
13+
'Hermione',
14+
'Harry',
15+
'Professor',
16+
'Dobby',
17+
'The House Elf',
18+
'Potter',
19+
'Granger',
20+
'Lockhart',
21+
'Weasley']
22+
23+
#since list_items_2 is in list_items_1 in the QUESTION
24+
25+
list_items_1.extend(list_items_2)
26+
print("sorting the list_items_1")
27+
list_items_1.sort()
28+
#IF SORTING OF LIST 2 IS REQ REMOVE THE COMMENT IN LINE BELOW
29+
#list_items_2.sort()
30+
31+
print(list_items_1)
32+
print(list_items_2)
33+
34+
35+
list_items_1=[a + b for a, b in zip(list_items_1,list_items_2)]
36+
print(list_items_1)

5_leastnum_1to20.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
3+
t=[]
4+
#u can find all the number divisible by 1to 20 if u remove the if found condition
5+
for i in range(2520,int(sys.maxsize)):
6+
found=False
7+
if (i%2==0 and i%3 and i%5==0 and i%7==0 and i%11==0 and i%13==0 and i&17==0 and i%19==0):
8+
t.append(i)
9+
found=True
10+
if found:
11+
print(i)
12+
break
13+
#print(t)

6_prime_interval.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def primenum(upperbound):
2+
for num in range(1,upperbound+1):
3+
# prime numbers are greater than 1
4+
if num > 1:
5+
for i in range(2,num):
6+
if (num % i) == 0:
7+
break
8+
else:
9+
print(num)
10+
11+
try:
12+
primenum(int(input("enter the upper bound ")))
13+
except Exception as e:
14+
print("enter a postive number")

7_string_palindrome.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
def palindrome(user_input):
4+
if(user_input[::-1]==user_input):
5+
print("palindroime")
6+
else:
7+
print("not a palindrome")
8+
9+
10+
palindrome(user_input=input("enter a string"))

0 commit comments

Comments
 (0)