Comparing Outputs (list) Of Two Functions Returning Wrong Boolean
I wrote two functions largest_number and largest_numbercopied and ran a stress test to compare their results. Both of the functions output a rearranged version of the argument list
Solution 1:
largest_numbercopied
removes elements from a
, but it's operating on the array that was passed in and not a copy of it. This means that your lines
print(f'numbers= {a}, Result1= {largest_number(a)}')
print(f'numbers= {a}, Result2= {largest_numbercopied(a)}')
will result in a
being cleared out and then
iflargest_number(a)== largest_numbercopied(a)
will be comparing the result of operating on an empty list.
Post a Comment for "Comparing Outputs (list) Of Two Functions Returning Wrong Boolean"