Question: Write a program which generates three separate random dice values (1, 2, 3, 4, 5 or 6) and then creates the smallest possible three digit

Write a program which generates three separate random dice values (1, 2, 3, 4, 5 or 6) and then creates the smallest possible three digit number which can be created using the dice values as digits. The program prints 2 lines of output:

  • the string, "Dice rolled: ", followed by the 3 dice values (in the order in which they were generated) separated by single spaces,
  • the string, "Smallest number: ", followed by the three digit number created from the dice values.

Notes

  • You can assume that the random module has been imported and you don't need to include the import statement in your answer.
  • Each dice can only be used once to make up the digits of the smallest number.

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!