Modularized program to find circumference, diameter, and area from a circle's radius I have to create a modularized program that can find out the diameter, circumference, and area of a circle's radius. I'm sure many of you can notice I kind of winged this from a example given from my teacher. Instead of people pointing out the fact that I coded this wrong, could you please give me reasons for what I should do so I can better understand this concept?

import math

def main():
    Radius = 0
    Diameter = 0
    Circumference = 0
    Area = 0


    Radius = GetRadius(Radius)
    Diameter = SetDiameter(Radius, Diameter)
    Circumference = SetCircumference(Radius, Circumference)
    Area = SetArea(Radius, Area)
    ShowResults(Radius, Diameter, Circumference, Area)


def GetRadius(myradius):
    myradius = float(str(input("Enter your radius: ")))
    return myradius

def SetDiameter(myradius, mydiameter):
    mydiameter = myradius * 2
    return mydiameter

def SetCircumference(myradius, mycircumference):
    PIE = 3.14159
    mycircumference = 2 * PIE * myradius
    return mycircumference

def SetArea(myradius, myarea):
    PIE = 3.14159
    myarea = PIE * myradius * myradius
    return myarea

def ShowResults(Radius, Diameter, Circumference, Area):
    print("The Diameter is",mydiameter)
    print("The Circumference is",mycircumference)
    print("The Area is",myarea)

main()
Many little comments here to make things simpler,shorter,more pythonic :


PEP 0008 gives some coding guidelines for python. Among other things, it gives a naming convention. Also, you don't need the "my" prefix everywhere.
You can use math.pi instead of repeating our own definition of pi everywhere. (Isn't it the reason why your import math in the first place)
Most of your function just need to return a value and updating the parameter probably shouldn't be their responsability.
Most of the variables are not really required.
there's no point to define a main function in your case.


After taking these comments into accounts, your code looks like this :

import math

def get_radius_from_user():
    return float(input("Enter your radius: "))

def get_diameter(radius):
    return radius * 2

def get_circumference(radius):
    return 2 * math.pi * radius

def get_area(radius):
    return math.pi * radius * radius

def show_results(radius):
    print("The Diameter is",get_diameter(radius))
    print("The Circumference is",get_circumference(radius))
    print("The Area is",get_area(radius))

show_results(get_radius_from_user())