A Little Puzzle¶

Open a file specified by the user. This file will contain a bunch of characters. You should read in each character from the file, one character at a time. Display every third character on the screen. Throw the other characters away.

There is a sample input file called puzzle.txt, containing a little message you can use to test your program.

For fun, the “thrown-away” characters might say something, too, in case you care to try to view them somehow.

Name your program puzzle.py

Open which file: puzzle2.txt

# The secret message should appear here...

Each file contains three messages. Can you display all three but use only one loop?


©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