python remove first occurrence from string code example
Example 1: remove first character from string python
s = ":dfa:sif:e"
print(s[1:])
prints:
dfa:sif:e
Example 2: remove first occurrence of element from list python
Input :
list [10, 20, 30, 40, 30]
function call to remove 30 from the list:
list.remove(30)
Output:
List elements after removing 30
list [10, 20, 40, 30]