Question

We will build one Python application via which users can perform various analytics tasks on data...

We will build one Python application via which users can perform various analytics tasks on data in 2-D table (similar to Spreadsheet) format which looks like:

Column Name 1

Column Name 2

Column Name 3

Column Name N


In this table, each row represents the data of one object that we are interested in. Columns, on the other hand, represent the attributes of these objects. For example, this table could represent students’ academic records. Each student’s record is defined with the following column names (as an example):

  • CWID: the student’s CWID
  • FirstName: the student’s first name
  • LastName: the student’s last name
  • Gender: the student’s gender (‘M’ or ‘F’)
  • BirthDate: the student’s date of birth (e.g. ‘03/14/1999’)
  • ClassID: the class id that the student took
  • ClassDate: the date when the student took the class (e.g. ‘01/26/2018’)
  • Grade: the student’s grade for the class

Since one student could take multiple classes, there might be multiple records in the table for a given student. For this assignment, you will write a script to implement such a table with Python built-in data object types such as list and dictionary etc. The script you write should support the following:

  • Ask the user to enter the number of student objects in the table
  • For each student object, ask the user to enter the data using the following format:

CWID:34726, FirstName:John, ……, Grade=A

Your script will be implemented as follows:

  1. Each student object is implemented with a Python dictionary object where column names are the keys and the value associated with each key is that for the key.
  2. Create a list object to store all dictionary objects created in step 1.
  3. To facilitate the operation of finding all student objects for a given ClassID, the script also create another dictionary object that use the possible ClassID values as keys. The dictionary object keeps track of the mapping between any ClassID and the list of student objects with that ClassID.

Please make sure that you do the following:

  • Add comments in your code
  • Attach the test data and results in your deliverable.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

I HOPE ITS HELPFULL TO YOU ...IF YOU HAVE ANY DOUBTS PLS COMMENTS BELOW...I WILL BE THERE TO HELP YOU...PLS RATE THUMBS UP...!! ALL THE BEST ...

ANSWER::-

AS FOR GIVEN DATA....

NOTE ::-

I have implemented an operation to search list of students based on class id, as only that operation was mentioned in the question. Please find the details.

CODE ::- # List of all students all_student_list = [] # Dictionary to hold students with class id as key and its associated value as list of # students. all_student_class_id = {} # Asking user to provide total number of students N = input("Total number of student? ") idx = 1 # Looping N times seeking student details and adding them to list and dictionary accordingly. for i in range(int(N)): print(" Please provide details of student " + str(idx) + " ") ID = input("Please provide student ID: ") first_name = input("Please provide student first name: ") last_name = input("Please provide student last name: ") gender = input("Please provide student gender ('M' or 'F'): ") dob = input("Please provide student date of birth (MM/dd/yyyy): ") class_id = input("Please provide class id of the student: ") class_date = input("Please provide class date (MM/dd/yyyy): ") grade = input("Student grade for the class: ") # Creating a single record (like a row in the spreadsheet) student_detail = {'ID': ID, 'first_name': first_name, 'last_name': last_name, 'gender': gender, 'dob': dob, 'class_id': class_id, 'class_date': class_date, 'grade': grade} # adding this record to the list all_student_list.append(student_detail) # also adding to the list of corresponding class id if class_id not in all_student_class_id: all_student_class_id[class_id] = [] all_student_class_id[class_id].append(student_detail) idx += 1 # To Perform search operation, asking class id to search for all students with this class id search_class_id = input(" Enter class id to be searched for: ") # Getting details fo the student list for this class id lst_students = all_student_class_id[search_class_id] idx = 1 # Looping through the list and printing details of each student. for stud in lst_students: print(" Please find details of student " + str(idx) + " ") print('ID:' + stud['ID']) print('First Name: ' + stud['first_name']) print('Last Name: ' + stud['last_name']) print('Gender: ' + stud['gender']) print('Date of Birth: ' + stud['dob']) print('Class Id: ' + stud['class_id']) print('Class Date: ' + stud['class_date']) print('Grade: ' + stud['grade']) idx += 1

I HOPE YOU UNDERSTAND..

I HOPE ITS HELP FULL TO YOU..PLS RATE THUMBS UP ITS HELPS ME ALOT...!

THANK YOU....!!!

Add a comment
Know the answer?
Add Answer to:
We will build one Python application via which users can perform various analytics tasks on data...
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