we can use indexing to help us find characters or words in a string. This is especially useful if we are looking for something in a paragraph or a variable.
Look at the slides below and try the tasks from the slides.
Task 1
Task 2
we can use indexing to help us find characters or words in a string. This is especially useful if we are looking for something in a paragraph or a variable.
Look at the slides below and try the tasks from the slides.
Task 1
Task 2
Thanks for your support.
Please, I am trying to create a password checker in Python that will check that a particular word is contained in whatever the user feeds as his password.
For example:
If the real password is john and the person has entered john bull as his password.
Is there a way to write that code??
var_string = “my name is John”
secretWord = “john”
if secretWord in var_string.split():
print(‘seceret word found’)
else:
print(“not found”)
The split function will separate words based on spaces so that you can search whole words