oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Formatting Methods #334

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

There are three string methods that can change the casing of a string. These are .lower(), .upper(), and .title().

Here's an example of .lower() in action:

oldoc63 commented 1 year ago

It's important to remember that string methods can only create new strings, they do not change the original string. This string methods are great for sanitizing user input and standardizing the formatting of your strings.

oldoc63 commented 1 year ago

You're a programmer working for an organization that is trying to digitize and store poetry called Preserve the Verse. You've been given two strings, the title of a poem and its author, and have been asked to reformat them slightly to fit the conventions of the organization's database. Make poem_title have title case and save it to poem_title_fixed. Print poem title and poem title fixed.

oldoc63 commented 1 year ago

The organization's database also needs the author's name to be uppercase only. Make poem_author uppercase and save it to poem_author_fixed. Print poem_author and poem_author_fixed.