Collaborating with Git and Forgejo
The goal of this assignment is to practice collaborating using Git and Forgejo while we get warmed up with Python programming.
- Submit your work as a git repository on our Forgejo server.
- You will work as a pair.
- Each student should make at least 10 git commits.
- Make good use of the Forgejo issues for your repo.
Index a text file
Design a Python program that takes the name of a file which contains text and prints out an index of that file. Each line of the index should show a word of the text followed by the numbers of each line upon which the word appears. The words should be in alphabetical order.
For example when the text file contains the previous paragraph, the output should be as follows:
a: 1, 2 alphabetical: 4 an: 2 and: 1 appears: 3 be: 4 by: 3 contains: 1 design: 1 each: 2, 3 file: 1, 2 followed: 3 in: 4 index: 2 line: 2, 3 name: 1 numbers: 3 of: 1, 2, 3 order: 4 out: 2 prints: 2 program: 1 python: 1 should: 2, 4 show: 2 takes: 1 text: 1, 3 that: 1, 2 the: 1, 2, 3 upon: 3 which: 1, 3 word: 2, 3 words: 4
You should include tests for your program.
Resources
You may find the following resources useful.
Pairs
[('Shelly', 'Zsuzsa'), ('Giorgia', 'Mats'), ('Irissa', 'Skye', ,'Max'), ('Natalia', 'Camille'), ('Ziyu', 'Ana'), ('Wester', 'Romane'), ('Indigo', 'Montasser', 'Margherita'), ]