+ 5
I have a problem!
I have written my problem in the code please check that 👇 Thanks https://code.sololearn.com/c9O4nu5AU8v8/?ref=app
17 Respostas
+ 8
Here's an example of using the difflib SequenceMatcher.ratio() method. I arbitrarily picked .7 as a cutoff ratio but you can experiment with different numbers. At this cutoff, "hellish fiends" is similar enough to "hello friends" to pass but "hollow frogs" fails.
https://code.sololearn.com/cV0IY8wfD38A/?ref=app
+ 12
You miss the print statement within the else statement.
a = input()
if a == "hello friends":
print("Hi")
else :
print("You are not allowed")
Also, if you plan to fulfill the problem statement, I suggest using regex.
+ 8
I am a bit happy that hollow frogs dont match.... (-:
+ 7
1. set input to lower case
2. check if input contains hello
3. check if input contains friend
4. check if len(input) is round about 13
5. split input to check borh words seperately.
6. check if set of input and set of hello friend are similiar
(intersection)....
+ 7
Xan also thanks from me!
+ 6
Oma Falk True, but fiends are still pretty creepy 👹
+ 6
Xan Thanks for sharing the cool module!
+ 6
Xan your old boss must be a amazing person!
+ 4
Ace I wanted to say that if the string doesn't match completely but nearly the same so it perform the function
Thanks
+ 4
Ace, Hatsy Rei, Xan , David Ashton
I'm unable to understand Regex and sequence match in internet please provide me a example code so that I can have an Idea
Thanks
+ 3
With PCRE regex flavor, you'd write sth as below to match it.
(h|H)ello (f|F)riend(s)?
Will accept,
Hello friends
hello friend
hello Friend
...
+ 3
Sample cpp code for that pattern
[https://code.sololearn.com/c3J89K2Ie3N2/?ref=app]
0
No problem. I didn't know about it either, until I did some digging after reading your question. My old boss used to say:
"It's highly likely somebody has solved a problem before"
also
"If something is too difficult, then you just haven't found an easier solution yet".
Quite obvious, I know. However, if I remember those two ideas, I often get to a better solution.