Computers and Technology
Computers and Technology, 14.03.2022 18:50, HammondE

You are given a dictionary consisting of word pairs. Every word is a synonym of the other word in its pair. All the words in the dictionary are different. After the dictionary there's one more word given. Find a synonym for it.

Python
dict = {}
times = int(input())
for _ in range(times):
a = input()
w1, w2 = a. split()
dict[w1] = w2
dict[w2] = w1
print(dict[input()])

How can I further condense this code?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, adam4449
Jackson is teaching the decimal number system. he wants his students to know how to expand numbers by powers of 10. which is the correct order in which digits are assigned values in the decimal number system?
Answers: 1
image
Computers and Technology, 23.06.2019 01:50, rhonda45801
Free points just awnser this. what should i watch on netflix
Answers: 2
image
Computers and Technology, 23.06.2019 16:30, mirmir62
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
image
Computers and Technology, 24.06.2019 02:00, akatherine1738
What is a loop? a. a collection of function definitions at the top of a program b. a line of code that defines a variable and assigns it a value c. a program that opens the turtle graphics window d. a block of code that repeats a specific number of times
Answers: 1
Do you know the correct answer?
You are given a dictionary consisting of word pairs. Every word is a synonym of the other word in it...

Questions in other subjects:

Konu
Mathematics, 18.07.2019 06:40
Konu
History, 18.07.2019 06:40