Answers for "how to square a list in python"

19

python square root

import math
a = input("what do you wnat to square root")
print(math.sqrt(a))
Posted by: Guest on July-09-2020
7

python square a number

import math

8 * 8          # 64
8 ** 2.        # 64
math.pow(8, 2) # 64.0
Posted by: Guest on March-07-2020
0

python square all numbers in list

def square(list):
    return [i ** 2 for i in list]
Posted by: Guest on July-24-2020
0

list square python

l1 = [1,2,3,4,5]

l2 = [x**2 for x in l1] 
l2
>>> [1,4,9,16,25]
Posted by: Guest on June-13-2021
0

list comprehension with square numbers python

def square(a):
    squares = []
    for i in a:
        squares.append(i**2)
    return squares
Posted by: Guest on August-21-2020

Code answers related to "how to square a list in python"

Python Answers by Framework

Browse Popular Code Answers by Language