Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a function possible_rolls. The function has two parameters: The parameter n_sides represents the number of sides on the dice (from 1 - n_sides) and

Define a function possible_rolls. The function has two parameters: The parameter n_sides represents the number of sides on the dice (from 1 - n_sides) and should have a default value of 6. The parameter n_dice represents the number of dice thrown together and should have a default value of 2 The function should return a Python list. Nested inside this list should be a list with every possible combination of rolls. The returned list should be sorted (see the below examples). possible_rolls(2, 2) # returns # [[1, 1], [1, 2], [2, 1], [2, 2]] possible_rolls(6, 1) # returns # [[1], [2], [3], [4], [5], [6]] possible_rolls(3, 2) # returns (adjusted for space) # [[1, 1], [1, 2], [1, 3], # [2, 1], [2, 2], [2, 3], # [3, 1], [3, 2], [3, 3]] possible_rolls() # returns (adjusted for space) # [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], # [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], # [3, 1], [3, 2], [3, 3], [3, 4], [3, 5], [3, 6], # [4, 1], [4, 2], [4, 3], [4, 4], [4, 5], [4, 6], # [5, 1], [5, 2], [5, 3], [5, 4]

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions