Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to make dice roll in python

#OM NAMAH SHIVA


import random
#computer picks a random number between 1 to 6
computer_choice = random.randint(1, 6)

print("you have 5 try's you scores more wins")
user_choice = int(input(["choose a number between 1 to 6"]))

#users_choice should not be higher than 6 
if user_choice >= 7:
    input("it should be between 1 to 6")
    #if user_choice input higher number than 7 two times it will quit the game
    if user_choice >= 7:
        exit()
#if user_choice is equal to computer_choice you win
if user_choice == computer_choice:
    print("you win")
    exit()

#if user_choice not equal to computer_choice you lose
else:
    print("you lose")
Source by gist.githubusercontent.com #
 
PREVIOUS NEXT
Tagged: #dice #roll #python
ADD COMMENT
Topic
Name
7+8 =