diff --git a/015-If Statements.md b/015-If Statements.md index 8b13789..d06e310 100644 --- a/015-If Statements.md +++ b/015-If Statements.md @@ -1 +1,17 @@ +#What are if statements? +If statements are used in python to tell python that if an argument is true,it should execute a set of instructions +Else it should execute another set of instructions. +If statements must be indented at the end of bracket (): +An example is illustrated below +#Using if statements +E.g to confirm a name that is (ibrahim) lets use an if statement +We first ask the user to input name +We then check if the name entered is ibrahim +The program should print(wrong name) if the name entered is not(ibrahim) + Soln +Line 1- Name=input('enter name:') +Line 2- if (Name=='ibrahim'): +Line 3- print('The name is',Name) +Line 4- else: +Line 5- print('wrong name')