I am trying to do leetcode #83 The thing I don't understand is that what's a difference between the following two ways:
    while cur and cur.next:
    while cur.next and cur:
If I try the second way, it will appear compile error. Can anyone help me to understand this concept?
    # Definition for singly-linked list.
    # class ListNode(object):
    #     def __init__(self, x):
    #         self.val = x
    #         self.next = None
    class Solution(object):
        def deleteDuplicates(self, head):
            """
            :type head: ListNode
    :rtype: ListNode
    """
    cur= head
    while cur and cur.next:
        if cur.val== cur.next.val:
            cur.next= cur.next.next
        else: 
            cur = cur.next
    return(head)
I am the beginner of data structure. I still confuse why cur.next is error way. The code cur = head didn't works?
 
    