Question: Hi! I'm struggling with this computer science problem in my homework. We use python and I don't think we are allowed loops. Help? Exercise 6.2Krabs

Hi! I'm struggling with this computer science problem in my homework. We use python and I don't think we are allowed loops. Help?

Hi! I'm struggling with this computer science problem in my homework. We

Exercise 6.2Krabs '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_krabs that takes a list of tuples (Example: [(3,6),(3,5),(2,2), (4,5)(4,1)]) representing the 2 rolls in each throw as a parameter. Your program should return 'The player won the game in trial number \{count of trials\}' for a win and 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)]) 'The player lost the game in trial number 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!