Read the task instructions that are included in the comments in the code, and then get started!
You can either edit and code online in repl.it or alternatively, you can simply cut and paste the below into your own python file
Solve the challenge on repl.it""" ==============TASK 1. Add an ID number to the file (e.g. 001, 002, and so on for each user) 2. Search by ID number, and return the whole record of the user e.g. Search by ID: 001 >>"Whole profile for 001:" --001,Ruth,Marvin,marvR,[email protected],200 """ import csv #1. This code snippet asks the user to enter a first name, and lists all the rows in the file that have that first name (use "Ruth" to test) #Note: we have a new file this time - called fakefacebook_withnames with open("fakefacebook_withnames.txt",newline="") as f: reader=csv.reader(f) email=input("Who are you looking for on fakefacebook? Enter a first name....:") for row in reader: for field in row: if field==email: print("The following people have that name....is this of any help?:",row)
Filename:fakefacebook_withnames.txt
firstname, lastname,username,password,email,no_of_likes Ruth,Marvin,marvR,pass123,[email protected],400 Carter,Smith,smithC,open123,[email protected],200 Joe,Blogs, blogsJ,2bg123,[email protected],99 Ruth,Pigachee,pigR,pig123,[email protected],72
A sample flow chart (design) for this particular challenge could look like:
Test No. | Description | Test Data(input) | Expected Outcome | Actual Outcome | Further Action? |
---|---|---|---|---|---|
1 | |||||
2 | |||||
3 | |||||
4 | |||||
5 |