Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_common_characters(msg1,msg2):
- l=[]
- for i in msg1:
- if((i in msg2) and i!=' '):
- l.append(i)
- a = "".join(l)
- if(a):
- return a
- else:
- return -1
- msg1="I like Python"
- msg2="Java is a very popular language"
- common_characters=find_common_characters(msg1,msg2)
- print(common_characters)
Add Comment
Please, Sign In to add comment