Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def main():
- global userIn
- userIn = input("Enter how many sides you want on your dice: ")
- userint()
- num = random.randrange(0, userInt)
- compStr = str(num)
- print("The computer chose " + compStr)
- restart()
- def userint():
- try:
- global userInt
- userInt = int(userIn)
- except ValueError:
- print("That's not a number!")
- main()
- def restart():
- again = input("Play Again? Yes/No: ")
- againLower = again.lower()
- if againLower == "y" or againLower == "yes":
- main()
- elif againLower == "n" or againLower == "no":
- print("Goodbye!")
- quit()
- else:
- print("That's an invalid input")
- restart()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement