What am I getting wrong here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What am I getting wrong here

def func (x): res = 0 for i in range (x): res += i return res print(func(4))

12th May 2021, 7:28 PM
Ifeanyichukwu Elochukwu
Ifeanyichukwu Elochukwu - avatar
5 Answers
+ 1
Thank you,i will ,bult and run again!
13th May 2021, 2:23 AM
Ifeanyichukwu Elochukwu
Ifeanyichukwu Elochukwu - avatar
0
Thank you so much,your answer is correct!
12th May 2021, 7:50 PM
Ifeanyichukwu Elochukwu
Ifeanyichukwu Elochukwu - avatar
0
Ifeanyichukwu Elochukwu Then why did you say you are getting wrong?
12th May 2021, 7:53 PM
A͢J
A͢J - avatar
0
It was not running on my IDE,it was giving me errors. Tried several times to debug but still the same thus in was stucked!
12th May 2021, 8:29 PM
Ifeanyichukwu Elochukwu
Ifeanyichukwu Elochukwu - avatar
- 1
Ifeanyichukwu Elochukwu Output is 6. What you expect?
12th May 2021, 7:30 PM
A͢J
A͢J - avatar