This question is the basic operation of the linked list, that is, the value val and the successor next need to be clarified, that is, temp = temp.next in the loop, which is equivalent to sliding back once
The second one is to be familiar with python functions. For example, str() converts it into characters (you can also directly convert all a list into strings), and strings in python can be spliced by '+', which is very Convenience
The other is that x[::-1] is the reverse order