Practice

Search a Product File

MEDIUMFile Handling7 marks
File I/O questionproducts.txt is pre-loaded for you during grading.

The file products.txt already contains one product name per line. Read a search term from the user and output Found if that name appears in the file (ignore case), otherwise Not found.

Input: One product name. Output: Found or Not found.

Example:

Input:  pencil
Output: Found
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Match ignoring case
products.txt
Pen
Pencil
Ruler
Inputs: pencil
Expected: Found
Test 2: Missing product
products.txt
Pen
Pencil
Ruler
Inputs: Book
Expected: Not found