working with loops and if statements working with random numbers Pro.docx

A

working with loops and if statements working with random numbers Pro

working with loops and if statements working with random
numbers Program behaviour This is a game that pits the user
against the computer. The program plays 10 rounds. During one
round, the computer displays a random number between 1 and
100, either as a base-10 value or a base-2 value (chosen
randomly). The user must enter the same value in the other
base. In other words if the computer displays a number in base-
10, the user enters base-2; if the computer displays a base-2
number, the user enters base-10. If the user input is correct, she
earns 1 point. Once the 10 rounds are completed, if the user
scored 5 or higher, she wins. If you need an explanation on
binary numbers and converting between binary and decimal, go
here. Program specifications The program should begin with a
brief user introduction of the game. The program should
display the current round number before a round starts. After
each round, the program should display how many rounds the
user has gotten right or wrong. I'm not going to specify what
functions you should including in your solution. The only
requirement is that you do design a program that uses functions.
Part of your score is how well your program uses functional
decomposition. When the user needs to enter a binary number,
they only need to enter the sequence of 0s and 1s. For example,
if the user wanted to enter the number 5 in binary, they would
enter 101 You will need to use the function radiant() from the
random module to generate a random number. You can find the
documentation for the radiant () function here. As always I
would suggest working on this program in pieces. There is a
method in the Python library to convert from decimal to binary
that you may use, named bin(). Be aware that the return string
from this function has the prefix '0b' on it. The program
should not display this prefix. Also, the program should not
expect user input to have this prefix. Documentation and Other
Style Issues You should follow all of the commenting
guidelines covered in the commenting guidelines. Use
descriptive variable and function names. Remember to include
block comments at the beginning of each function. This program
has probably the most complex algorithm to date. Make sure to
include algorithm comments in your solution. This doesn't
mean you have to comment every line, but you might comment a
block of code, like a control structure. Use a global constant in
this game (the winning score) This way, it is easy to modify the
program to change that value. Extra Credit If you choose to
implement your own function to convert from decimal to binary,
instead of using a Python library function, you will earn extra
credit. Written Report Please type up the answers to the
following questions and include as a comment at the bottom of
your .py file: 1. How did you go about starting this assignment?
2. During development, where did you get stuck, if at all, and
how did you get unstuck? 3. How did you test your program?
Does your program meet the homework specification? If not, in
what ways does it fall short? 4. What did you learn from this
assignment? What would you do differently next time?
Solution
python

Recomendados

