Having trouble with the GuessNumber project on Python

Does anyone know why I get number_of_sides not defined?
Here’s the code

"""The program should do the following:

Roll a pair of dice.
Add the values of the roll.
Ask the user to guess a number.
Compare the user's guess to the total value.
Determine the winner (user or computer)."""
#Imported functions
from random import randint
from time import sleep
#User number guess
def get_user_guess():
  guess = int(raw_input("Guess a number: "))
  return guess

def roll_dice(number_of_sides):
  first_roll = randint(1, number_of_sides)
  second_roll = randint(1, number_of_sides)
max_val = number_of_sides * 2  
print "Maximum values is: %d" % max_val
guess = get_user_guess()
if guess > max_val:
  print "Your guess is invalid"

number_of_sides is the function parameter, so it has a local variable scope for the roll_dice function, for some mysterious reason max_val = number_of_sides * 2 is no longer inside the function body.

Hi, thanks for your help but now it says max_val is not defined on line 23

Did you think through what needs to be nested inside the function? I just pointed out that one line, which i hoped would make you think about what should be inside the function

I have had this issue as well. The problem is mainly just making sure that you pay attention to spellings:
For example: numb_of_sides when define should always be exactly referred to as number_of_sides
It can’t be number_of_sides with an s at the end.