42967/how-to-search-for-a-word-in-a-string-in-python
You can do it like this:
txt = "My name is Kumar" x = txt.find("Kumar") print(x)
This will print the location at which the found word starts. I have used a single variable. You can run a loop for this to check in the list
class Solution: def firstAlphabet(self, s): self.s=s k='' k=k+s[0] for i in range(len(s)): if ...READ MORE
if "ABCD" in "xxxxABCDyyyy": This can be used ...READ MORE
If you are talking about the length ...READ MORE
following way to find length of string x ...READ MORE
Try this: if cookie and not cookie.isspace(): # the ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
You can use the endswith method. It checks ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.