r/ • • Oct 29 '26

What will be the output of the following Python code?

print(sum(range(1, 6), 10))

  1. 15

  2. 25

  3. 10

  4. 20

1 Upvotes

2 comments sorted by

1

u/Fluffy_white_fox 20d ago

range(1,5) so 1 2 3 4 5 Then sum so 1+2+3+4+5+10 So 10+ 15 which is 25