[Tutor] New Programmer - Designing

2013-03-07 Thread Christopher Emery
Hello All,

I am new to this email list as can see from subject, my name is
Christopher.  I am trying to learn how to design a program but I seem not
to find any resource online that will teach how to design the program
before you start programming.

I would like to create a program that will filter a file and put the
information into two database (text based for now)

So how would I start the process of designing such a application?

Also because this is a part of a bigger application that will have many
user interfaces, phone, web, mobile I want to learn how to keep code apart
from UI. For example if a program was created to take a person information
how would that look?  I tried to think of basic process. so in this example
I know the following would need be done:

user would pick option on UI to Add, Update, Delete, if add picked then
grab information from UI as varibles (I am assuming)
then process would check varibles types are correct and existing
then process would either give error or continue to storing the information

So how would one go about designing this module?  Would this be the right
name to call this part of a bigger program?

Thank you for your assistance, please don't mind my writing I am not a good
writer.

Sincerely in Christ,
Christopher
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Peter Otten
akuma ukpo 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?

This line in your test code is wrong:

> self.assertEqual(gallons_to_cups(0), 16)
 
By the way, adding 0 does not change the result here:

> return 16 * quant + 0


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Danny Yoo
On Thu, Mar 7, 2013 at 2:36 PM, akuma ukpo  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)


Good, thanks for showing us how you're testing this.

I disagree with this specific test.  If I don't have any gallons, how
can that become sixteen cups?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Joel Goldstick
On Thu, Mar 7, 2013 at 4:36 PM, akuma ukpo  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  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  wrote:
>>
>>> On Thu, Mar 7, 2013 at 1:55 PM, akuma ukpo  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


Re: [Tutor] Need help with function coding.

2013-03-07 Thread akuma ukpo
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  wrote:

> i now know how to define functions.
>
> My problem is i don't know what particular function that converts gallons
> directly to cups.
>
> 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  wrote:
>
>> On Thu, Mar 7, 2013 at 1:55 PM, akuma ukpo  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


Re: [Tutor] Need help with function coding.

2013-03-07 Thread akuma ukpo
i now know how to define functions.

My problem is i don't know what particular function that converts gallons
directly to cups.

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  wrote:

> On Thu, Mar 7, 2013 at 1:55 PM, akuma ukpo  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*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Danny Yoo
On Thu, Mar 7, 2013 at 1:55 PM, akuma ukpo  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
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Mark Lawrence

On 07/03/2013 20:23, akuma ukpo wrote:

I have a python lab to do but for some reason i can't understand.


(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

--
/Akuma/



I'll assume that you don't know how a cup is defined so please read this 
http://gwydir.demon.co.uk/jo/units/volume.htm#small.


Then write some code, test it and if you have problems please get back 
to us.


--
Cheers.

Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Danny Yoo
> (a) Write a function which converts from gallons to cups2


Do you know how to write functions?  Can you write a function that
takes a number and returns twice that number, for example?

Show us what you have seen already, and we may be able to start from there.

The question you are asking does not tell us anything useful,
unfortunately.   More specifically, it doesn't tell us where you are
getting confused.  Since we can't just solve the problem for you, the
best thing you can do is to help us see where you are getting stuck.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Need help with function coding.

2013-03-07 Thread Joel Goldstick
On Thu, Mar 7, 2013 at 3:23 PM, akuma ukpo  wrote:

> I have a python lab to do but for some reason i can't understand.
>
>
> (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
>
> Do you know how to define  a function?  Do you know how your function can
return a value?  Do you know the formula for converting gallons to cups.
Hint: there are 8 ounces in a cup and 128 ounces in a gallon.  There are a
thousand milliliters in a liter.  I'm sure you can google how many liters
in a gallon.

So write what you have tried so far


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


[Tutor] Need help with function coding.

2013-03-07 Thread akuma ukpo
I have a python lab to do but for some reason i can't understand.


(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

-- 
*Akuma*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-07 Thread Charles Leviton
Thanks Devin.  now I have a better understanding of what happens.
Let me explore finditer- hearing for the first time.


On Mon, Mar 4, 2013 at 8:47 PM, Devin Jeanpierre wrote:

> On Mon, Mar 4, 2013 at 8:22 PM, Charles Leviton
>  wrote:
> > I have some confusion regarding when findall returns a list of strings
> and
> > when it returns a list of tuples.
> > Would appreciate an explanation.
>
> If there are no groups, it returns a list of strings, where the
> strings are the whole match.
>
> If there is one group, it returns a list of strings, where the strings
> are the content of the group.
>
> Otherwise, it returns a list of tuples of strings, where the tuples
> contain the group contents (the same as if an individual match had its
> groups() method called).
>
> If you want consistency, use finditer instead of findall.
> http://docs.python.org/2/library/re.html#re.finditer
>
> -- Devin
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] mysqlite

2013-03-07 Thread Alan Gauld

On 07/03/13 00:35, Lolo Lolo wrote:


Because i find following your tutorials very easy i have looked

> at the other topics you have on your site.
> i notice they are not available in Python 3

Not yet, I'm still working on them. :-)

I have been very busy at work the last 2-3 years so made little progress 
but last month I took voluntary redundancy and plan on taking a 6 month 
sabbatical so hopefully I will have time to complete the v3 tutor.



but doesnt this matter? or would i need to wait for a python 3 version?


You should be able to translate the v2 to v3 fairly easily.


Also which could i read next network programming or writing web applications?


The web apps bit is very thin, even in v2, it needs a lot of work
so I'd say networking or OS are a better bet for now.

The networking topic really works best if you read the 3 topics in 
order: OS, IPC, Networking because they build on each other.
If you are familiar with computing concepts like processes, pipes and so 
on you could reads them separately but otherwise I'd follow through in 
order.



--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor