This is one of my mini project of dice rolling and I want to improve it further with more advanced Python. Maybe you have any ideas to improve the code itself?
This code will ask the minimum and maximum number for the dice from the user and the number of times it will roll them, giving random numbers.
import random #Size choosing for dice while True: #Choosing the minimum number Min = input("Please input the minimum number of your dice: ") try: Min = int(Min) except ValueError: print("Invalid input") continue #Choosing the maximum number Max = input("Please input the maximum number of your dice: ") try: Max = int(Max) except ValueError: print("Invalid input") continue #Check if the minimum and maximum is valid if Min > Max: print("Minimum is bigger than Maximum.\n Please reinput data...") continue elif Min == Max: print("Minimum is equaled to Maximum,\n Please reinput data...") continue print(f"Your dice is from {Min} to {Max}.") break #Random number generater while True: Rollcount = input("How many times do you want to roll the dice: ") try: Rollcount = int(Rollcount) break except ValueError: print("Invalid input") continue for i in range(0,Rollcount): roll = random.randint(Min,Max) print(roll)