import random
def showDice(dice):
if dice==1:
print('+-------+')
print('| |')
print('| * |')
print('| |')
print('+-------+')
elif dice==2:
print('+-------+')
print('| * |')
print('| |')
print('| * |')
print('+-------+')
elif dice==3:
print('+-------+')
print('| * |')
print('| * |')
print('| * |')
print('+-------+')
elif dice==4:
print('+-------+')
print('| * * |')
print('| |')
print('| * * |')
print('+-------+')
elif dice==5:
print('+-------+')
print('| * * |')
print('| * |')
print('| * * |')
print('+-------+')
elif dice==6:
print('+-------+')
print('| * * * |')
print('| * * * |')
print('| * * * |')
print('+-------+')
else:
print('Wrong dice value!')
for x in range(0,2):
dice=random.randrange(1,7) #7 will be excluded
showDice(dice)
Note: Python is indentation sensitive and in the answer box if indentation is broken.Please refer to attached screenshot of code and make space and newline for for,if,else,etc. accordingly.Please let me know if any concerns.

Output

In python.. If we want the computer to pick a random number in a given range...
(MATLAB) Write a program that simulates a dice roll by picking a random number from 1-6 and then picking a second random number from 1-6. How many times do you get two 1’s. What many times do you get two 1’s if you simulate 10,000 rolls of a pair of dice?
Can anyone please answer these? It's python coding question focusing on random practice!! 1. Write a function biasedCoinFlip(p) to return a biased coin flip that returns ''heads'' with probability p and tails otherwise. For example, when p=0.5, this function will behave like the last. On the other hand, p=0.25 will mean that there is only one chance in four of getting the result of "heads". 2. Write a function randomCard() to randomly return a card in a standard deck(suits: diamonds,...
How to write python code that is a dice rolling function that generates random numbers. The dice rolling function takes two arguments: the first argument is the number of sides on the dice and the second argument is the number of dice. The function returns the sum of the random dice rolls. For example, if I call roll dice(6,2) it might return 7, which is the sum of randomly chosen numbers 4 and 3. It somewhere along the lines of:...
We want to design our die class (to be named aDie) such that we can have statements such as: aDie D; // To instantiate a Die object int rolled = D; // To get the value rolled by D rolled = D + D; // To get the value of the sum of 2 rolls of the die aDie d1, d2; // to instantiate 2 dice rolled = d1 + d2; // To get the value of the sum of...
In python: The randrange(min, max) produces a random integer greater than or equal to min and less than max. So randrange(0,3) produces either 0, 1, or 2 Write a program that asks the user to input paper, rock, scissors, or done If they input something else, repeat the question. If they input 'done', exit the game loop. If they input rock, paper, or scissors, have the computer pick a random choice. Write a function that takes two strings, each 'rock', 'paper',...
question 2 in C programming please
PE-05b-01 (Six-sider) write a counter-controlled program that prompts the user to enter the number of times n to roll a six-sided die. The program should print to the screen the iteration of the loop and result for each roll 1 ) How many times would you like to roll? 3 roll 6 6 5 1 2) PE 05b 02 (Flash Cards) Write a counter-controlled program that creates addition problems for an elementary kid to...
Using simple python code import random Your program should: generate positive random integers in the range of 1 to 500 count the number of iterations. update and output the highest number generated.
Write a C++ program that generates a random number from 0 to 9. It will then prompt the user to guess the random number it generated. Your program stops if the user guesses the right number. (Use the cout function to display the random number the computer generates so that you can determine if your code actually works). SAMPLE OUTPUT Random number = 8 Guess a number in the range [0,9]: 1 Too low Guess a number in the range...
PYTHON: Using Lists and Arrays! 5. In a program, write a function that accepts two arguments: a list, and a number n. The program should generate 20 random numbers, in the range of 1 through 100, and assign each number to the list. The program should also ask the user to pick a number from 1 through a 100 and assign that number to n. The function should display all of the number in the list that are greater than...
Problem 3. Functional Code with Random Number Sequences Write a generator gen_rndtup(n) that creates an infinite sequence of tuples (a, b) where a and b are random integers, with 0 < a,b < n. If n == 7, then a and b could be the numbers on a pair of dice. Use the random module. a) Use lambda expressions, the itertools.islice function (https://docs.python.org/3/library/itertools.html#itertools.islice), and the filter function to display the first 10 generated tuples (a, b) from gen_rndtup(7) that have...