H Distance Coderbyte challenges

Can you simply explain what they want from me in coderbyte challenge? I am really new and stuck :frowning:

H Distance

Have the function HDistance(strArr) take the array of strings stored in strArr, which will only contain two strings of equal length and return the number of characters at each position that are different between them. For example: if strArr is [“house”, “hours”] then your program should return 2. The string will always be of equal length and will only contain lowercase characters from the alphabet and numbers.

Examples

Input: [“10011”, “10100”]
Output: 3

Input: [“abcdef”, “defabc”]
Output: 6

here is the function:

def HDistance(strArr):

code goes here

return strArr

keep this function call here

print HDistance(raw_input())

so you need help with a

Ok… send me a link

welcome to codadamy forms :grinning:

1 Like

Hi thank you! :slight_smile: Sorry I submitted the one I posted question about already. but here is the new one I am doing on H Distance if you can help pls Coderbyte | The #1 Coding Assessment Platform

1 Like

what is the codbyte challange called?

I think it is called H Distance

1 Like

what it wants I think it to find the difference from the 2 strings. hope this helps
happy coding :smiley:

1 Like

Did anyone solve this? No matter what I put it either comes up with the words I used as examples or the number 0 or 1 depending on how I change the code

It may be easier to help if you share your code.
The return should not be in the loop.

def HDistance(strArr): length = min(len(strArr[0]), len(strArr[1])) h = 0 for j in range(length): if (strArr[0][j] != strArr[1][j]): h += 1 return h print(HDistance(["10011", "10100"])) print(HDistance(["abcdef", "defabc"])) print(HDistance(["house", "hours"]))