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 datalist below.
The script will continue to prompt for a new specimen input until the user enters a blank label ie they just press "Return" when prompted for a labelHint: 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, datalist might end up looking like this if the labels, lengths, and weights were entered with these values:
ababch
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
