st1 = 'inserisci una stringa:rrrrrrrrrrrrrrrr ' st2 = 'aaa' while len(st1) >20: st1 = raw_input('inserisci una stringa con max 20 lettere: ') while st2[-1] in st2[0:2]: st2 = raw_input('inserisci una stringa con lettera finale diversa da prime 2: ') def accetta(st1,st2): c = raw_input("dammi un carattere: ") c = c.lower() if (c in st1.lower()) and (c in st2.lower()): print c+' is in both' elif (c in st1.lower()): print c+' is in 1' elif (c in st2.lower()): print c+' is in 2' else: print c+' is not in both' accetta(st1,st2) def mischia(st1,st2): if len(st1) > len(st2): s = len(st2) diff = len(st1)-s else: s = len(st1) diff = len(st2) - s i = 0 stnew = "" # print s, diff while i < s: stnew = stnew+st1[i]+st2[-(i+1)] # print stnew i = i+1 if len(st1) > len(st2): stnew = stnew+st1[s:] else: i = 0 while i< diff: stnew = stnew+st2[-(s+i+1)] i = i+1 return stnew s = mischia(st1,st2) print s #####FINE##### ##altra opzione per mischiare le stringhe con mischia2 ####### def mischia2(st1,st2): #swap st2 i = 1 st3 ="" while i <= len(st2): st3=st3+st2[-i] i = i+1 if len(st1)>len(st3): i = 0 st4="" while i