Answers for "python list of size"

7

create a list of a certain length python

# 2.X only. Use list(range(10)) in 3.X.
>>> l = range(10)
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Posted by: Guest on April-17-2020
4

how to get size of list in python

list_1 = ["Hello", 1, "World", 2]
# if you want length of this lins use len() function
print(len(list_1))

# if you want size in bytes
import sys
print(sys.getsizeof(list_1), "Bytes")
Posted by: Guest on March-08-2021
0

fixed size list in python

L, R, answer = [0]*length, [0]*length, [0]*length
Posted by: Guest on May-19-2020
3

python list of size

li = [None] * 5 # [None, None, None, None, None]
li = [0] * 5 # [0, 0, 0, 0, 0]
Posted by: Guest on May-16-2020

Python Answers by Framework

Browse Popular Code Answers by Language