title: Google FooBar unexpected failed valuation
body: <p>I am working on a Google FooBar challenge and the test case doesn't seem to be correct; below is the highlight.</p>
  
  <pre><code>return the product of non-empty subset of those numbers. Example [2, -3, 1, 0, -5], 
  would be: xs[0] = 2, xs[1] = -3, xs[4] = -5, 
  
  giving the product 2*(-3)*(-5) = 30.  
              So answer([2,-3,1,0,-5]) will be "30".
  </code></pre>
  
  <p>Given the following:</p>
  
  <p>Case 1:</p>
  
  <pre><code>Inputs:
          (int list) xs = [2, 0, 2, 2, 0]
  Output:
      (string) "8"
  </code></pre>
  
  <p>Case 2:</p>
  
  <pre><code>Inputs:
      (int list) xs = [-2, -3, 4, -5]
  Output:
      (string) "60"
  </code></pre>
  
  <p>The "expected result" of 60 confuses me, shouldn't the expected result be 120? When I submit the following code: </p>
  
  <pre><code> def answer(xs):
      runningTotal = ""
      for i in range(0, len(x)):
          if x[i] != 0:
              runningTotal = runningTotal + "(" + str(x[i]) +")" + " * "
  
      answer = runningTotal.replace("-","")[:-3]
      return str(eval(answer))
  </code></pre>
  
  <p>It passes Test 1, but fails test 2 (and 3,4,5 which I am not given the test conditions). Is there something I am missing, or is it possible this is an error on Google's expected results? Below is the entire instruction set.</p>
  
  <h1>Power Hungry</h1>
  
  <p>Commander Lambda's space station is HUGE. And huge space stations take a LOT of power. Huge space stations with doomsday devices take even more power. To help meet the station's power 
  needs, Commander Lambda has installed solar panels on the station's outer surface. But the station sits in the middle of a quasar quantum flux field, which wreaks havoc on the solar 
  panels. You and your team of henchmen has been assigned to repair the solar panels, but you can't take them all down at once without shutting down the space station (and all those pesky 
  life support systems!). </p>
  
  <p>You need to figure out which sets of panels in any given array you can take offline to repair while still maintaining the maximum amount of power output per array, and to do THAT, you'll 
  first need to figure out what the maximum output of each array actually is. Write a function answer(xs) that takes a list of integers representing the power output levels of each panel in an 
  array, and returns the maximum product of some non-empty subset of those numbers. So for example, if an array contained panels with power output levels of [2, -3, 1, 0, -5], then the maximum 
  product would be found by taking the subset: xs[0] = 2, xs[1] = -3, xs[4] = -5, giving the product 2*(-3)*(-5) = 30.  So answer([2,-3,1,0,-5]) will be "30".</p>
  
  <p>Each array of solar panels contains at least 1 and no more than 50 panels, and each panel will have a power output level whose absolute value is no greater than 1000 (some panels are 
  malfunctioning so badly that they're draining energy, but you know a trick with the panels' wave stabilizer that lets you combine two negative-output panels to produce the positive 
  output of the multiple of their power values). The final products may be very large, so give the answer as a string representation of the number.</p>
  
  <h1>Languages</h1>
  
  <p>To provide a Python solution, edit solution.py
  To provide a Java solution, edit solution.java</p>
  
  <h1>Test cases</h1>
  
  <p>Inputs:
      (int list) xs = [2, 0, 2, 2, 0]
  Output:
      (string) "8"</p>
  
  <p>Inputs:
      (int list) xs = [-2, -3, 4, -5]
  Output:
      (string) "60"</p>
  
  <p>Use verify [file] to test your solution and see how it does. When you are finished editing your code, use submit [file] to submit your answer. If your solution passes the test cases, it will 
  be removed from your home folder.</p>
  
  <p>[EDIT]</p>
  
  <p>I adjusted <strike> my code as follows </strike> and all of my test cases return as expected, but now all but the first test fails (even though I have access to case 1 and 2 which both return the expected results on my local computer); for a few minutes the test cases were absent from the readme.txt file but after logging out and back in it was back to the original file. Am I missing some subtly or could this be an error on their system (I only ask because I would expect to pass their first two tests as I pass the first (meaning my return type is correct) and fail the second even though their "output" and mine match. **Please do not give code examples, as noted by Fayaz this is a challenge and I not phishing for someone to do this on my behalf (what fun would that be?!).</p>
  
  <p>[EDIT] 
  After rebooting computer, I noticed I zoomed in slightly and it was cutting off the text (that's embarrassing) I also noticed a few moments later my code made the assumption of 0 being the default if the value was lower than 0, which clear didn't work. After that minor adjustment everything passed and I live to code another day. Thank you all so much for your help/support!</p>