SoFunction
Updated on 2024-11-15

Python implementation of finding the same character in two strings and outputting it

This article example describes the python implementation of finding the same character in two strings and output. Shared for your reference. Specific implementation methods are as follows:

seq1 = "spam" 
seq2 = "scam" 
res = []
for x in seq1:
  if x in seq2:
    (x)
print res 

The output is as follows:

['s', 'a', 'm']

I hope that what I have described in this article will help you in your Python programming.