Write a Python function to create and print a list where the values are square of numbers between 1 and 20


Introduction

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.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. def printValues():
  2. l = list()
  3. for i in range(1,21):
  4. l.append(i**2)
  5. print(l)
  6.  
  7. printValues()

Result

python language techstudy.org

     





Related Topics




Popular Posts