eight lines. As before there is not any kind of validation. typing anything other than the key words will result in errors.
from random import choice items = ['rock', 'paper', 'scissors'] print(f'Options: {", ".join(items)}') pc, player = choice(items), input('>> ').lower() wins = ('paper', 'rock', 'paper covers rock'), ('rock', 'scissors', 'rock crushes scissors'), ('scissors', 'paper', 'scissors cuts paper') winner = ['tie game' if player == pc else ('player wins' if player in wins[0] and pc in wins[1] else 'pc wins')] print(f'player -> {player} | pc -> {pc}') print(winner[0])
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags