Coder Social home page Coder Social logo

i4g_zuriteam_rock_paper_scissors_game's Introduction

Task Title: Creating and Using [Local] Python Packages

Guidelines for Submission:

  1. Push your solution to a public GitHub repository using Git CLI
  2. Create a README.md and add whatever links are necessary
  3. Submit the GitHub URL to the Repository on the LMS

[Rock-Paper-Scissors]

Rock-Paper-Scissors is a simple two-player game where, at a signal, players make figures with their hands, representing a rock, a piece of paper, or a pair of scissors. The winner is determined according to a set of rules. You can find the official rules under the Resources.

A brief summary:

If the two players choose the same “character” it’s a tie, and the game repeats

  • Rock beats Scissors
  • Paper beats Rock
  • Scissors beats Paper

You have been tasked to create a simple version of this game with Python. In your version, one player will be controlled by the computer and the other player controlled by you - the user (i.e CPU vs Player).

You should make use of the inbuilt Python module random and its choice method.

Instructions:

Create a new Python file and call it main.py. Inside it you'll create your game.

Create a list to store all possible options:

  • "R" for "rock",
  • "P" for "paper",
  • "S" for "scissors".

When the program is run, ask the user to pick an option between "R", "P" or "S"

If user input is invalid (not amongst our options), print an error, and ask for their input again (should be a loop).

Use the choice function from the inbuilt Python random module to make a choice for CPU player(computer).

Print both player's moves in the format: Player (Rock) : CPU (Paper)

Check both player's moves:

If there is a winner, print the winner, and the program ends.

If it's a tie (the computer and player pick the same move), restart the game from step 3

i4g_zuriteam_rock_paper_scissors_game's People

Contributors

waga43 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.