Please answer it in Python Below are the first 4 lines of such a file whose number of lines is not known a priori: Bella 91.0 18.5 19.5 19.5 19.0 19.5 (91 is a dist note) Azhar 83.0 19.0 18.5 18.5 18.5 19.0 Clara 91.0 17.5 17.5 17.5 18.5 19.0 Dalton 92.5 17.0 18.5 18.5 17.5 18.0 Write a function import_result that takes as an argument the name of the file that contains the results file_name and reads it to make the list of results. Each item in this result list is a dictionary corresponding to a competitor. The keys to this dictionary are: • 'name' with the competitor's name associated • 'note_dist' with which is associated the score obtained by the competitor for the length of his jump. It is known from the question. • 'notes_style' to which is associated the list of 5 marks obtained by the competitor for the style of his jump. Thus, if the file passed as an argument consists only of the 4 lines given as an example previously, the function will return: [{'name': 'Bella', 'notes_style': [18.5, 19.5, 19.5, 19.0, 19.5], 'note_dist': 91.0}, {’nom’: Azhar, ’notes_style’: [19.0, 18.5, 18.5, 18.5, 19.0], ’note_dist’: 83.0}, {'name': Clara, 'notes_style': [17.5, 17.5, 17.5, 18.5, 19.0], 'note_dist': 91.0}, {'name': 'Dalton', 'notes_style': [17.0, 18.5, 18.5, 17.5, 18.0], 'note_dist': 92.5}] Warning: we remind you that by

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please answer it in Python

Below are the first 4 lines of such a file whose number of lines is not known a priori:

Bella 91.0 18.5 19.5 19.5 19.0 19.5 (91 is a dist note)

Azhar 83.0 19.0 18.5 18.5 18.5 19.0

Clara 91.0 17.5 17.5 17.5 18.5 19.0

Dalton 92.5 17.0 18.5 18.5 17.5 18.0

Write a function import_result that takes as an argument the name of the file that contains the results file_name and reads it to make the list of results. Each item in this result list is a dictionary corresponding to a competitor. The keys to this dictionary are:

• 'name' with the competitor's name associated

• 'note_dist' with which is associated the score obtained by the competitor for the length of his jump. It is known from the question.

• 'notes_style' to which is associated the list of 5 marks obtained by the competitor for the style of his jump.

Thus, if the file passed as an argument consists only of the 4 lines given as an example previously, the function will return:

[{'name': 'Bella', 'notes_style': [18.5, 19.5, 19.5, 19.0, 19.5], 'note_dist': 91.0},

{’nom’: Azhar, ’notes_style’: [19.0, 18.5, 18.5, 18.5, 19.0], ’note_dist’: 83.0},

{'name': Clara, 'notes_style': [17.5, 17.5, 17.5, 18.5, 19.0], 'note_dist': 91.0},

{'name': 'Dalton', 'notes_style': [17.0, 18.5, 18.5, 17.5, 18.0], 'note_dist': 92.5}]

Warning: we remind you that by default everything that is read in a file is of type string.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY