On Tue, Sep 29, 2009 at 10:59 AM, <wrobl...@cmich.edu> wrote: > I'm trying to make a very simple example to show alternate execution... if > a > number is divisible by 3 it will say so and if it isnt, it will say so. > Heres my > program---- > > n= raw_input("enter a number= ") > def divisible(n): > if n%3 == 0: > print n, "is divisible by 3" > else: > print n, "is not divisible by 3" > print divisible > > when I try it out, and enter 3, I get this------ > > enter a number= 3 > <function divisible at 0x02CC06B0> > >>> > > I'm not sure why I am getting this and am not quite sure what this means... > could someone explain what I am doing wrong here and why it is telling me > this? > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
You need the call the function with the user input n = raw_input("enter a number= ") def divisible(n): if n%3 == 0: print n, "is divisible by 3" else: print n, "is not divisible by 3" print divisible(n) Vince
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor