Yet another cheating Python solution

  • 0
            zeroes = 0
            while 0 in nums:
                zeroes = zeroes + 1
            for z in xrange(0, zeroes):

    What I want to know is how the while x in list mechanism works in Python. How can Python just select all elements in a list that are equal to x, and act upon those elements?

    Also what does this problem even teach? If I was given this problem, I have no idea what technical knowledge I'm supposed to be demonstrating here.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.