Close Menu
SkytikSkytik

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    At Least 32 People Dead After a Mine Bridge Collapsed Due to Overcrowding

    November 17, 2025

    Here’s how I turned a Raspberry Pi into an in-car media server

    November 17, 2025

    Beloved SF cat’s death fuels Waymo criticism

    November 17, 2025
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    SkytikSkytik
    • Home
    • AI Tools
    • Online Tools
    • Tech News
    • Guides
    • Reviews
    • SEO & Marketing
    • Social Media Tools
    SkytikSkytik
    Home»AI Tools»Implementing the Rock Paper Scissors Game in Python
    AI Tools

    Implementing the Rock Paper Scissors Game in Python

    AwaisBy AwaisNovember 28, 2025No Comments5 Mins Read0 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    Implementing the Rock Paper Scissors Game in Python
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Introduction to the Game

    has been an interesting and on-the-go game since our childhood, one we could play anywhere when bored. The game is simple. It involves two players, and each player has to choose one of the 3 options: Rock, Paper, or Scissors. Rock is expressed using a fist, Scissors with the two fingers spread out, and Paper with the hand opened flat.

    The following are the different scenarios that can happen and what they would mean:

    • Rock vs Paper: The Paper covers the Rock. Paper wins.
    • Rock vs Scissors: The Rock breaks the Scissors. Rock wins.
    • Paper vs Scissors: The Scissors cut the Paper. Scissors wins.
    • Same signs: draw!

    we will use our understanding of the game, as well as our beginner’s knowledge of Python, to code this game into a computer program. This will be done with the help of Python conditional statements: ‘if’, ‘elif’, and ‘else’, as well as the use of the random module, which is an in-built Python module. We will learn to import it and use its function to include the element of randomness in our game.

    Implementing the Game in Python

    Now we will implement the game in Python. We will use the concepts of Python Lists and Randomisation using the Python random module to achieve our goal.

    This is how the program will proceed:

    The program will ask you to choose Rock, Paper or Scissors. The computer will randomly choose one of the 3 choices. Based on the different scenarios above, the program will decide who won the game and will give an option to play again.

    Defining the List & Generating the ASCII Art

    First, we will generate the ASCII Art for Rock Paper Scissors. We will store these inside variables named correspondingly, which are further stored inside a Python List rps_list.

    
    rock = """
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
    """
    
    paper = """
         _______
    ---'    ____)____
               ______)
              _______)
             _______)
    ---.__________)
    """
    
    scissors = """
        _______
    ---'   ____)____
              ______)
           __________)
          (____)
    ---.__(___)
    """
    
    rps_list = [rock, paper, scissors ]
    Photo by Fadilah Im on Unsplash

    Asking for Input from the User

    The next step is to get the input from the user. We will use the variable user_choice to store what the user chooses to play the game with, as well as print it out for the user to see. Notice that the variable user_choice will store the input as a string. This key point will be useful to remember when we use conditionals to compare both the user’s and the computer’s choices in our article ahead.

    user_choice = input("What do you choose? Type 'rock' for Rock, 'scissors' for Scissors and 'paper' for Paper")
    print(f"User chooses {user_choice}")

    Computer’s Random Choice

    Once the user has decided their choice, next we will make the computer make a random choice. We will use the random module for this purpose. You can check more about this through the following link:

    random — Generate pseudo-random numbers

    The random module’s choice() function allows us to randomly make a choice from a given Python list that has been given as a parameter to it. We will store this random choice in the variable computer_choice and print it out.

    import random
    computer_choice = random.choice(rps_list)
    print(f"Computer chooses {computer_choice}")

    Moreover, you can also check this article, that tells you how to include randomisation in our code using Python’s random module. It includes an easy explanation of the different functions with easy-to-understand examples:

    How to Implement Randomization with the Python Random Module

    Scenarios using Conditionals

    Now we will define all the different scenarios that we mentioned in the beginning in code form. We will use if, elif, and else, which are Python’s conditional statements, for this purpose.

    if computer_choice == rock and user_choice == 'scissors':
        print("You lose")
    elif computer_choice == rock and user_choice == 'paper':
        print("You win")
    elif computer_choice == rock and user_choice == "rock":
        print("Draw")
    elif computer_choice == paper and user_choice == 'paper':
        print("Draw")
    elif computer_choice == paper and user_choice == 'scissors':
        print("You win")
    elif computer_choice == paper and user_choice == "rock":
        print("You lose")
    elif computer_choice == scissors and user_choice == 'scissors':
        print("Draw")
    elif computer_choice == scissors and user_choice == "rock":
        print("You win")
    elif computer_choice == scissors and user_choice == 'paper':
        print("You lose")
    else:
        print("Error")

    As can be seen from the code above, we have utilized each and every scenario, comparing the computer’s choice with the user’s choice that had been stored as a string as can be understood from the inverted comma, and then printed out the results, whether the user wins, or the computer wins or it has resulted in a draw between them both.

    Conclusion

    The above program is a simple Python code, which is easy to understand and gives an introduction to Python’s conditionals and the use of the random module, specifically its choice function.

    Although there are a number of ways in which the scenarios could have been coded, the above was an explicit and beginner-friendly code involving the if, elif and else conditionals. Can you think about any other way this game could have been coded?

    Game Implementing Paper Python Rock Scissors
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Awais
    • Website

    Related Posts

    Efficient High-Resolution Visual Understanding for Vision-Language Models

    March 19, 2026

    Large Language Model Enhanced Greybox Fuzzing

    March 19, 2026

    Why You Should Stop Worrying About AI Taking Data Science Jobs

    March 19, 2026

    [2603.14845] Integrating Weather Foundation Model and Satellite to Enable Fine-Grained Solar Irradiance Forecasting

    March 18, 2026

    The New Experience of Coding with AI

    March 18, 2026

    A Rubric-Based Expert-Panel Study of Human Detection of LLM-Generated Korean Text

    March 18, 2026
    Leave A Reply Cancel Reply

    Top Posts

    At Least 32 People Dead After a Mine Bridge Collapsed Due to Overcrowding

    November 17, 20250 Views

    Here’s how I turned a Raspberry Pi into an in-car media server

    November 17, 20250 Views

    Beloved SF cat’s death fuels Waymo criticism

    November 17, 20250 Views
    Don't Miss

    The best BPM automation software for enterprises in 2026

    March 19, 2026

    Business process management (BPM) is about designing, executing, monitoring, and improving the way work gets…

    WTF Is a Weeknight Recipe?

    March 19, 2026

    Why the Best AI Use Cases in Marketing Start with Intelligence, Not Creation

    March 19, 2026

    Efficient High-Resolution Visual Understanding for Vision-Language Models

    March 19, 2026
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews

    The Best Steak Knives, Tested and Reviewed (2026)

    March 19, 2026

    March Madness Marketing Strategies | Sprout Social

    March 19, 2026
    Most Popular

    13 Trending Songs on TikTok in Nov 2025 (+ How to Use Them)

    November 18, 20257 Views

    How to watch the 2026 GRAMMY Awards online from anywhere

    February 1, 20263 Views

    Corporate Reputation Management Strategies | Sprout Social

    November 19, 20252 Views
    Our Picks

    At Least 32 People Dead After a Mine Bridge Collapsed Due to Overcrowding

    November 17, 2025

    Here’s how I turned a Raspberry Pi into an in-car media server

    November 17, 2025

    Beloved SF cat’s death fuels Waymo criticism

    November 17, 2025

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram Pinterest YouTube Dribbble
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    • Disclaimer

    © 2025 skytik.cc. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.