Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Rock-Paper-Scissors Game #220

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Python/Rock-Paper-Scissors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import random

player = 0
cpu = 0

print("three points win the game!")

while player<3 and cpu<3:
cpu_choice = random.choice(["rock","paper","scissors"])
player_choice = input("Rock Paper Scissors: ")

print(f"CPU: {cpu_choice} VS Player: {player_choice}")
if player_choice.lower()==cpu_choice:
print("Tie! No Points")
elif player_choice.lower()=="rock":
if cpu_choice =="scissors":
player+=1
print("Player wins! One Point")
elif cpu_choice=="paper":
cpu+=1
print("CPU wins! One Point")
elif player_choice.lower()=="scissors":
if cpu_choice =="paper":
player+=1
print("Player wins! One Point")
elif cpu_choice=="rock":
cpu+=1
print("CPU wins! One Point")
elif player_choice.lower()=="paper":
if cpu_choice =="rock":
player+=1
print("Player wins! One Point")
elif cpu_choice=="scissors":
cpu+=1
print("CPU wins! One Point")
else:
print("Invalid input! New round!")
print("Player wins!!" if player>cpu else "CPU wins!!")