Search⌘ K
AI Features

Puzzles 11 to 14

Discover how to apply Python concepts through puzzles on range sequences, summing values, list appending, slicing, and the modulo operator. Learn to predict outputs and engage with the Elo rating system to track your Python skill improvement.

Puzzle 11

What is the output of the following code?

Note: Enter the output you guessed. Then, press the Run button, and your new Elo will be calculated. Don’t forget to save your Elo rating.

Python 3.5
#############################
## id 93
## Puzzle Elo 815
## Correctly solved 76 %
#############################
print(sum(range(0, 7)))
Did you find this helpful?

Range function

The range function returns a sequence starting from the first value (inclusive) and ending at the second value (exclusive).

range(1,101)

Sum function

The sum function sums up the values in the iterable.

Python 3.5
arr = {1,2,3,4,5}
a = sum(arr)
print(a)

Solution

The correct solution is 21.

Combining the sum and range functions sums up the sequence from 0 to 6.

Your Elo rating will be updated according to the following table.

Your Elo Correct Incorrect
0 - 500 46 -9
...