Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#In Chapter 3 . 4 , we wrote a function called find _ pressure #that calculated pressure given number of moles, #temperature, volume, and optionally,

#In Chapter 3.4, we wrote a function called find_pressure
#that calculated pressure given number of moles,
#temperature, volume, and optionally, a value for R. If no
#value was given for R, we assumed its value should be
#0.082057.
#
#However, as written, that function could crash: what about
#when the user enters a Volume of 0? That would cause a
#ZeroDivisonError! (In addition to breaking the laws of
#physics, but there's no Python error for that.)
#
#Revise that find_pressure function to catch that error. If
#that error occurs, return the string "Volume must be
#greater than 0." Otherwise, the function should work just
#as it did before.
#
#Feel free to copy your answer to that exercise and work
#from there. If you'd prefer to start from scratch, remember:
#you're creating a function called find_pressure that returns
#a value for pressure given variables n, T, V, and optionally
#R, according to this formula:
#
# Pressure =(nRT)/ V
#
#You may not use a conditional. R should have a default value
#of 0.082057.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions