Welcome back to another Python tutorial, In this tutorial, I will show you how to make a simple login using if statements and strings.

 

To start, make a new python file, name it what you like. Once created remember to type the following:

import os

import sys

import time

We won’t be using any of these but we may in a future tutorial. Once that’s typed into the file set your password to your liking by typing:

password = “Example”

Type the password you want where it says “Example”, Make sure you use quotation marks. Proceed by typing the following:

if password == input(“Enter Password:”)

print(“Correct Password”)

The Input() function allows you to type something from the console and then will check if it equal (==) to the password if it is, it will output saying “Correct Password”.

 

In the end, your file should look something like this.Python Tutorial 3 - Simple login 1

 

In the next tutorial, I will show you how to download new imports.

 

Previous Tutorial

 

Leave a Reply