The string data type (literally meaning a string of characters) is very commonly used in your Python scripts that use I/O (input and output). Any input you get via the `input()` function is initially saved and handled as a string. Luckily, Python has many built in methods specifically for string objects, which you can use to validate input or process any string.
In this assignment, you will use Python’s built-in string methods to interact with the string:
`sentence = “Python is my favorite programming language!”`
Write a program called `string_methods.py`, in which you define the string above. After defining it, you will use string methods to perform the next tasks:
Please note that all of the above is hardcoded and will result in the same output every time.
-!- CODE language-bash -!-$ python3 list_methods.py
Python is my favorite programming language!
PYTHON IS MY FAVORITE PROGRAMMING LANGUAGE!
CodeGrade is your virtual teaching assistant for your coding classroom. You teach, CodeGrade takes care of the rest.
With our 40+ built-in fully automatically graded Introduction to Python assignments for university-level courses, you can start teaching Python at your institution with confidence now. Or, scale your classroom with CodeGrade's tools.
Book a personal 30-minute demo now and we'll show you how to get started with CodeGrade in less than 1 hour!