The output of this code is 0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

The output of this code is 0

Any one answer plz Kasi Sireesha Next time add a link to the code and a bit more info about your problem here in the description, otherwise your question will be removed by the moderation team - Ace

17th Jun 2020, 3:39 PM
Kasi Sireesha
Kasi Sireesha - avatar
5 Answers
+ 2
def func(x): res=0 for i in range(x): res+=i return res print(func(4)) Your indentation level are not proper. The above code is with proper indentation
17th Jun 2020, 3:55 PM
Darren Gonsalves
Darren Gonsalves - avatar
+ 4
Which code?
17th Jun 2020, 3:44 PM
Abhay
Abhay - avatar
+ 3
Kasi Sireesha there is no code here to help you... Please use the 8 rules for getting help from the community. Thanks and happy coding. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community
17th Jun 2020, 3:48 PM
BroFar
BroFar - avatar
+ 2
Kasi Sireesha res+=i return res so when function runs 0 is added to res and since return is in same line as res vataible , function stops executing and 0 is returned
17th Jun 2020, 3:54 PM
Abhay
Abhay - avatar
0
https://code.sololearn.com/ca2TotiW0HpO/?ref=app In the exceptions theory questions., the answer was given as 6.can u explain??
17th Jun 2020, 3:47 PM
Kasi Sireesha
Kasi Sireesha - avatar