1 of 5
Exercise #1beginner

Create a Square Function

Define a function named square(n) that accepts a number n and returns its square (n * n). Then call square(7) and print the returned result.

Instructions

  • Define `def square(n):`.
  • Return `n * n` or `n ** 2`.
  • Print the result of `square(7)`.
Progressive Hints (1 / 2)

Remember to use the `return` keyword instead of just calculating inside the function.

solution.py
Loading Monaco Editor...

Press Ctrl+Enter or click "Run Code" to execute your solution in the browser.