Q:

Write a Python program find the common values that appear in two given strings.

0

 Write a Python program find the common values that appear in two given strings.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def intersection_of_two_string(str1, str2):
    result = ""
    for ch in str1:
        if ch in str2 and not ch in result:
            result += ch
    return result

str1 = 'Python3'
str2 = 'Python2.7'
print("Original strings:")
print(str1)
print(str2)
print("\nIntersection of two said String:") 
print(intersection_of_two_string(str1, str2))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now