On 27-Apr-11 14:35, Edgar Almonte wrote:
try this :



  model=raw_input("What kind of car do you drive?")
  gallons=raw_input("How many gallons have you driven?")
  number1 = float (gallons)
  miles=raw_input("How many miles have you driven?")
  number2 = float (miles)


  try:
number1 = float (gallons)
number2 = float (miles)

Indentation error aside, you'll never reach that exception because the previous number1 = float(gallons) would raise one if the input was wrong. Either move the try..except block to enclose the first one, or wait until the try...except block to do the typecast.
--
Steve Willoughby / st...@alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to