#🔒 Search in a string
19 messages · Page 1 of 1 (latest)
@lyric canyon
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
you appear to be searching for a string of K characters, where it doesn't matter what the characters are
of course that will match at the start of the string
did you want to search for actual periods (i.e., the character '.')?
Yes
no need to use the re library, in that case
!e
print("..." in "Hey, Fred ... pass the peas")
@nova walrus :white_check_mark: Your 3.12 eval job has completed with return code 0.
True
💐
!e
code
!e N,K=input('' '').split()
N=int(N)
K=int(K)
num_list = list()
for i in range(1, N + 1):
forest = input('')
value = 0
if ('.' * K in forest) == True:
value += 1
num_list.append(bool(value))
else:
value = 0
num_list.append(bool(value))
if any(num_list) == True:
print('1')
elif all(num_list) == False:
print('0')
@lyric canyon :x: Your 3.12 eval job has completed with return code 1.
:warning: Note: input is not supported by the bot :warning:
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | N,K=input('' '').split()
004 | ^^^^^^^^^^^^
005 | EOFError: EOF when reading a line
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.