I’ve recently started dabbling in python, you can check out my video series “Python for Absolute Beginners.”
What’s really helped me solidly the concepts I’ve learned thus far, is to explain and teach them to others.
Today’s topic is regarding some helpful shortcuts to turn your code into a beautiful masterpiece. If you’re completely new to python here’s a bit of background to be caught up to speed on the content in this article.
The basics are that a) Python is a general-purpose programming language b) a string is a sequence of one or more characters used to code and communicate with the computer.
An example of a string would be, ‘hello world.’
- len() : this method will return the length (number of characters) of a string.
- lower() : this method eliminates any capitalization in your strings.
- upper() : this method does the opposite of lower() and returns the string completely upper case.
- str() : this method turns non-strings into strings! For example, a 2 alone will not be a string but if you use the function str (2) it will print the value as a string: “2.”
These are just a few examples of strings methods but there are a lot of other interesting ones you can find here.