Skip to content

Commit 0aabbda

Browse files
authored
Update __init__.py
1 parent e593839 commit 0aabbda

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

__init__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22

33
app = Flask(__name__)
44

5-
@app.route('/<int:n>')
6-
def fibo(n):
7-
a, b = 0, 1
8-
res = str(a) # Initialisation avec le premier terme
9-
10-
for _ in range(1, min(n, 50)): # Limité à 50 termes pour la sécurité
11-
res += f", {b}"
12-
a, b = b, a + b
13-
14-
return res
5+
@app.route('/somme/<path:valeurs>')
6+
def somme(valeurs):
7+
liste_nombres = valeurs.split('/')
8+
liste_nombres = [int(n) for n in liste_nombres]
9+
res = sum(liste_nombres)
10+
return str(res)
1511

1612
if __name__ == '__main__':
1713
app.run(host='0.0.0.0')

0 commit comments

Comments
 (0)