Skip to content

Instantly share code, notes, and snippets.

@suzukiyoshihisa
Created August 31, 2020 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzukiyoshihisa/700a96f882a2e104b264a7c0e12af948 to your computer and use it in GitHub Desktop.
Save suzukiyoshihisa/700a96f882a2e104b264a7c0e12af948 to your computer and use it in GitHub Desktop.
import random
def main():
dice_rolls = int(input('何個サイコロを振りますか? '))
dice_size = int(input('サイコロの最大値は何にしますか? '))
dice_sum = 0
for i in range(0, dice_rolls):
roll = random.randint(1, dice_size)
dice_sum += roll
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}')
print(f'サイコロの合計値は {dice_sum} です')
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment