Summary
Keywords
Full Transcript
#python #tutorial #course # Here are the Unicode characters I use for drawing the dice. # Youtube has strange spacing, so the ASCII art looks warped in the description. # It should still work if you copy and paste it into PyCharm. # โ โ โ โ โ โ โ import random dice_art = { 1: ("โโโโโโโโโโโ", "โ โ", "โ โ โ", "โ โ", "โโโโโโโโโโโ"), 2: ("โโโโโโโโโโโ", "โ โ โ", "โ โ", "โ โ โ", "โโโโโโโโโโโ"), 3: ("โโโโโโโโโโโ", "โ โ โ", "โ โ โ", "โ โ โ", "โโโโโโโโโโโ"), 4: ("โโโโโโโโโโโ", "โ โ โ โ", "โ โ", "โ โ โ โ", "โโโโโโโโโโโ"), 5: ("โโโโโโโโโโโ", "โ โ โ โ", "โ โ โ", "โ โ โ โ", "โโโโโโโโโโโ"), 6: ("โโโโโโโโโโโ", "โ โ โ โ", "โ โ โ โ", "โ โ โ โ", "โโโโโโโโโโโ") } dice = [] total = 0 num_of_dice = int(input("How many dice?: ")) for die in range(num_of_dice): dice.append(random.randint(1, 6)) # PRINT VERTICALLY # for die in range(num_of_dice): # for line in dice_art.get(dice[die]): # print(line) # PRINT HORIZONTALLY for line in range(5): for die in dice: print(dice_art.get(die)[line], end="") print() for die in dice: total += die print(f"total: {total}")
