Newbie question about evaluating raw_input() responses

2013-05-21 Thread C. N. Desrosiers
Hi,

I'm just starting out with Python and to practice I am trying to write a script 
that can have a simple conversation with the user.

When I run the below code, it always ends up printing response to "if age > 
18:" -- even if I enter a value below 18.

Can anyone point me to what I am doing wrong?  Many thanks in advance.

age=raw_input('Enter your age: ')
if age > 18:
print ('Wow, %s. You can buy cigarettes.' % age)
else:
print ('You are a young grasshopper.')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread C. N. Desrosiers
Muchas gracias!

On Wednesday, May 22, 2013 2:35:18 AM UTC-4, Fábio Santos wrote:
> You have to convert `age` to an integer. Use int() to do it. Then you can 
> compare it to other numbers and obtain the expected results.
> 
> On 22 May 2013 07:29, "C. N. Desrosiers"  wrote:
> 
> Hi,
> 
> 
> 
> I'm just starting out with Python and to practice I am trying to write a 
> script that can have a simple conversation with the user.
> 
> 
> 
> When I run the below code, it always ends up printing response to "if age > 
> 18:" -- even if I enter a value below 18.
> 
> 
> 
> Can anyone point me to what I am doing wrong?  Many thanks in advance.
> 
> 
> 
> age=raw_input('Enter your age: ')
> 
> if age > 18:
> 
>     print ('Wow, %s. You can buy cigarettes.' % age)
> 
> else:
> 
>     print ('You are a young grasshopper.')
> 
> --
> 
> http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread C. N. Desrosiers
Hi,

I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.  I'd 
like to write a program that boots my computer at a specific time, loads 
iTunes, and starts playing a podcast.  Is this sort of thing possible in Python?

Thanks in advance.

CND
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread C. N. Desrosiers
Thank you!


On Sun, Jun 16, 2013 at 3:49 PM, Jason Swails wrote:

>
>
>
> On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers 
> wrote:
>
>> Hi,
>>
>> I'm planning to buy a Macbook Air and I want to use it as a sort of
>> alarm.  I'd like to write a program that boots my computer at a specific
>> time, loads iTunes, and starts playing a podcast.  Is this sort of thing
>> possible in Python?
>>
>
> Python cannot do this by itself, as has already been mentioned.
>
> If you're using a Mac, you can schedule your computer to turn on (and/or
> off) using System Preferences->Energy Saver->Schedule...
>
> Then run a Python script in a cron job.
>
> In fact, you could do this in bash ;)
>
> HTH,
> Jason
>



-- 
Christian Nicolás Desrosiers
Master of City Planning candidate
School of Architecture + Planning
Massachusetts Institute of Technology

t. 717 860 6252
e. c...@mit.edu

www.twitter.com/cndesrosiers
-- 
http://mail.python.org/mailman/listinfo/python-list