Читать книгу Introduction to Python Programming for Business and Social Science Applications - Frederick Kaefer - Страница 84

Stop, Code, and Understand! SCU 3.3 String Operations

Оглавление

Download the file “SCU 3_3.py” from the companion website and save it either on your computer or on a removable storage device. Open the file in the Python IDLE editor and add a line of code that uses the .upper() method to convert the string my_string to uppercase. Execute the modified program after the change to verify that the revised code runs and produces the correct result.


Lessons learned: In this section, we learned about Python string operations, which are very useful when working with portions of strings. We learned that strings are immutable, so we are not able to modify portions of strings in place, but we are able to replace strings by assigning portions of a string or combinations of string portions using concatenation.

Introduction to Python Programming for Business and Social Science Applications

Подняться наверх