Answer the question
In order to leave comments, you need to log in
How to set a condition in Python if "text" + "something random"?
How to set an if condition in Python so that it reacts to a certain typed text?
a = some-given-text AND some random text
something like if a = 'text' + 'random'
print('Hello')
text is the first parameter given, and random is any random the next word, number...
text23894234, textsdfsdf, text12, textWHAT. so that when I enter all these words, I get print('Hello')
Answer the question
In order to leave comments, you need to log in
There are several options. One of them: make a cut of the string and compare the first conditionally 4 letters. If they are equal to the given string, then the action is performed. Example:
a = 'text2283832939'
if a[:4] == 'text':
print('Hello')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question