Friday , Oct , 24, 2025

Today This Free Friday I am working on a project on YouTube a Rock , Paper, scissors

import random

user_wins = 0
computer_wins = 0

while True:
    user_input = input("Type Rock/Paper/Sissors or Q to quit: ").lower()
    if user_input == "q":
        break
    
    if user_input not in ["rock", "paper", "scissors"]:
        continue
  • This part make sure that the user pick rock, paper, or scissors or Q for Quit
 if user_input not in ["rock", "paper", "scissors"]:
        continue

    random_number = random.randint(0,2)
    # rock: 0, paper: 1, scissors: 2
    computer_pick = options[random_number]
    print("Computer picked" , computer_pick + ".")

    if user_input == "rock" and computer_pick == "scissors"
       print("You won!")
       user_wins += 1
       continue


print("Goodbye!")
  • This part of code make sure that numbers the choices the user picks

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top