Note that inside a function, you can use a global variable, but can't change it without declaring it with global (see here).
The quote in the doc that matters:
It would be impossible to assign to a global variable without global, although free variables may refer to globals without being declared global.
The first program used the variable by calling a method, which is okay and it price resolves to the global variable. For the second you intended to change a global variable's value, which isn't doable unless the variable is declared with global. Since you can't change the global variable's value, it will create a new local variable and assign the value to it.
To fix it, you need to use global to declare it first:
price=[]
def checkCondition(a,b):
global price
if a<b:
price.append(123) # also works without the global
price = 123
if __name__ == '__main__':
checkCondition(1,2)
print price