Write a Python function to create and print a list where the values are square of numbers between 1 and 20
I have used python 3.7 compiler for debugging purpose.
def printValues(): l = list() for i in range(1,21): l.append(i**2) print(l) printValues()
Result:
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used python 3.7 compiler for debugging purpose.
Result:
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]
need an explanation for this answer? contact us directly to get an explanation for this answer