Python Hello World and String Manipulation
Get Started (Prerequisites)
Install Anaconda (Python) on your operating system. You can either download anaconda from the official site and install on your own or you can follow these anaconda installation tutorials below.
Install Anaconda on Windows: Link
Install Anaconda on Mac: Link
Install Anaconda on Ubuntu (Linux): Link
Open a Jupyter Notebook
Open your terminal (Mac) or command line and type the following (see 1:16 in the video to follow along) to open a Jupyter Notebook:
jupyter notebook
Print Statements/Hello World
(The code in the post is available on my github)
Type the following into a cell in Jupyter and type shift + enter to execute code.
# This is a one line comment
print('Hello World!')
![](https://miro.medium.com/v2/resize:fit:220/1*tRRBPYjREydsRIcKFa9NPQ.png)
Strings and String Manipulation
Strings are a special type of a python class. As objects, in a class, you can call methods on string objects using the .methodName() notation. The string class is available by default in python, so you do not need an import statement to use the object interface to strings.
# Create a variable
# Variables are used to store information to be referenced
# and manipulated in a computer program.
firstVariable = 'Hello World'
print(firstVariable)
![](https://miro.medium.com/v2/resize:fit:202/1*f0aXyvLgXb7PCV1Xao_D8Q.png)
# Explore what various string methods
print(firstVariable.lower())
print(firstVariable.upper())
print(firstVariable.title())
![](https://miro.medium.com/v2/resize:fit:200/1*8dZfNBBABBSTuXxqE9mI3g.png)
# Use the split method to convert your string into a list
print(firstVariable.split(' '))
![](https://miro.medium.com/v2/resize:fit:252/1*gG7KFXpkNjbYjQgZwgtGTQ.png)
# You can add strings together.
a = "Fizz" + "Buzz"
print(a)
![](https://miro.medium.com/v2/resize:fit:142/1*p7y9qCsQmXAbae7Cf9t_3w.png)
Look up what Methods Do
For new programmers, they often ask how you know what each method does. Python provides two ways to do this.
1. (works in and out of Jupyter Notebook) Use help to lookup what each method does.
![](https://miro.medium.com/v2/resize:fit:700/1*3Mz8PtPFypNrptb9JqyOqA.png)
2. (Jupyter Notebook exclusive) You can also look up what a method does by having a question mark after a method.
# To look up what each method does in jupyter
# (doesnt work in outside of jupyter)
firstVariable.lower?
![](https://miro.medium.com/v2/resize:fit:700/1*VrLofndKpFcsKNAsv5vz9Q.png)
Closing Remarks
Please let me know if you have any questions either here, in the comments section of the youtube video, or through Twitter! The code in the post is also available on my github. Part 2 of the tutorial series is Simple Math.