dictionary = {}
name = input("Name: ")
while name: #while the name is not blank
age = input("Age: ")
dictionary[name] = age
name = input("Name: ")
print("Thank you, bye!")
f = open("1ex.txt","w")
f.write( str(dictionary) )
f.close()
So I have this code, it does what I want, but I cant seems to figure it out how can I write the file, so that it would have not a dictionary, but smth like this:
Jane, 25
Jim, 24
I tried putting everything into a list, but it doesn't work out for me.