To start this assignment, download this zip file.
Homework 4a — Strings
Once again, before running the tests we provide, you will need to upgrade the
byu-pytest-utilspackage. Read the guide on upgrading a package to do this. You will want at least version
1. Practice Problems
practice_problems.py you will find the stubs of several functions, along
with documentation that explains what each function should do. You should
implement all of these.
There are tests provided; looking at the input and output in
test_practice_problems could be helpful.
The parameter “words” refers to a list of strings. A word in words could be a string such as “I appreciate your thoughtfulness.” All you need to count is the number of punctuation marks or uppercase letters which are in the string as a whole.
Writing additional functions, such as one that finds the number of uppercase letters in a string, is recommended.
2. BYU Students
Write a program that asks for a list of students.
Each student has name, hometown, and school.
When a person enters nothing for the name, the list is complete.
- Print out all the names of students from BYU in ALL CAPS.
- Print out all the names of students from other schools.
Match the prompts and formatting from the following example:
Enter a student. Name: Eliza Snow Hometown: Becket School: BYU Enter a student. Name: George Smith Hometown: Provo School: UVU Enter a student. Name: BYU Students: - ELIZA SNOW Other Students: - George Smith
You can find starter code in
Be sure you can pass the tests before you turn in the assignment. Review the guide on using pytest if you need to review using pytest and what to do if a test fails.
Manual grading will focus on decomposition, fluency, and appropriate management of strings.