import random def main(): dice_rolls = int(input('你想掷多少个骰子?')) dice_sum = 0 dice_size = int(input('骰子有多少面? ')) for i in range(0, dice_rolls): roll = random.randint(1, dice_size) if roll == 1: print(f'You rolled a {roll}! Critical Fail') elif roll == dice_size: print(f'You rolled a {roll}! Critical Success') else: print(f'You rolled a {roll}') dice_sum += roll print(f'You rolled a total of {dice_sum}') if __name__== "__main__": main() #