Doubt with neighboring numbers in Python [closed]

-1

I would like to know if anyone could help me with this code in order to calculate neighbor numbers (common numbers) in two Arrays, but does not return output.

i = 0
j = 0
k = 0
input1 = input()
input2 = input()
input1.split(", ")
input2.split(", ")
while i < len(input1):
    while j < len(input2):
        if input1[i] == input2[j]:
            result = input1[i]
            print(result)
        j = j + 1
    i = i + 1
    
asked by anonymous 23.05.2018 / 00:16

1 answer

0

The error is very simple, just use raw_input() instead of input() . Basically the input() it will receive and interpret as a list of integers, and when you try to use input1.split(", ") it will not recognize the command, but when you use raw_input() you create a string list, and in that list you use input1.split(", ") and you can turn it back to int if necessary.

    
23.05.2018 / 03:59