Page 355 - Information_Practice_Fliipbook_Class11
P. 355

Program 27: Write a program that accepts student data, stores it in a dictionary, and then searches for and displays
            the names of students who have scored more than 75 marks.


            Ans. '''
                 Objective: To display the names of students who have marks above 75

                 Input: studentData
                 Output: names of students who have marks>75

                 '''
                 studentData = {}

                 ch = 'y'

                 while ch == 'y':
                  rollNo = input("Enter Roll No : ")

                  name = input("Enter Name : ")
                  marks = int(input("Enter Marks : "))

                  studentData[rollNo] =[name, marks]
                  ch = input("Do you wish to enter more : ")

                  if ch != 'y':

                    break
                 print(studentData)

                 print("The names of students who have scored more than 75 marks are :")
                 for D in studentData:

                  if studentData[D][1] > 75:
                    print(studentData[D][0])

            Program 28: Write a program to accept the values of principal, rate, and time and calculate the simple interest.

            Ans. '''

                 Objective: To calculate the simple interest

                 Input: principal, rate, time
                 Output: simple interest

                 '''
                 principal = float(input("Enter the principal amount (P): "))

                 rate = float(input("Enter the rate of interest (R) as a percentage: "))
                 time = float(input("Enter the time period (T) in years: "))

                 rate /= 100

                 simpleInterest = principal * rate * time
                 print(f"Simple Interest: {simpleInterest:.2f}")



                                                                                                      Practical  341
   350   351   352   353   354   355   356   357   358   359   360