Question: Write a short script that will prompt Label: Length ( mm ) : Weight ( mg ) : It will read an

Write a short script that will prompt
"Label: "
"Length (mm): "
"Weight (mg): "
It will read an arbitrary string for the label, and floats for length and width. The resulting three values should be added as a tuple
(label, length, weight)
to the (initially empty) list data_list below.
The script will continue to prompt for a new specimen input until the user enters a blank label (i.e., they just press "Return" when prompted for a label).(Hint: A blank label would return an empty string ("") for the input.)
An algorithm might look like this:
Prompt and read a label.
While the label isn't empty:
Prompt and read length
Prompt and read weight
Add the tuple (label, length, weight) to the list.
Prompt and read a new label
In terms of the final result, data_list might end up looking like this (if the labels, lengths, and weights were entered with these values):
[('ab1301',2.57,7.813),('ab1302',8.1367,12.427),('ch1980',7.5,8.48)]
Fill in your script below. I have started by providing you with an empty data list to store results in.
Note that the data labels could be any arbitrary string, while length and weight could be any floating point number. The above example data list is only one possible set of values.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!