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" ? -- https://mail.python.org/mailman/listinfo/python-list