Question: Please code in Python! Please code in Python! Please code in Python! Please code in Python! Please code in Python! Please code in Python! Project

Please code in Python!

Please code in Python!

Please code in Python!

Please code in Python! Please code in Python!

Please code in Python! Please code in Python!

Please code in Python! Please code in Python!

Please code in Python! Please code in Python!

Please code in Python!

Please code in Python!

Please code in Python!

Project - Odds or Evens (12 point project) For this project you are going to program a game called "Odds and Evens. The game is similar to rock paper scissors. It is played between two players, in your version it will be you versus the computer. Each player will choose either "odds or evens, since you're playing the computer you will get first pick. Once you have chosen your side, you each choose a number of fingers to play-0 to 5. The winner is determined by whether the sum of your fingers is odd or even (depending on what you chose). Here's a clip of the game being played: Part 1 - Pick odds or evens 1. Create a new Python file called "OddsAndEvens.py". 2. Add a main method. 3. Add a print function that produces the following text on the console. Let's play a game called "Odds and Evens" 4. Ask the user for their name and then upon entering their name store it in a variable to be used in interacting with the user. What is your name? 5. Now greet the user and ask them to choose either odds or evens. Let the user type in either "0" or "E". Hi name, which do you choose? (0)dds or (E) vens? 6. Using an if/else statement print out whether the user chose "odds" or "evens. name has picked odds! The computer will be evens. Or name has picked evens! The computer will be odds. 7. Finally add a print that produces a series of "-" characters to separate this stage from the others in your output. Here is an example of the output your stage one should produce: -- GRASP exec: java OddsAndEvens Let's play a game called "Odds and Evens" What is your name? George Hi George, Which do you choose? (0) dds or (E)venso George has picked odds! The computer will be evens. Part 2 - Play the Game Now you are going to be adding the actual game play to your game. 1. Ask the user how many "fingers" they are going to play, and let them enter in a number How many "fingers" do you put out? 2. Add the following code to your program to let the computer choose a random number to represent their fingers: import random number = random.randint(0, 5); 3. Add a print that tells the user how many fingers the computer played. The computer plays number "eingers". 4. Add another line of "-" characters to separate this part of your output from the results. 5. Now you need to determine what the results are. Add the user's number and the computer's numbers together to get the sum. Add a print that will print out the math to show the user Sum - user Number + computerNumber Now you need to figure out if the sum is odd or even. You can use the % or "mod" operator to do so. The mod operator returns the reminder, any number % 2 with a remainder of 0 (meaning it is perfectly divisible by 2) is even, any number % 2 with a remainder of 1 is odd. Here is the code you can use sum : 2 oddOrEven will be true if sum us even, it will be false if sum is odd. Now use an if/else statement to print out whether sum was odd or even. 6. Add another line of -" characters to end your program. Here is an example of the output your stage two should produce oddorEven -- 1 GRASP exec: java OddsAndEvens Let's play a game called Odds and Evens" What is your name? Jerry Hi Jerry, which do you choose? () dds or (E) vens? E Jerry has picked evens! The computer will be odds. How many "fingers" do you put out? 2 The computer plays 3 "fingers". 2 + 3 - 5 5 is ... odd! Part 3 - Who won? Now that we know the results, it's time to decide who the winner is! Inside your if/else statement that prints out odd or even you are going to add another set of if/else statements to tell who the winner is based on what the player chose back in stage 1. Here is some "pseudo code" (notation resembling simplified code, not real code) that you can use to write the real code. if (the sum was even) print out even 1f (the user chose evens) the user wins else the computer wins else // inverse of above it statement Here is an example of what the output of your stage three should produce ----GRASP exec: java OddsAndEvens Let's play a game called "Odds and Evens" What is your name? Elaine Hi Elaine, which do you choose? (O) dds or (E) vena? Elaine has picked odds! The computer will be evens. How many "fingers" do you put out? The computer plays o "fingers". 1 + 0 = 1 1 13 ... odd! That means Elaine wins! :)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!