A community for students. Sign up today!
Here's the question you clicked on:
 0 viewing
 2 years ago
#6.00x
I'm taking a stab at writing some reallife practical modules based on where I'm at with the lectures and readings. Can anyone help me troubleshoot why I don't get any output with the following:
#exhaustive enumeration test to determine concentration from known absorbance#
conc=0 #starting with a concentration of 0#
Absorbance=(0.0049*conc**3)(0.0604*conc**2)+(0.0972*conc)+0.6692 #3rd level polynomial curve fit of standard curve#
while Absorbance!=0.69: #absorbance value for which concentration is unknown#
conc=conc+0.000001
if Absorbance>=0.69: #restrict accuracy of answer#
print conc, 'ug/ml is the concentration'
 2 years ago
#6.00x I'm taking a stab at writing some reallife practical modules based on where I'm at with the lectures and readings. Can anyone help me troubleshoot why I don't get any output with the following: #exhaustive enumeration test to determine concentration from known absorbance# conc=0 #starting with a concentration of 0# Absorbance=(0.0049*conc**3)(0.0604*conc**2)+(0.0972*conc)+0.6692 #3rd level polynomial curve fit of standard curve# while Absorbance!=0.69: #absorbance value for which concentration is unknown# conc=conc+0.000001 if Absorbance>=0.69: #restrict accuracy of answer# print conc, 'ug/ml is the concentration'

This Question is Closed

rsmith6559
 2 years ago
Best ResponseYou've already chosen the best response.0Without seeing the proper indentation, it's tough to troubleshoot Python. One subtle thing that may be a problem is that conc = 0 initializes conc as an integer. I would imagine that it would be promoted by conc += 0.000001, but maybe not. Since the code isn't working, it won't kill anything to change it to: conc = 0.0 which will init it as a float. More importantly, the only assignment of Absorbance is before the while loop, so that makes it an endless loop.

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.1There are a few problems here. First, you are not changing Absorbance inside the while loop so it will be and infinite loop. Second, Absorbance is likely never going to equal exactly 0.69 so again infinite loop try <= or put the if inside the while and use a break satement. Third, this would be slow so you would likely want to think about a bisection search or similar aside from simple calculating it which I am sure is not the point.

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.1One more thing, if you are posting code you are likely better off dropping it into a pastebin or similar code site and providing the link.

bwCA
 2 years ago
Best ResponseYou've already chosen the best response.0please use a code pasting site: http://dpaste.com http://pastebin.com http://pastie.org http://codepad.org http://ideone.com

inicoud
 2 years ago
Best ResponseYou've already chosen the best response.0thanks for the guidance. Is there someplace that I can find syntax definitions for all the commands? For example, when you type raw_input( a pop up appears that defines what information is requested ([prompt])>string. This was really helpful in trying to understand what I'm supposed to be doing.

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.1You can type help() in python for help on something like help(abs). Try also help(__builtins__), lots of scrolling here. You can also check out http://docs.python.org/library/

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.1You can also do dir(__builtins__) for a list of builtin functions and like dir(float) for methods you can use with float. etc

bwCA
 2 years ago
Best ResponseYou've already chosen the best response.0the documentation.s should be installed on your computer. the Tutorial is a must. for windows and Idle, F1 will bring up the documentation  i find this version easier to use than the online version. can't say about linux versions or ipython. http://docs.python.org/

bwCA
 2 years ago
Best ResponseYou've already chosen the best response.0and the beginners links on the wiki first page have good stuff http://wiki.python.org/moin/
Ask your own question
Ask a QuestionFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.