Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7672043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:11:44+00:00 2026-05-31T16:11:44+00:00

I’ve got this as a homework question and dont know how I should go

  • 0

I’ve got this as a homework question and dont know how I should go about it.

Firstly, I’ve been given a dataset with a list of employees’ names, addresses, emails etc. with about 50 employees in total.

You are asked to write an application to provide information about the members of staff. Your program should prompt the user to enter search criteria. Any members of staff who match the search criteria should be printed to the screen in the following format:

Position Designation Room and Extension Name and Email Address
(columns are tab-separated)

Matching information…………
You will have to amend the dataset for processing, and you may choose to hold this in a separate file, although this is not necessary. Your program should satisfy certain constraints:

  • You should compare each column in the dataset against the search criteria.
  • The comparisons should not be case-sensitive.
  • All output should be in initial capitals, apart from the email address.
  • If a match is found, the results line should be printed and the columns should all line up.
  • Where there is no match, a message should be printed, without a title line.

You should save (1) your program, and (2) a paragraph to explain HOW you accomplished the processing of the dataset.

You should also run these test cases on your application:

  • Search for ‘brenda’
  • Search for all clerical staff.
  • Search for ‘BredNa’
  • Find Dr Carr’s position
  • Which office is Neil located in?

So, firstly, how should I read this dataset? Should I read it in as a text file or create a tuple, dictionary? etc.


staff = [['prof.liam maguire','head of school','academic','MS127','75605','lguire@ulster.ac.uk'],
 ['prof. martin McGinnity','director of intelligent systems research centre','academic','MS112','75616','tinnity@ulster.ac.uk'],
 ['dr laxmidhar Behera','reader','academic','MS107','75276','lra@ulster.ac.uk'],
 ['dr girijesh Prasad','professor','academic','MS137','75645','gad@ulster.ac.uk'],
 ['dr kevin Curran','senior lecturer','academic','MS130','75565','krran@ulster.ac.uk'],
 ['mr aiden McCaughey','Senior Lecturer','academic','MG126','75131','aughey@ulster.ac.uk'],
 ['dr tom Lunney','postgraduate courses co-ordinator (Senior Lecturer)','academic','MG121D','75388','tfney@ulster.ac.uk'],
 ['dr heather Sayers','undergraduate courses','co-ordinator (Senior Lecturer)','academic','MG121C','75148','hmyers@ulster.ac.uk'],
 ['dr liam Mc Daid','senior lecturer','academic','MS016','75452','ljid@ulster.ac.uk'], 
['mr derek Woods','senior lecturer','academic','MS134','75380','dnoods@ulster.ac.uk'],
 ['dr ammar Belatreche','lecturer','academic','MS104','75185','aatreche@ulster.ac.uk'],
 ['mr michael Callaghan','lecturer','academic','MS132','75771','mjllaghan@ulster.ac.uk'],
 ['dr sonya Coleman','lecturer','academic','MS133','75030','saeman@ulster.ac.uk'],
 ['dr joan Condell','lecturer','academic','MS131','75024','jdell@ulster.ac.uk'],
 ['dr damien Coyle','lecturer','academic','MS103','75170','dhle@ulster.ac.uk'],
 ['mr martin Doherty','lecturer','academic','MG121A','75552','merty@ulster.ac.uk'],
 ['dr jim Harkin','lecturer','academic','MS108','75128','jgrkin@ulster.ac.uk'],
 ['dr yuhua Li','lecturer','academic','MS106','75528','yi@ulster.ac.uk'],
 ['dr sandra Moffett','lecturer','academic','MS015','75381','soffett@ulster.ac.uk'],
 ['mrs mairin Nicell','lecturer','academic','MG127','75007','micell@ulster.ac.uk'],
 ['mrs maeve Paris','lecturer','academic','MG040','75212','m@ulster.ac.uk'],
 ['dr jose Santos','lecturer','academic','MG035','75034','jantos@ulster.ac.uk'],
 ['dr nH. Siddique','lecturer','academic','MG037','75340','nhique@ulster.ac.uk'],
 ['dr zumao Weng','lecturer','academic','MG050','75358','zmng@ulster.ac.uk'],
 ['dr shane Wilson','lecturer','academic','MG038','75527','s.on@ulster.ac.uk'],
 ['dr caitriona carr','computing and Technical Support','MG121B','75003','crr@ulster.ac.uk'],
 ['mr neil McDonnell','technical Services Supervisor','computing and Technical Support','MS030 / MF143','75360','ndonnell@ulster.ac.uk'],
 ['mr paddy McDonough','technical Services Engineer','computing and Technical Support','MS034','75322','p.ugh@ulster.ac.uk'],
 ['mr bernard McGarry','network Assistant','computing and Technical Support','MG132','75644','bgrry@ulster.ac.uk'],
 ['mr stephen Friel','secretary','clerical staff','MG048','75148','siel@ulster.ac.uk'],
 ['ms emma McLaughlin','secretary','clerical staff','MG048','75153','eughlin1@ulster.ac.uk'],
 ['mrs. brenda Plummer','secretary','clerical staff','MS126','75605','blmmer@ulster.ac.uk'],
 ['miss paula Sheerin','secretary','clerical staff','MS111','75616','perin@ulster.ac.uk'],
 ['mrs michelle Stewart','secretary','clerical staff','MG048','75382','mwart@ulster.ac.uk']]


