Welcome back, in this tutorial you will learn how to use if statements and variables.


Start off by creating a new file, name it whatever you wish.

For this program, you don’t need to import anything but I would recommend you

import os

import sys

import time

as it’ll save time in the long run when we work on more advanced programs.


A string is something the computer stores

example:Python tutorial 2 - if statements and Strings 1

In this example, the string variable1 is storing “Hello World”. you can use this to output something without writing it multiple times.


An if statement works by checking something and if it exists it will listen to the following code if it doesn’t exist, it will either end the program or look for an “else” statement.


if statement example:Python tutorial 2 - if statements and Strings 2

In this example, the computer will output “Hello World” because the if statement is true.




In the next python tutorial, I will be teaching how to set up a simple login interface using if statements, and strings.


Previous Tutorial


Leave a Reply