CJCoding With Joseph
15free / daySign inCreate account

Look Up The Quantity

Write every row of stock to stock.csv with csv.writer and writerow (open the file with newline=""; there is no header row). Then read a wanted item name from input, open the file again and go through it with csv.reader; when a row's first value equals the wanted name print <item>: <quantity> in stock using the row's second value and remember that it was found. If no row matches, print <item> is not stocked after the loop instead. Input: one line, no prompt. Import only csv.

Expected Output:

pads: 12 in stock

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
FilesCSV
📥 Auto-Input:
pads\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.