另一种写法

控制流 / 条件语句 / if/else 语句

from random import randint


def get_latitude():
    return randint(-90, 90)


latitude = get_latitude()

# 允许使用括号,但不推荐
if (latitude == 0):
    location = "Equator"
elif (latitude < 0):
    location = "Southern Hemisphere"
else:
    location = "Northern Hemisphere"

# 语句体写在同一行:允许,但不推荐
if latitude < 0: sign = "-"
else: sign = "+"

print(f"{latitude = }")
print(f"{location = }")
print(f"{sign = }")