get user-play name] [move()] гате rock paper get_computer_play () pmpu Comp-num Scissors main() in user more comp_move P-wine-winctie (get_user_play() get computer play())
get user-play name] [move()] гате rock paper get_computer_play () pmpu Comp-num Scissors main() in user more comp_move P-wine-winctie (get_user_play() get computer play())
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Does my python code match the hierarchy chart?
![get_user_play)
Ob
name
rock
move()
paper
191
[get_computer_play() pmput main()| rain)
Comp-num]
main()
Scissors
user_more() comp-moved P_win] [c_win tie
veľ
get_user_play() get computer play())](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3eb03a80-7cae-4d33-b228-e2e0361c370e%2Fb0ba11e6-2b2c-43c7-8a38-3de990ae46e8%2Fpjhjuqa_processed.jpeg&w=3840&q=75)
Transcribed Image Text:get_user_play)
Ob
name
rock
move()
paper
191
[get_computer_play() pmput main()| rain)
Comp-num]
main()
Scissors
user_more() comp-moved P_win] [c_win tie
veľ
get_user_play() get computer play())
![def get_user_play(name, rock 8, paper 1, scissors - 2):
move int(input("Enter your move (8 for Rock, 1 for Paper, and 2 for Scissors: "))
if rock move:
print(name, "plays rock, Computer plays ", end-'')
elif paper move:
print(name, "plays paper, Computer plays ", end-'')
elif scissors -- move:
print(name, plays scissors, Computer plays ", end-'')
return nove
import random
def get_computer_play (rock-8, paper 1, scissors - 2):
comp_num= random.randint(0,2)
if rock comp_num:
print("rock")
return rock
elif paper comp_num:
print("paper")
return paper
elif scissors - comp_num:
print("scissors")
return scissors
def main():
name = str(input("Welcome to the game, Rock, Papers, Scissors. You will be playing against the computer. What is your name?: "))
print (f"Here are the rules {name}")
print("If a player chooses Rock and other chooses Scissors, Rock wins.")
print("If a player chooses Scissors and other chooses Paper, Scissors wins.")
print("If a player chooses Paper and other chooses Rock, Paper wins.")
print("If both players make the same choice, it's a tic")
print("Enter -1 to quit the game")
P_win-0
c_win-e
c_tic-0
while True:
main()
user_move = get_user_play(name)
#User winning
if user_move--1:
break
comp_move = get_computer_play()
if user_move -- comp_move:
print("Its a tie')
c_tie-c_tie+1
elif user_move
and comp_move-2: #if user plays rock & computer plays scissors, user wins
print(f'Rock breaks scissors. (name) wins!')
P_win-p_win+1
elif user_move 1 and comp_move 8: #if user plays paper & computer plays rock, user wins
print(f'Paper covers rock. (name) wins!')
P_win-p_win+1
elif user_move -- 2 and comp_move1: sif user plays scissors & computer plays paper, user wins
print(f'Scissors cuts paper. {name} wins!')
P_win-p_win+1
# Computer winning
elif comp_move -- and user_move 2: sif computer plays rock & user plays scissors, computer wins
print (f'Rock breaks scissors. The computer wins!')
c_win - c_win+1
elif comp_move
1 and user_move 8: sif computer plays paper & user plays rock, computer wins
rint(f'Paper covers rock. The computer wins!')
c_win - c_win + 1
2 and user_move 1: #if computer plays scissors & user plays paper, computer wins
print(f'Scissors cuts paper. The computer wins!')
c_win - c_win +1
print (f'There were (c_tie+p_win+c_win} games: (name) won (p_win} games, computer won (c_win) games, and there were (c_tie) ties.')
elif comp_move](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3eb03a80-7cae-4d33-b228-e2e0361c370e%2Fb0ba11e6-2b2c-43c7-8a38-3de990ae46e8%2Fvtevy1bn_processed.png&w=3840&q=75)
Transcribed Image Text:def get_user_play(name, rock 8, paper 1, scissors - 2):
move int(input("Enter your move (8 for Rock, 1 for Paper, and 2 for Scissors: "))
if rock move:
print(name, "plays rock, Computer plays ", end-'')
elif paper move:
print(name, "plays paper, Computer plays ", end-'')
elif scissors -- move:
print(name, plays scissors, Computer plays ", end-'')
return nove
import random
def get_computer_play (rock-8, paper 1, scissors - 2):
comp_num= random.randint(0,2)
if rock comp_num:
print("rock")
return rock
elif paper comp_num:
print("paper")
return paper
elif scissors - comp_num:
print("scissors")
return scissors
def main():
name = str(input("Welcome to the game, Rock, Papers, Scissors. You will be playing against the computer. What is your name?: "))
print (f"Here are the rules {name}")
print("If a player chooses Rock and other chooses Scissors, Rock wins.")
print("If a player chooses Scissors and other chooses Paper, Scissors wins.")
print("If a player chooses Paper and other chooses Rock, Paper wins.")
print("If both players make the same choice, it's a tic")
print("Enter -1 to quit the game")
P_win-0
c_win-e
c_tic-0
while True:
main()
user_move = get_user_play(name)
#User winning
if user_move--1:
break
comp_move = get_computer_play()
if user_move -- comp_move:
print("Its a tie')
c_tie-c_tie+1
elif user_move
and comp_move-2: #if user plays rock & computer plays scissors, user wins
print(f'Rock breaks scissors. (name) wins!')
P_win-p_win+1
elif user_move 1 and comp_move 8: #if user plays paper & computer plays rock, user wins
print(f'Paper covers rock. (name) wins!')
P_win-p_win+1
elif user_move -- 2 and comp_move1: sif user plays scissors & computer plays paper, user wins
print(f'Scissors cuts paper. {name} wins!')
P_win-p_win+1
# Computer winning
elif comp_move -- and user_move 2: sif computer plays rock & user plays scissors, computer wins
print (f'Rock breaks scissors. The computer wins!')
c_win - c_win+1
elif comp_move
1 and user_move 8: sif computer plays paper & user plays rock, computer wins
rint(f'Paper covers rock. The computer wins!')
c_win - c_win + 1
2 and user_move 1: #if computer plays scissors & user plays paper, computer wins
print(f'Scissors cuts paper. The computer wins!')
c_win - c_win +1
print (f'There were (c_tie+p_win+c_win} games: (name) won (p_win} games, computer won (c_win) games, and there were (c_tie) ties.')
elif comp_move
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY