Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how to solve in python Exercise 4: Exercise Krabs 'Krabs' is a dice game where two dice are rolled, and a player wins or loses
how to solve in python
Exercise 4: Exercise Krabs 'Krabs' is a dice game where two dice are rolled, and a player wins or loses based on the sum of the roll. Here are the simplified rules that your program krabs.py must implement to help users figure out the outcome of the game. Straight win - If the sum of the two dice is 7 or 11 on the first throw, the player wins and the game is over. Straight loss - If the sum results in 'krabs', i.e, 2, 3 or 12 on the first throw, the player loses and the game is over. Game continuation - If the sum is 4,5,6,8,9 or 10 on the first throw, then that sum becomes the player's 'points'. The game continues until: - the player wins by rolling the sum that equals their 'points', or - they lose if the sum of the 2 rolls in any round (excluding first throw) is 7. Create a function check k krabs that takes a list of tuples (Example: [(3,6),(3,5),(2,2),(4,5) (4,1)1) representing the 2 rolls in each throw as a parameter. Your program should return 'The player won the game in trial number fcount of trials\}' for a win and The player lost the game in trial number \{count of trials\}' for a loss. >> check_krabs ((4,3),(3,5),(5,5)]) The player won the game in trial number 1 . check_krabs([(2,6), (2,4),(1,4),(5,2)]) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started