Question
based on this idea the following formula can be derived for approximating the integral where h

5 points Make a nested dictionary from a file The viscosity of gases depends on the temperature T. For some gases the followi
python

python
0 0
Add a comment Improve this question Transcribed image text
Answer #1

01 nested dict.py - D:/Coding/Python/nested dict.py (3.7.4) File Edit Format Run Options Window Help viscosity_data = air,

OUTPUT :

================== RESTART: D: /Coding/Python/nested d ======= >>> mu_data[air][C] == 120 True >>> mu_data[hydrogen][T

CODE :

viscosity_data = """air,120,291.15,18.27
nitrogen,111,300.55,17.81
oxygen,127,292.25,29.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"""

mu_data = {}
for line in viscosity_data.split('\n'):
#Split the line using comma
data = line.split(',')
#Dictionary for each gas
gas = {}
#Populate values
gas['C'] = float(data[1])
gas['T_0'] = float(data[2])
gas['mu_0'] = float(data[3])
#Assign it to gas
mu_data[data[0]] = gas

Add a comment
Know the answer?
Add Answer to:
based on this idea the following formula can be derived for approximating the integral where h...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The viscosity of gases depends on the temperature. For some gases the following formula is relevant:...

    The viscosity of gases depends on the temperature. For some gases the following formula is relevant: µ(T) = µ0 T0 −C T + C T T01.5 where the values of the constants C,T0, and µ0 are found in the le viscosity_of_gases.dat. The temperature is measured in Kelvin. (a) Load the le into a nested dictionary mu_data such that we can look up C , T0 , and µ0 for a gas with name name by mu_data[name][X], where X is ’C’...

  • 1. Which of the following are the sites within the human body where carbon dioxide and...

    1. Which of the following are the sites within the human body where carbon dioxide and oxygen are exchanged? A. Alveoli B. Arteries C. Synapses D. Venules 2. Which of the following describes the most important reason for repeating an experimental investigation? A. To verify the validity of the original findings B. To expand upon the original investigation C. To manipulate the independent variable D. To attempt to disprove the hypothesis 3. Lithium has an atomic number of 3 and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT