str ExercisesFor lecture notes on strings, please review this page.
This program will abbreviate a given string to only it’s uppercase letters.
comp110/exercises directory create a new folder named ex05_stringsabbreviate.py in your comp110/exercises/ex05_strings folder.abbreviate that is given a str value as a parameter and returns a new str abbreviation.
str should contain only the uppercase letter of the input string.< and > should be used for determining whether a letter is uppercase. No built-in string methods should be used.main function that has no parameters and returns None.
input built-in function to prompt the user for text that has uppercase letters in it.abbreviate function to convert the string to an abbreviation and print it out.Example program run:
Write some text with some uppercase letters: Happy BirthDay
The abbreviation is "HBD".
Write some text with some uppercase letters: American Standard Code for Information Interchange
The abbreviation is "ASCII".
This program will rate your feelings with an emoji.
likertmoji.py in your comp110/exercises/ex05_strings folder."\U0001F920""\U0001F603""\U0001F610""\U0001F62D""\U0001F643"Define a function named represent that is given a rating int as a parameter and returns the str representing the matching emoji given by the table below.
| Rating | Emoji | Code |
|---|---|---|
| greater than 5 | 🤠 | "\U0001F920" |
| 4 or 5 | 😃 | "\U0001F603" |
| 3 | 😐 | "\U0001F610" |
| 1 or 2 | 😭 | "\U0001F62D" |
| less than 1 | 🙃 | "\U0001F643" |
main function that has no parameters and returns None.
input built-in function to prompt the user for a rating from 1-5.represent function to convert the rating to an code string for the appropriate emoji and print it out.Example program run A:
How do you feel on a scale of 1-5? 4
😃
Example program run B:
How do you feel on a scale of 1-5? -3
🙃
__author__ set equal to your PID as a stringif __name__ == "__main__": . Be sure to indent your main() function call by one tab. This is important for allowing the grader to run. It should look like:Go ahead and delete any submission zips lingering around in your workspace from the previous exercise.
When you are ready to submit for grading, close out any open Python Debug Console terminals using the Trash Can and then open up a clean, new terminal.
python -m tools.submission comp110/exercises/ex05_strings
This should produce a submission timestamped with the current date/time for uploading on Gradescope.