After I have initialized my headers in my code it adds a blank space which is annoying , I am not familiar with pandas however I hope to accomplish is to delete the blank space.
Moreover my CSV file appears like this after I run the header function and then run the add_user function
username,passcode
a,Adidas123_
a,Adidas123_
I Hope to get it like this
username,passcode
a,Adidas123_
a,Adidas123_
def header():
    headerList = ['username','passcode']
    # open CSV file and assign header
    with open("students.csv", 'w') as file:
        dd = csv.DictWriter(file, delimiter=',',
                            fieldnames=headerList)
        dd.writeheader()
def add_user():
    infile = open("students.csv", "a")
    username = str((input('enter your username:')))
    passcode = "Adidas123_"
    data1 = f"\n{username},{passcode}"
    data = data1.strip() # strips white space
    infile.write(data +"\n") # appends to new line
    print('record added succesfully !')
    infile.close()
 
    