To resolve the issue in your code, you need to make a small modification. The problem lies in the line y = str(i).join(x). Instead, you should use the join() method on an empty string and pass i and x as arguments to concatenate them correctly.
Here's the updated code:
list1 = [('my', '1.2.3', 2), ('name', '9.8.7', 3)]
list2 = []
for i, j, k in list1:
x = j.split('.')[1]
y = ''.join([str(i), x]) # Concatenate i and x using ''.join()
list2.append((y, k))
print(list2)
This will give you the expected output:
[('my2', 2), ('name8', 3)]
In the revised code, y = ''.join([str(i), x]) creates a new string by concatenating i and x without any separator. The resulting string is then added to list2 along with the corresponding value of k.