new_contents: # Definition for singly-linked list.
  # class ListNode(object):
  #     def __init__(self, x):
  #         self.val = x
  #         self.next = None
  
  class Solution(object):
      def reverseList(self, head):
          """
          :type head: ListNode
          :rtype: ListNode
          """
          dummy = ListNode(0)
          dummy.next = head
          
          while head and head.next:
              p = head.next
              head.next = p.next
              p.next = dummy.next
              dummy.next = p
              
          return dummy.next
  
subject: Create RevLinkedList_002.py