Rock, Paper, Scissors Game In Python!🐍
HTML-код
- Опубликовано: 30 сен 2024
- PLEASE LIKE AND SUBSCRIBE ITS FREE!
#beginners #tutorial #python
Check out my other videos to learn more computer science & programming concepts please :)
Code used in the video will be pinned in the comments!
Socials and other platforms:
linktr.ee/Yous...
# hi, please like and subscribe. It would mean a lot :D
import random
options = ("rock", "paper", "scissors")
running = True
while running:
player = None
computer = random.choice(options)
while player not in options:
player = input("Enter a proper choice pls (rock, paper, or scissors): ")
print(f"Player: {player}")
print(f"Computer: {computer}")
if player == computer:
print("It's a tie")
elif player == "rock" and computer == "scissors":
print("You win!")
elif player == "paper" and computer == "rock":
print("You win!")
elif player == "scissors" and computer == "paper":
print("You win!")
else:
print("You lose!")
if not input("Do you want to play again? (y/n): ").lower() == "y":
running = False
print("Thanks for playing :D ")
# if player == computer:
# print("computer: ", computer)
# print("player: ", player)
# print("Tie")
# elif player == "rock":
# if computer == "paper":
# print("computer: ", computer)
# print("player: ", player)
# print("You Lose!")