Welcome

For loop

Automated grading of homework assignments and tests

  • fork this repository
  • solve the task
  • commit with proper message

Problems

For_loop01

Given the list of numbers, return the sum of the numbers in the list

Example 1:

Input: [1,2,3,4,5]
Output: 15

Example 2:

Input: [6,3,1]
Output: 10

For_loop02

Given a list of numbers, return the sum of the numbers at even index in the list

Example 1:

Input: [7,1,5,2,8]
Output: 20

Example 2:

Input: [1,2,3,4,5]
Output: 9

Constraints:

  • 1 <= length(list1) <= 10^5

For_loop03

Given a list of numbers, return the sum of the numbers at odd index in the list

Example 1:

Input: [7,8,3,5,2]
Output: 13

Example 2:

Input: [1,2,3,4,5]
Output: 5

Constraints:

  • 1 <= length(list1) <= 10^5

For_loop04

Given the list of numbers, return the sum the even numbers in the list

Example 1:

Input: [5,3,2,8,5]
Output: 10

Example 2:

Input: [8,7,6,5,4]
Output: 18

Constraints:

  • 1 <= length(list1) <= 10^5

For_loop05

Create a list ranging from K to N. Return the List

Example 1:

Input: [5,3,2,8,5]
Output: 13

Example 2:

Input: [8,7,6,5,4]
Output: 12

Constraints:

  • 1 <= length(list1) <= 10^5

For_loop06

Given the list of numbers, return the sum of the numbers between k and n in the list

Example 1:

Input: [6,2,8,1,6,3,7], 2, 4
Output: 9

Example 2:

Input: [1,2,3,4,5], 0, 3
Output: 3

For_loop07

Given the list of numbers, return the sum of the even numbers between k and n in the list

Example 1:

Input: [5,6,7,8], 0, 3
Output: 5

Example 2:

Input: [1,8,2,5,3,7,4], 3, 7
Output: 7

Constraints:

For_loop08

Given the list of numbers, return the sum of the odd numbers between k and n in the list

Example 1:

Input: [1, 2, 3, 4, 5], 0, 4
Output: 6

Example 2:

Input: [7, 7, 2, 5, 1, 6], 2, 6
Output: 11

Constraints:

Warning

  • don't copy other solutions or any solution
  • don't remove commentsA sample command-line application with an entrypoint in bin/, library code in lib/, and example unit test in test/.