Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def hamming(str1, str2):
- i = 0
- if not len(str1) - len(str2) == 0:
- if len(str1) - len(str2) < 0:
- for x in range (0,len(str2) - len(str1)):
- str1 = str1 + " "
- if len(str1) - len(str2) > 0:
- for x in range (0,len(str1) - len(str2)):
- str2 = str2 + " "
- for x in range(0,len(str1)):
- if not str1[x] == str2[x]:
- i = i + 1
- return i
- word = input(str)
- a = int(input())
- min = 999
- for x in range (0,a):
- words = input(str)
- if min > hamming(word,words):
- min = hamming(word,words)
- w = words
- if a > 0:
- print(w)
- if a == 0:
- print("BRAK PODPOWIEDZI")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement