On Thu, Mar 7, 2013 at 4:36 PM, akuma ukpo <johnnyu...@gmail.com> wrote:
> I am defining the function in one .py file and testing the function in > another .py file. > > this is my code for the test: > > def test_quantity_convert(self): > self.assertEqual(gallons_to_cups(0), 16) > self.assertEqual(gallons_to_cups(100), 1600) > > this is my code for the defined function: > > def gallons_to_cups(quant): > """ > Takes quantity 'quant' in Gallons and computes and > returns the equivalent Cup quantity > """ > return 16 * quant + 0 > > > what am i doing wrong? > > > On Thu, Mar 7, 2013 at 4:28 PM, akuma ukpo <johnnyu...@gmail.com> wrote: > >> i now know how to define functions. >> >> My problem is i don't know what particular function that converts gallons >> directly to cups. >> > Knowing how many cups in a gallon is a google search away. I think its 128/8 but you should check http://lmgtfy.com/?q=how+many+cups+in+a+gallon >> However, i derived a function that converts celsius to fahrenheit (9/5 * >> temperature + 32) tested it using python and it passed the test. >> >> I need a function for gallons to cups in a similar format. >> >> On Thu, Mar 7, 2013 at 4:14 PM, Danny Yoo <d...@hashcollision.org> wrote: >> >>> On Thu, Mar 7, 2013 at 1:55 PM, akuma ukpo <johnnyu...@gmail.com> wrote: >>> > i don't know how to write functions. so i guess that is where i'm >>> stuck. i >>> > was following a tutorial on my lab document but i still did not >>> understand >>> > what to do. i will attach the pdf and python files as well. >>> >>> I am CCing the rest of the Python tutor mailing list. Please use >>> reply-to-all when responding to messages on Tutor. I'm omitting the >>> attachments you sent me, as they're not that useful to me. >>> >>> >>> Since you do not know how to write functions yet, I would strongly >>> focus on solving that confusion first. If you don't know how to write >>> any functions, then you will have difficulty with your problem set. >>> >>> >>> Has your instructor given you any information on how to write a >>> function? For example, >>> >>> http://www.learnpython.org/page/Functions >>> >> >> >> >> -- >> *Akuma* >> > > > > -- > *Akuma* > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick http://joelgoldstick.com
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor