I need a lesson.

Scott Barron kain at dynup.net
Wed Jun 7 21:15:47 EDT 2000


Hi Fred,

Maybe try something similar to this:

while 1:
	## Put your code to calculate speed here

	if raw_input ("Do another? ") == "n":
		break

That is a very basic infinite loop that will break out if you answer "n"
to the question.  What you should do next is find a good book that covers
basic programming concepts.  A good place to start nay be the book
"Programming Python".  If you can't afford to buy it, you may be able to
read it online at http://www.netlibrary.com .  Hope this hepled some.

-Scott

In article <8hmn80$4vu$1 at ionews.ionet.net>, "F. G. Brown"
<fgbrown at ionet.net> wrote:
> Greetings, I just recently started learning to program using Python, and
> to be honest when it comes to programming I'm almost dumb as a rock. 
> I've done some Qbasic, but I consider it a dead language as far as the
> future is concerned and wish to concentrate my efforts with Python.
> Here's the rub.  The following is a module called howfast.py that I
> can't get to repeat.  In Qbasic I would have used a goto at the end and
> it would have worked fine.  Of course there is no goto in Python and
> that where I can use anyone's help.  See if you can understand what I'm
> trying to accomplish below, it's a little scrambled towards the end, and
> tell me the error of my ways.  I have the book "Learning Python" but I'm
> still stuck.  If there are any questions I'll be glad to reply. Thanks,
> Fred
> ?????????????????????????????????????????????
> 
> 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!'
> 
> 




More information about the Python-list mailing list