[Tutor] basic function concept

Alan Gauld alan.gauld at btinternet.com
Sun Nov 17 09:47:01 CET 2013


On 17/11/13 05:16, Alex Kleider wrote:
> On 2013-11-16 13:20, Byron Ruffin wrote:
>> def main(x, y, z):
>>     print (x, y, z)
>>
>> def funct():
>>     x = 1
>>     y = 2
>>     z = 3
>>     return x, y, z
>>
>> main()
>>
>> Can someone tell me why main is not being given any arguments?
>
> Because you didn't give it any.
> Try
> main(funct())

make that

main(*funct())

funct returns a tuple so you need to unpack it in the main()
argument list using the * notation.


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



More information about the Tutor mailing list