From 4519167a2e1e226c7137d802e131b84704f07945 Mon Sep 17 00:00:00 2001 From: yabagiibrahim <55027665+yabagiibrahim@users.noreply.github.com> Date: Mon, 7 Oct 2019 02:04:58 +0100 Subject: [PATCH] 015-If statements.md I hope this helps --- 015-If Statements.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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')