Question:
Write a Python program that computes the circumference or area of a circle depending on the user's choice.?
Brandon
2012-02-26 20:26:21 UTC
Your job is to translate what you see below into a working Python program. The programming you have to do will involve the use of conditionals and or loops to make it work. When your program is working 100%, you should be able to step through the sequence below. You will see responses included for each response so that when you run your program, you can use the same responses to be sure it is working properly.

*************start program****************

Do you want to calculate the area or circumference of a pool? 
Enter Y or N: ( on a response of Y )

Enter the value of the radius of the pool: ( prompt the user for the raidus )

Enter your choice of task.
C to computer circumference, A to compute area: ( on a response of C )

The circumference for a pool of radius 2.7 is ( some number )

Do you want to process more pools? 
Enter Y or N: ( on a Y response )


Enter the value of the radius of the pool: ( prompt the user for the raidus )

Enter your choice of task.
C to computer circumference, A to compute area: (on a response of C )

The area for a pool of radius 2.7 is ( some number )

Do you want to process more pools?
 Enter Y or N: ( on a response of N)

Thank you!

*************end program****************

I am having trouble creating a python code, hoping someone can show me please and thank you.
Three answers:
Jared
2012-02-26 21:44:25 UTC
This is pretty simple Python 2.7 one I wrote in about 3 min:

http://pastebin.com/a0YzCSMu



You will probably want to modify it to you're liking. But it will give you the idea.
?
2016-02-26 04:48:57 UTC
A= pi *(r^2) C= 2*pi*r Solving the circumference equation for pi, we have: pi= C/(2*r) and substituting C/(2*r) for pi in the area formula, we have: A= [C/(2*r)]*(r^2) since (r^2)/r = r our formula simplifies to: A=C*r/2
Mostafiz
2012-02-27 04:42:59 UTC
for help visit http://en.wikibooks.org/wiki/Think_Python


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...