SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
Write a program that lets the user play the game of Rock, Paper, Scissors against the computer.
Requirements: (save the program as game.py and the log as ola104.log) - The program should
work as follows. 1. When the program begins, a random number in the range of 1 through 3 is
generated. If the number is 1 , then the computer has chosen rock. If the number is 2 , then the
computer has chosen paper. If the number is 3 , then the computer has chosen scissors. (Don't
display the computer's choice yet.) 2. The user enters his or her choice of "rock", "paper", or
"scissors" at the keyboard. 3. The computer's choice is displayed. 4. Winer declared - Allow the
user to play multiple games. - Implement the following user-defined functions (required) as
described below. main0 # Main logic: top-level algorithm implements a flag controlled loop
calls intro0, get_comp_choice 0 , get_user_choice 0 , display_choices 0 , and keep_going0
functions intro0 # displays the description of game get_comp_choice0 # calls randint( function,
returns an int (computer choice) get_user_choice0 # gets user choice, implements an input
validation loop, calls choice_to_num0, and returns an int (user choice) choice_to_num(choice) #
accepts a string ("rock", "paper", or "scissors") and returns an int (1,2, or 3)
num_to_choice(num) # accepts an int (1,2, or 3) and returns a string ("rock", "paper", or
"scissors") display_choices(comp_choice, user_choice)# accepts two ints (1,2, or 3), calls
num_to_choice0 and display choices keep_going0 #gets users response and returns True if user
wants to play more

Mais conteúdo relacionado

Semelhante a Write a program that lets the user play the game of Rock, Paper, Scis.pdf

#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx
adkinspaige22
 
Random 120507151041-phpapp02
Random 120507151041-phpapp02Random 120507151041-phpapp02
Random 120507151041-phpapp02
Yazeed Khalid
 
How to Download & Install Print Drivers MAC
How to Download & Install Print Drivers MACHow to Download & Install Print Drivers MAC
How to Download & Install Print Drivers MAC
Melissa Heck
 

Semelhante a Write a program that lets the user play the game of Rock, Paper, Scis.pdf (14)

Game Programming I - Introduction
Game Programming I - IntroductionGame Programming I - Introduction
Game Programming I - Introduction
 
01 the basics getting started with computers-esol
01 the basics getting started with computers-esol01 the basics getting started with computers-esol
01 the basics getting started with computers-esol
 
#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx
 
Random 120507151041-phpapp02
Random 120507151041-phpapp02Random 120507151041-phpapp02
Random 120507151041-phpapp02
 
It tools and buisness system.docx
It tools and buisness system.docxIt tools and buisness system.docx
It tools and buisness system.docx
 
Week3.pptx
Week3.pptxWeek3.pptx
Week3.pptx
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
How to Download & Install Print Drivers MAC
How to Download & Install Print Drivers MACHow to Download & Install Print Drivers MAC
How to Download & Install Print Drivers MAC
 
IRJET- IoT based Gesture Control Gaming
IRJET- IoT based Gesture Control GamingIRJET- IoT based Gesture Control Gaming
IRJET- IoT based Gesture Control Gaming
 
Game engine
Game engineGame engine
Game engine
 
Basic computer skills of BSc IT
Basic computer skills of BSc ITBasic computer skills of BSc IT
Basic computer skills of BSc IT
 
Basic of computer (1)
Basic of computer (1)Basic of computer (1)
Basic of computer (1)
 
プレゼンテーション2
プレゼンテーション2プレゼンテーション2
プレゼンテーション2
 
Bow&arrow game
Bow&arrow gameBow&arrow game
Bow&arrow game
 

Mais de amanstudio07860

Mais de amanstudio07860 (20)

X-Gal is included in the growth medium on which cells transformed wit.pdf
 X-Gal is included in the growth medium on which cells transformed wit.pdf X-Gal is included in the growth medium on which cells transformed wit.pdf
X-Gal is included in the growth medium on which cells transformed wit.pdf
 
Write the SQL command to insert a row of data into the table ORDERS i.pdf
 Write the SQL command to insert a row of data into the table ORDERS i.pdf Write the SQL command to insert a row of data into the table ORDERS i.pdf
Write the SQL command to insert a row of data into the table ORDERS i.pdf
 
Written Assignment 6 , respond to the following question. As the text.pdf
 Written Assignment 6 , respond to the following question. As the text.pdf Written Assignment 6 , respond to the following question. As the text.pdf
Written Assignment 6 , respond to the following question. As the text.pdf
 
Write two paths to reach the following directoriesIs the following.pdf
 Write two paths to reach the following directoriesIs the following.pdf Write two paths to reach the following directoriesIs the following.pdf
Write two paths to reach the following directoriesIs the following.pdf
 
Write the class named Student which has the following data members - .pdf
 Write the class named Student which has the following data members - .pdf Write the class named Student which has the following data members - .pdf
Write the class named Student which has the following data members - .pdf
 
write minimum 250 words essay Topic Be a real state agent required a.pdf
 write minimum 250 words essay Topic Be a real state agent required a.pdf write minimum 250 words essay Topic Be a real state agent required a.pdf
