Question

Untitled - Notepad File Edit Format View Help Algorithms 1.You have been given a 1le with two columns: a name and an integer
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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::

p -open (data.txt, r) #Opening the file where data is stored count #count variable which count no of member who attended

Output Screen Shot::-

2 Club Member Who has attended less than 5 sessions:

(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.

Add a comment
Know the answer?
Add Answer to:
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...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT