answer to the module 3 quiz 5th question is shown wrong when i work in playground | SoloLearn: Learn to code for FREE!

0

answer to the module 3 quiz 5th question is shown wrong when i work in playground

for this particular code : def func(x): res=0 for I in range(x): res+=i return res print (fund(4)) ans in quiz it was 6 in playground it is 0as I understood so wanted to know explanation

6/8/2020 6:05:14 AM

Pavithra B G

1 Answer

New Answer

+1

Pavithra B G It's nothing but 0+1+2+3=6 Answer will be 6 Run this code in code playground with correct indentation, you will get the answer in simple Syntax : res=0 for i in range(4): res+=i print(res)