Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please type in python Make a nested dictionary from a file 5 points The viscosity u of gases depends on the temperature T. For some
Please type in python
Make a nested dictionary from a file 5 points The viscosity u of gases depends on the temperature T. For some gases the following formula is relevant: MET) = 0 FC .)". where the values of the constants C, To, and wo are found in a file viscosity.dat. The temperature is measured in Kelvin. Suppose we have already loaded the file into a string viscosity_data using the read method. viscosity_data contains data (in order as gas, C,T_0, mu_0 ) such as: viscosity_data = '''air, 120,291.15, 18.27 nitrogen, 111,300.55,17.81 oxygen, 127, 292.25,20.18 carbon dioxide, 240,293.15, 14.8 carbon monoxide, 118,288.15, 17.2 hydrogen, 72,293.85, 8.76 ammonia, 370,293. 15,9.82 sulphur dioxide, 416,293.65, 12.54'11 Convert the data in the string viscosity data into a nested dictionary mu_data such that we can look up C, To, and Mo for a gas with a name name by mu_data[name] [X], where X can be one of 'C', 'T_0', or 'mu_0'. The numerical values in mu_data should all be float s. For instance, the following statements should be True : mu_data[ 'air' ][ 'C' ] == 120.0 mu_data[ 'hydrogen' ][ 'T_0' ] == 293.85 mu_data[ 'sulphur dioxide' ][ 'mu_0' ] == 12.54 Hint: I would expect a correct answer to contain a for loop. (There may be other ways of doing this but this seems most straightforward to me.)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started