subject
Engineering, 12.03.2020 00:13 BreadOfTheBear

In Python, Part 2: sorting apples (again)The last time we sorted apples we used two separate arrays (i. e. lists), one to hold the names, one to hold the 'sweetness' (called parallel arrays). Below is a single string that contains the same data:apples = "McIntosh:3,Red Delicious:5,Fuji:8,Gala:6,Ambrosia: 7,Honeycrisp:7.5,Granny Smith:1"In this case, the apples are separated by commas, and each apple has two attributes (name and sweetness) separated by a colon. We will use the power of string's split method to sort this dataset.1. define a function named apple_sort that takes a single string as an parameter, this string will be an "apple". That is it will be one of the items like 'Honeycrisp:7.5'. The function will return a numeric value that represents the sweetness of the item. This function will behave as a custom sorting function.2. define a function named a sort_csv that takes a single string as an parameter (which represents the complete dataset). This function will split the incoming dataset into the separate items and then it will sort those items using your function you created in part 1.So after you are done, the following code:print(sort_csv(apples))Should print out:['Fuji:8', 'Honeycrisp:7.5', 'Ambrosia:7', 'Gala:6', 'Red Delicious:5', 'McIntosh:3', 'Granny Smith:1']

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Afluid flows with a velocity field given by v=(x/t)i.. determine the local and convective accelerations when x=3 and t=1.
Answers: 2
question
Engineering, 04.07.2019 18:10
Adouble-strand no. 60 roller chain is used to transmit power between a 13-tooth driving sprocket rotating at 300 rev/min and a 52-tooth driven sprocket. a) what is the allowable horsepower of this drive? b) estimate the center-to-center distance if the chain length is 82 pitches. c) estimate the torque and bending force on the driving shaft by the chain if the actual horsepower transmitted is 30 percent less than the corrected (allowable) power.
Answers: 3
question
Engineering, 04.07.2019 18:10
Aturning operation is performed with following conditions: rake angle of 12°, a feed of 0.35 mm/rev, and a depth of cut of 1.1 mm. the work piece is aluminum alloy 6061 with t6 heat treatment (a16061-t6). the resultant chip thickness was measured to be 1.0 mm. estimate the cutting force, fc. use shear stress of 207 mpa and coefficient of friction on the tool face of 0.6.
Answers: 1
question
Engineering, 06.07.2019 02:30
1in2 processor chip can be modelled as an isothermal plane wall of silicon, isothermal on both sides. the power input to the bottom of the plane wall, or the processing power of the chip, often called the thermal design power (tdp), is 100w. assume the periphery is adiabatic. the silicon is 400 microns thick. the temperature at the junction, or in this case on the bottom of the isothermal plane wall, is 85°c. what is the top surface temperature, assuming that the only mode of heat transfer is conduction
Answers: 1
You know the right answer?
In Python, Part 2: sorting apples (again)The last time we sorted apples we used two separate arrays...
Questions
question
Mathematics, 10.10.2019 13:30
Questions on the website: 13722359