Page 434 - Computer Science Class 11 With Functions
P. 434
'''
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
def searchRecords ():
'''
Objective : To search for students scoring >75
Input Parameter : None
Return Value : None
'''
print("The names of students who have scored more than 75 marks are :")
for rollNum in studentData:
if studentData[rollNum][1] > 75:
print(studentData[rollNum][0])
acceptData()
print("The data in dictionary is : ")
print(studentData)
searchRecords()
Program 18
Write a program to accept the values of principal, rate, and time and calculate the simple interest.
Ans. def simpleInterest(principal,rate,time):
'''
Objective : To calculate simple interest
Input Parameters :
principal- numeric value denoting principal amount
rate - numeric value denoting rate of interest in % per annum
time - numeric values indicating time period in years
Return Value : None
'''
rate /= 100
simple_interest = principal * rate * time
print(f"Simple Interest: {simple_interest:.2f}")
432 Touchpad Computer Science-XI

