#mastery15 Use of the conditional “if”

What the “if” does is that if a condition is fulfiled it will do what it is inside of it.

An example of this is

num=1+1

if (num>3):

print (“Hello”) must be idented so it can be part of the if

This program wont print anything because the condition num>3 is not fulfiled , in order for it to print something it must be num<3 or num=2 because num equals 2

num=1+1

if (num<3):

print(“Hello”) must be idented so it can be part of the if

This program will show the user:

Hello the condition is now fulfiled (2<3) 

 

CC BY 4.0 #mastery15 Use of the conditional “if” by Gilberto Rogel García is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.