Code Point
September 08, 2010, 08:15:47 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Geshi Sintax Hilighting Mod Installed. Tens of languages available.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: im having some problems  (Read 3440 times)
eopia
Jr. Member
*

Karma: 0
Offline Offline

Posts: 3


« on: July 10, 2007, 11:10:13 AM »

ok so im doing the thing from this website http://programming-crash-course.com/programed_interactivity
here is my code from notepad


gallon_price = 2.41

print
print "This program calculates a car mileage"
print

# A line starting with a # is a comment
# Use it to comment important parts of your code

#
# The raw_input() function asks the user for a text
# As a text can't be multiplied or divided the
# float() function tranforms the text into a decimal number
#
distance = float(raw_input("How many miles were measured ? "))
print
consumed = float(raw_input("How many gallons of gas were consumed ? "))

mpg = distance / consumed
cost = gallon_price / mpg

print
print "mileage is", mpg, "miles per gallon"
print
print "cost is US$", cost, "per mile"
print


whenever i execute the programs it gives me the prompts and then once i answer them the screen just goes away and gives me no answe
Logged
Alter Lobo
Global Moderator
Jr. Member
*****

Karma: 10
Offline Offline

Posts: 65


« Reply #1 on: July 10, 2007, 11:22:32 AM »

Try inserting this as the last line of your program:

Code
raw_input('Press enter to exit')
 
Logged
eopia
Jr. Member
*

Karma: 0
Offline Offline

Posts: 3


« Reply #2 on: July 10, 2007, 02:35:12 PM »

ok i will and shud i be doing this with IDLE or notebook?
Logged
eopia
Jr. Member
*

Karma: 0
Offline Offline

Posts: 3


« Reply #3 on: July 10, 2007, 02:37:08 PM »

wow it worked thanks!
Logged
fuston05
Jr. Member
*

Karma: 0
Offline Offline

Posts: 14


« Reply #4 on: February 06, 2008, 04:28:06 PM »

i had the same problem, but i found that it was due to entering whole # values, instaead use decimal values(4.0, etc..) worked for me  Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!