variable = "Hello"
def function():
global variable
print(variable)
function()
# When Python parses the body of a function definition and encounters an assignment such as
feed = 5
#Python interprets feed as a local variable by default. If you do not wish for it to be a local variable, you must put
global feed
feed = 5
def calculate_grade(grade):
if grade > 80:
letter = "A"
elif grade > 70:
letter = "B"
elif grade > 60:
letter = "C"
elif grade > 50:
letter = "D"
else:
letter = "F"
return letter
def calculate_grade(grade):
if grade > 80:
letter = "A"
elif grade > 70:
letter = "B"
elif grade > 60:
letter = "C"
elif grade > 50:
letter = "D"
return letter