[Tutor] Tutor Digest, Vol 117, Issue 25
Vlad Olariu
florinvlad.olariu at gmail.com
Sat Nov 16 12:02:40 CET 2013
is this active?
2013/11/16 <tutor-request at python.org>
> Send Tutor mailing list submissions to
> tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-request at python.org
>
> You can reach the person managing the list at
> tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
> 1. Re: TypeError: generatePersonID() takes exactly 1 argument (0
> given) (Suhas Bhairav)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 16 Nov 2013 08:58:54 +0530
> From: Suhas Bhairav <suhasbhairav at hotmail.com>
> To: Alex Kleider <akleider at sonic.net>, "tutor at python.org"
> <tutor at python.org>
> Subject: Re: [Tutor] TypeError: generatePersonID() takes exactly 1
> argument (0 given)
> Message-ID: <BAY176-W298F272ACD25F10F8FE94D4FA0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello,
> In your program, when you're calling generatePersonID(), you need to pass
> an argument to the function i.e. the value of fullName.This is because when
> you're defining the function generatePersonID(), it is
> generatePersonID(fullName) and not just generatePersonID(). So you have
> pass an arguments while you're calling it.
> Eg:def main(): getUserInput () generatePersonID ("Suhas")
>
> RegardsSuhas
>
> > Date: Thu, 14 Nov 2013 09:24:50 -0800
> > From: akleider at sonic.net
> > To: tutor at python.org
> > Subject: Re: [Tutor] TypeError: generatePersonID() takes exactly 1
> argument (0 given)
> >
> > On 2013-11-14 07:54, Thabile Rampa wrote:
> > > Hi,
> > >
> > > So I'm learning how to define my own functions, and in an exercise I
> > > was given, I get this error:
> > >
> > > Traceback (most recent call last):
> > > File "X:/X/xxx/Xxxxx/function_practice.py", line 36, in <module>
> > > main ()
> > > File "X:/X/xxx/Xxxxx/function_practice.py/function_practice.py
> > > [1]", line 34, in main
> > > generatePersonID ()
> > > TypeError: generatePersonID() takes exactly 1 argument (0 given)
> > >
> > > Here is the code:
> > >
> > > def getUserInput():
> > > """
> > > Get input from the user, i.e fullname, grossSalary, costs.
> > > Returns: fullName, grossSalary, costs
> > > """
> > >
> > > grossSalary =None ;
> > > costs =None
> > > fullName=""
> > >
> > > while not fullName:
> > >
> > > fullName = raw_input ("First and Last Names: ")
> > >
> > > while not grossSalary:
> > > #TODO
> > > grossSalary = int (raw_input ("Annual Gross Salary: "))
> > >
> > > while not costs:
> > > #TODO
> > > costs = int(raw_input ("Yearly costs: "))
> > >
> > > return fullName, grossSalary, costs
> > >
> > > def generatePersonID (fullName):
> > > """generates unique ID"""
> > > global id
> > > id = (fullName) + 1
> > > personID = str (id) + fullName
> > > return personID
> > >
> > > def main ():
> > > getUserInput ()
> > > generatePersonID ()
> > >
> > > main ()
> > >
> > > raw_input ("Press the enter key to exit.")
> >
> > You define 'generatePersonID' as a function that requires one parameter
> > but you do not give it a parameter when you call it with in your 'main'
> > function. That's exactly what your error message is trying to tell you.
> >
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/tutor/attachments/20131116/c172caf5/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> https://mail.python.org/mailman/listinfo/tutor
>
>
> ------------------------------
>
> End of Tutor Digest, Vol 117, Issue 25
> **************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131116/d1dee7b1/attachment.html>
More information about the Tutor
mailing list