subject

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?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 24.06.2019 08:20
Which type of entity describes a fundamental business aspect of a database? a. linking b. lookup c. domain d. weak
Answers: 3
question
Computers and Technology, 24.06.2019 11:20
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
question
Computers and Technology, 24.06.2019 20:20
3. write assignment statements that perform the following operations with the variables a, b, and c: a. adds 2 to a and assigns the result to b b. multiplies b times 4 and assigns the result to a c. divides a by 3.14 and assigns the result to b
Answers: 2
You know the right answer?
You are given a dictionary consisting of word pairs. Every word is a synonym of the other word in it...
Questions
question
English, 18.05.2021 02:50
question
Advanced Placement (AP), 18.05.2021 02:50
Questions on the website: 13722363