nameError: name 'assign_username' is not defined

25 views Asked by At

I'm trying a run a certain part of my code(elif == 'va') but it keeps on returning nameError: 'assign_username is not defined.I don't understand why as the variables that I'm trying to print are already defined under elif == 'a'.

elif menu == "a":
    assign_username = input("Please enter the username of the person assigned to the task:\n")
    task_name = input("Please enter title of the task:\n")
    task_desc = input("Please enter description of the task:\n")
    task_due_date = input("Please enter the due date of the task:\n")
    current_date = input("Please enter the current date:\n")
    task_completion = input("Is the task finished? Yes/No:\n")
    f2.write(f'\n{assign_username}, {task_name}, {task_desc}, {current_date}, {task_due_date}, {task_completion}')
        

elif menu == "va":

    print(f"Assigned to: {assign_username}")
    print(f"Task: {task_name}")
    print(f"Task description: {task_desc}")
    print(f"Date assigned: {current_date}")
    print(f"Due date: {task_due_date}")
    print(f"Task completed: {task_completion}")
    
0

There are 0 answers