Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python substring

learn_coding = "You can learn to code for free! Yes, for free!"
substring = "paid"

print(learn_coding.index(substring))

# output

# Traceback (most recent call last):
#  File "main.py", line 4, in <module>
#    print(learn_coding.index(substring))
# ValueError: substring not found
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #Python #substring
ADD COMMENT
Topic
Name
8+8 =