[Tutor] Just started Python

Edgar Almonte samudhio at gmail.com
Thu Apr 28 00:23:37 CEST 2011


yes i just forget remove the previous one


On Wed, Apr 27, 2011 at 5:39 PM, Steve Willoughby <steve at alchemy.com> wrote:
> 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 / steve at 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 at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list