NEA Support

Below is a series of different programs that have pseudocode and flowcharts completed for them. Use them to try and relate your algorithm designs to your code.

Example 6 - Product Catalogue - Writing to a File

This program is designed to show how you might create a login system which reads from a text file.

Flowchart



Pseudocode



Python Code

			#Example of writing to a file
another = "Y"
while another == "Y":
    barcode = input("Enter an 8 digit barcode: ")
    description = input("Enter a product description: ")
    price = input("Enter a price: ")
    file=open("Products.csv","a")
    file.write(barcode + "," + description + "," + price)
    file.close()
    print("Product added to catalogue")
    another = input("Do you want to add another? Y/N ")