I wrote this demo command line interpreter to demonstrate using the
cmd module: https://gist.github.com/amitsaha/6047955
$ python3 demo_cmd_interpreter.py
Welcome to Dummy shell. Type help or ? to list commands.
dummyshell>> help
Documented commands (type help ):
=
On Sun, Sep 22, 2013 at 10:18:23AM +1000, Amit Saha wrote:
> Hi all,
>
> I want my program to report an error if anything other than a number
> which I can then convert to float using float() is entered as input:
>
> # Python 3
> try:
> a = float(input('Enter a number: '))
>
> except ValueEr
On Sat, Sep 21, 2013 at 8:18 PM, Amit Saha wrote:
> Hi all,
>
> I want my program to report an error if anything other than a number
> which I can then convert to float using float() is entered as input:
>
> # Python 3
> try:
> a = float(input('Enter a number: '))
>
> except ValueError:
>
Hi all,
I want my program to report an error if anything other than a number
which I can then convert to float using float() is entered as input:
# Python 3
try:
a = float(input('Enter a number: '))
except ValueError:
print('Wrong input')
else:
print('Right input')
This seems to do