0

Backstory: Usain Bolt, you, and Qazi had a race. Surprisingly, Usain bolt won. You came in 2nd and Qazi came in 3rd :(. Can you

Backstory: Usain Bolt, you, and Qazi had a race. Surprisingly, Usain bolt won. You came in 2nd and Qazi came in 3rd :(. Can you think of a way to write a function that given a person's name, returns his/her place? ALSO Can you think of a way to write a function that given a place, returns his/her name? WRITE 2 FUNCTIONS One that converts choice to number and One that converts number to choice. """

20th Jan 2018, 4:37 PM
Ubair Noor
Ubair Noor - avatar
4 Answers
+ 3
you need a bidirectional map
20th Jan 2018, 4:58 PM
code learner
code learner - avatar
+ 1
Granted the placing is static, I'd take this approach- You could simply great a dictionary, containing the person as the key, and place as a value. Then you can define your two fuctions. They would contain simple print statements. You don't even have to create functions for that.
20th Jan 2018, 9:36 PM
Bryan
Bryan - avatar
0
ok how can i create it
20th Jan 2018, 5:04 PM
Ubair Noor
Ubair Noor - avatar
0
šŸ‘šŸ‘šŸ‘šŸ‘
21st Jan 2018, 4:59 AM
Ubair Noor
Ubair Noor - avatar