forked from kajal200031/basic-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
if elif else.py
94 lines (88 loc) · 2.31 KB
/
if elif else.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#if-elif-else
#1 students marks
marks=int(input("enter the marks:"))
if 90<marks<=100:
print("first grades")
elif 80<marks<=90:
print("second grades")
elif 70<marks<=80:
print("third grades")
elif 33<marks<=70:
print("pass")
else:
print("fail")
#2 greatest among two number
n1=int(input("enter first number:"))
n2=int(input("enter second number:"))
if n1>n2:
print("n1 is greatest")
elif n2>n1:
print("n2 is greatest")
else:
print("both number are equal")
#3 greatest among three number
n1=int(input("enter first number:"))
n2=int(input("enter second number:"))
n3=int(input("enter third number:"))
if n1>n2 and n1>n3:
print("n1 is greatest number")
elif n2>n1 and n2>n3:
print("n2 is greatest number")
elif n3>n1 and n3>n2:
print("n3 is greatest number")
else:
print("both are equal")
#4 type of variable
var1=2+3j
if (type(var1)==int):
print("type of variable is integer:")
elif (type(var1)==float):
print("type of variable is float:")
elif (type(var1)==complex):
print("type of variable is complex:")
elif (type(var1)==bool):
print("type of variable is bool:")
elif (type(var1)==str):
print("type of variable is string:")
elif (type(var1)==tuple):
print("type of variable is tuple:")
elif (type(var1)==list):
print("type of variable is list:")
elif (type(var1)==dict):
print("type of variable is dictionary:")
else:
print("not defined")
#5 print weekdays
n5=int(input("enter the number:"))
if n5==1:
print("sunday")
elif n5==2:
print("Monday")
elif n5==3:
print("Tuesday")
elif n5==3:
print("wednesday")
elif n5==4:
print("Thursday")
elif n5==6:
print("Friday")
elif n5==7:
print("Saturday")
else:
print("write a number between 1 to 7")
#atm
print("enter your card")
pin=int(input("please enter your pin:"))
loc=input("enter the location:")
if loc== "withdrawl cash":
print("please collect your cash")
elif loc=="balance enquiry":
print("your ammount is 476528")
elif loc=="mini statement":
print("check your statement")
elif loc=="pin change":
print("pin changed successfully")
elif loc=="pin generation":
print("pin generation successfully")
else:
print("your transaction is invalid 'please collect your card'")