Page 117 - KEC Khaitan C8.5 Flipbook
P. 117

PROJECT NAME 7: Rock Paper Scissors
                 Software Used: CodeSkulptor

                 Objective:

                 Create a Python program to simulate a simple rock-paper-scissors game by:
                     Accepting user input for rock, paper, or scissors
                     Generating the computer's choice randomly

                     Using conditions to determine the winner
                 Use Codeskulptor3-https://py3.codeskulptor.org/

                 Step-by-Step Instructions: (Plan IPO)
                 1.  Input:
                         The user enters the choice of "rock as 1," "paper as 2," or "scissors as 3"  (dynamic - varies
                         with each user).

                         Computer will also make a choice using “Random” library reference.
                 2.  Process: Use conditions to determine the winner:
                     Rock beats scissors.      Scissors beat paper.      Paper beats rock.
                     If both choices are the same, it’s a tie.
                                                                                              “Computer Wins”
                 3.  Output: Display who won or if it’s a tie. Refer to the sample
                         Code:                                              Flow:


                                                                        ENTER YOUR CHOICE: ROC

                                                                       COMPUTER MAKES A CHOICE




                                                                          DID YOU CHOICE
                                                                           ROCK, PAPER,
                                                                            SCISSORS


                                                         ROCK                PAPER              SCISSORS

                                                        DID THE             DID THE              DID THE
                                                       COMPUTER            COMPUTER             COMPUTER
                                                      CHOOSE ROCK,        CHOOSE ROCK,         CHOOSE ROCK,
                                                      PAPER, SCISSORS     PAPER, SCISSORS      PAPER, SCISSORS



                                            ROCK  PAPER SCISSORS  PAPER  SCISSORS  ROCK  SCISSORS  ROCK     PAPER
                                              IT'S A TIE!  YOU LOSE!  YOU WIN!  YOU WIN!  YOU LOSE!  YOU LOSE!  YOU WIN!

                 Bonus Feature:

                     Replay Option: Add a loop to let the user play multiple rounds.
                     Score Tracking: Implement a scoring system to keep track of wins, losses, and ties.
                     Custom Messages: Add messages for streaks or consistent wins.

                     Validation: Ensure the user enters a valid number (1, 2, or 3).


                                                                                                 Hands-On Project  115
   112   113   114   115   116   117   118   119   120   121   122