Guest User

Untitled

a guest
Dec 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. def find_common_characters(msg1,msg2):
  2. l=[]
  3. for i in msg1:
  4. if((i in msg2) and i!=' '):
  5. l.append(i)
  6. a = "".join(l)
  7. if(a):
  8. return a
  9. else:
  10. return -1
  11. msg1="I like Python"
  12. msg2="Java is a very popular language"
  13. common_characters=find_common_characters(msg1,msg2)
  14. print(common_characters)
Add Comment
Please, Sign In to add comment