Circumference of a circle is defined as length of perimeter of circle. Mathematically, circumference of a circle having radius r will be 2πr. Quite simeple, so we need to just code this simple mathematical formula as Python Code.
Python Code for Finding Circumference of Circle
# Calculate circumference of a Circle # Importing Python's Math Module import math # Using value of pie inside math inside π = math.tau # Ask user for radius of circle radius = float(input("Enter radius of circle => ")) # Circumference of circle = 2πr circumference = 2 * π * radius # Printing out circumference of circle print("Circumference of circle is => ", circumference)
Output of Above Code
Enter radius of circle => 5 Circumference of circle is => 62.83185307179586