I need a lesson.

David Porter jcm at bigskytel.com
Wed Jun 7 20:15:39 EDT 2000


* F. G. Brown <fgbrown at ionet.net>:

> The following is a module called howfast.py that I can't get to repeat.

> howfast.py
> 
> a = input("What is the distance you traveled in miles?  ")
> b = input("How many seconds did it require?  ")
> c = a*3600.00/b
> print "You were going %d mph!" %c
> if c > 75:
>  print "Hey you better slow down!"
> d = raw_input ("Would you like to do another? (y)es or (n)o")
> if d == 'y':
>  print 'Here we go!'
> else:
>  print 'See ya!'
> 

How about:

#---------------------

while 1:
    a = input("What is the distance you traveled in miles?  ")
    b = input("How many seconds did it require?  ")
    c = a*3600.00/b
    
    print "You were going %d mph!" %c
    
    if c > 75:
        print "Hey you better slow down!"
    
    d = raw_input ("Would you like to do another? (y)es or (n)o")
    if d == 'y':
        print 'Here we go!'
        continue	
    else:
        print 'See ya!'
        break

#----------------------
	

  david.
	
	
-- 
Incline thine ear you glassworks of Murano. -- e.e.cummings in a blender




More information about the Python-list mailing list