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.
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.
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 |