Skip to content

Instantly share code, notes, and snippets.

@imShakil
Created August 10, 2020 10:21
Show Gist options
  • Save imShakil/cc53f9be64e6279395d14362c4c5716b to your computer and use it in GitHub Desktop.
Save imShakil/cc53f9be64e6279395d14362c4c5716b to your computer and use it in GitHub Desktop.
def square_number(list_of_number):
"""
@param list_of_number: a given list of integer number
@return: list of square number
>>> square_number([1, 2, 3, 4])
[1, 4, 9, 16]
>>> square_number([10, 20, 30])
[100, 400, 900]
"""
return [num ** 2 for num in list_of_number]
if __name__ == '__main__':
import doctest
doctest.testmod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment