We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b970c5 commit 88c12afCopy full SHA for 88c12af
1 file changed
__init__.py
@@ -6,16 +6,12 @@
6
7
@app.route('/<int:valeur>')
8
def exercice(valeur):
9
- val = [0, 1]
10
- result = []
11
- result.append(val[0])
12
- result.append(val[1])
13
-
14
- for _ in range(2, valeur):
15
- result.append(val[0] + val[1])
16
- val[1] += val[0]
17
- val[0] = val[1] - val[0]
18
- return jsonify(result)
+ count = ['0', '1'] if n > 1 else ['0']
+
+ for _ in range(2, n):
+ count.append(str(int(count[-1]) + int(count[-2])))
+ return ', '.join(count[:n])
19
20
if __name__ == "__main__":
21
app.run(debug=True)
0 commit comments