First function

Created by Julien Palard

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)
>>> circle_perimeter(10)
>>> circle_perimeter(100)


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


>>> print(42)


>>> print(identity(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:

  • Ctrl-Enter: Send your code to the correction bot.
  • Escape: Get back to the instructions tab.

See solutions