0

Need Python Solution (Python Tuple)

Write a python program that takes 2 inputs from the user. . Input1: A string containing a single sentence or multiple sentences. Multiple sentences are separated by full stops. . Input2: A list containing special characters. After taking the inputs, your task is to create a dictionary where the keys will be the corresponding special characters from the given list and the values will be the words in the given sentence. You need to find out which key belongs to which value. To do that, you should calculate the index number using the formula given below. The calculated index is the corresponding key of the word. Make sure no duplicate values are inserted. The formula: Index value of special character list = (ASCII sum of the word) * (length of special character list) Sample Input 1: I love Programming. Python is love." ['@','

#x27;,'&','#'] Sample Output 1: Words in the given String: [I', love', 'Programming', 'Python', is' love'l Answer: ('
#x27;: [I]. '&': ['love', 'Python], "#: ['Programming'] '@: ['is'])

9th Aug 2022, 9:06 PM
Md Zehad khan
Md Zehad khan - avatar
1 Respuesta
0
That's a littlr bit hardcore, for a quiz. How would one be sure there's enough keys as special characters for words as values?
9th Aug 2022, 11:17 PM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar