Practice

Read Names from File

MEDIUMFile Handling
File I/O questionnames.txt is pre-loaded for you during grading.

A file called names.txt has already been created and contains three names, one per line:

Alice
Bob
Charlie

Open the file for reading. Read each name and output it. Close the file when done.

Input: None (read from the file). Output: Three names, each on a separate line, exactly as stored in the file.

Example output:

Alice
Bob
Charlie
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Three names in file
names.txt
Alice
Bob
Charlie
Expected: Alice Bob Charlie
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade
names.txt pre-loaded during grading — not available in local runs