Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Latest commit

 

History

History
25 lines (18 loc) · 666 Bytes

File metadata and controls

25 lines (18 loc) · 666 Bytes

Restricted sum

From time to time you have to solve some task without your favorite tool or library. To simulate this situation in a simple way, we want you to implement the sum() function in a very restricted environment.

Given a list of numbers, you should find the sum of these numbers. The code for your solution should not contain any of the banned words, even as a part of another word.

The list of banned words is as follows:

  • sum
  • import
  • for
  • while
  • reduce
  • eval
  • __ (two underscores)

Input: A list of numbers.

Output: The sum of numbers.

Example:

restricted([1, 2, 3]) == 6
restricted([2, 2, 2, 2, 2, 2]) == 12