-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday_03conditionals.py
More file actions
106 lines (76 loc) · 2.2 KB
/
Copy pathday_03conditionals.py
File metadata and controls
106 lines (76 loc) · 2.2 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#--------------------------------------
#day3_conditionals
#--------------------------------------
#1.Grade calculator
name=str(input("Enter name:"))
English=int(input("Enter marks in English="))
Maths=int(input("Enter marks in Maths="))
Science=int(input("Enter marks in Science="))
avg=(English+Maths+Science)//3
print("Average Marks=",avg)
print("Calculating the Grade:")
if (avg>=85):
print(" Grade:'A' ")
elif (avg>=65 and avg<85):
print("Grade:'B' ")
elif (avg>=45 and avg<65):
print("Garde:'C' ")
else:
print("Failed!")
print("----------------------------------")
#2.Vowel_Consonant
c=str(input("Enter character:"))
vowels='AEIOUaeiou'
if(c in vowels):
print("The given character is a vowel.")
else:
print("The given character is a consonant.")
print("-----------------------------")
#3.Triangle validity
print("The sides of a Triangle:")
a=int(input("a="))
b=int(input("b="))
c=int(input("c="))
if((a+b)>c and (b+c)>a and (a+c)>b):
print("The given sides form a valid Triangle.")
else:
print("It's not a valid Triangle")
print("-------------------------------")
#4.Electricitybill
units=int(input("Enter units:"))
if units<=100:
print("Bill=₹0")
elif(units>100 and units<=200):
print("Bill=₹",(units-100)*5)
elif(units>200):
print("Bill=₹",((100*5)+(units-200)*10))
else:
print("Invalid")
print("------------------------------")
#5.Simple login system
user_name=input("Set username:")
pass=input("Set password:")
print("\nLogin")
username=input("Username:"))
password=input("Password:")
if(user_name==username and pass==password):
print(" Login Successful! ")
elif(user_name!=username):
print("Invalid Username")
else:
print("Invalid Password")
print("--------------------------------")
#6.Discount calculator
print("Discount Calculator")
amt=int(input('Enter the total amount purchased:₹ '))
if amt >=5000:
discount=(5000*(50/100))
final_amt= amt-discount
print("After discount of 50%: ₹ ",final_amt)
elif amt>=2000:
discount=(2000*(20/100))
final_amt= amt-discount
print("After discount of 20%: ₹ ",final_amt)
else:
print("No discounts for purchase less than ₹2000.")
print("-------------------------------")