In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of January 4th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #11 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

[IP101] Cypher's Betrayal

"Cypher, you've made the right decision. Your desire to return to the Matrix... to a world free from the suffering of reality... is understandable. All we need is for you to sabotage their mission. The rest will fall into place."

"You’re right, Smith.", Cypher says. "This glitch will be perfect."

Cypher pulls out a device from his pocket — a small chip that he's planted inside the Nebuchadnezzar.

"This little friend is doing to corrupt the data as they try to process it.", Cypher grins. "They’ll never know what hit them. Especially not Neo."

"Tell me more, Cypher. What exactly is this... glitch you're referring to?", Agent Smith asks.

"It's simple.", Cypher says. "The ship's system will process data from the Matrix, but there's a catch. Some of the data will be corrupted — strings, invalid values — anything that will trip them up. It won't stop the process completely, but it will cause enough of a disturbance. They'll be unable to process the data, not without errors."

"I see.", Smith nods. "So, you’re hoping to confuse them, halt their progress. A simple trick, really. But it will buy us time. I will make sure the agents are in position to capture them while they are occupied with this... glitch."

Cypher nods, a smug look crossing his face. He’s convinced that this simple flaw will be enough to bring down the crew. But little does he know, Neo is moving strong catching these glitches...

The Problem

Cypher has done his part. The glitch is in place. Now, it's up to you to help Neo process the data correctly despite the corrupted entries.

Write a Python function process_data(lst) that, given a list of integers lst, returns another list with the integers that are the sum of two consecutive integers. The function should catch exceptions to continue processing the data.

For instance:

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

0 ≤ |lst| ≤ 100       Size of the input list
-1000 ≤ lsti ≤ 1000       Elements of the list (integers)
lsti can be a string       This scenario should raise an exception. Even though consecutive strings can be concatenated, this is not allowed.

Example Function Calls Example Output
print(process_data([10, 3, 5, 6, 9, 3]))
print(process_data([10, 3, 5, "NA", 9, 1]))
print(process_data([10, 3, 5, "B", 9, "C"]))
[13, 8, 11, 15, 12]
[13, 8, 10]
[13, 8]

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto