Re: [Tutor] Limit raw_input to hundredth decimal point

2011-07-02 Thread Ryan Kirk
Thanks all! This helps a lot. On Jul 1, 2011, at 6:13 AM, Steven D'Aprano wrote: Ryan Kirk wrote: Is there a way to limit raw_input to the hundredth decimal point? No. raw_input is a tool that does one thing: it collects input from the user. It doesn't understand numbers, check for

[Tutor] Limit raw_input to hundredth decimal point

2011-07-01 Thread Ryan Kirk
Is there a way to limit raw_input to the hundredth decimal point? For example, I'd like to allow the user to enter 5.75 but not 5.756: dollars = raw_input(Please enter a dollar amount: $) Thanks! ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] Limit raw_input to hundredth decimal point

2011-07-01 Thread Izz ad-Din Ruhulessin
You can use a regular expression or plain simple len() 2011/7/1 Ryan Kirk ryank...@me.com Is there a way to limit raw_input to the hundredth decimal point? For example, I'd like to allow the user to enter 5.75 but not 5.756: dollars = raw_input(Please enter a dollar amount: $) Thanks!

Re: [Tutor] Limit raw_input to hundredth decimal point

2011-07-01 Thread Christian Witts
On 2011/07/01 09:30 AM, Ryan Kirk wrote: Is there a way to limit raw_input to the hundredth decimal point? For example, I'd like to allow the user to enter 5.75 but not 5.756: dollars = raw_input(Please enter a dollar amount: $) Thanks! ___ Tutor

Re: [Tutor] Limit raw_input to hundredth decimal point

2011-07-01 Thread Steven D'Aprano
Ryan Kirk wrote: Is there a way to limit raw_input to the hundredth decimal point? No. raw_input is a tool that does one thing: it collects input from the user. It doesn't understand numbers, check for decimal places, check the input for spelling errors, or anything else. It's a hammer, not