TASK 3 (25 points) [Testing: Variables and expression, strings, conditional-statements, loops] Function task3() is a simple dice game that roles a dice ten times. The user wins if they have more than 35 points. The number of points is the sum of all the dice rolls and a bonus of 10 points if exactly two of the dice rolls are ones. Implement your dice game as follows: (1) Print a welcome message (2) Output the result of 10 dice rolls using randint(1,6)-print roll # and dice value as shown below. (3) Sum up the values of rolls 1-10. (4) If two of the rolls were the number 1, then print out "+10 Bonus for snake eyes [1][1]!". Add 10 points to the sum-[Note that more than two "ones" do not get a bonus]. (5) If the final points (including bonus) is greater than 35, the user wins; otherwise, they lose. Print out the appropriate message as shown below. (6) Ask the user to input 'Y' to play again. (7) If the user inputs either 'Y' or 'y', return to (1) and play the game again. Otherwise, the function is done. Example of task running (user input in red). --Task 3-- Dice Game Rolling Die 10 times Roll 1: [6] Roll 2: [2] Roll 3: [6] Roll 4: [6] Roll 5: [5] Roll 6: [1] Roll 7: [1] Roll 8: [1] Roll 9: [3] Roll 10: [6] Print the dice values as shown. Print roll # (starting from 1) and the dice value in []. More than two [1] does not result in the "snake eye" bonus of 10 points. After showing the two rolls results, sum up the value of all the dice. If it is more than 35 the user wins Total 37 OVER 35 POINTS [YOU WIN!]. -- Enter 'Y' to play again: y + Dice Game Ask the user to enter 'Y' to play again. if 'Y' or 'y' is entered, continue to play. Rolling Die 10 times Roll 1: [6] Roll 2: [1] Roll 3: [4] Roll 4: [5] Roll 5: [2] Roll 6: [1] Roll 7: [4] Roll 8: [3] Roll 9: [1] Roll 10: [2] Total 29 Here the sum for the second game is 35 or TOO FEW POINTS [YOU LOSE!]« less. The user loses. -- Enter 'Y' to play again: y
TASK 3 (25 points) [Testing: Variables and expression, strings, conditional-statements, loops] Function task3() is a simple dice game that roles a dice ten times. The user wins if they have more than 35 points. The number of points is the sum of all the dice rolls and a bonus of 10 points if exactly two of the dice rolls are ones. Implement your dice game as follows: (1) Print a welcome message (2) Output the result of 10 dice rolls using randint(1,6)-print roll # and dice value as shown below. (3) Sum up the values of rolls 1-10. (4) If two of the rolls were the number 1, then print out "+10 Bonus for snake eyes [1][1]!". Add 10 points to the sum-[Note that more than two "ones" do not get a bonus]. (5) If the final points (including bonus) is greater than 35, the user wins; otherwise, they lose. Print out the appropriate message as shown below. (6) Ask the user to input 'Y' to play again. (7) If the user inputs either 'Y' or 'y', return to (1) and play the game again. Otherwise, the function is done. Example of task running (user input in red). --Task 3-- Dice Game Rolling Die 10 times Roll 1: [6] Roll 2: [2] Roll 3: [6] Roll 4: [6] Roll 5: [5] Roll 6: [1] Roll 7: [1] Roll 8: [1] Roll 9: [3] Roll 10: [6] Print the dice values as shown. Print roll # (starting from 1) and the dice value in []. More than two [1] does not result in the "snake eye" bonus of 10 points. After showing the two rolls results, sum up the value of all the dice. If it is more than 35 the user wins Total 37 OVER 35 POINTS [YOU WIN!]. -- Enter 'Y' to play again: y + Dice Game Ask the user to enter 'Y' to play again. if 'Y' or 'y' is entered, continue to play. Rolling Die 10 times Roll 1: [6] Roll 2: [1] Roll 3: [4] Roll 4: [5] Roll 5: [2] Roll 6: [1] Roll 7: [4] Roll 8: [3] Roll 9: [1] Roll 10: [2] Total 29 Here the sum for the second game is 35 or TOO FEW POINTS [YOU LOSE!]« less. The user loses. -- Enter 'Y' to play again: y
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
This code must be in python
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education