Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.python > #3482
| Newsgroups | fr.comp.lang.python |
|---|---|
| Subject | Somme, récursive |
| From | raph14 <nospam_rgb.baralle@gmail.com.invalid> |
| Organization | !No_Organization! |
| Message-ID | <48-dnbOA4f2klhb9nZ2dnUU7983NnZ2d@giganews.com> (permalink) |
| Date | 2021-04-29 14:38 -0500 |
Bonjour,
J'essaie de faire une question de mon DM de NSI mais problème, je bloque. Aider
moi svp :,)
Il faut faire la somme de (4,7,5,5,2,6,9,3,8,4) en utilisant une récursivité.
Voici la question:
"Implémenter une fonction récursive max_pyr(pyramide) retournant la somme
maximale de la
pyramide."
Je n'y arrive pas j'ai essayé en créent cela:
def max_pyr(liste):
somme=0
if len(liste)<=0:
return somme
else:
somme+=liste[0]
liste.del[0]
return (max_pyr(liste),somme)
Mais rien cela ne marche pas...
Aider moi svp
Back to fr.comp.lang.python | Previous | Next — Next in thread | Find similar
Somme, récursive raph14 <nospam_rgb.baralle@gmail.com.invalid> - 2021-04-29 14:38 -0500
Re: Somme, récursive Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2021-04-29 22:38 +0200
Re: Somme, récursive Dominique <zzz@aol.com.invalid> - 2021-04-30 07:02 +0200
Re: Somme, récursive Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2021-04-30 12:07 +0200
Re: Somme, récursive raph14 <nospam_rgb.baralle@gmail.com.invalid> - 2021-04-30 09:56 -0500
Re: Somme, récursive raph14 <nospam_rgb.baralle@gmail.com.invalid> - 2021-04-30 09:57 -0500
Re: Somme, récursive Olivier Miakinen <om+news@miakinen.net> - 2021-04-30 17:06 +0200
Re: Somme, récursive Olivier Miakinen <om+news@miakinen.net> - 2021-04-30 17:17 +0200
Re: Somme, récursive Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2021-04-30 18:14 +0200
Re: Somme, récursive raph14 <nospam_rgb.baralle@gmail.com.invalid> - 2021-04-30 11:46 -0500
Re: Somme, récursive Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2021-04-30 20:09 +0200
Re: Somme, récursive raph14 <nospam_rgb.baralle@gmail.com.invalid> - 2021-04-30 14:04 -0500
Re: Somme, récursive Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2021-04-30 21:15 +0200
Re: Somme, récursive debimax <debimax@free.fr> - 2021-04-30 15:03 +0200
Re: Somme, récursive Dominique <zzz@aol.com.invalid> - 2021-04-30 18:46 +0200
Re: Somme, récursive debimax <debimax@free.fr> - 2021-04-30 22:05 +0200
Re: Somme, récursive Dominique <zzz@aol.com.invalid> - 2021-05-01 04:39 +0200
csiph-web