Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Find common characters between two strings
def printCh(str1,str2): string1 = str1 string2 = str2 s1 = set(string1) s2 = set(string2) common_char = s1 & s2 return common_char def printCh1(str1,str2): ans = [] for ch in str1: if ch in str2 and ch not in ans: ans += ch return ans string1 = 'sathuaa' string2 = 'hat' print(printCh(string1,string2)) print(printCh1(string1,string2))
run
|
edit
|
history
|
help
0
if else
Yyy
BiseccionPython
linked_lists_2
Python Monthly Calendar
mul table
H
reverse words
Bubble sort
sai hw user table for loop