[Solved] Error detection in basic code [closed]


First of all, you appear to have an IndentationError and there are extra space around the dot:

def divide_list(list1, list2):
    list_out = []
    for number1 in list1:
        for number2 in list2:
            list_out.append(float(number1) / float(number2))
    return list_out

# Test case
print divide_list([1 ,2 ,3], [4 ,5 ,6])

I also added some PEP 8 formatting. Next time, try giving the answerer some information about the problem.

  • Indentation is required in python
  • By default in Python 2 dividing an integer by an integer always returns an integer
  • Pay attention to code formatting – see the changes I made to make the code look better. In general pay attention to PEP 8.

5

solved Error detection in basic code [closed]