Recently I was learning python,and I want to use the function that is opposite of append() function.How can I use the function insert an element in the first position of the list.Thank you!
Prepend doesn't exist, but you can simply use the insert method:
list.insert(0, element)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With