So how would I go about finding a duplicate element of a string from another string in python using a for the most part one-to-two line or a quick fix?
for example,
str1 = "abccde"
str2 = "abcde"
# gets me c
Through the use of str2, finding there was a duplicate element in str1, so detecting that str1 has a duplicate of an element in str2. Not sure if there's a way through .count to do that, like str1.count(str2) or something.
I'm using this contextually for my hangman assignment and I'm a beginner coder, so we are using mostly built-in functions and the basics for the assignments, and there's a piece of my code within my loop that will keep printing because it dings the double letters.
Ex. hello, grinding, concoction.
So I pretty much made a "used" string, and I am trying to compare that to my correct letters list, and the guesses are 'appended' so I can avoid that.
note: they will be inputted, so I won't be able to say or just hardcode the letter c if that makes sense.
Thank you!