white hat? perhaps you can find some stuff in /r/opendirectories or something in reddit. I've got some book and tutorial there. But never feel the need to read it, so it lays abandoned somewhere.
I just made it up a little while ago. I was frustrated with not getting some emotes, so I decided to share my pain. It means: whatever you think it means. Or it can mean fire eyes. _
(python) How do you get to know whether a character in string A is in string B? I just need to know if at least one character is common in both of them. for eg. x = 'asdf' y = 'fghj' In this, we know that 'f ' is common. How to make a program to find out whether x and y have a character in common? (Since I don't need to to find the substring x in y or vice versa, I cannot use in or .find , right?)
Except a character is a substring in python. So the simplest way is to iterate through x and see whether the current character is in y, in which case, both in and find() are viable.
(sorry for the late reply) hmm...when you just do x in y, the whole substring x is searched in the same sequence in y. But I only wanted one character. I guess loop is the best option. Here is what I wrote (I have just started functions; I originally wanted this for writing a function): def isIn(x, y): for i in x: if i in y: return True return False # defined the function w = 'qwefsdsav' q = 'asdaugfwq' print(isIn(w, q)) True Too simple to be true. But sadly I am a novice. I will have to stick to loops right now :/ thanks
I know, right? This is why Python has a wide fanbase. It's simple and it comes equipped with lots of nice things. Also, I think your solution is good enough. However, @noisypixy showed us a cleaner one. Note that according to Python's docs, you should use frozensets instead of sets because set() was deprecated in 2.6.