On Wed, Aug 10, 2016 at 12:39 PM, Cai Gengyang <gengyang...@gmail.com> wrote:
> I managed to get this piece of code to work :
>
>>>> print("This program calculates mpg.")
> This program calculates mpg.
>>>> milesdriven = input("Enter miles driven:")
> Enter miles driven: 50
>>>> milesdriven = float(milesdriven)
>>>> gallonsused = input("Enter gallons used:")
> Enter gallons used: 100
>>>> gallonsused = float(gallonsused)
>>>> gallonsused = float(gallonsused)
>>>> mpg = milesdriven / gallonsused
>>>> print("Miles per gallon:", mpg)
> Miles per gallon: 0.5
>>>> print("This program calculates mpg.")
> This program calculates mpg.
>>>> milesdriven = input("Enter miles driven:")
> Enter miles driven: 100
>>>> milesdriven = float(milesdriven)
>>>> gallonsused = input("Enter gallons used:")
> Enter gallons used: 500
>>>> gallonsused = float(gallonsused)
>>>> mpg = milesdriven / gallonsused
>>>> print("Miles per gallon:", mpg)
> Miles per gallon: 0.2
>
> But, why can't i define a variable like "miles_driven" with an underscore in 
> my Python Shell ? When I try to define it , the underscore doesn't appear at 
> all and instead I get this result :
> "miles driven" , with no underscore appearing even though I have already 
> typed "_" between "miles" and "driven" ?

Are you using IDLE on OSX?  Try changing your font or bumping up the
size (or switch to 3.5.2, which has better defaults).

-- 
Zach
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to