[Python-bugs-list] [ python-Bugs-450633 ] Had error trying to follow tutorial.

noreply@sourceforge.net noreply@sourceforge.net
Tue, 14 Aug 2001 12:56:17 -0700


Bugs item #450633, was opened at 2001-08-13 15:26
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=450633&group_id=5470

Category: Documentation
Group: Python 2.1.1
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Had error trying to follow tutorial.

Initial Comment:
I copied code from the Python tutorial from your site 
and pasted into the Windows Python shell, but I got an 
error. I already had an x floating around, so I used 
k. 

>>> k = int(raw_input("Please enter a number: "))
Please enter a number: 6.8
Traceback (most recent call last):
  File "<pyshell#43>", line 1, in ?
    k = int(raw_input("Please enter a number: "))
ValueError: invalid literal for int(): 6.8

Thanks for your time.

Thu Duong
thubar2000@yahoo.com

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-08-14 12:56

Message:
Logged In: YES 
user_id=3066

You entered a float, but int() only converts to integers, not floats, so the exception was expected.  The prompt in the example is misleading.  I've corrected this in the revision control repository to request "an integer" instead of "a number".

Doc/tut/tut.tex revision 1.147.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=450633&group_id=5470