0

simple simple grrr

import math
import time

while 1:
	
	r = input("Enter Circle Radius --> ")
	
	circ = (pow(r,2)) * 3.14
	print ''
	print 'The circumferance of a circle with a radius of ',r,'is',circ,'.'
	print ''
	
	time.sleep(2)
	print ''
	print ''
	print ''
	print "Loop Start or Exit? 'l' or 'e'."
	print ''
	choice = input("--> ")
	
	if choice == l:
		
		time.sleep(2)
		os.startfile("C:\Documents and Settings\Sameer\Desktop\Circumferance Finder.py",r)
		quit()
	
	if choice == e:
		
		quit()
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by masterofpuppets
0

hi,
you can just continue the loop if the user enters 1 instead of reloading the program again, like this:

import math
import time
 
while True:
 
    r = input( "Enter Circle Radius --> " )

    circ = ( pow( r, 2 ) ) * 3.14
    print ''
    print 'The circumferance of a circle with a radius of ',r,'is',circ,'.'
    print ''

    time.sleep( 2 )
    print ''
    print ''
    print ''
    print "Loop Start or Exit? 'l' or 'e'."
    print ''
    # For Python2 change this to raw_input() to get input as a string
    choice = raw_input( "--> " )

    if choice == "l":
        time.sleep( 2 )
    elif choice == "e":
        break

hope this helps :)

Edited by masterofpuppets: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.