len(list)
list -- 這是要被計算元素個數的列表
#!/usr/bin/python3 list1 = ['physics', 'chemistry', 'maths'] print (len(list1)) list2=list(range(5)) #creates list of numbers between 0-4 print (len(list2))
3 5