top of page

Week 6: Working with data

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

Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

Email:
kabadzhg@uni.coventry.ac.uk

bottom of page