Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am learning Python(3.6) and this is one of our lab questions.Please give explanation inside lines so that I will be able to understant each

image text in transcribed

I am learning Python(3.6) and this is one of our lab questions.Please give explanation inside lines so that I will be able to understant each step clearly.Thanks in advance

3. In this question, write a docstring for your function. a) Write a function named throwuntil(x) that takes integer x (2 s x S 12) as parameter, and throws a pair of dice randomly until their sum is equal to x, displays the values of dice with the given sum, and returns the number of rolls it takes to roll the given sum. Your function may assume that x is an int and 2 sxs 12. b) Write a program that inputs a sum between 2 and 12 from the user, and determines the value of two dice adding to the sum, and the number of times it takes to roll the dice. Your program should validate that the input sum is between 2 and 12 and prompt for another input until it is in the correct range. Sample run 1: Enter sum of dice: 1 Sum must be between 2 and 12 inclusive Enter sum of dice: 13 Sum must be between 2 and 12 inclusive Enter sum of dice: 12 Diel 6 Die2 6 Dice are rolled 5 times to get the sum 12 Sample run 2: Enter sum of dice: 2 Diel 1 Die2 1 Dice are rolled 64 times to get the sum 2 e9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

=+ How would you advise those problems be resolved?

Answered: 1 week ago