import time
from machine import Pin
leds = []
for i in range(10):
leds.append(Pin(i,Pin.OUT))
leds[i].value(0)
def hamming_distance(str1,str2):
dist = 0
if len(str1)!=len(str2):
print("Error! The strings must have to be of the same length")
return dist
for a,b in zip(str1,str2):
if a!=b:
dist+=1
return dist
while True:
s1 = input("Enter String 1 :")
s2 = input("Enter String 2 :")
distance = hamming_distance(s1,s2)
print(f"The hamming distance between the two strings is {distance}")
for i in range(distance):
leds[i].value(1)
time.sleep(5)
for i in range(distance):
leds[i].value(0)