Archived

This topic is now archived and is closed to further replies.

Potato_Tempest

"Pausing" programs in python

Recommended Posts

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?

Share this post


Link to post
Share on other sites
getch() might work for you. dunno what exactly you''re wanting here but this pauses your program and waits for a key press

Share this post


Link to post
Share on other sites
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 menu
print "Area Caculation Program"
print "-----------------------"
print
print "Select a shape"
print "1. Rectangle"
print "2. Circle"
print "3. Triangle"
print "4. Trapazoid"


shape = input()

#get area

if 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", area

elif shape == 2:
print "Area of a Circle"
print "---------------"
print
radius = input("Please input the radius")
area = (3.14*radius)*radius
print "The area is", area

elif 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", area

elif 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

Share this post


Link to post
Share on other sites