[Tutor] Codehelp: confused by the output in IDLE

vikas mohan itechsys at gmail.com
Fri Dec 16 10:54:29 CET 2005


Hi again!

The following is a piece of code that I have written:

*def funcA(x): # function describiing the oddness or eveness of an x number
  if x%2 == 0:
    print x, "is even"
  else:
    print x, "is odd"

def funcB(y): # function describiing the oddness or eveness of an y number
  if y%2 ==0:
    print y, "is even"
  else:
    print y, "is odd"

# no more functions after this line    *

> *x=input("Please type a number: ")
> print x*
>
> *y=input("Please type another number: ")
> print y*
>
> *if x>y:
>     print x,("is greater than"),y
> else:
>     print y,("is greater than"),x*
>
> *if y and x >=0:
>     print ("Both are positive numbers!")*
>
> *print funcA(x)
> print funcB(y)*
>
 And this is the output in IDLE after execution:

> *Please type a number: 5
> 5
> Please type another number: 10
> 10
> 10 is greater than 5
> Both are positive numbers!
> 5 is odd
> None
> 10 is even
> None*
>

I don't understand why I am getting 2 instances of "None" in the output,
when it has not been programmed by me. What is going on?

Pls. advice

Thanks again,
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051216/c51843bd/attachment.html


More information about the Tutor mailing list