Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Need help deriving a convertion function on python (http://www.velocityreviews.com/forums/t958475-need-help-deriving-a-convertion-function-on-python.html)

 johnnyukpo@gmail.com 03-07-2013 08:25 PM

Need help deriving a convertion function on python

Good day,

I have a computer programming assignment. I am completely lost and i need some help.

These are the questions that are confusing me
(a) Write a function which converts from gallons to cups2
(b) Now we’d like to be able to convert from cups to milliliters, since metric measurements
are easier to convert between. Implement a function which does this.
(c) We’d also like to be able to easily convert gallons into milliliters,so implement a
function which does this

 Rick Johnson 03-07-2013 10:15 PM

Re: Need help deriving a convertion function on python

On Thursday, March 7, 2013 2:25:42 PM UTC-6, johnn...@gmail.com wrote:
> I have a computer programming assignment. I am completely
> lost and i need some help. These are the questions that
> are confusing me
>
> (a) Write a function which converts from gallons to cups2

How can we help you if we have no idea of what level of programming experience you have attained. Can you write functions? Can you declare variables? What about mathematics? If you can already do all these things then make anattempt to accomplish problem "(a)" and then ask us a specific question when you run into trouble.

> (b) Now we’d like to be able to convert from cups to
> milliliters, since metric measurements are easier to
> convert between. Implement a function which does this.
>
> (c) We’d also like to be able to easily convert gallons
> into milliliters, so implement a function which does this

In due time grasshopper. First make an attempt to solve problem "(a)". Chris gave some great advice however i would like to insert a "step 0" into his"advice list" (this is python after all ;-).

* STEP 0: Learn how to convert from gallons to cups using a
pencil and paper only.

* STEP 2: Try to write a python function that will take one
parameter (representing the number of gallons) and then
perform the mathematical equations required to deduce the
number of cups in a gallon, THEN return the result.

 Dave Angel 03-08-2013 12:07 AM

Re: Need help deriving a convertion function on python

On 03/07/2013 03:40 PM, Chris Angelico wrote:
> On Fri, Mar 8, 2013 at 7:25 AM, <johnnyukpo@gmail.com> wrote:
>> Good day,
>>
>> I have a computer programming assignment. I am completely lost and i need some help.
>>
>> These are the questions that are confusing me

<SNIP>
>
> By the way, you may
> find the python-tutor list more suitable, if you feel your questions
> are particularly basic:
> http://mail.python.org/mailman/listinfo/tutor
>

Actually his brother 'akuma upko' (sharing the same account) posted the
same question on Python-tutor 2 minutes before johnny posted it here.

--
DaveA

 All times are GMT. The time now is 05:59 PM.