Hide

Problem C
List Negate

If you are doing this problem outside of a class, or your instructor has not given you code to use as a starting point, skip ahead to the Input/Output sections for a concise description of the input/output requirements of this problem.

CS 121 students: To solve this problem, use file negate.py from your CS 121 repository as a starting point. It will handle the input/output, and all you will need to do is add code in the places indicated in the file.

You must implement a function called negate_values that, given a list of integers, must return a new list with the values of the original list negated.

If you are using negate.py as a starting point, you can ignore the rest of the Input/Output sections below. Just submit your modified negate.py once you have written your solution.

Input

The input is composed of one or two lines. The first line contains an integer $n$ ($0 \le n \le 100$) that specifies the number of values in the list. If $n=0$, there is no second line (i.e., the input is an empty list of values). If $n>0$, then the second line contains the $n$ integers (for each integer $x$, $-1\, 000\, 000 \leqslant x \leqslant 1\, 000\, 000$), each separated by a single space.

Output

If $n=0$, then print EMPTY. Otherwise, print the $n$ integers from the input, each separated by a single space, but with each value negated.

Sample Input 1 Sample Output 1
3
5 -10 15
-5 10 -15
Sample Input 2 Sample Output 2
5
-14 -5 -39 -5 -7
14 5 39 5 7
Sample Input 3 Sample Output 3
0
EMPTY

Please log in to submit a solution to this problem

Log in