Week 6: Working with data
- leprik9
- Nov 18, 2015
- 1 min read
This week we were introduced to dictionaries.
The first task was to write a function whose input is string of text; and output a dictionary where the words from the stringare the keys, and the number of times they occur the values. I had to use a string method to split the string into a list of words; then iterate over the list, each time either adding a new dictionary or increasing a value

The second task was to create a function codeOnly that removes all comments (everything that starts with #) from a script. It was tested on the script above.

And the last task i did was to write a function to compare two text files. The function should print out the difference and in which line was the difference

Comments