Inside the code editor we've tried to write a function that takes an array nums as argument and for every number in the array:
prints "negative" if that number is less than zero
or prints the number itself, if the number is greater than or equal to zero
So when we called the function for [2, -12, 0, 4, -5, 3], we expected it to print:
2
negative
0
4
negative
3
but it seems like we made some mistakes because when we run our code, it produces this output:
positive
2
-12
0
positive
4
-5
positive
3
Assignment:
Your task is to fix our loop such that it will print the desired output.
Free plan: 30 tutor messages. Premium is unlimited.