Hi,
I am currently using a CSV file (actually one big table of data) consisting of data including names, addresses and coordinates of various restaurants.
I want to write a code that allows the users to introduce more than one restaurant (like in the code below), and allows him to stop when they want, by asking “do you want to input one more restaurant? (y/n)”. By answering “n”, the process should stop and the file is saved.
The code I now have is:
Hope someone can help me out. Thankss.
I am currently using a CSV file (actually one big table of data) consisting of data including names, addresses and coordinates of various restaurants.
I want to write a code that allows the users to introduce more than one restaurant (like in the code below), and allows him to stop when they want, by asking “do you want to input one more restaurant? (y/n)”. By answering “n”, the process should stop and the file is saved.
The code I now have is:
name = input("restaurant name is: ") address = input("restaurant address is: ") lonlat = input("coordinates are: ") new_row = list((name, address, lonlat)) table.append(new_row) print(table[-1]) with open("GermanRestaurants_v1.csv", mode="w") as handler: file_writer = csv.writer(handler) for row in table: file_writer.writerow(row)However, I don't now how/where to include a defined questioned where the first part of the code is repeated when someone answers yes, or the file will be saved when someone answers no.
Hope someone can help me out. Thankss.