Challenge: Write a Square Function

Can we write a function that will calculate the square of the number?

Problem statement

Write a function in Powershell and Python that will calculate the square of the number.

Expected output.

The function should return the square of the given number, for example :

  • For 5, it should return 25
  • For 6, it should return 36

Coding exercise

This problem is designed to check your understanding, so you are encouraged to solve it on your own. If you get completely stuck, refer to the next lesson which will explain the solution in detail.

Python

Get hands-on with 1400+ tech skills courses.