Update diceRoller.py

The program is designed to rollimport random
import time
roll = 0 #setting value of roll to 0
prenumber = 0 #setting value of prenumber to 0
gameover = False #assigning False to gameover

s1 = "- - - - -\n|       |\n|   O   |\n|       |\n- - - - -\n" #Dice roll graphics
s2 = "- - - - -\n| O     |\n|       |\n|     O |\n- - - - -\n"
s3 = "- - - - -\n| O     |\n|   O   |\n|     O |\n- - - - -\n"
s4 = "- - - - -\n| O   O |\n|       |\n| O   O |\n- - - - -\n"
s5 = "- - - - -\n| O   O |\n|   O   |\n| O   O |\n- - - - -\n"
s6 = "- - - - -\n| O   O |\n| O   O |\n| O   O |\n- - - - -\n"

def diceroll(roll): #function that rolls dice
    print("rolling.....")
    roll = random.randint(1,6) #generates a random number between 1 and 6
    return roll #returning the value of roll


def show_dice(roll): #function displays correct graphics
    if roll == 1: #if roll is equal to 1 then print coinciding graphic
        print(s1)
    elif roll == 2:#if roll is equal to 2 then print coinciding graphic
        print(s2)
    elif roll == 3:#if roll is equal to 3 then print coinciding graphic
        print(s3)
    elif roll == 4:#if roll is equal to 4 then print coinciding graphic
        print(s4)
    elif roll == 5:#if roll is equal to 5 then print coinciding graphic
        print(s5)
    elif roll == 6:#if roll is equal to 6 then print coinciding graphic
        print(s6)


#MAIN PROGRAM
print("The idea of this game is to roll the same number twice in a row")
print()
time.sleep(1) #1 second break

while gameover == False: #will loop whilst gameover is equal to False
    false = False #setting value of false to False
    print()
    ask = input("Type roll when you want to roll the dice") #user input

    if ask == "roll": #dice will not roll until user has entered "roll"
        roll = diceroll(roll) #assigned output of diceroll function to roll and calling function
        time.sleep(1) # 1 second break
        show_dice(roll) #calling show_dice function

    else: #if something other than roll is entered
        print()
        print("I do not understand") #display message to alert user
        print("please try again")
        false = True #set value of false to true so that this go does not count

    if prenumber == roll and false == False: #if you have rolled the same number twice in a row
        gameover = True
        print("you have rolled the same number twice in a row")
        print("you have won!!!")

    prenumber = roll #set prenumber to the value of roll, this means that the last number you rolled is stored
    

           
 a dice when asked to by the user. The program then keeps asking the user to roll the dice until the same number is rolled twice in a row.

One error that I fixed was to do with calling the functions at the end of the code. One of the functions was called correctly (but didn't run) and the other wasn't. This was because there were no brackets after it, although for the program to work and the other function run the value of roll needed to become global so it could be used. I corrected this by returning the value of roll at the end of the function.

Another error that I fixed was the error in the if and elif statements. Instead of using a double equals sign the programmer had used a single equals sign so there was a syntax error as the program was trying to assign but couldn't. The program can not do it. I corrected it by changing all of the single equals to double equals.