Data which i have used for this experiment::-
sachin 12
kumar 13
sam 05
Anita 04
Ada 03
Xavier 10
Source Code::-
fp = open("data.txt", "r")
#Opening the file where data is stored
count = 0 #count variable which count no of member who attended less than 5 sessions.
for f in fp:
#Looping one by one line from the file
session = f.split()[1]
#storing no of session people has attended
if int(session) < 5:
#If session is less than 5 then increment the count by one
count +=1
print("%s Club Member Who has attended less than 5 sessions::" %count)
Output::-
2 Club Member Who has attended less than 5 sessions:: |
Output Screen Shot::-
(b)Solution::-
Complexity of the source code is n.I have used one loop inside the program and It will loop one by one item
so it will go 1 to n.
complexity is n.
Untitled - Notepad File Edit Format View Help Algorithms 1.You have been given a 1le with two columns: a name and an integer (whole number representing how many aquatics training sessions the per...