-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathif-else.py
More file actions
45 lines (37 loc) · 864 Bytes
/
if-else.py
File metadata and controls
45 lines (37 loc) · 864 Bytes
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
"""
demo about if-else
"""
#if
a = 5
if a>0:
print("a is positive")
num = int(input("enter the number"))
if num%2 == 0:
print("Number is even")
a = int(input("Enter a ? "))
b= int(input("enter b"))
c = int(input("Enter c"))
if a>b and a>c:
print("a is largest")
if b>a and b>c:
print("b is largest")
if c>a and c>b:
print("c is largest")
#if-else
age = int(input("Enter your age? "))
if age > 18:
print("You are Eligible")
else:
print("Sorry! you are not eligible")
# if-elif-elif-else
marks = int(input("Enter the marks? "))
if marks > 85 and marks <= 100:
print("Congrats! grade A")
elif marks >60 and marks <= 85:
print("Grade B")
elif marks >40 and marks <=60:
print("Grade c")
elif (marks>30 and marks <= 40):
print("Grade c")
else:
print("you are fail!! ")