225k views
2 votes
1. Print welcome message, ask the user for their name and use it when printing the scoreboard and narrating the game.

Ask the user to pick rock, paper, scissors.

2. Ask the user how many points they want to play to ( first to score that many points wins, so if they pick 5, first to score 5 points, not "best of 5" than they lose.

3. Computer choice will be random.

4. Show both user and computer throws in a neat/creative way.

5. Check to see who has won the round and award points.

6. Print a "scoreboard" each round that shows each player score, and how many points they're playing too.

7. At the end of the game, print the final score and who won the game, and some goodbye/ thanks message.

User Tanu
by
4.5k points

1 Answer

4 votes

import random

name = input("Welcome! What's your name? ")

computer_choices = (["rock", "paper", "scissors"])

rounds = int(input("How many points do you want to play to, {}? ".format(name)))

user_total = 0

comp_total = 0

while user_total < rounds and comp_total < rounds:

user_choice = input("rock, paper, or scissors? ")

computer = random.choice(computer_choices)

if user_choice == computer:

print("It's a draw! You both threw {}".format(user_choice))

elif user_choice == "rock" and computer == "scissors":

user_total += 1

print("You threw rock and the computer threw scissors! You won!")

print("{}: {} point(s) out of {} point(s)".format(name, user_total, rounds))

print("Computer: {} point(s) out of {} point(s)".format(comp_total, rounds))

elif user_choice == "paper" and computer == "rock":

user_total += 1

print("You threw paper and the computer threw rock! You won!")

print("{}: {} point(s) out of {} point(s)".format(name, user_total, rounds))

print("Computer: {} point(s) out of {} point(s)".format(comp_total, rounds))

elif user_choice == "scissors" and computer == "paper":

user_total += 1

print("You threw scissors and the computer threw paper! You won!")

print("{}: {} point(s) out of {}".format(name, user_total, rounds))

print("Computer: {} point(s) out of {} point(s)".format(comp_total, rounds))

else:

comp_total += 1

print("You threw {} and the computer threw {}! You lost!".format(user_choice, computer))

print("{}: {} point(s) out of {}".format(name, user_total, rounds))

print("Computer: {} point(s) out of {} point(s)".format(comp_total, rounds))

print("The final scores are:")

print("{}: {} points".format(name, user_total))

print("Computer: {} points".format(comp_total))

if user_total > comp_total:

print("You won! Thanks for playing!")

else:

print("The Computer won! Thanks for playing")

I've tried to come up with something similar to what you wanted. If you have anymore question, I'll do my best to answer them.

User Shalane
by
4.6k points