Tuples are technically just immutable lists, but by convention we tend to use tuples and lists for quite different purposes.| www.pythonmorsels.com
Want to turn a list of strings into a single string? You can use the string join method to join a list of strings together (concatenating them with a delimiter of your choice).| www.pythonmorsels.com
Strings can be split by a substring separator. Usually the string split is called without any arguments, which splits on any whitespace.| www.pythonmorsels.com
Wondering how to concatenate a string in Python? Hold on! There are two ways to build up bigger strings out of smaller strings: string concatenation (with +) and string interpolation (with f-strings).| www.pythonmorsels.com
Python programmers typically check for empty lists by relying on truthiness.| www.pythonmorsels.com
Instead of using hard-coded indices to get tuple elements, use tuple unpacking to give descriptive names to each item. Important items should have a name instead of a number.| www.pythonmorsels.com
The range function can be used for counting upward, countdown downward, or performing an operation a number of times.| www.pythonmorsels.com
Sequences are iterables that have a length. Sequences are ordered collections (they maintain the order of their contents). The most common sequences built-in to Python are string, tuple, and list.| www.pythonmorsels.com
Need to represent multiple lines of text in Python? Use Python's multi-line string syntax!| www.pythonmorsels.com
Is your Python program printing out a traceback? You have an uncaught exception! You can catch that exception with a try-except block.| www.pythonmorsels.com
If you need to make a very simple command-line interface and it doesn't need to be friendly, you can read sys.argv to manually process the arguments coming into your program.| www.pythonmorsels.com
Lists are used to store and manipulate an ordered collection of things.| www.pythonmorsels.com
In Python, slicing looks like indexing with colons (:). You can slice a list (or any sequence) to get the first few items, the last few items, or all items in reverse.| www.pythonmorsels.com
In Python, truthiness is asking the question, what happens if I convert an object to a boolean. Every Python object is truthy by default. Truthiness in Python is about non-emptiness and non-zeroness.| www.pythonmorsels.com