List Operations#

[1]:
number_of_inputs = int(input())


max = 0
while number_of_inputs > 0:
    i = float(input())
    if i > max:
        max = i
    number_of_inputs -= 1
print(max)


# list_of_inputs = []
# while number_of_inputs > 0:
#     i = float(input())
#     list_of_inputs.append(i)
#     number_of_inputs -= 1

# list_of_inputs.sort(reverse=True)
# print(list_of_inputs[0])

55.0
[2]:
l = [1,2,3,2,3,6]
l.append(7)
l
[2]:
[1, 2, 3, 2, 3, 6, 7]
[3]:
l.count(3)
[3]:
2
[4]:
l.extend([7,8,7])
l
[4]:
[1, 2, 3, 2, 3, 6, 7, 7, 8, 7]
[5]:
l.index(7) # first occurance index of the specified value
[5]:
6
[6]:
l.insert(1,10) # position, element
l
[6]:
[1, 10, 2, 3, 2, 3, 6, 7, 7, 8, 7]
[7]:
l.pop(1) # index remove element
l
[7]:
[1, 2, 3, 2, 3, 6, 7, 7, 8, 7]
[8]:
l.remove(3) # removes first occurance of specified element
l
[8]:
[1, 2, 2, 3, 6, 7, 7, 8, 7]
[9]:
l.reverse() # reverse the list
l
[9]:
[7, 8, 7, 7, 6, 3, 2, 2, 1]
[10]:
l.sort() # sort the list
[11]:
l.clear() # clean the list
[12]:
l
[12]:
[]
[15]:
l = list("Hello I am nishant".replace(" ",""))

[15]:
['H', 'e', 'l', 'l', 'o', 'I', 'a', 'm', 'n', 'i', 's', 'h', 'a', 'n', 't']