Python Basics – Strings Utility¶
Overview¶
This beginner-friendly utility introduces Python string fundamentals through hands-on examples. It is perfect for newcomers following the learning path in Documentation/Programs/level1_fundamentals.py and looking for extra practice manipulating text data.
What You'll Learn¶
- Creating and concatenating strings
- Formatting strings with f-strings and
str.format() - Common string methods (
upper,lower,split,join, etc.) - Basic validation and cleaning workflows used in data preparation
Files¶
strings_tutorial.py: Walkthrough script with guided printouts and function examples
How to Run¶
Keep the file open in your editor while it runs so you can see how each code section aligns with the console output.Practice Ideas¶
- Build a function that formats user input into title case
- Parse comma-separated text into a cleaned list of tickers
- Use
startswith/endswithto validate filenames before saving data
Next Steps¶
- Explore list operations in
UTILS - Data Structures - Lists/ - Continue through the Level 1 program in
Documentation/Programs/level1_fundamentals.py
Running it¶
More in Python Fundamentals¶
- Python Basics - Comprehensions: Comprehensions are Python's most elegant way to transform data—replacing loops with readable, performant one-liners.
- Python Basics - Control Flow: Control flow structures (if/elif/else, for, while, comprehensions, break, continue) are the foundation of all algorithms.
- Python Basics - Dates and Times: Markets run on a calendar, not a clock. Interest accrues over days, options expire on a date, and any backtest that miscounts trading days will quietly misreport every annualised number it produces.
- Python Basics - Essential Libraries: A working quant leans on a small set of libraries for almost everything.
- Python Basics - Functions: This utility teaches Python functions - the building blocks of modular, reusable code.
- Python Basics - Imports and Modules: Almost every Python program begins with a few import lines.