Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.python > #3650
| From | Benoit Izac <use.reply.to@INVALID.ADDRESS> |
|---|---|
| Newsgroups | fr.comp.lang.python |
| Subject | Re: print |
| Date | 2021-11-26 08:15 +0100 |
| Message-ID | <875ysf1j6v.fsf@izac.org> (permalink) |
| References | <61a08538$0$3730$426a34cc@news.free.fr> |
Bonjour, Le 26/11/2021 à 07:56, ast <ast@invalid> a écrit dans le message <61a08538$0$3730$426a34cc@news.free.fr> : > si je fais: > >>>> for i in range(5): > i > > > 0 > 1 > 2 > 3 > 4 > > j'ai bien l'affichage de i > > mais si je fais la même chose dans une fonction: > >>>> def test(): > for i in range(5): > i > > >>>> test() >>>> > > Je n'ai rien. Pourquoi ? J'imagine que dans le premier cas, i est renvoyé à chaque itération à l'interpréteur, alors que dans le second cas, c'est renvoyé à la fonction et vu qu'elle ne renvoie rien, tu n'as rien. -- Benoit Izac
Back to fr.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
print ast <ast@invalid> - 2021-11-26 07:56 +0100
Re: print Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2021-11-26 08:15 +0100
Re: print Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2021-11-26 14:04 +0100
csiph-web