Operator list

Write a function operate(data, ops) that applies in turn the operators
listed in ops to the data. The data is a list of n > 0 integers. Then
ops is a string of length n − 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 ops
and of data: 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
