Write a function computing the perimeter of a circle given its radius.
First read the function tutorial.
Your function should be named circle_perimeter(radius)
,
where the radius
parameter is the radius of a cirle.
Your function should return the perimeter of a circle of the given radius
.
To test it, we will import your function and try it with different values, such as:
>>> circle_perimeter(1)
6.283185307179586
>>> circle_perimeter(10)
62.83185307179586
>>> circle_perimeter(100)
628.3185307179587
For example, here is a simple function which takes a value and give it back unmodified:
def identity(x):
return x
We can call our identity
function and check it gave us back the given value:
>>> identity(42) == 42
True
So:
>>> print(42)
42
and:
>>> print(identity(42))
42
are behaving the same. In the first case, we give 42
to print
,
which prints "42". In the 2nd example we give 42
to identity
,
which gives back 42
, which is directly given to print
, printing
"42" again.
We could also compare those equivalent codes:
>>> fourty_two = 42
>>> print(fourty_two)
>>> fourty_two = identity(42)
>>> print(fourty_two)
>>> fourty_two = 42
>>> fourty_two = identity(fourty_two)
>>> print(fourty_two)
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts: