[Tutor] <function animals at 0x662f0> what does it mean?
Richard Gelling
uselinux34 at yahoo.co.uk
Mon Nov 13 20:35:15 CET 2006
Registered Linux User : 256848
Failure isn't an option -- it comes bundled with Microsoft Windows
-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of Kristinn Didriksson
Sent: 13 November 2006 16:51
To: tutor at python.org
Subject: [Tutor] <function animals at 0x662f0> what does it mean?
Hello,
This is my first program calling functions :) It worked nicely except for
the message above. Can anyone explain what the message means.
Thanks,
Kristinn
Program
-----------------------------
# a program that prints the lyrics for Old Mcdonal had a farm for 5
different animals.
# this will have two functions: oldMac and animals # two functions will be
passed: animal and sound
def animals(animal, sound):
# print out the lyrics calling the subroutine for aminals
print "Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!"
print "And on the farm he had a ", animal + ", Ee-igh, Ee-igh, Oh!"
print "With a", sound + ",", sound, "here and a" , sound + ",",
sound + " there."
print "Here a", sound + ", there a", sound + ", everyehere a", sound
+ ",", sound + "."
print "Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!"
print
return animals
def oldMac():
print animals("cow", "moo")
print animals("pig", "oink")
print animals("horse", "neigh")
print animals("dog", "woof")
print animals("cat", "meow")
oldMac()
------------------------------
Output
-----------------------------
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
And on the farm he had a cow, Ee-igh, Ee-igh, Oh!
With a moo, moo here and a moo, moo there.
Here a moo, there a moo, everyehere a moo, moo.
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
<function animals at 0x66030>
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
And on the farm he had a pig, Ee-igh, Ee-igh, Oh!
With a oink, oink here and a oink, oink there.
Here a oink, there a oink, everyehere a oink, oink.
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
<function animals at 0x66030>
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
And on the farm he had a horse, Ee-igh, Ee-igh, Oh!
With a neigh, neigh here and a neigh, neigh there.
Here a neigh, there a neigh, everyehere a neigh, neigh.
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
<function animals at 0x66030>
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
And on the farm he had a dog, Ee-igh, Ee-igh, Oh!
With a woof, woof here and a woof, woof there.
Here a woof, there a woof, everyehere a woof, woof.
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
<function animals at 0x66030>
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
And on the farm he had a cat, Ee-igh, Ee-igh, Oh!
With a meow, meow here and a meow, meow there.
Here a meow, there a meow, everyehere a meow, meow.
Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!
<function animals at 0x66030>
-------------------------------
I don't think you need the 'return animals' in the animals function. It is
just displaying where the aniaml function is in memory.
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list