I am given an text file...I have to write a progr thay reads above file and displays names of females and count of males and fem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am given an text file...I have to write a progr thay reads above file and displays names of females and count of males and fem

please help with python

2nd Apr 2017, 11:21 AM
Juandré
4 Answers
+ 3
Module 4 in the course teaches you how to read files. To say anything more to your question I'd need to know how exactly the data in your file is formatted.
2nd Apr 2017, 11:40 AM
Tob
Tob - avatar
+ 3
In that case I'd recommend to iterate over the file object with a for loop (that will give you the contents line by line) and use the split and strip methods of strings.
3rd Apr 2017, 12:55 AM
Tob
Tob - avatar
0
Helen Simpton - M Todd Clever - F thats the format of the names in the file
2nd Apr 2017, 11:43 AM
Juandré