Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40818 > unrolled thread

Need help deriving a convertion function on python

Started byjohnnyukpo@gmail.com
First post2013-03-07 12:25 -0800
Last post2013-03-07 19:07 -0500
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Need help deriving a convertion function on python johnnyukpo@gmail.com - 2013-03-07 12:25 -0800
    Re: Need help deriving a convertion function on python Chris Angelico <rosuav@gmail.com> - 2013-03-08 07:40 +1100
    Re: Need help deriving a convertion function on python Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-07 14:15 -0800
    Re: Need help deriving a convertion function on python Dave Angel <davea@davea.name> - 2013-03-07 19:07 -0500

#40818 — Need help deriving a convertion function on python

Fromjohnnyukpo@gmail.com
Date2013-03-07 12:25 -0800
SubjectNeed help deriving a convertion function on python
Message-ID<891bd56d-5821-4268-8fa2-ba54e3a08d22@googlegroups.com>
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

[toc] | [next] | [standalone]


#40822

FromChris Angelico <rosuav@gmail.com>
Date2013-03-08 07:40 +1100
Message-ID<mailman.3054.1362688829.2939.python-list@python.org>
In reply to#40818
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
> (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

Here's a good place to start:

http://docs.python.org/3/tutorial/

After that, think about your task as three sub-tasks:

1) Get and parse input - what does your human need to tell your program?
2) Processing - the actual conversion, the meaty mathematical stuff
3) Produce output - what does your program report to your human?

Then start work on any one of the three. If you get stuck, move on to
one of the others. Once you've put some code together, test it, play
with it, and refine it. And if you get stuck, THEN come and ask for
help; but first, try to solve the problem yourself.

The purpose of this assignment is to help you learn to write code, so
we're not going to simply give you the code :) 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

The Python tutorial really is a very good place to start. I'm
seriously considering giving it to a ten-year-old girl, granting her
just IDLE and a web browser, and seeing what she can accomplish in a
day.

ChrisA

[toc] | [prev] | [next] | [standalone]


#40830

FromRick Johnson <rantingrickjohnson@gmail.com>
Date2013-03-07 14:15 -0800
Message-ID<9c5a5287-6d8d-48c0-86a8-bebb935e2499@googlegroups.com>
In reply to#40818
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 an attempt 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 1: Read docs and learn about functions (if applicable).

 * 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.

[toc] | [prev] | [next] | [standalone]


#40835

FromDave Angel <davea@davea.name>
Date2013-03-07 19:07 -0500
Message-ID<mailman.3061.1362701294.2939.python-list@python.org>
In reply to#40818
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web