- PEP8
- Spaces are preferred to tabs
- Use ruff to tidy up your code.
- Typer is a library for building comand-line applications
Why do this in two steps?
file_name = input("Enter file name: ")Why not give the file name on the command line using
./index.py test1.txt
or even better, have the program read from stdin and write to stdout so you can pipe the file into the program
./index.py < test1.txt
- Look up the
readlinesmethod. Use the
enumerateiterative instead oflinecounter += 1
- defaultdict is a handy library
uv rocks! Learn how to use it.
#!/usr/bin/env -S uv run --script # # /// script # dependencies = ["cowsay"] # /// import cowsay cowsay.cow("Don't have a cow man!")
Conventions for naming identifiers. Check PEP8
camelCase PascalCase snake_case kebab-case
Introduce yourself to git
git config --global user.email "you@example.com" git config --global user.name "Your Name"
If you commit from different places, be sure you have the same git identity at both. If you don't tell git your identity, it will make assumptions
Natalia Jiménez <nataliajm115@gmail.com> Natalia Jiménez <nataliajimenez@MacBook-Pro-de-Natalia.local> Natalia Jiménez <nataliajimenez@sp-byods-145-109-37-84.wireless.uva.nl> Komari <138456103+komarijasmine@users.noreply.github.com> sjitix <adrawing26@gmail.com> camellia <camellia@sp-byods-145-109-46-30.wireless.uva.nl> Skye Li <skyeli@sp-byods-145-109-1-193.wireless.uva.nl> apple <apple@sp-byods-145-109-45-224.wireless.uva.nl>
Pairs
[('Shelly', 'Zsuzsa'), ('Giorgia', 'Mats'), ('Irissa', 'Skye', ,'Max'), ('Natalia', 'Camille'), ('Ziyu', 'Ana'), ('Wester', 'Romane'), ('Indigo', 'Montasser', 'Margherita'), ]
- Never edit or make commits through the browser.
- Yikes! commits
- How to Write a Git Commit Message
.gitignorefor files you want git to ignore, e.g. .DSStore- LLMs?
- A solution in index.py