Dice Game – Accumulator Pattern and Conditionals (40 pts) IN PYTHON
Write a program dicegame.py that has the following functions in the following order: in python
Page 1 of 2
The Python 3.x Program is given below within the table. You are requested to create a python file named dicegame.py within the python ide and copy the below codes and paste into it and run the Program.
dicegame.py |
|
OUTPUT
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC
v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more
information.
>>>
========= RESTART: C:/Program Workspace/Python 3
Workspace/dicegame.py =========
Score Test #1:
r1 = 1, r2 = 3, s = 2;
The score should be 4
The actual score is = 4
Score Test #2:
r1 = 2, r2 = 3, s = 2;
The score should be 10
The actual score is = 10
Score Test #3:
r1 = 3, r2 = 2, s = 3;
The score should be 10
The actual score is = 10
Score Test #4:
r1 = 4, r2 = 4, s = 2;
The score should be 13
The actual score is = 13
Score Test #5:
r1 = 3, r2 = 3, s = 3;
The score should be (r1+r2)-(3*s) = 6-9 = -3. The actual score is =
-3
Result Test #1:
Goal = 10 Score = 20 Result = Nailed it!
Result Test #2:
Goal = 10 Score = 21 Result = Nailed it!
Result Test #3:
Goal = 10 Score = 19 Result = So so performance!
Result Test #4:
Goal = 10 Score = 15 Result = So so performance!
Result Test #5:
Goal = 10 Score = 10 Result = So so performance!
Result Test #6:
Goal = 10 Score = 9 Result = Not good… not good at all!
Result Test #7:
Goal = 10 Score = -3 Result = Not good… not good at all!
*************** G A M E B E G I N S ******************
Enter the number of sides of dice: 5
Enter the number of rounds to be played: 3
The goal to achieve is: 9.0
Round # 1
Roll 1 = 4 Roll 2 = 3
Score = 7
Round # 2
Roll 1 = 2 Roll 2 = 4
Score = 6
Round # 3
Roll 1 = 4 Roll 2 = 4
Score = 13
Total score is = 26
Nailed it!
>>>
NOTE: Please comment your doubts(if any) within the comments section and please give a thumbs up if you liked the Program.
Get Answers For Free
Most questions answered within 1 hours.