Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

015-If statements.md #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions 015-If Statements.md
Original file line number Diff line number Diff line change
@@ -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')