Name can be undefined problem

name = “Christian”

print (f"Hello {name}")

is_online: True

if is_online:
print (“you are online”)
else:
print (“you are offline”)

“if is_online:” is the undefined error im getting in pycharm

im following a youtube video and it works just fine for him, idk whats happening.

Change is_online: True to is_online = True

:facepalm:

thank you

# ============================================================
def online():
    is_online = True    # i do not yet know how to toggle this
    if is_online is True:
        print ("You are online.")
    else:
        print ("You are offline.")
# ============================================================
def usr_name():
    username = "[Username]"
    print (f"Hello, {username}")
# ============================================================
def main():
    usr_name()
    online()
# ============================================================
if __name__ == "__main__":
    main()
# ============================================================
# ========================def new():==========================
def password():
    usr_pass = input("Enter password: ")
    if usr_pass == "0000":
        print("Logging in...")
    else:
        print("Incorrect password.")
# ============================================================
def online():
    is_online = True
    if is_online is True:
        print ("You are online.")
    else:
        print ("You are offline.")
# ============================================================
def usr_name():
    username = "[Username]"
    print (f"Hello, {username}")
# ============================================================
def main():
    password()    # new()
    usr_name()
    online()
# ============================================================
if __name__ == "__main__":
    main()
# ============================================================

truly riced now

# ============================================================
def username():
    while True:
        usr_name = input("Enter username: ")
        if usr_name == ("Username"):
            break
        else:
            print("Incorrect username.")
# ============================================================
def password():
    while True:
        usr_pass = input("Enter password: ")
        if usr_pass == "Password":
            print("Logging in...")
            break
        else:
            print("Incorrect password.")
# ============================================================
def usr_name():
    username = "Username"
    print (f"Hello, {username}")
# ============================================================
def online():
    is_online = True
    if is_online is True:
        print ("You are online.")
    else:
        print ("You are offline.")
# ============================================================
def main():
    username()
    password()
    usr_name()
    online()
# ============================================================
if __name__ == "__main__":
    main()
# ============================================================

If you assign to a variable in a function, Python assumes that it’s local to that function unless you declare in that function that it’s global or nonlocal.

When you say
user_name = input("Enter Username: ")

Then the text "Enter Username: " just sets the text to be
displayed as information for the user about what to enter.

The returned value in user_name contains only what the user actually
typed in.

Glancing at your previous posts, I think you should learn about
function parameters and return values.