title: Is it possible to use a variable then later redefine it?
body: <p>I´m making a project for school and it is a dice game. This snippet of my code is like a catch 22.</p>
  
  <p>I need to define a variable otherwise it flags, so I do this but then every time the button is run it changes the value to zero instead of increasing it.</p>
  
  <pre><code>if Rollnop1 == 0 :
      Userscore1 = Randomnumber
      print ("User 1 ",Userscore1 )
  
      Rollnop1 = Rollnop1+1 #But this changes it so it will go to the next players roll, every 
      #time the button is pressed it changes the variable back to 0
  </code></pre>
  
  <pre><code>def gamerun():
      global Player
      global usernamestr
      global passwordstr
      global usernamestr2
      global passwordstr2
      Rollnop1 = 0
  
      def roll2():
          Rollnop2 = 0 
          Randomnumber = random.randint(2,12)
          print ("Console: Random Number 2 = ",Randomnumber)
  
          if Rollnop2 == 0 :
              Userscore2 = Randomnumber
              print ("User 2 ",Userscore2 )
  
      def roll1():
          Rollnop1 = 0 #Need to define this here otherwise It wont work
          Randomnumber = random.randint(2,12)
          print ("Console: Random Number = ",Randomnumber)
  
          if Rollnop1 == 0 :
              Userscore1 = Randomnumber
              print ("User 1 ",Userscore1 )
              Rollnop1 = Rollnop1+1 #But this changes it so it will go to the next players roll, every 
                                    #time the button is pressed it changes the variable back to 0
  
          else:
              roll2()
  
      actdicegame = Tk()
      gamerunl0 = Label(actdicegame, text = usernamestr, fg = "black")
      gamerunl0.pack()
      gamerunl1 = Label(actdicegame, text = "Roll The Dice", fg = "black")
      gamerunl1.pack()
      gamerunb1 = Button(actdicegame, text="ROLL",fg="Black", command=roll1)#Register Butto
      gamerunb1.pack()
  
      actdicegame.geometry("350x500")
      print ("Console: GUI RUNNING 1")
      actdicegame.mainloop()
  </code></pre>
  
  <p>snippet <a href="https://pastebin.com/FSWwBGpA" rel="nofollow noreferrer">https://pastebin.com/FSWwBGpA</a></p>