0

I am trying to create a program (Python 3.6) that calculates area and circumference of MULTIPLE circles given each radius by user.I am also supposed to define separate functions and call them to main function. My output needs to be in table format.I have spent over 15 hours trying to figure out what I'm doing wrong and haven't made much progress. I think I may need to use a for loop eventually and string formatting, but so far it's not actually performing the functions and doing the math. What am I doing wrong? I am a basic intro student, so I can't use super advanced tricks that I wouldn't have learned yet. Here is what I have so far..

import math

def Circ_Circumf(Radius):
    Circumference =(math.pi * 2) * Radius
    return Circumference

def Circ_Area(Radius):
    Area = int(Radius)**2 * math.pi
    return Area

def main():
    # User Inputs Number of Circles
        Num_Circ = eval(input("Enter Number of Circles: "))

    # User Inputs Radius of Each Circle
        Radius = eval(input("Enter Radius of Each Circle Separated By Space: "))

    # Calculate Circumference of Each Circle
    C = Circ_Circumf(Radius)
    print(C)
Tara
  • 3
  • 1
  • You first need to _call_ the functions. None of your code will run unless you have some code to call the functions and pass the arguments. `main()` does not run automatically. Edit: actually, you do call `Circ_Circumf()` but it itself is inside `main()`. Call `main()` outside of a function e.g. `a = main()` with no indentation under your existing code. – roganjosh Apr 08 '17 at 19:54
  • Incidentally, `eval` is a really bad way to get the sizes. Use `int` instead in your first call; for the radii you *will* want a loop. – Arya McCarthy Apr 08 '17 at 19:56
  • As @aryamccarthy said , use `int` not `eval` , get your `Num_Circ` , then iterate over it to calculate each `Circ_Circumf` – t.m.adam Apr 08 '17 at 21:04

0 Answers0