cours_progra/bac1/q1/renforcement/entrainement_0712/stringdiff.py

15 lines
395 B
Python
Raw Normal View History

2023-02-15 13:40:50 +01:00
def diff(in1: str, in2: str) -> list:
ret = list()
for k, v in enumerate(in1):
if in2[k] != v :
ret.append((k, v, in2[k]))
return ret
if __name__ == "__main__":
in1, in2 = input("entrez la phrase 1:") , input("entrez la phrase 2")
diff_ins = diff(in1, in2)
if len(diff_ins) == 0:
print("Phrases identiques")
else:
print(diff_ins)