-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbranching.py
43 lines (40 loc) · 1.33 KB
/
branching.py
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
# print('The program starts here')
# answer = input("enter any letter from A to D in Capital letter: ")
# if answer == "A":
# print("You entered A")
# elif answer == "B":
# print("You entered B")
# elif answer == "C":
# print('You entered C')
# elif answer == "D":
# print("You entered D")
# else:
# print("Please Follow the instruction")
# print('The program ends here')
# scores = input("enter the score from 0-100: ")
# scores = int(scores)
# if 70 <= scores <= 100:
# print("Grade = A ")
# elif 60 <= scores <= 69:
# print("Grade = B ")
# elif 50 <= scores <= 59:
# print("Grade = C ")
# elif 45 <= scores <= 49:
# print("Grade = D ")
# elif 40 <= scores <= 44:
# print("Grade = E ")
# elif 0 <= scores <= 39:
# print("Grade = F ")
# else:
# print("INVALID SCORE")
number = input("enter a number: ")
number = int(number)
if number % 6 == 0:
print("the number is divisible by 2 and 3")
elif number % 2 == 0:
print("number is a multiple of 2")
elif number % 3 == 0:
print("number is a multiple of 3")
else:
print("number is not a multiple of 2 or 3")
# the order matters a lot. you have to start with the interception point in your if statement, and then the other conditions come to your elif so long as it has an inclusive if else if statement.