billdotson

March 1st, 2007, 03:48 AM

Here is my source code for a program to find the circumference of a circle:

import math

def newline():

print

radius = 4

circle = radius * radius * math.pi

newline()

print "Say the radius of a circle =" , radius

newline()

print "To find the circumference we take the value of the radius and square that value, then multipy that result by pi."

newline()

print "That gives us the circumference of the circle."

newline()

print "It's circumference is" , circle , "units."

newline()

print "So the equation for the circumference of a circle is circumference = (radius*radius)*pi"

So if I want to have the program so that I can enter my own value for radius while the program is running? Like if I wanted to have a question before any of the other ran that asked "What is the radius of your circle?" and then allowed you to enter any value you wanted for the radius and then radius would then equal that value.

Does that make any sense? If not I want to have it set up like a formula in a spreadsheet where whatever number you enter for radius changes the value for circumference.

Later on I was thinking of making a simple program that it's only purpose would be to be calculate interest for your investments.. like how much are you putting in, what is the percentage rate, how long are you going to keep it in there?

import math

def newline():

radius = 4

circle = radius * radius * math.pi

newline()

print "Say the radius of a circle =" , radius

newline()

print "To find the circumference we take the value of the radius and square that value, then multipy that result by pi."

newline()

print "That gives us the circumference of the circle."

newline()

print "It's circumference is" , circle , "units."

newline()

print "So the equation for the circumference of a circle is circumference = (radius*radius)*pi"

So if I want to have the program so that I can enter my own value for radius while the program is running? Like if I wanted to have a question before any of the other ran that asked "What is the radius of your circle?" and then allowed you to enter any value you wanted for the radius and then radius would then equal that value.

Does that make any sense? If not I want to have it set up like a formula in a spreadsheet where whatever number you enter for radius changes the value for circumference.

Later on I was thinking of making a simple program that it's only purpose would be to be calculate interest for your investments.. like how much are you putting in, what is the percentage rate, how long are you going to keep it in there?