I Enjoy Repeating My Self... [help condense code] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I Enjoy Repeating My Self... [help condense code]

This code seems very wet but I'm not sure how to condense it. Seems like a lot of the code can be reused or discluded. What do you guys think? https://code.sololearn.com/ca6r9lXUP2au/?ref=app

12th Jan 2020, 4:18 PM
Joshua Morgan
Joshua Morgan - avatar
2 Answers
+ 2
Here is my revision. I made use of the indexing of the words in your list (right beats left) for the condition and a dictionary for the winner’s text like Seb TheS suggested. https://code.sololearn.com/crDIOryVC5jT/?ref=app
12th Jan 2020, 5:34 PM
Zerokles
Zerokles - avatar
+ 2
I think the game could have a dictionary: {"Rock", "Scissors", "Paper"} with text they will do if they win and only winner's text would be printed.
12th Jan 2020, 4:25 PM
Seb TheS
Seb TheS - avatar