Skip to content

Commit 6afc423

Browse files
Merge pull request #1 from Suvoo/main
added set 14
2 parents 3f5a0fc + c25a75d commit 6afc423

File tree

15 files changed

+196
-0
lines changed

15 files changed

+196
-0
lines changed

Week 1/SET 14 -Week 1/ques1.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
n = int(input())
2+
3+
for i in range(1,n+1) :
4+
if i%5==0:
5+
continue
6+
if i*i == n:
7+
break
8+
print(i)

Week 1/SET 14 -Week 1/ques2.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
def encrypt(text,s):
2+
result = ""
3+
4+
for i in range(len(text)):
5+
char = text[i]
6+
7+
if (char.isupper()):
8+
result += chr((ord(char) + s-65) % 26 + 65)
9+
10+
else:
11+
result += chr((ord(char) + s - 97) % 26 + 97)
12+
13+
return result
14+
15+
#check the above function
16+
text = input()
17+
s = int(input())
18+
print("OLD SENTENCE IS : ")
19+
print(text)
20+
21+
words = text.split()
22+
23+
print("NEW SENTENCE IS : ")
24+
for i in words:
25+
print(encrypt(i,s),end=" ")

Week 1/SET 14 -Week 1/ques3.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def modify(s):
2+
if s[0].isupper() ==True:
3+
print(s.upper())
4+
else:
5+
print(s.lower())
6+
7+
s = input()
8+
modify(s)

Week 1/SET 14 -Week 1/ques4.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def sumofDigits(n):
2+
sum = 0
3+
for digit in str(n):
4+
sum += int(digit)
5+
print(sum)
6+
7+
n =input()
8+
sumofDigits(n)
9+
10+

Week 1/SET 14 -Week 1/ques5.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
def MaxZero(ar,n) :
2+
l=[int(x) for x in ar.split()]
3+
z=0
4+
maxz=0
5+
maxval=0
6+
for x in l:
7+
s=str(x)
8+
no=[int(y) for y in s]
9+
z=no.count(0)
10+
if maxz<z:
11+
maxz=z
12+
maxval=x
13+
elif maxz==z and maxz!=0:
14+
maxval=max(maxval,x)
15+
del no
16+
if maxz==0:
17+
print(-1)
18+
else:
19+
print(maxval)
20+
21+
n=int(input())
22+
ar=input()
23+
MaxZero(ar,n)
24+
25+
26+

Week 2/SET 14 -Week 2/ques1.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def ispangram(str):
2+
alphabet = "abcdefghijklmnopqrstuvwxyz"
3+
for char in alphabet:
4+
if char not in str.lower():
5+
return False
6+
7+
return True
8+
9+
str = input("enter a sentence :\n ")
10+
if ispangram(str):
11+
print('contains all alphabets')
12+
else:
13+
print('does not contain all alphabets')

Week 2/SET 14 -Week 2/ques2.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
arr = tuple(map(int,input().split()))
2+
3+
adderp = sum(list(filter(lambda x: (x>= 0) , arr)))
4+
addernp = sum(list(filter(lambda x: (x<0) , arr)))
5+
6+
print(adderp)
7+
print(addernp)
8+

Week 2/SET 14 -Week 2/ques3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
arr = [int(x) for x in input().split()]
2+
test_list = list(set(arr))
3+
print(test_list)

Week 2/SET 14 -Week 2/ques4.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tuple1 = tuple(map(int,input().split()))
2+
tuple2 = tuple(map(int,input().split()))
3+
tuple3 = tuple(map(int,input().split()))
4+
5+
adder = tuple(map(lambda x, y, z: (x + y + z)//3, tuple1, tuple2, tuple3))
6+
7+
print(adder)
8+

Week 2/SET 14 -Week 2/ques5.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
my_dict = {1:'Apple', 2:'Oracle',3:'Advanced Programming Practice',4:'Software Project Management', 5:'Fundamentals of mathematics'}
2+
3+
for x in range(1,6):
4+
#print(my_dict[i])
5+
test_str = my_dict[x]
6+
res = {i : test_str.count(i) for i in set(test_str)}
7+
print(res)
8+

0 commit comments

Comments
 (0)