import time
import random
run_again = "yes"
while run_again == "yes":
boredGame = True
compScore = 0
userScore = 0
print("Rock Paper Scissors vs Computer")
print("Your opponent will be the Computer")
score = int(input("How many scores to win? "))
time.sleep(0.5)
print("\nNOTE: No space before or/and after the word you have chosen")
time.sleep(0.5)
print("\nComputer:", compScore," ", "You:", userScore, "\n")
while boredGame:
print("rock")
print("paper")
print("scissor")
user_weap = input("Choose your weapon: ")
comp_weap = random.choice(["rock", "paper", "scissor"])
if user_weap.lower() == "rock":
if comp_weap == "paper":
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("Computer Win")
compScore += 1
print("\nComputer:", compScore," ", "You:", userScore)
if compScore == score:
game_run = str(input("Play the game again? yes/no: "))
if game_run == "yes":
compScore = 0
userScore = 0
else:
exit()
else:
print()
elif comp_weap == "scissor":
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("You Win")
userScore += 1
print("\nComputer:", compScore," ", "You:", userScore)
if userScore == score:
game_run = str(input("Play the game again? yes/no: "))
if game_run == "yes":
compScore = 0
userScore = 0
else:
exit()
else:
print()
else:
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("It's a Draw")
print("\nComputer:", compScore," ", "You:", userScore, "\n")
elif user_weap.lower() == "paper":
if comp_weap == "scissor":
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("Computer Win")
compScore += 1
print("\nComputer:", compScore," ", "You:", userScore)
if compScore == score:
game_run = str(input("Play the game again? yes/no: "))
if game_run == "yes":
compScore = 0
userScore = 0
else:
exit()
else:
print()
elif comp_weap == "rock":
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("You Win")
userScore += 1
print("\nComputer:", compScore," ", "You:", userScore)
if userScore == score:
game_run = str(input("Play the game again? yes/no: "))
if game_run == "yes":
compScore = 0
userScore = 0
else:
exit()
else:
print()
else:
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("It's a Draw")
print("\nComputer:", compScore," ", "You:", userScore, "\n")
elif user_weap.lower() == "scissor":
if comp_weap == "rock":
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("Computer Win")
compScore += 1
print("\nComputer:", compScore," ", "You:", userScore)
if compScore == score:
game_run = str(input("Play the game again? yes/no: "))
if game_run == "yes":
compScore = 0
userScore = 0
else:
exit()
else:
print()
elif comp_weap == "paper":
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("You Win")
userScore += 1
print("\nComputer:", compScore," ", "You:", userScore)
if userScore == score:
game_run = str(input("Play the game again? yes/no: "))
if game_run == "yes":
compScore = 0
userScore = 0
else:
exit()
else:
print()
else:
time.sleep(0.3)
print("\nComputer:", comp_weap)
print("You:", user_weap)
print("It's a Draw")
print("\nComputer:", compScore," ", "You:", userScore, "\n")
shall i run with copy pasteHi guys, i saw ElSlayRR's post about his rock paper and scissors code in a very simple way. I've created this on my own, you could try run and play it. You can also set the score to win u want. I want to share my code to you. What are your thoughts about this? If you have a better idea share it to us, it would be great
Python:import time import random run_again = "yes" while run_again == "yes": boredGame = True compScore = 0 userScore = 0 print("Rock Paper Scissors vs Computer") print("Your opponent will be the Computer") score = int(input("How many scores to win? ")) time.sleep(0.5) print("\nNOTE: No space before or/and after the word you have chosen") time.sleep(0.5) print("\nComputer:", compScore," ", "You:", userScore, "\n") while boredGame: print("rock") print("paper") print("scissor") user_weap = input("Choose your weapon: ") comp_weap = random.choice(["rock", "paper", "scissor"]) if user_weap.lower() == "rock": if comp_weap == "paper": time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("Computer Win") compScore += 1 print("\nComputer:", compScore," ", "You:", userScore) if compScore == score: game_run = str(input("Play the game again? yes/no: ")) if game_run == "yes": compScore = 0 userScore = 0 else: exit() else: print() elif comp_weap == "scissor": time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("You Win") userScore += 1 print("\nComputer:", compScore," ", "You:", userScore) if userScore == score: game_run = str(input("Play the game again? yes/no: ")) if game_run == "yes": compScore = 0 userScore = 0 else: exit() else: print() else: time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("It's a Draw") print("\nComputer:", compScore," ", "You:", userScore, "\n") elif user_weap.lower() == "paper": if comp_weap == "scissor": time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("Computer Win") compScore += 1 print("\nComputer:", compScore," ", "You:", userScore) if compScore == score: game_run = str(input("Play the game again? yes/no: ")) if game_run == "yes": compScore = 0 userScore = 0 else: exit() else: print() elif comp_weap == "rock": time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("You Win") userScore += 1 print("\nComputer:", compScore," ", "You:", userScore) if userScore == score: game_run = str(input("Play the game again? yes/no: ")) if game_run == "yes": compScore = 0 userScore = 0 else: exit() else: print() else: time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("It's a Draw") print("\nComputer:", compScore," ", "You:", userScore, "\n") elif user_weap.lower() == "scissor": if comp_weap == "rock": time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("Computer Win") compScore += 1 print("\nComputer:", compScore," ", "You:", userScore) if compScore == score: game_run = str(input("Play the game again? yes/no: ")) if game_run == "yes": compScore = 0 userScore = 0 else: exit() else: print() elif comp_weap == "paper": time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("You Win") userScore += 1 print("\nComputer:", compScore," ", "You:", userScore) if userScore == score: game_run = str(input("Play the game again? yes/no: ")) if game_run == "yes": compScore = 0 userScore = 0 else: exit() else: print() else: time.sleep(0.3) print("\nComputer:", comp_weap) print("You:", user_weap) print("It's a Draw") print("\nComputer:", compScore," ", "You:", userScore, "\n")
Yuppshall i run with copy paste
the computer's choice is randomit always draw why
I can do that but it's really unfair tho XDMaybe we could make the computer always win so the player is frustrated haha
nope, I've created chess gameYour first Python game. Easy, right?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?