+ 1

wrong result

why the result in this code isn't 9: def fu(x) for i in range(x): print(x) return fu(10)

21st Oct 2020, 10:26 AM
Toufik Salhi
Toufik Salhi - avatar
2 Antworten
0
Learn about how range function works .
21st Oct 2020, 11:44 AM
Hima
Hima - avatar
0
First of all, you don't have a colon after def fu(x) Second, you print x, which is the argument you passed to fu(x), i.e., you passed 10 to fu(x). So 10 assigns to x.
21st Oct 2020, 12:04 PM
你知道規則,我也是
你知道規則,我也是 - avatar