write minimum 250 words essay Topic Be a real state agent required a.pdf
 
Write Java variable declarations to create one int variable called nu.pdf
 Write Java variable declarations to create one int variable called nu.pdf Write Java variable declarations to create one int variable called nu.pdf
Write Java variable declarations to create one int variable called nu.pdf
 
Write coding using c language develop a prototype application for dat.pdf
 Write coding using c language develop a prototype application for dat.pdf Write coding using c language develop a prototype application for dat.pdf
Write coding using c language develop a prototype application for dat.pdf
 
Write an application that ask the user to enter 2 integers, obtains.pdf
 Write an application that ask the user to enter 2 integers, obtains.pdf Write an application that ask the user to enter 2 integers, obtains.pdf
Write an application that ask the user to enter 2 integers, obtains.pdf
 
Write a single C statement that corresponds to the two MIPS assembly .pdf
 Write a single C statement that corresponds to the two MIPS assembly .pdf Write a single C statement that corresponds to the two MIPS assembly .pdf
Write a single C statement that corresponds to the two MIPS assembly .pdf
 
Write a recursive function elemAt that returns the ith item of the li.pdf
 Write a recursive function elemAt that returns the ith item of the li.pdf Write a recursive function elemAt that returns the ith item of the li.pdf
Write a recursive function elemAt that returns the ith item of the li.pdf
 
Write a recursive function flip that takes a list of pairs, and retu.pdf
 Write a recursive function flip that takes a list of pairs, and retu.pdf Write a recursive function flip that takes a list of pairs, and retu.pdf
Write a recursive function flip that takes a list of pairs, and retu.pdf
 
Write a Python module called inches2centimeters that will accept one .pdf
 Write a Python module called inches2centimeters that will accept one .pdf Write a Python module called inches2centimeters that will accept one .pdf
Write a Python module called inches2centimeters that will accept one .pdf
 
Write a Python program that can perform the following operations on a.pdf
 Write a Python program that can perform the following operations on a.pdf Write a Python program that can perform the following operations on a.pdf
Write a Python program that can perform the following operations on a.pdf
 
Write a program that stores integers in a linked list. Please refer t.pdf
 Write a program that stores integers in a linked list. Please refer t.pdf Write a program that stores integers in a linked list. Please refer t.pdf
Write a program that stores integers in a linked list. Please refer t.pdf
 
Write a program that creates 2 Lists. The first is the list of names .pdf
 Write a program that creates 2 Lists. The first is the list of names .pdf Write a program that creates 2 Lists. The first is the list of names .pdf
Write a program that creates 2 Lists. The first is the list of names .pdf
 
Write a program that implements a function. The function should creat.pdf
 Write a program that implements a function. The function should creat.pdf Write a program that implements a function. The function should creat.pdf
Write a program that implements a function. The function should creat.pdf
 
Write a program named ArrayDemo that stores an array of 10 integers. .pdf
 Write a program named ArrayDemo that stores an array of 10 integers. .pdf Write a program named ArrayDemo that stores an array of 10 integers. .pdf
Write a program named ArrayDemo that stores an array of 10 integers. .pdf
 
Write a Java program to represent a family tree. A sample family tree.pdf
 Write a Java program to represent a family tree. A sample family tree.pdf Write a Java program to represent a family tree. A sample family tree.pdf
Write a Java program to represent a family tree. A sample family tree.pdf
 
Worksheet No. 3 - Upper left side of the worksheet, prepare the State.pdf
 Worksheet No. 3 - Upper left side of the worksheet, prepare the State.pdf Worksheet No. 3 - Upper left side of the worksheet, prepare the State.pdf
Worksheet No. 3 - Upper left side of the worksheet, prepare the State.pdf
 

Último

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Último (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 

Write a program that lets the user play the game of Rock, Paper, Scis.pdf

  • 1. Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. Requirements: (save the program as game.py and the log as ola104.log) - The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1 , then the computer has chosen rock. If the number is 2 , then the computer has chosen paper. If the number is 3 , then the computer has chosen scissors. (Don't display the computer's choice yet.) 2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. 3. The computer's choice is displayed. 4. Winer declared - Allow the user to play multiple games. - Implement the following user-defined functions (required) as described below. main0 # Main logic: top-level algorithm implements a flag controlled loop calls intro0, get_comp_choice 0 , get_user_choice 0 , display_choices 0 , and keep_going0 functions intro0 # displays the description of game get_comp_choice0 # calls randint( function, returns an int (computer choice) get_user_choice0 # gets user choice, implements an input validation loop, calls choice_to_num0, and returns an int (user choice) choice_to_num(choice) # accepts a string ("rock", "paper", or "scissors") and returns an int (1,2, or 3) num_to_choice(num) # accepts an int (1,2, or 3) and returns a string ("rock", "paper", or "scissors") display_choices(comp_choice, user_choice)# accepts two ints (1,2, or 3), calls num_to_choice0 and display choices keep_going0 #gets users response and returns True if user wants to play more