- Information
- AI Chat
Was this document helpful?
10. File IO - This is the last assignment of the course
Course: Computer science1015 (CSC1015F)
257 Documents
Students shared 257 documents in this course
University: University of Cape Town
Was this document helpful?
Version 28/04/2022 11:52:33
Page 1 of 4
CSC1015F Assignment 10
File Input and Output
Assignment Instructions
This assignment involves constructing Python programs that perform file input and output.
Furthermore, your solutions to this assignment will be evaluated for correctness and for the following
qualities:
• Documentation
o Use of comments at the top of your code to identify program purpose,
author and date.
o Use of comments within your code to explain each non-obvious functional
unit of code.
• General style/readability
o The use of meaningful names for variables and functions.
• Algorithmic qualities
o Efficiency, simplicity
These criteria will be manually assessed by a tutor and commented upon. Up to 10 marks will be
deducted for deficiencies.
Question 1 [35 marks]
Write a Python program called 8anagramsearch.py9 that searches a file for anagrams of a given
word, printing the results in alphabetical order.
Given two words, each is an anagram of the other if they contain the same letters in the same
quantities. For example, 'green' and 'genre'.
Here are 4 examples of intended program behaviour:
(NOTE: the input from the uses is shown in bold font.)
Sample I/O:
***** Anagram Finder *****
Enter a word: triangle
['alerting', 'altering', 'integral']
Sample I/O:
***** Anagram Finder *****
Enter a word: Orange
['onager']
Sample I/O:
***** Anagram Finder *****
Enter a word: back
Sorry, anagrams of 'back' could not be found.