CODE IN PYTHON # Take input for word pairs wordPairsInputsThroughConsole = input() # split pairs into list eachWordList

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

CODE IN PYTHON # Take input for word pairs wordPairsInputsThroughConsole = input() # split pairs into list eachWordList

Post by answerhappygod »

CODE IN PYTHON
# Take input for word pairswordPairsInputsThroughConsole = input()
# split pairs into listeachWordList = wordPairsInputsThroughConsole.split()# Take input for namenameToSearchInWrdPairs = input()
# Convert eachWordList list to dictionary of alternate items byusing slicing and zip methoddictionaryOfWordPairs = (dict(zip(eachWordList[::2],eachWordList[1::2])))
# print the matched word if foundif nameToSearchInWrdPairs in dictionaryOfWordPairs: print(dictionaryOfWordPairs[nameToSearchInWrdPairs])else: # otherwise print a message of not found print("Not found")
THIS IS WHAT I HAVE SO FAR BUT I KEEP GETTING WRONGOUTPUTS.
1: Compare outputkeyboard_arrow_up
0 / 3
Output differs. See highlights below. Special characterlegend
Input
Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank
Your output
Not found
Expected output
867-5309
2: Compare outputkeyboard_arrow_up
0 / 3
Output differs. See highlights below. Special characterlegend
Input
Jasmin,312-3145 Scooby-Doo,093-1212 Jasmin
Your output
Not found
Expected output
312-3145
3: Compare outputkeyboard_arrow_up
0 / 2
Output differs. See highlights below. Special characterlegend
Input
Mo,391-0993 Rachel,019-1265 Ruby,010-8712 Steve,312-3318Maria,871-0091 Rachel
Your output
Not found
Expected output
019-1265
4: Compare outputkeyboard_arrow_up
0 / 2
Output differs. See highlights below. Special characterlegend
Input
Sally,190-1214 Sue,119-6442 Sue
Your output
Not found
Expected output
119-6442
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply