Withdraw money from ATM
Start
Insert card here
Show(write password)
Enter password
Wrong
password
Is password
correct?
Get money End
1
Insert card here
Show(write password)
Enter password Wrong password
Is password
Get money correct?
2
Repetition (loops)
and Selection (if/else)
3
Boolean Values
■ In programming you often need to know if an expression
is True or False.
■ You can evaluate any expression in Python, and get one of two
answers, True or False.
■ When you compare two values, the expression is evaluated and
Python returns the Boolean answer:
■ Operators:
>
==
<
■ Example:
print(10 > 9)
print(10 == 9)
print(10 < 9)
4
if
■ if statement: Executes a group of statements only if a certain
condition is true. Otherwise, the statements are skipped.
■ Syntax:
if condition:
statements
■ Example:
gpa = 3.4
if gpa > 2.0:
print "Your application is accepted."
5
If/else condition
■ Example:
a = 200
b = 33
if b > a:
print("b is greater than a")
else:
print("b is not greater than a")
■ Example 2:
var1 = int(input(“Enter the first number : ”)
var2 = int(input(“Enter the second number : ”)
if var1 > var2:
print(“var 1 value is - ”, var1, - is greater than var2 value “, var2)
else:
print(“var 2 value is - ”, var2, - is greater than var1 value “, var1)
6
Withdraw money from ATM
Start
Insert card here
Show(write password)
Enter password
Wrong
password
Is password
correct?
Get money End
7
Insert card here
Show(write password)
Enter password Wrong password
Is password
Get money correct?