Код: Выделить всё
def first_difference(str1, str2):
"""
Returns the first location in which the strings differ.
If the strings are identical, it should return -1.
"""
if str1 == str2:
return -1
else:
for str1, str2 in zip(str1, str2):
if str1 != str2:
return str1
string1 = input("Enter first string:")
string2 = input("Enter second string:")
print(first_difference(string1, string2))
INPUT
Enter first string: python
Enter second string: cython
OUTPUT
Enter first string: python
Enter second string: Cython
p
Таким образом, вместо 'p' цель состоит в>
Подробнее здесь: https://stackoverflow.com/questions/710 ... strings-di