trouble understanding None

Edo eelgueta at navix.cl
Tue Nov 11 22:12:48 EST 2003


You should not print the function result, just invoke them.

Ed.

Jakle wrote:

> I'm trying to write a program (with my very limited knowledge of python)
> that will convert text I type into those letters drawn with ascii symbols. I
> did 2 letters then went to test it. Here's the code I have so far:
> 
> *******************************************
> def S():
>     print    "  ________  "
>     print    " /--------\ "
>     print    "//        \\"
>     print    "||        ^^"
>     print    "||          "
>     print    "\\________  "
>     print    " \--------\ "
>     print    "          \\"
>     print    "          ||"
>     print    "_         ||"
>     print    "\\________//"
>     print    " \--------/ ",
> 
> def T():
>     print    "______________"
>     print    "------  ------"
>     print    "      ||      "
>     print    "      ||      "
>     print    "      ||      "
>     print    "      ||      "
>     print    "      ||      "
>     print    "      ||      "
>     print    "      ||      "
>     print    "      ||      "
> 
> print S(), T()
> *******************************************
> 
> WOW, that came out weird, but if you copy/paste it into idle it looks fine.
> That an "S" and a "T". Anyways, The idea is to have a function for each
> letter, then use a for loop and a ton of if statements to traverse and print
> the letters/functions. I understand that I might be doing too much work to
> do this, but I'm trying to practice what I am learning. OK, the test prints
> the letters, but also prints "None" at the end of each function. I don't
> understand it. I'm reading "How To Think Like A Computer Scientist: Learning
> With Python", and it only has one little paragraph about the "None" return
> value, and that's only regarding conditional statements. If someone could
> throw some wisdom my way I'm be very greatful. Thanks ahead of time.
> 
> 





More information about the Python-list mailing list