I am extremely new to programming and I tasked myself with the challenge of making a dice rolling game. It goes from 1 to 6 and it first asks you if you're interested in playing. Then it rolls. Then it spits out the number, and asks if you want to play again.
I got it to work, however, I can guarantee that it could be shorter. I am COMPLETELY stumped on this part. I would honestly like critique on how to clean up my programming. I know I'm brand new, but I would like to learn efficiency as well as the basics if possible.
I programmed in Python version 3.
import random game_start = input("Would you like to roll the dice?") def dice_roll(): print("Your number is: " + str(random.randint(1,6))) global play_again play_again = input("Would you like to play again?") if game_start == "yes": dice_roll() while play_again == "yes": dice_roll() elif game_start == "no": print("Game Over") else: print("Input not recognized")