May-02-2022, 08:02 PM
If we are going for one shot. This could be made even shorter. There is no validation of any kind.
from random import choice wins = [('paper', 'rock', 'paper covers rock'), ('scissors', 'paper', 'scissors cut paper'), ('rock', 'scissors', 'rock smashes scissors')] pc = choice(['rock', 'paper', 'scissors']) print('Type in rock, paper, or scissors') player = input('>> ').lower() for win in wins: if player in win[0] and pc in win[1]: print(f'Player wins: {win[2]}') break elif pc in win[0] and player in win[1]: print(f'PC wins: {win[2]}') break elif player in win[0] and pc in win[0]: print('Tie Game') break
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