
Python Tips and Tricks
- How to insert elements in the list?
i)beginning of the list
ii)end of the list
iii)at a particular index
s=[1,2,3,4,5,6]
Adding element at beginning of the list:
s.insert(0,99)
Adding element at the end of the list.
s.append(55)
Adding element at a particular index 3
s.insert(3,77)




Note:
Adding element at end of the list using insert.
It will push the last element to the end of the list and insert it in that position.
s=[1,2,3]
s.insert(-1,99)
print (s)
Output:
[1, 2, 99, 3]
One-Time
Monthly
Yearly
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
$5.00
$15.00
$100.00
$5.00
$15.00
$100.00
$5.00
$15.00
$100.00
Or enter a custom amount
$
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.
Buy Me a CoffeeBuy Me a CoffeeBuy Me a Coffee