Operator list

Write a function operate(data,ops)operate(data, ops) that applies in turn the operators listed in opsops to the datadata. The data is a list of n>0n>0 integers. Then opsops is a string of length n1n-1 made up of the characters ’+’ and ’*’ standing respectively for sum and product. The result of the function is to be the outcome of the operations in left-to-right order both of opsops and of datadata: the first operator is applied to the first two integers, the second operator is applied to the outcome and the third integer, and so on.

Problem information

Author: José Luis Balcázar

Generation: 2026-01-25T16:54:50.940Z

© Jutge.org, 2006–2026.
https://jutge.org