Practical File 1. name = input("Enter name: ") desig = input("Enter Designation(GM, M, AM, any other): ") b = int(input("Enter basic salary: ")) if desig == "GM": a = 0.7 * b elif desig == "M": a = 0.5 * b elif desig == "AM": a = 0.3 * b else: a = 0.1 * b gross = b + a if gross >= 100000: tax = 0.1 * gross else: tax = 0.05 * gross net = gross - tax if desig == "GM": desig = "General Manager" elif desig == "M": desig = "Manager" elif desig == "AM": desig = "Assistant Manager" else: desig = "Employee" print("Name: ", name, "|", "Designation: ", desig, "|","Basic Salary: ", b) print("Arrears: ", a, "|", "Tax: ", tax, "|","Net Salary: ", net) 1. OUTPUT Enter name: Aaron Thomas Enter Designation(GM, M, AM, any other): M Enter basic salary: 50000 Name: Aaron Thomas | Designation: Manager | Basic Salary: 50000 Arrears: 25000.0 | Tax: 3750.0 | Net Salary: 71250.0 2. a = int(input("Enter coefficient of x^2: ")) b = int(input("Enter coefficient of x: ")) c = int(input("Enter constant: ")) d = b ** 2 - 4 * a * c if d >= 0: print("The roots are real") r1 = (-b + d ** 0.5) / 2 * a r2 = (-b - d ** 0.5) / 2 * a print("The roots are ", r1, ", ", r2) else: print("The roots are not real") 2. OUTPUT Enter coefficient of x^2: 2 Enter coefficient of x: 5 Enter constant: 2 The roots are real The roots are -2.0 , -8.0 3. calls = int(input("Enter your no. of calls: ")) if calls < 100: b=0 elif 100 <= calls <= 300: b = (calls - 100) * 0.5 elif 300 < calls < 600: b = (200 * 0.5) + (calls - 300) * 0.75 else: b = (200 * 0.5) + (300 * 0.75) + (calls - 600) * 1 print("Mobile Bill: ", b, sep = "₹") 3. OUTPUT Enter your no. of calls: 100 Mobile Bill: ₹0.0 Enter your no. of calls: 200 Mobile Bill: ₹50.0 Enter your no. of calls: 300 Mobile Bill: ₹100.0 Enter your no. of calls: 400 Mobile Bill: ₹175.0 Enter your no. of calls: 500 Mobile Bill: ₹250.0 Enter your no. of calls: 600 Mobile Bill: ₹325.0 Enter your no. of calls: 700 Mobile Bill: ₹425.0 4. amt = int(input("Enter amount: ")) t = int(input("Enter time period: ")) if t >= 5: s = amt * 0.1 if amt >= 6000 and t >= 1: s = amt * 0.08 if 2000 <= amt < 6000 and t >= 2: s = amt * 0.07 if amt < 2000 and t >= 2: s = amt * 0.05 print("Simple Interest: ", s, sep = "₹") 4. OUTPUT Enter amount: 6000 Enter time period: 5 Simple Interest: ₹480.0 Enter amount: 7000 Enter time period: 1 Simple Interest: ₹560.0 Enter amount: 4000 Enter time period: 2 Simple Interest: ₹280.0 Enter amount: 1500 Enter time period: 3 Simple Interest: ₹75.0 5. a = float(input("Enter num1: ")) b = float(input("Enter num2: ")) c = float(input("Enter num3: ")) if b < a > c: if b > c: max, mid, min = a, b, c else: max, mid, min = a, c, b elif a < b > c: if a > c: max, mid, min = b, a, c else: max, mid, min = b, c, a elif a < c > b: if a > b: max, mid, min = c, a, b else: max, mid, min = c, b, a print("Ascending Order:", min, ",", mid, ",", max) 5. OUTPUT Enter num1: 45 Enter num2: 67 Enter num3: 21 Ascending Order: 21.0 , 45.0 , 67.0 6. for i in range(0,3): name = input("Enter name: ") sub1 = float(input("Enter marks in sub1: ")) sub2 = float(input("Enter marks in sub2: ")) sub3 = float(input("Enter marks in sub3: ")) agg = (sub1 + sub2 + sub3) / 3 if agg >= 90: grade = "A" elif agg >= 70 and agg < 90: grade = "B" else: grade = "C" print("Aggregate: ", agg, "%", "\nGrade: ", grade) print(" ") 6. OUTPUT Enter name: Aaron Enter marks in sub1: 56 Enter marks in sub2: 78 Enter marks in sub3: 90 Aggregate: 74.66666666666667 % Grade: B Enter name: Jason Enter marks in sub1: 89 Enter marks in sub2: 66 Enter marks in sub3: 79 Aggregate: 78.0 % Grade: B Enter name: Arnav Enter marks in sub1: 90 Enter marks in sub2: 93 Enter marks in sub3: 96 Aggregate: 93.0 % Grade: A 7. n = int(input("Enter num: ")) f=1 for i in range(1, n + 1): f=f*i print(f) 7. OUTPUT Enter num: 5 120 8. n1 = int(input("Enter num1: ")) n2 = int(input("Enter num2: ")) if n1 < n2: a = n1 b = n2 else: a = n2 b = n1 print("Odd numbers between", a, "and", b, ": ") for i in range(a, b + 1): if i % 2 == 1: print(i, end = ", ") 8. OUTPUT Enter num1: 6 Enter num2: 20 Odd numbers between 6 and 20 : 7, 9, 11, 13, 15, 17, 19, 9. n=0 while n != 4: print("\n1 --> Area of circle \n2 --> Area of square \n3 --> Area of Rectangle \n4 --> Exit") n = int(input("Enter num(between 1 - 4): ")) if n == 1: r = float(input("Enter radius of circle: ")) area = 3.14 * (r ** 2) print("Area:", area) elif n == 2: s = float(input("Enter side of square: ")) area = s ** 2 print("Area:", area) elif n == 3: l = float(input("Enter length of rectangle: ")) b = float(input("Enter breadth of rectangle: ")) area = l * b print("Area:", area) elif n == 4: print("Thanks") else: print("Please enter a number between 1 - 4") 9. OUTPUT 1 --> Area of circle 2 --> Area of square 3 --> Area of Rectangle 4 --> Exit Enter num(between 1 - 4): 1 Enter radius of circle: 7 Area: 153.86 1 --> Area of circle 2 --> Area of square 3 --> Area of Rectangle 4 --> Exit Enter num(between 1 - 4): 2 Enter side of square: 4 Area: 16.0 1 --> Area of circle 2 --> Area of square 3 --> Area of Rectangle 4 --> Exit Enter num(between 1 - 4): 3 Enter length of rectangle: 5 Enter breadth of rectangle: 4 Area: 20.0 1 --> Area of circle 2 --> Area of square 3 --> Area of Rectangle 4 --> Exit Enter num(between 1 - 4): 4 Thanks 10. i=0 s=0 while i < 10: n=int(input("Enter a number: ")) if n % 10 == 7: s=s+n i=i+1 print(s) 10. OUTPUT Enter a number: 7 Enter a number: 17 Enter a number: 90 Enter a number: 45 Enter a number: 0 Enter a number: 2 Enter a number: 5 Enter a number: 8 Enter a number: 194 Enter a number: 45463 24 11. n = int(input("Enter number: ")) t=n rev = 0 while n > 0: r = n % 10 rev = rev * 10 + r n = n // 10 if t == rev: print("Palindrome") else: print("Not Palindrome") 11. OUTPUT Enter number: 10 Not Palindrome Enter number: 121 Palindrome 12. a = int(input("Enter sub1 marks: ")) b = int(input("Enter sub2 marks: ")) c = int(input("Enter sub3 marks: ")) d = int(input("Enter sub4 marks: ")) e = int(input("Enter sub5 marks: ")) per = (a + b + c + d + e) / 5 if per >= 50: print("You have passed") else: print("You have failed") 12. OUTPUT Enter sub1 marks: 90 Enter sub2 marks: 70 Enter sub3 marks: 80 Enter sub4 marks: 56 Enter sub5 marks: 89 You have passed Enter sub1 marks: 45 Enter sub2 marks: 34 Enter sub3 marks: 69 Enter sub4 marks: 30 Enter sub5 marks: 23 You have failed 13. n = int(input("Enter n: ")) flag = 1 for i in range(2, n): if n % i == 0: flag = -1 break if flag == -1: print("The number is composite") else: print("The number is prime") 13. OUTPUT Enter n: 10000 The number is composite Enter n: 5 The number is prime 14. n1 = int(input("Enter n1: ")) n2 = int(input("Enter n2: ")) for i in range(n2, n1 - 1, -1): print("--------------------") for j in range(1, 6): print(i, "x", j, "=", i * j) 14. OUTPUT Enter n1: 1 Enter n2: 3 -------------------3x1=3 3x2=6 3x3=9 3 x 4 = 12 3 x 5 = 15 -------------------2x1=2 2x2=4 2x3=6 2x4=8 2 x 5 = 10 -------------------1x1=1 1x2=2 1x3=3 1x4=4 1x5=5 15. x = int(input("Enter x: ")) n = int(input("Enter n: ")) sum = 0 sign = 1 for i in range(1, n + 1): fac = 1 for j in range(1, i + 1): fac = fac * j p = x ** i sum = sum + sign * (p/fac) sign = sign * -1 print(sum) 15. OUTPUT Enter x: 5 Enter n: 5 13.333333333333332 16. r = int(input("Enter number of rows: ")) for i in range(1, r + 1): c = "A" for j in range(1, i + 1): print(c, end = " ") k = ord(c) + 1 c = chr(k) print() 16. OUTPUT Enter number of rows: 5 A AB ABC ABCD ABCDE 17. r = int(input("Enter number of rows: ")) for i in range(1, r + 1): c = "A" for j in range(1, i + 1): print(c, end = " ") k = ord(c) + 1 c = chr(k) k = ord(c) - 2 c = chr(k) for l in range(i - 1, 0, -1): print(c, end = " ") k = ord(c) - 1 c = chr(k) print() 17. OUTPUT Enter number of rows: 5 A ABA ABCBA ABCDCBA ABCDEDCBA 18. r = int(input("Enter number of rows: ")) for i in range(1, r + 1): c = "A" print(" " * (r - i), end = " ") for j in range(1, i + 1): print(c, end = " ") k = ord(c) + 1 c = chr(k) k = ord(c) - 2 c = chr(k) for l in range(i - 1, 0, -1): print(c, end = " ") k = ord(c) - 1 c = chr(k) print() 18. OUTPUT Enter number of rows: 5 A ABA ABCBA ABCDCBA ABCDEDCBA 19. s = input("Enter message: ") n = "" for i in s: if i >= "A" and i < "Z": o = ord(i) + 33 n = n + chr(o) elif i == "Z": n = n + "a" elif i > "a" and i <= "z": o = ord(i) - 33 n = n + chr(o) elif i == "a": n = n + "Z" elif i == " ": n = n + "#" elif i == "#": n=n+"" else: n=n+i print("Coded message: ", n) 19. OUTPUT Enter message: bob BOB99 Coded message: ANA#cpc99 20. ch = "y" L = [] while ch != "n": n = input("Enter string: ") L.append(n) ch = input("y or n? ") S = [] for i in L: if i[0] == i[-1]: S.append(i) print("Strings starting and ending with same char: ", S) 20. OUTPUT Enter string: aaron y or n? y Enter string: malayalam y or n? y Enter string: 6966 y or n? y Enter string: python y or n? n Strings starting and ending with same char: ['malayalam', '6966'] 21. ch = "y" L = [] while ch != "n": n = int(input("Enter number: ")) L.append(n) ch = input("y or n? ") P = [] R = [] for i in L: s = str(i) if s == s[::-1]: P.append(int(i)) else: R.append(int(i)) print("Palindromes: ", P) print("Not palindromes: ", R) 21. OUTPUT Enter number: 2345 y or n? y Enter number: 232 y or n? y Enter number: 111 y or n? y Enter number: 56435 y or n? n Palindromes: [232, 111] Not palindromes: [2345, 56435] 22. s = input("Enter string: ") a = s.split() c=0 for i in a: if i[-1] in "aeiouAEIOU": c=c+1 print("Strings not ending with consonant: ", i, end = " ") print() print("No. of strings not ending with consonant:", c) 22. OUTPUT Enter string: aaron ooo boy pasta ooo pasta No. of strings not ending with consonant: 2 23. ch = "y" L = [] while ch != "n": n = input("Enter string: ") L.append(n) ch = input("y or n? ") for i in L: print("#".join(i)) 23. OUTPUT Enter string: apple y or n? y Enter string: orange y or n? y Enter string: banana y or n? n a#p#p#l#e o#r#a#n#g#e b#a#n#a#n#a 24. ch = "y" L = [] while ch != "n": n = int(input("Enter number: ")) L.append(n) ch = input("y or n? ") e=0 o=0 le = [] lo = [] for i in L: if i % 2 == 0: le.append(i) e=e+1 else: lo.append(i) o=o+1 print("Even nos.:", le, "Count:", e) print("Odd nos.:", lo, "Count:", o) 24. OUTPUT Enter number: 34 y or n? y Enter number: 5699 y or n? y Enter number: 1 y or n? y Enter number: 72 y or n? 4221 Enter number: 4221 y or n? n Even nos.: [34, 72] Count: 2 Odd nos.: [5699, 1, 4221] Count: 3 25. t = (20, 40.5, "hello", 71, 18, "Bye") s = () c=0 for i in t: if type(i) == int or type(i) == float: c=c+1 elif type(i) == str: s = s + (i,) print("No. of numeric values:", c) print("Strings:", s) 25. OUTPUT No. of numeric values: 4 Strings: ('hello', 'Bye') 26. ch = "y" s = () while ch != "n": ch = input("Enter string: ") if ch == "n": break s = s + (ch,) t = () for i in s: if len(i) % 2 != 0: k = len(i) // 2 if i[k] in "aeiouAEIOU": t = t + (i,) print("Strings whose middle char is a vowel:", t) 26. OUTPUT Enter string: vwoel Enter string: aaron Enter string: owowo Enter string: sdakfjh Enter string: n Strings whose middle char is a vowel: ('vwoel', 'owowo') 27. emp = {} ch = "" while ch != "5": print("1.Add\n2.Display all\n3.Search\n4.Modify\n5.Exit") ch = input("Enter choice: ") print() if ch == "1": eno = int(input("Enter employee no.: ")) name = input("Enter name: ") desig_num = input("1.GENERAL MANAGER\n2.MANAGER\n3.ASSISTANT MANAGER\n4.ANY OTHER\nEnter designation code: ") if desig_num == "1": desig = "General Manager" elif desig_num == "2": desig = "Manager" elif desig_num == "3": desig = "Assistant Manager" else: desig = "Other" basic = int(input("Enter basic salary: ")) v = [name, desig, basic] emp[eno] = v print() elif ch == "2": for i in emp: print("Employee Number:", i) print("Name:", emp[i][0]) if emp[i][1] == "General Manager": print("Designation: ", emp[i][1]) hra = emp[i][2] * 0.85 elif emp[i][1] == "Manager": print("Designation: ", emp[i][1]) hra = emp[i][2] * 0.80 elif emp[i][1] == "Assistant Manager": print("Designation: ", emp[i][1]) hra = emp[i][2] * 0.50 else: print("Designation: ", emp[i][1]) hra = emp[i][2] * 0.30 tot = emp[i][2] + hra print("Basic Salary:", emp[i][2]) print("HRA:", hra) print("Total:",tot) print() elif ch == "3": empno = int(input("Enter the employee number for search: ")) if empno in emp: print("Name: ",emp[empno][0]) print("Designation: ",emp[empno][1]) print("Basic salary: ",emp[empno][2]) print("HRA:", hra) print("Total:",tot) print() else: print("Invalid number") print() elif ch == "4": mod_eno = int(input("Enter the employee number to modify: ")) if mod_eno in emp: name = input("Enter name: ") desig_num = input("1.GENERAL MANAGER\n2.MANAGER\n3.ASSISTANT MANAGER\n4.ANY OTHER\nEnter designation code: ") if desig_num == "1": desig = "General Manager" elif desig_num == "2": desig = "Manager" elif desig_num == "3": desig = "Assistant Manager" else: desig = "Other" basic = int(input("Enter basic salary: ")) v = [name, desig, basic] emp[mod_eno] = v print() else: print("Invalid employee number") 27. OUTPUT 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 1 Enter employee no.: 11 Enter name: Aaron Thomas 1.GENERAL MANAGER 2.MANAGER 3.ASSISTANT MANAGER 4.ANY OTHER Enter designation code: 2 Enter basic salary: 40000 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 1 Enter employee no.: 22 Enter name: Joel John 1.GENERAL MANAGER 2.MANAGER 3.ASSISTANT MANAGER 4.ANY OTHER Enter designation code: 3 Enter basic salary: 30000 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 2 Employee Number: 11 Name: Aaron Thomas Designation: Manager Basic Salary: 40000 HRA: 32000.0 Total: 72000.0 Employee Number: 22 Name: Joel John Designation: Assistant Manager Basic Salary: 30000 HRA: 15000.0 Total: 45000.0 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 3 Enter the employee number for search: 22 Name: Joel John Designation: Assistant Manager Basic salary: 30000 HRA: 15000.0 Total: 45000.0 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 4 Enter the employee number to modify: 11 Enter name: Kevin de bruyne 1.GENERAL MANAGER 2.MANAGER 3.ASSISTANT MANAGER 4.ANY OTHER Enter designation code: 1 Enter basic salary: 50000 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 2 Employee Number: 11 Name: Kevin de bruyne Designation: General Manager Basic Salary: 50000 HRA: 42500.0 Total: 92500.0 Employee Number: 22 Name: Joel John Designation: Assistant Manager Basic Salary: 30000 HRA: 15000.0 Total: 45000.0 1.Add 2.Display all 3.Search 4.Modify 5.Exit Enter choice: 5 28. stu = {} ch = "" while ch != "6": print("1.Add\n2.Search by name\n3.Search by grade\n4.Modify by Reg no.\n5.Display all\n6.Exit") ch = input("Enter choice: ") flag = 0 if ch == "1": reg = int(input("Enter Reg. no: ")) name = input("Enter name: ") agg = int(input("Enter aggregate: ")) if agg >= 70: grade = "A" elif agg >= 50 and agg < 70: grade = "B" else: grade = "C" stu[reg] = [name, agg, grade] print() elif ch == "2": n_search = input("Enter name for search: ") for i in stu: if stu[i][0] == n_search: flag = 1 print("Reg. no:", i) print("Aggregate:", stu[i][1]) print("Grade:", stu[i][2]) if flag == 0: print("No data") print() elif ch == "3": g_search = input("Enter grade for search: ") for i in stu: if stu[i][2] == g_search: flag = 1 print("Name:", stu[i][0]) print("Reg. no:", i) print("Aggregate:", stu[i][1]) if flag == 0: print("No data") print() elif ch == "4": r_mod = int(input("Enter reg no to modify: ")) if r_mod in stu: name = input("Enter new name: ") agg = int(input("Enter new aggregate: ")) if agg >= 70: grade = "A" elif agg >= 50 and agg < 70: grade = "B" else: grade = "C" stu[reg] = [name, agg, grade] else: print("No data") print() elif ch == "5": for i in stu: print("Name:", stu[i][0]) print("Reg. no:", i) print("Aggregate:", stu[i][1]) print("Grade:", stu[i][2]) print() elif ch == "6": print("Thank you") else: print("Invalid number") print() 28. OUTPUT 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 1 Enter Reg. no: 25700 Enter name: Aaron Enter aggregate: 70 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 1 Enter Reg. no: 26789 Enter name: Arnav Enter aggregate: 50 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 2 Enter name for search: Arnav Reg. no: 26789 Aggregate: 50 Grade: B 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 3 Enter grade for search: A Name: Aaron Reg. no: 25700 Aggregate: 70 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 4 Enter reg no to modify: 26789 Enter new name: Joel Enter new aggregate: 68 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 5 Name: Aaron Reg. no: 25700 Aggregate: 70 Grade: A Name: Joel Reg. no: 26789 Aggregate: 68 Grade: B 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 7 Invalid number 1.Add 2.Search by name 3.Search by grade 4.Modify by Reg no. 5.Display all 6.Exit Enter choice: 6 Thank you 29. data = {"AE789" : ["Aaron","2025-01-31"], "BG789" : ["Mbappe","2027-11-23"], "SZ789" : ["Kevin","2026-06-15"]} ch = "" while ch != "5": print("1.Search by year\n2.Search by month\n3.Search by name\n4.Search by passport no.\n5.Exit") ch = input("Enter choice: ") flag = 0 if ch == "1": y = input("Enter year to search: ") for i in data: if y == data[i][1][0:4]: flag = 1 print("Name:", data[i][0]) print("Passport no:", i) if flag == 0: print("Invalid year input") print() elif ch == "2": m = input("Enter month to search: ") for i in data: if m == data[i][1][5:7]: flag = 1 print("Name:", data[i][0]) print("Passport no:", i) if flag == 0: print("Invalid month input") print() elif ch == "3": n = input("Enter name for search: ") for i in data: if n == data[i][0]: flag = 1 print("Passport no:", i) print("Expiry date:", data[i][1]) if flag == 0: print("Invalid name") print() elif ch == "4": pass_num = input("Enter passport no. to search: ") if pass_num in data: print("Name:", data[pass_num][0]) print("Expiry date:", data[pass_num][1]) else: print("Invalid passport number") print() elif ch == "5": print("Thank you") else: print("Invalid number") print() 29. OUTPUT 1.Search by year 2.Search by month 3.Search by name 4.Search by passport no. 5.Exit Enter choice: 1 Enter year to search: 2027 Name: Mbappe Passport no: BG789 1.Search by year 2.Search by month 3.Search by name 4.Search by passport no. 5.Exit Enter choice: 2 Enter month to search: 01 Name: Aaron Passport no: AE789 1.Search by year 2.Search by month 3.Search by name 4.Search by passport no. 5.Exit Enter choice: 3 Enter name for search: Kevin Passport no: SZ789 Expiry date: 2026-06-15 1.Search by year 2.Search by month 3.Search by name 4.Search by passport no. 5.Exit Enter choice: 4 Enter passport no. to search: AE789 Name: Aaron Expiry date: 2025-01-31 1.Search by year 2.Search by month 3.Search by name 4.Search by passport no. 5.Exit Enter choice: 5 Thank you 30. data = {} ch = "" while ch != "6": print("1.Add\n2.Search by salt\n3.Search by disease\n4.List of medicines\n5.Remove by med name\n6.Exit") ch = input("Enter choice: ") flag = 0 if ch == "1": med = input("Enter medicine name: ") salt = input("Enter name of salt: ") disease = input("Enter name of disease: ") price = int(input("Enter price of medicine: ")) data[med] = [salt, disease, price] print() elif ch == "2": salt = input("Enter salt to search: ") for i in data: if salt == data[i][0]: flag = 1 print("Med name:", i) print("Disease:", data[i][1]) print("Price:", data[i][2]) if flag == 0: print("Invalid salt name") elif ch == "3": disease = input("Enter disease to search: ") for i in data: if disease == data[i][1]: flag = 1 print("Med name:", i) print("Salt:", data[i][0]) print("Price:", data[i][2]) if flag == 0: print("Invalid disease name") print() elif ch == "4": for i in data: print("Med name:", i) print("Salt:", data[i][0]) print("Disease:", data[i][1]) print("Price:", data[i][2]) print() elif ch == "5": med = input("Enter med name to modify: ") if med in data: med = input("Enter new medicine name: ") salt = input("Enter new name of salt: ") disease = input("Enter new name of disease: ") price = int(input("Enter new price of medicine: ")) data[med] = [salt, disease, price] print() else: print("Invalid med name") elif ch == "6": print("Thank you") else: print("Invalid number") print() 30. OUTPUT 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 1 Enter medicine name: Paracetamol Enter name of salt: Magnesium Enter name of disease: Cold Enter price of medicine: 20 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 1 Enter medicine name: Crocine Enter name of salt: Iron Enter name of disease: Cancer Enter price of medicine: 50 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 2 Enter salt to search: Iron Med name: Crocine Disease: Cancer Price: 50 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 3 Enter disease to search: Cold Med name: Paracetamol Salt: Magnesium Price: 20 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 4 Med name: Paracetamol Salt: Magnesium Disease: Cold Price: 20 Med name: Crocine Salt: Iron Disease: Cancer Price: 50 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 5 Enter med name to modify: Crocine Enter new name of salt: Aluminium Enter new name of disease: Viral fever Enter new price of medicine: 40 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 4 Med name: Paracetamol Salt: Magnesium Disease: Cold Price: 20 Med name: Crocine Salt: Aluminium Disease: Viral fever Price: 40 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 7 Invalid number 1.Add 2.Search by salt 3.Search by disease 4.List of medicines 5.Remove by med name 6.Exit Enter choice: 6 Thank you