How to make if statement in Python

This tutorial is about if statement in python in minutes and it will help you to understand if statements.

4 months ago   •   2 min read

By Nerd Clump

In this tutorial we are going to learn if statements in python with an example and this help you to create simple if statements. And in this tutorial we are going to ask the user input and then we will use if statements.

Lets Start

First we have to write a code that will ask the user to add input

1. User_Input = input("What's in your Mind:")

This line "User_Input = input("What's in your Mind:")" means when the code get executed then it will ask "What's in your Mind " then you have to give a input.

User_Input = input("What's in your Mind:")
if len(User_Input) <100:
	print("Please Explain More to Continue")

This Line "if len(User_Input) <50:" means that if the user input is less than 50 characters then it will print "Please Explain More to Continue".

Else Statement time !!

We added the else so that the user can know that there's no mistake in their input

User_Input = input("What's in your Mind:")
if len(User_Input) <50:
	print("Please Explain More to Continue")
else:
	print("You're Ready to Continue")

Want Results here you go

If you run the program you'll get this as shown in image 1

Image 1

If the user types less than 50 characters then you will get these results as shown in the image 2

Image 2

If the user types more than 50 characters then you will get these results as shown in the image 3

Image 3

Yeah, That was the tutorial about if statement in python and you should share this tutorial on the social media.

Thanks for Reading How to make if statement in Python on Nerd Clump.

Spread the word

Keep reading