-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_10Control_Statements.py
More file actions
75 lines (55 loc) · 1.28 KB
/
Python_10Control_Statements.py
File metadata and controls
75 lines (55 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
NEED of CONTROL STATEMENT
➡️ It can be used beyond the sequenctial execution
CONTROL STATEMENT / CONDITIONAL STATEMENT
Control Statement are statements which control or change the flow of execution.
1- IF STATEMENT #CONDITIONAL STATEMENT
2- IF ELIF #CONDITIONAL STATEMENT
3- IF ELIF ELSE #CONDITIONAL STATEMENT
4- WHILE LOOP
5- FOR LOOP
6- BREAK STATEMENT
7- CONTINUE STATEMENT
8- PASS
9- ASSERT STATEMENT
10-RETURN STATEMENT
"""
"""
1- IF STATEMENT
if condition:
statement
"""
#CODE1
"""if 2>1:
print("Greater") #condition is true that is why we are able to see the output
if 2<1:
print("NO OUTPUT will be printed here") #condition is not true """
#CODE2
"""number = int(input("Enter a number : "))
if number >= 0:
print("Number is positive")
"""
"""
2- IF-ELSE
if condition:
statement
else
statement
"""
#CODE3
"""number = int(input("Enter the number : "))
if number>=0:
print("Positive")
else:
print("Negative")"""
"""
3- IF ELIF
"""
#CODE4
Bill = int(input("Enter your billing amount : $" ))
if Bill>=10000:
print("You are elligible for the discount")
elif Bill >=1 and Bill < 9999:
print("Sorry but you are not elligible for the discount SHOP MORE !!!")
else:
print("Invalid AMOUNT, Enter valid amount ")