15. File Assignments

Short problems using File.
  1. Count the number of lines in a file.

  2. Count the number of words in a file.

  3. Count the number of characters in a file.

  4. Find the sum of all of the integers in a file.

  5. Print out the file with line numbers in front of each line.

  6. Where’s Waldo? Create a file called “waldo.txt” that consists of 10000 lines of text. Each line should have 10 random integers from 0 to 9999. Except that there is a 0.1% chance that a given line will instead have all of the same integer.

  7. Find Waldo Read a file called “waldo.txt” and print out every integer that occurs 10 times on a line, just like you would make in the previous problem.

  8. Implement the “tree” command.

     .
     └── Risk
        ├── build.bat
        ├── build.sh
        ├── changelog.txt
        ├── compress.rkt
        ├── contributors.txt
        ├── notes.txt
        ├── PlannedAdditions.txt
        ├── README.md
        └── src
            ├── dice-functs.rkt
            ├── ellipse.rkt
            ├── fonts
            │   └── Roboto-Light.ttf
            ├── graph.rkt
            ├── hit-box-determiner.rkt
            ├── imgs
            │   ├── 6ca.jpg
            │   ├── board.png
            │   ├── cardico.png
            │   ├── close.png
       etc you get the idea
    

More Practice

Additional exercises

Last modified August 18, 2023: 2022-2023 End State (7352e87)