This video is all about rock paper, scissors. Please like if you liked the video, dislike if you didn't and be sure to hit that subscribe button and turn on bell notifications so you don't miss a video.
Code:
import random
def pick():
choices = ["rock", "paper", "scissors"]
computer_choice = choices[random.randint(0,2)]
player_choice = input("Please pick, rock, paper, or scissors: ").lower()
if player_choice in ["rock", "r"]:
if computer_choice == "rock":
print("You picked rock, computer picked rock, you tied.")
elif computer_choice == "scissors":
print("You picked rock, computer picked scissors, you win")
elif computer_choice == "paper":
print("You picked rock, computer picked paper, you lose.")
elif player_choice in ["paper", "p"]:
if computer_choice == "rock":
print("You picked paper, computer picked rock, you win")
elif computer_choice == "paper":
print("You picked paper, computer picked paper, you tied.")
elif computer_choice == "scissors":
print("You picked paper, computer picked scissors, you lose")
elif player_choice in ["scissors", "s"]:
if computer_choice == "rock":
print("You picked scissors, computer picked rock, you lose.")
elif computer_choice == "paper":
print("You picked scissors, computer picked paper, you win")
elif computer_choice == "scissors":
print("You picked scissors, computer picked scissors, you tied.")
play_again = input("Do you want to play again? (y/n): ").lower()
if play_again in ["y", "yes"]:
pick()
elif play_again in ["n", "no"]:
print("Bye")
quit()
pick()
Thank you for watching and I will see you in the next video.
In questa pagina del sito puoi guardare il video online Python - Rock, Paper, scissors della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Viral Shah 09 agosto 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 24 volte e gli è piaciuto 1 spettatori. Buona visione!