Professional Documents
Culture Documents
NAME: POOVARASAN A
1) Data protection has become one of the most crucial task in the internet. An application
The encryption can be represented using modular arithmetic by first transforming the letters
Write a subroutine “encrypt(msg, n)” that takes ‘msg’ and ‘n’ as parameters and returns
Text : ATTACKATONCE
Shift: 4
Cipher: EXXEGOEXSRGI
Program:
result = ""
for i in range(len(txt)):
char = txt[i]
if (char.isupper()):
else:
return result
# check the above function
txt = "ATTACKATONCE"
s=4
2) Develop an application called “Feedback analyzer”. The application has sets of words for
Your task is to store the bag of words in a tuple. Given a feedback sentence, find out if it is a
Output: Positive
Output: Negative
Program:
def analyze_feedback(feedback):
feedback = feedback.lower()
words = feedback.split()
positive_count = 0
negative_count = 0
if word in positive_words:
positive_count += 1
negative_count += 1
else:
value of a pixel is in the ranges of [0,255]. The following method is used for encrypting a
pixel value for a given key, which is in the range [0,255] too.
Program:
Write a lambda function in python to perform the above task. For increasing the strength of
def encrypt(image,key):
enrypted_image = image.copy()
for i in range(5):
return encrypted_image
encrypted_image = encrypt_image(image,key)
print(encrypted image)
4) Write 2 lambda functions in python to calculate the volume and area of a sphere using the
formulas.
Program:
pi=22/7
of the students. Your task is to create a dictionary in python to store the pair {register_no:
marks} for 5 students. For a given, register number, display the corresponding marks.
Program:
n=int(input("Enter n: "))
d={}
for i in range(n):
d[roll_no]=[name,marks]
for k in d:
if(d[k][1]>75):
print(d[k][0])