Spam detector | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Spam detector

What i input all are being shown that as a spam!!! Help me slove it https://code.sololearn.com/cxtXmWk5cx8G/?ref=app

22nd Mar 2022, 5:32 AM
Apu
Apu - avatar
8 Answers
+ 3
I think the condition you wrote in the if statement should be: if text in ("click to download", "click to make money", " click to watch", "watch this", " click to log in")
22nd Mar 2022, 5:50 AM
shreya
shreya - avatar
+ 1
Pks I used lower to convert the entered text into lowercase. And no, if u input "watch this" or any of the other phrases in the tuple, it shows it's a spam
22nd Mar 2022, 7:26 AM
shreya
shreya - avatar
0
shreya did u try? Let me try and i will get back to u
22nd Mar 2022, 5:52 AM
Apu
Apu - avatar
0
shreya it didnt work. I know i have to use elif but i want to know whats wrong with this one
22nd Mar 2022, 5:56 AM
Apu
Apu - avatar
22nd Mar 2022, 6:26 AM
shreya
shreya - avatar
0
shreya what about lower(). Why did u use it? and now whatever i input in your one, shown that, its not a spam😃😃😃
22nd Mar 2022, 6:34 AM
Apu
Apu - avatar
0
shreya i made a mistake actually. When input prompt came i put a spece before write.thats why its made wrong answer.thanks for helping
22nd Mar 2022, 7:34 AM
Apu
Apu - avatar
0
txt = "click to downloa buddy" l= ["click to download", "click to make money", " click to watch", "watch this", " click to log in"] if any(i in txt for i in l): print("Spam") else: print("Ok")
22nd Mar 2022, 10:07 AM
Shadoff
Shadoff - avatar