#Here is a simple dice rolling simulator in Python:
In python
code :
import random
def roll_dice():
return random.randint(1, 6)
num_rolls = int(input("How many times would you like to roll the dice? "))
for i in range(num_rolls):
roll = roll_dice()
print(f"Roll {i+1}: {roll}")
Output :
How many times would you like to roll the dice? 5
Roll 1: 4
Roll 2: 4
Roll 3: 2
Roll 4: 2
Roll 5: 6
Dice rolling using python,
- You can run this code in a Python interpreter or in python compiler
- it will ask you how many times you would like to roll the dice.
- It will then simulate rolling a 6-sided dice that number of times and print out the result of each roll.
tic tac toe game download link here
- You have to must try in your python compiler use idle avoid online compilers to Errors
0 Comments