Given a string, write a program to mirror the characters of the string in alphabetical order to create a secret message.
Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.
abcdefghijklmzyxwvutsrqpon nopqrstuvwxyzmlkjihgfedcbaInput
The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).Output
The output should be a single line containing the secret message. All characters in the output should be in lower case.
Explanation
.
Sample Input 1
pythonoutput
kbgslmsample 2
Foundationsoutput
ulfmwzgrlmhGiven a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.
Note: You need to replace both uppercase and lowercase characters. You can ignore replacing all characters that are not letters.
a b c d e f g h i j k l m n o p q r s t u v w x y z
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Input
Explanation
For example, if the given input is "python", "p" should replaced with "16", similarly"y" with "25","t" with "20","h" with "8","o" with "15","n" with "14". So the output should be "16-25-20-8-15-14".
python learning16-25-20-8-15-14 12-5-1-18-14-9-14-7python16-25-20-8-15-14Foundations6-15-21-14-4-1-20-9-15-14-19In this python code there are three test cases. The three test cases are not coming expected output.
The three test cases are in below link
https://drive.google.com/file/d/1pcEniOexSN8TMkXxXU05FDKoPlYYbLCe/view?usp=sharing
sentence = "to be or not to be"
s = sentence.split()
s.sort()
result = []
for word1 in s:
for word2 in s:
result.append(word1 + " " + word2)
result = set(result)
result = list(result)
result.sort()
for item in result:
if item in sentence:
result.remove(item)
for item in result:
if " ".join(item.split()[::-1]) in sentence:
result.remove(item)
for item in result:
spl = item.split()
if (spl[0] == spl[1]) and (sentence.count(spl[0]) < 2):
result.remove(item)
for item in result:
spl = item.split()
dup = spl[1] + " " + spl[0]
if dup in result:
result.remove(dup)
result.insert(0, "be be")
for item in result:
print(item)create a program that has a dictionary:
studentgrade={
"john" :90,
"doe" :70,
"jane":83,
"marie":67,
"robert":59,
}
change the value into its equivalent:
91-100-oustanding
81-90-verygood
71-80-good
61-70-poor
51-60-failed
sample output:
{'john' : 'verygood', 'doe':'poor','jane':'verygood','marie':'poor',
'robert':'failed'}
INPUT:
You will receive exactly one word on a single line
OUTPUT:
Print the following sentence to the screen, substituting the word read in from your dataset in place of the
placeholder NAME: NAME, the needs of the many outweigh the needs of the few, or the one; live long and
prosper
Concatenate Word Pairs
Given a sentence and an integer L, write a program to concatenate word pairs so that the concatenated word has the length L.
The first line of input will be a sentence.
The second line of input will be an integer L.
The output should be containing the unique concatenated word pairs each in a line in the lexicographical order.
For example, if the given sentence and L are
Welcome to your exam
6
The words which can be paired so that they make concatenated word with length 6 are
Word1Word2toyourtoexamexamtoyourto
So the output should be printing each concatenated word in a line in the lexicographical order
examto
toexam
toyour
yourto
Sample Input 1
Welcome to your exam
6
Sample Output 1
examto
toexam
toyour
yourto
Sample Input 2
My parents and I went to a movie
9
Sample Output 2
Myparents
moviewent
parentsMy
parentsto
toparents
wentmovie
Input
You will not receive any input for this (and only this) problem
Output
Print a welcome message to the screen as follows:
We bid welcome to the ladies of Beauxbaton and our friends from the north, the sons of DurmstrangTriplet Sum
Write a Python Program for Triplet Sum
The below link contains Triplet Sum Question and test cases
https://drive.google.com/file/d/1kPR1eOaf9JTOqqAj4w_A4e8Nc0jIa3fM/view?usp=sharing
Triplet Sum
Given an array n integers, find and print all the unique triplets (a, b, c) in the array which give the sum K. (a+b+c=K).
Input
The first line of the input will be space separated integers, denoting the elements of the array. The second line of the input will be an integer denoting the required sum K
Output
The output should be multiple lines, each line containing a unique triplet. The elements of the triple must be sorted in increasing order and all the triplets printed must be sorted in increasing order. Print "No Matching Triplets Found" if there are no triplets with the given sum.
Test Case 1
Input
0 12 17 8 9 21
29
Output
(0, 8, 21)
(0, 12, 17)
(8, 9, 12)
Test Case 2
Input
0 1 2 3 5 7 13 17 19 19
22
Output
(0, 3, 19)
(0, 5, 17)
(1, 2, 19)
(2, 3, 17)
(2, 7, 13)
We need all two test cases can be came when code was run. I want exact outputs for all test cases