Data Structures and List


'''
data types - int , float , string , boolean 
data structures - list , tuple , set , dictionary
'''

word = "pineapple"

studentid = 67

marks = [89 , 99 , 78 , 99] 

print(marks)

marks.append(4)

print(marks)

marks.remove(99)

print(marks)

Functions in List


evens = [4,8,6] 

print(len(evens))
print(sum(evens))
print(max(evens))
print(sorted(evens))

'''
len and sum are functions that can be used on lsit 
len returns number of elements 
and sum returns sum of all numbers 
and max returns maximum number among all of them
and sorted returns list in sorted order
'''

Methods of List

lst = ["apple"  , "orange" , "apple" , "watermelon"]

apple_count = lst.count("apple")

print(apple_count)