0

I am using Python 3.

This is a script that i am in the process of writing. It asks for a name/birthday, takes that input, and appends it into a list. The list is then written to another file.

I have done research on this and can't find why it isn't working.

Here is my code:

print("""Enter the name and birthday of the person like this:
Adam 1/29
""")

all_birthdays = [ "none so far" ]

while True:
    birthday = input("> ").upper()

    if birthday == "":
        break

    if birthday == "LIST":
        print(all_birthdays)

    if birthday not in all_birthdays:
        all_birthdays.append(birthday)
    else:
        print("This name/birthday is already known")

birthday_list = open('test.txt','w')

for bday in all_birthdays
    birthday_list.write("%s\n" %bday)

SECOND EDIT: I added code ( bottom-most for loop and the create file ). It worked, but i can't seem to even find the file anywhere. Any help? How can i find it and open it? This code was found at: Writing a list to a file with Python

Community
  • 1
  • 1
John Doe
  • 25
  • 1
  • 9

1 Answers1

0

This line:

 birthday = input("> ").upper

Should be:

 birthday = input("> ").upper()

The former assigns the upper function to the variable birthday rather than the uppercase of the input string.

FujiApple
  • 796
  • 5
  • 16