Homework 4 - Strings
Homework 4: Strings and Arrays
The puprose of this homework is to get additional practice with strings and lists, and working with them in Python. This is just a single small project.
Make sure to follow the [collaboration policy][collab] for all homework.
Assessment
For Proficiency credit, your submissions must pass all the test cases on Gradescope.
For Mastery credit, your submission must pass all test cases, and also have:
- Useful, informative variable names
- Clear and consistent spacing/linebreaks
- At least one function that you have written that returns a value
Q1: q1.py
You will be given an integer n
, followed by n
words, each on their own line. Your job is to read in the input, and then output:
- How many duplicate words there are
- What the duplicate words were, in alphabetical order
Here, a duplicate is any word repeated twice or more.
Importantly, words that are capitalized differently should be considered to be the same word and treated accordingly. The duplicate words should be output in alphabetical order.
Example input:
6
apple
zebra
Bear
ZEBRA
Zebra
bear
Example output:
2
bear
zebra