matches = []

criterion = input ("please enter search criterion: ")
 criterion = criterion.lower()

for person in staff:
 for characteristic in person:
 if characteristic in person:
 if criterion in characteristic:
 matches.append(person)
 break
 if len(matches) == 0:
 print("No Match")
 else:
  print("POSITION |||DESIGNATION ||| EXT & ROOM NO||| NAME & EMAIL")
 for i in matches:
 print (i[1].title(),': ',i[2].title(),':',i[3].upper()+ i[4],':',i[0].title(), i[5].title())`

This is what ive came up with so far and it seems to work, is there any improvements you would make?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:11:45+00:00Added an answer on May 31, 2026 at 4:11 pm

    Thank you for being honest and telling us that this is a homework question. StackOverflow discourages straight-up giving out answers to homework questions, but we can guide you towards the correct answer.

    With regards to “amend the dataset for processing”: This implies that the data is not currently in a consistent format. The first thing you need to do is look at the data you’ve been given, and decide the best representation for the data.

    I’d recommend a columnar tab-delimited data file- this is easily created in Microsoft Excel by placing the data in a spreadsheet, and saving it as text. (Excel will complain that it will lose all the various things that make it a spreadsheet instead of a text file, but that’s okay- you want a text file.) Save the updated file.

    Excel produced what’s called a tab-delimited text file: a 2-dimensional grid of data (like the shape of a spreadsheet), represented with one row of data per line (rephrased, the linebreak symbol is used to separate rows of data, which text editors interpret as a command to start writing on a new line), and the tab character (written in Python within an escaped string as \t, but really a single character of its own) separating cells within each row. This is also known as tab-separated values, or TSV. Closely related is comma-separated values, or CSV, which is another option in Excel. CSV can also stand for character-separated values, which is the general term for any text file representing a grid of data by using some character (‘,’ for comma-separated, ‘\t’ for tab-separated) to separate records.

    CSVs are a very common file format, so Python is ready to help you out here. Python has a library, csv, designed to read these files for you. If you used Excel text format, you’ll need to tell it your dialect is excel-tab, since that symbolizes tab-delimited files as Excel outputs them.

    You’ll need to construct a csv.reader to read your formatted data file. Use the order you put the columns in to understand the lists that you get when you read the CSV one line at a time- the order of the columns and the order of the items in each row is the same, so use that information to index correctly into the list to find each field.

    Once you’ve read a row, what do you want to do with it?

    You have a choice of storage formats in your program:

    • Save every record to a list (acting like a list of lists, since each record acts like a list). Now it’s loaded, and when you want to search it, you iterate over your entire list-of-lists and use equality testing to find matches. This can be done with a list comprehension, which is almost certainly what your teacher is looking for.
    • Additionally, create a dict for each column of the file, and store every record in every dictionary: each dict maps that column value to your key. There’s a catch here! A dict can only store one record for each key, but you’ll definitely have different personnel in the same “designation” (multiple professors, multiple clerical staff, etc.) and there’s no way to be sure that no two people will have the same name, either. Your indexing dicts will have to store lists of records themselves, not just single records.

    The second approach is much faster for repeated queries, since you’re organizing all the records at the start for fast lookup. The first is much easier to implement, however, and is more likely to be what your teacher expects. I’d recommend implementing the first, understanding it, and then if you have time, implement the second.

    The user interface for all this is up to you, of course, but this should put you well on your way to implementing the core of the program. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.