¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
Why it doesn't remove the pattern?
Wast trying to solve the youtube task but everything except the first input worked and I don't know why https://code.sololearn.com/cks35Ok8dIUR/?ref=app
7 Respuestas
+ 1
No problem.
0
"https://www.youtube.com/watch?v=kbxkq_w51PM".split() doesn't do anything to the string (apart from put it in a list). So pattern will never be in link.split().
I guess all the other cases follow the alternative format..?
Edit to explain:
print("hello" in "hello world!") # True
print("hello" in ["hello world!"] # False since "hello" is not an element of the list
0
But the .remove(). ?
0
The remove() isn't executed because the if returns False.
0
That makes sense.
Thank you very much!
0
Even if it were executed, it would only cause an error since "watch?=" is not an element in ["https://www.youtube.com/watch?v=kbxkq_w51PM"].
0
👌👍Thanks again