xxxxxxxxxx
# plz suscribe to my youtube channel -->
# https://www.youtube.com/channel/UC-sfqidn2fKZslHWnm5qe-A
#get length of list
list_example = ["python","ruby","java","javascript","c#","css","html"]
print(len(list_example))
xxxxxxxxxx
studentGrades = [9.1, 8.8, 10.0, 7.7, 6.8, 8.0, 10.0, 8.1, 10.0, 9.9]
print(len(studentGrades))
xxxxxxxxxx
# Creating a List
List1 = []
print(len(List1))
# Creating a List of mixed values
List2 = ["Softhunt", ".net", 14]
print(len(List2))
# Creating a List of numbers
List3 = [10, 20, 14, 31, 3]
print(len(List3))
xxxxxxxxxx
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")
xxxxxxxxxx
#a list
cars = ['Ford', 'Volvo', 'BMW', 'Tesla']
#some updates on list
cars.append('Honda')
cars.append('Tata')
#find length of list
length = len(cars)
print('Length of the list is :', length)
6
xxxxxxxxxx
li = [None] * 5 # [None, None, None, None, None]
li = [0] * 5 # [0, 0, 0, 0, 0]
xxxxxxxxxx
# define a list
my_list = [1, 2, 3, 4]
# get the length of the list
length = len(my_list)
# print the length
print(length)