[Tutor] How to print a variable from an if/else statement

Joaquim Santos jsantos.lazer at gmail.com
Wed Sep 12 12:39:23 CEST 2012


>
>
>
> Message: 3
> Date: Wed, 12 Sep 2012 09:32:38 +0000
> From: chrisbva81 at gmail.com
> To: tutor at python.org
> Subject: [Tutor] How to print a variable from an if/else statement
> Message-ID:
>         <2057338575-1347442886-cardhu_decombobulator_blackberry.rim.net-
> 2019341514- at b3.c12.bise6.blackberry>
>
> Content-Type: text/plain
>
> Hello,
>
> I'm very new thanks in advance for your help.
>
> My If statement is:
>
> If age < (40):
>   Print("you are young.")
> Else:
>   Print("You look great.")
>
> Basically what I want to do is have a sentence using print that includes
> the results of the If or Else which is based on the users input of age.
>
>  I don't know if I'm doing something wrong by doing it this way. I can't
> figure it out.
>
> Thankyou!
>
> Chris
> Sent via BlackBerry by AT&T
>
>
>
My first time answering the list!!! (sorry for this outburst!)

>From my limited knowledge your if/else statement is correct BUT your print
should start with lower caps, that's why it's not working.

You can see here a bunch of examples on how to use it properly ->
http://docs.python.org/release/3.0.1/library/functions.html?highlight=print#print

Hope this helps!

Cheers!

Joaquim Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120912/9dc8ea16/attachment.html>


More information about the Tutor mailing list