NPTEL The Joy Of Computing Using Python Week 6 Programming Assignment | NPTEL Swayam Assignment Answers
Nptel Week 6 Programming Assignment Answers:
Q.1: Given a list L containing integers, write a program that creates and prints a dictionary 'd' containing all the the numbers that occur twice or more in the list as keys and their indexes as values. Both the keys are and their values should be in the same order as given the list.
You have to take the input.
Input
List
Output
Dictionary D
Q.2: Romeo and Juliet love each other. Romeo wants to send a message to Juliet and also don't want anyone to read it without his permission. So he shifted every small letter in the sentence by -2 position and every capital letter by -3 position. (If the letter is c, after shifting to by -2 position it changes to a, and for D new letter will be A).
But the letter is too long and Romeo does not have enough time to encrypt his whole letter. Write a program to help Romeo which prints the encrypted message. You can assume there are no special characters except spaces and numeric value.
Input
A string S
Output
Encrypted string
Example
Input
Hello Juliet
Output
Ecjjm Gsjgcr
Explanation
H is shifted by -3 position and changed to E. 'e' is shifted by -2 position and changed to c and so on.
Q.3: Take a string S as an input and print 'palindrome' if string S is a palindrome or 'not palindrome' if string S is not a palindrome.
A palindrome is a word which spells same from forward and backward. Example DAD.
Input
A string S
Output:
palindrome or not palindrome
If you are facing any queries regarding this assignment solutions, then please drop comment in comment section.
0 Comments