Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # import modules
- import time
- import random
- import os
- def display_rolling_dice_message():
- dot = ""
- for _ in range(23):
- if len(dot) >= 5:
- dot = ""
- else:
- dot += "."
- os.system("cls")
- print(f"Rolling Dices, Please Wait{dot}")
- time.sleep(0.1)
- # make dice
- dice = list(range(1, 6))
- # Make a empty list to hold value of rolled dices
- picked = []
- # loop 5 times and pick up a random number from dice
- for _ in range(1, 6):
- picked.append(random.choice(dice))
- # display and animate rolling message
- display_rolling_dice_message()
- # clear the console for new message
- os.system("cls")
- # print the result
- print("Your dice roll ended up with:")
- print("--------------------------")
- print("| D1 | D2 | D3 | D4 | D5 |")
- print("--------------------------")
- print(f"| {picked[0]} | {picked[1]} | {picked[2]} | {picked[3]} | {picked[4]} |")
- print("--------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement