Advertisement

"Pausing" programs in python

Started by January 31, 2002 06:29 PM
5 comments, last by Potato_Tempest 22 years, 10 months ago
I know you can "pause" a program in c++, but i dont know how to do it in python. Can anyone help me out?
B00
well iv no reply''s to this topic, so i thought maybe someone didnt understand my question. The question is basically:

How can I stop the program from closing itself after the program has done its job? Do I have to create a loop to the top of the program or something?
B00
Advertisement
getch() might work for you. dunno what exactly you''re wanting here but this pauses your program and waits for a key press
ehhh? how would i use that? Yeah, im lookin for something that will pause the program until they press a key. Heres my program, mabye u can help me out:

  #print menuprint "Area Caculation Program"print "-----------------------"printprint "Select a shape"print "1. Rectangle"print "2. Circle"print "3. Triangle"print "4. Trapazoid"shape = input()#get areaif shape == 1:	print "Area of a Rectangle"	print "---------------"	print	length = input("Please input length")	width = input("Please input width")	area = length*width	print "the area is", areaelif shape == 2:	print "Area of a Circle"	print "---------------"	print	radius = input("Please input the radius")	area = (3.14*radius)*radius	print "The area is", areaelif shape == 3:	print "Area of a Triangle"	print "------------------"	print	length = input("Please input length")	width = input("Please input width")	area = 0.5*(length*width)	print "The area is", areaelif shape == 4:	print "Area of a Trapazoid"	print "-------------------"	print	length = input("Please input length")	b = input("Please input the first width")	c = input("Please input the second width")	area = 0.5*length(b+c)	print "The area is", area  
B00
I pretty much want to make it so that when users get their answeres, they can actually see them, and the program won''t just shut down.
B00
I don''t know Python, but hiw about something like this at the end:

dummy = input("Press any key to exit.")
Advertisement
hmmm. I guess that works, but it gives a nasty syntax error before it closes.
B00

This topic is closed to new replies.

Advertisement