Devry cis 170 c i lab 5 of 7 arrays and strings por
Devry cis 170 c i lab 5 of 7 arrays and stringsDevry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and stringsash52393
8 vistas6 diapositivas
Devry cis 170 c i lab 5 of 7 arrays and strings por
Devry cis 170 c i lab 5 of 7 arrays and stringsDevry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and stringsshyaminfo04
6 vistas6 diapositivas
Project two c++ tutorial por
Project two c++ tutorialProject two c++ tutorial
Project two c++ tutorialBabatunde Salaam
690 vistas13 diapositivas
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docx por
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docxBTE 320-498 Summer 2017 Take Home Exam (200 poi.docx
BTE 320-498 Summer 2017 Take Home Exam (200 poi.docxAASTHA76
2 vistas22 diapositivas
Functions in c++ por
Functions in c++Functions in c++
Functions in c++Asaye Dilbo
351 vistas15 diapositivas
Bottom of FormCreate your own FunctionFunctionsFor eac.docx por
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
8 vistas19 diapositivas

Más contenido relacionado

Similar a working with loops and if statements working with random numbers Pro.docx

i have 10 python programming questions half of the questions.docx por
i have 10 python programming questions half of the questions.docxi have 10 python programming questions half of the questions.docx
i have 10 python programming questions half of the questions.docxscottharry3
3 vistas2 diapositivas
Cis 1403 lab1- the process of programming por
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingHamad Odhabi
112 vistas20 diapositivas
COMP 122 Entire Course NEW por
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEWshyamuopeight
11 vistas33 diapositivas
Python in details por
Python in detailsPython in details
Python in detailsKhalid AL-Dhanhani
403 vistas79 diapositivas
Presentation 2 (1).pdf por
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdfziyadaslanbey
10 vistas16 diapositivas
03b loops por
03b   loops03b   loops
03b loopsManzoor ALam
1.5K vistas63 diapositivas

Similar a working with loops and if statements working with random numbers Pro.docx(20)

i have 10 python programming questions half of the questions.docx por scottharry3
i have 10 python programming questions half of the questions.docxi have 10 python programming questions half of the questions.docx
i have 10 python programming questions half of the questions.docx
scottharry33 vistas
Cis 1403 lab1- the process of programming por Hamad Odhabi
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programming
Hamad Odhabi112 vistas
COMP 122 Entire Course NEW por shyamuopeight
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
shyamuopeight11 vistas
For this assignment- you will write a C++ program that asks the user t.docx por EvanY5VMacLeodq
For this assignment- you will write a C++ program that asks the user t.docxFor this assignment- you will write a C++ program that asks the user t.docx
For this assignment- you will write a C++ program that asks the user t.docx
EvanY5VMacLeodq3 vistas
Devry cis-170-c-i lab-5-of-7-arrays-and-strings por noahjamessss
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
noahjamessss14 vistas
Devry cis-170-c-i lab-5-of-7-arrays-and-strings por cskvsmi44
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
cskvsmi4417 vistas
Devry cis 170 c i lab 5 of 7 arrays and strings por jody zoll
Devry cis 170 c i lab 5 of 7 arrays and stringsDevry cis 170 c i lab 5 of 7 arrays and strings
Devry cis 170 c i lab 5 of 7 arrays and strings
jody zoll46 vistas
PT1420 Modules in Flowchart and Visual Basic .docx por amrit47
PT1420 Modules in Flowchart and Visual Basic             .docxPT1420 Modules in Flowchart and Visual Basic             .docx
PT1420 Modules in Flowchart and Visual Basic .docx
amrit472 vistas
Cis 170 c ilab 5 of 7 arrays and strings por CIS321
Cis 170 c ilab 5 of 7 arrays and stringsCis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and strings
CIS321419 vistas
Errors occur in programs, and there are two ways to address the pr.docx por YASHU40
Errors occur in programs, and there are two ways to address the pr.docxErrors occur in programs, and there are two ways to address the pr.docx
Errors occur in programs, and there are two ways to address the pr.docx
YASHU402 vistas
Student Lab Activity CIS170C Week 6 Lab InstructionsLa.docx por florriezhamphrey3065
Student Lab Activity CIS170C Week 6 Lab InstructionsLa.docxStudent Lab Activity CIS170C Week 6 Lab InstructionsLa.docx
Student Lab Activity CIS170C Week 6 Lab InstructionsLa.docx
FAST - Department of Computing MODULE CSYM028 por ChereCheek752
FAST - Department of Computing   MODULE  CSYM028       FAST - Department of Computing   MODULE  CSYM028
FAST - Department of Computing MODULE CSYM028
ChereCheek7522 vistas
Write a program that will convert Decimal (Base 10) number to Its cor.docx por ajoy21
 Write a program that will convert Decimal (Base 10) number to Its cor.docx Write a program that will convert Decimal (Base 10) number to Its cor.docx
Write a program that will convert Decimal (Base 10) number to Its cor.docx
ajoy213 vistas
Eng 1101 Unit 3 Programming Assignment por Gloria Moore
Eng 1101 Unit 3 Programming AssignmentEng 1101 Unit 3 Programming Assignment
Eng 1101 Unit 3 Programming Assignment
Gloria Moore2 vistas

Más de ajoy21

Please complete table with answers; BUT ALSO, show step by step all .docx por
Please complete table with answers; BUT ALSO, show step by step all .docxPlease complete table with answers; BUT ALSO, show step by step all .docx
Please complete table with answers; BUT ALSO, show step by step all .docxajoy21
14 vistas1 diapositiva
Please check the syllabus for the following essays(I am done with th.docx por
Please check the syllabus for the following essays(I am done with th.docxPlease check the syllabus for the following essays(I am done with th.docx
Please check the syllabus for the following essays(I am done with th.docxajoy21
9 vistas1 diapositiva
Please choose from the following companies for Assignment 21. H.docx por
Please choose from the following companies for Assignment 21. H.docxPlease choose from the following companies for Assignment 21. H.docx
Please choose from the following companies for Assignment 21. H.docxajoy21
3 vistas2 diapositivas
Please complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docx por
Please complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docxPlease complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docx
Please complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docxajoy21
3 vistas1 diapositiva
PLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docx por
PLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docxPLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docx
PLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docxajoy21
3 vistas2 diapositivas
Please complete ModuleWeek 4 assignment Research Paper Abstract .docx por
Please complete ModuleWeek 4 assignment Research Paper Abstract .docxPlease complete ModuleWeek 4 assignment Research Paper Abstract .docx
Please complete ModuleWeek 4 assignment Research Paper Abstract .docxajoy21
3 vistas1 diapositiva

Más de ajoy21(20)

Please complete table with answers; BUT ALSO, show step by step all .docx por ajoy21
Please complete table with answers; BUT ALSO, show step by step all .docxPlease complete table with answers; BUT ALSO, show step by step all .docx
Please complete table with answers; BUT ALSO, show step by step all .docx
ajoy2114 vistas
Please check the syllabus for the following essays(I am done with th.docx por ajoy21
Please check the syllabus for the following essays(I am done with th.docxPlease check the syllabus for the following essays(I am done with th.docx
Please check the syllabus for the following essays(I am done with th.docx
ajoy219 vistas
Please choose from the following companies for Assignment 21. H.docx por ajoy21
Please choose from the following companies for Assignment 21. H.docxPlease choose from the following companies for Assignment 21. H.docx
Please choose from the following companies for Assignment 21. H.docx
ajoy213 vistas
Please complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docx por ajoy21
Please complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docxPlease complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docx
Please complete ModuleWeek 4 Discussion Board Forum 3 with a repl.docx
ajoy213 vistas
PLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docx por ajoy21
PLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docxPLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docx
PLEASE AVOID CHANGING PRICE AFTER THE AGREEMENT IS SIGNED, THANK YOU.docx
ajoy213 vistas
Please complete ModuleWeek 4 assignment Research Paper Abstract .docx por ajoy21
Please complete ModuleWeek 4 assignment Research Paper Abstract .docxPlease complete ModuleWeek 4 assignment Research Paper Abstract .docx
Please complete ModuleWeek 4 assignment Research Paper Abstract .docx
ajoy213 vistas
Please complete outline to be used as guide for my assignment. For.docx por ajoy21
Please complete outline to be used as guide for my assignment. For.docxPlease complete outline to be used as guide for my assignment. For.docx
Please complete outline to be used as guide for my assignment. For.docx
ajoy213 vistas
Please complete the assignment listed below.Define and explain, us.docx por ajoy21
Please complete the assignment listed below.Define and explain, us.docxPlease complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docx
ajoy214 vistas
PLEASE COMPLETE ALL WORK IN DETAILDo work on a paper topic tha.docx por ajoy21
PLEASE COMPLETE ALL WORK IN DETAILDo work on a paper topic tha.docxPLEASE COMPLETE ALL WORK IN DETAILDo work on a paper topic tha.docx
PLEASE COMPLETE ALL WORK IN DETAILDo work on a paper topic tha.docx
ajoy212 vistas
Please complete in professional detail with professional responses f.docx por ajoy21
Please complete in professional detail with professional responses f.docxPlease complete in professional detail with professional responses f.docx
Please complete in professional detail with professional responses f.docx
ajoy212 vistas
PLEASE COMPLETE IN DETAIL AND PROVIDE SPECIFICS FOR AN INDIVIDUAL WH.docx por ajoy21
PLEASE COMPLETE IN DETAIL AND PROVIDE SPECIFICS FOR AN INDIVIDUAL WH.docxPLEASE COMPLETE IN DETAIL AND PROVIDE SPECIFICS FOR AN INDIVIDUAL WH.docx
PLEASE COMPLETE IN DETAIL AND PROVIDE SPECIFICS FOR AN INDIVIDUAL WH.docx
ajoy213 vistas
Please complete the below assignments, attached are pages from the t.docx por ajoy21
Please complete the below assignments, attached are pages from the t.docxPlease complete the below assignments, attached are pages from the t.docx
Please complete the below assignments, attached are pages from the t.docx
ajoy214 vistas
Please complete as two separate essay questions, in APA format.  No .docx por ajoy21
Please complete as two separate essay questions, in APA format.  No .docxPlease complete as two separate essay questions, in APA format.  No .docx
Please complete as two separate essay questions, in APA format.  No .docx
ajoy215 vistas
Please carefully check the due timeyou have 10+hours to finish thi.docx por ajoy21
Please carefully check the due timeyou have 10+hours to finish thi.docxPlease carefully check the due timeyou have 10+hours to finish thi.docx
Please carefully check the due timeyou have 10+hours to finish thi.docx
ajoy213 vistas
please check the folloing due today and in 935 Call a local met.docx por ajoy21
please check the folloing due today and in 935 Call a local met.docxplease check the folloing due today and in 935 Call a local met.docx
please check the folloing due today and in 935 Call a local met.docx
ajoy213 vistas
Please check the attachment for my paper.Please add citations to a.docx por ajoy21
Please check the attachment for my paper.Please add citations to a.docxPlease check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docx
ajoy212 vistas
Please carefully review the information in Chapter 2 relative to wha.docx por ajoy21
Please carefully review the information in Chapter 2 relative to wha.docxPlease carefully review the information in Chapter 2 relative to wha.docx
Please carefully review the information in Chapter 2 relative to wha.docx
ajoy214 vistas
Please choose one of the following questions and write a paper of up.docx por ajoy21
Please choose one of the following questions and write a paper of up.docxPlease choose one of the following questions and write a paper of up.docx
Please choose one of the following questions and write a paper of up.docx
ajoy214 vistas
Please build a cultural metaphor for a country besides the United St.docx por ajoy21
Please build a cultural metaphor for a country besides the United St.docxPlease build a cultural metaphor for a country besides the United St.docx
Please build a cultural metaphor for a country besides the United St.docx
ajoy214 vistas
Please be sure you can deliver a quality response, mantain  honework.docx por ajoy21
Please be sure you can deliver a quality response, mantain  honework.docxPlease be sure you can deliver a quality response, mantain  honework.docx
Please be sure you can deliver a quality response, mantain  honework.docx
ajoy213 vistas

Último

2022 CAPE Merit List 2023 por
2022 CAPE Merit List 2023 2022 CAPE Merit List 2023
2022 CAPE Merit List 2023 Caribbean Examinations Council
4.6K vistas76 diapositivas
Ch. 7 Political Participation and Elections.pptx por
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptxRommel Regala
90 vistas11 diapositivas
Class 10 English lesson plans por
Class 10 English  lesson plansClass 10 English  lesson plans
Class 10 English lesson plansTARIQ KHAN
280 vistas53 diapositivas
Women from Hackney’s History: Stoke Newington by Sue Doe por
Women from Hackney’s History: Stoke Newington by Sue DoeWomen from Hackney’s History: Stoke Newington by Sue Doe
Women from Hackney’s History: Stoke Newington by Sue DoeHistory of Stoke Newington
148 vistas21 diapositivas
231112 (WR) v1 ChatGPT OEB 2023.pdf por
231112 (WR) v1  ChatGPT OEB 2023.pdf231112 (WR) v1  ChatGPT OEB 2023.pdf
231112 (WR) v1 ChatGPT OEB 2023.pdfWilfredRubens.com
151 vistas21 diapositivas
CWP_23995_2013_17_11_2023_FINAL_ORDER.pdf por
CWP_23995_2013_17_11_2023_FINAL_ORDER.pdfCWP_23995_2013_17_11_2023_FINAL_ORDER.pdf
CWP_23995_2013_17_11_2023_FINAL_ORDER.pdfSukhwinderSingh895865
518 vistas6 diapositivas

Último(20)

Ch. 7 Political Participation and Elections.pptx por Rommel Regala
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptx
Rommel Regala90 vistas
Class 10 English lesson plans por TARIQ KHAN
Class 10 English  lesson plansClass 10 English  lesson plans
Class 10 English lesson plans
TARIQ KHAN280 vistas
Use of Probiotics in Aquaculture.pptx por AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL95 vistas
The basics - information, data, technology and systems.pdf por JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1106 vistas
AUDIENCE - BANDURA.pptx por iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood77 vistas
Classification of crude drugs.pptx por GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra1483 vistas
Education and Diversity.pptx por DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar135 vistas
Create a Structure in VBNet.pptx por Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P72 vistas
Psychology KS4 por WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch76 vistas
Structure and Functions of Cell.pdf por Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan455 vistas
Sociology KS5 por WestHatch
Sociology KS5Sociology KS5
Sociology KS5
WestHatch65 vistas
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant... por Ms. Pooja Bhandare
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Ms. Pooja Bhandare73 vistas

working with loops and if statements working with random numbers Pro.docx

  • 1. working with loops and if statements working with random numbers Program behaviour This is a game that pits the user against the computer. The program plays 10 rounds. During one round, the computer displays a random number between 1 and 100, either as a base-10 value or a base-2 value (chosen randomly). The user must enter the same value in the other base. In other words if the computer displays a number in base- 10, the user enters base-2; if the computer displays a base-2 number, the user enters base-10. If the user input is correct, she earns 1 point. Once the 10 rounds are completed, if the user scored 5 or higher, she wins. If you need an explanation on binary numbers and converting between binary and decimal, go here. Program specifications The program should begin with a brief user introduction of the game. The program should display the current round number before a round starts. After each round, the program should display how many rounds the user has gotten right or wrong. I'm not going to specify what functions you should including in your solution. The only requirement is that you do design a program that uses functions. Part of your score is how well your program uses functional decomposition. When the user needs to enter a binary number, they only need to enter the sequence of 0s and 1s. For example, if the user wanted to enter the number 5 in binary, they would enter 101 You will need to use the function radiant() from the random module to generate a random number. You can find the documentation for the radiant () function here. As always I would suggest working on this program in pieces. There is a method in the Python library to convert from decimal to binary that you may use, named bin(). Be aware that the return string from this function has the prefix '0b' on it. The program should not display this prefix. Also, the program should not expect user input to have this prefix. Documentation and Other Style Issues You should follow all of the commenting guidelines covered in the commenting guidelines. Use descriptive variable and function names. Remember to include block comments at the beginning of each function. This program
  • 2. has probably the most complex algorithm to date. Make sure to include algorithm comments in your solution. This doesn't mean you have to comment every line, but you might comment a block of code, like a control structure. Use a global constant in this game (the winning score) This way, it is easy to modify the program to change that value. Extra Credit If you choose to implement your own function to convert from decimal to binary, instead of using a Python library function, you will earn extra credit. Written Report Please type up the answers to the following questions and include as a comment at the bottom of your .py file: 1. How did you go about starting this assignment? 2. During development, where did you get stuck, if at all, and how did you get unstuck? 3. How did you test your program? Does your program meet the homework specification? If not, in what ways does it fall short? 4. What did you learn from this assignment? What would you do differently next time? Solution python