45.4k views
2 votes
1) Create python code to compute the circumference of a circle with a given radius. (formula is 2 pi R) (pi can be set at 3.14). Include a print statement such as (A circle with Radius of 10 has a Circumference of 62.8

User Jah
by
6.9k points

1 Answer

1 vote

Answer:

pi = 3.14

r = float(input("Enter radius: "))

circumference = 2 * pi * r

print("A circle with Radius of {} has a Circumference of {:.1f}".format(r, circumference))

Step-by-step explanation:

Initialize the pi as 3.14

Ask the user to enter the r

Calculate the circumference using the given formula

Print the result as requested format

(Note that I used .format() to format the output. The values in the {}'s will be the ones in the format() method, r and circumference respectively)

User Dchris
by
6.3k points