Simple File Reading¶

Start by creating a text file in Notepad (or any other text editor) containing your first and last name, separated by whitespace. Save it as name.txt.

Then write a program that opens that file and displays the two names on the screen, with no input from the keyboard.

Name your program simple_file_read.py

Then try changing the name in the file, saving it again, and running the program again. Confirm that it works and is properly reading the file with the new name.

Using my psychic powers (aided by reading data from the file),
I have determined that your name is Horace Mann.

©2021 Daniel Gallo

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.

Creative Commons License

Adapted for Python from Graham Mitchell’s Programming By Doing