1. Basic String Creation and Assignment
Single Quotes: my_string = 'Hello, World!'
Double Quotes: my_string = "Hello, World!"
Triple Quotes: Useful for multi-line strings or strings containing both single and double quotes.
2. Accessing Characters in Strings
Strings in Python are sequences of characters, so you can access individual characters using indexing:
Slicing allows you to extract a substring from a string:
No comments:
Post a Comment