Merci beaucoup c'est intéressant Le lun. 16 nov. 2020 à 14:29, Agripreneur Updates < [email protected]> a écrit :
> for i in range (5, 0, -1): > print (i) > > On Sun, Nov 15, 2020, 8:22 PM MAHA RAJA <[email protected]> wrote: > >> ordered print >> i=1 >> while (i>=5){ >> print (i) >> i=i+1 >> } >> >> >> unordered print >> >> i=5 >> while (i<=1){ >> print (i) >> i=i-1 >> >> } >> >> >> >> >> >> On Sun, 15 Nov 2020, 10:39 pm Derek <[email protected] wrote: >> >>> You can also use range; >>> >>> >>> for i in range(0, 5): >>> ... print(i + 1) >>> ... >>> 1 >>> 2 >>> 3 >>> 4 >>> 5 >>> >>> >>> >>> or in reverse: >>> >>> >>> for i in range(5, 0, -1): >>> ... print(i) >>> ... >>> 5 >>> 4 >>> 3 >>> 2 >>> 1 >>> >>> >>> >>> On Saturday, 14 November 2020 at 21:26:04 UTC+2 [email protected] >>> wrote: >>> >>>> Python has the enumerate function for these situations. >>>> >>>> for i, item in enumerate(items): >>>> #your print statement here >>>> >>>> 'i' will give you the index of the list/iterable, and item will give >>>> you the item. >>>> >>>> On Sat, 14 Nov 2020 at 11:57, paidjoo indo <[email protected]> wrote: >>>> >>>>> Hello I'm newbie in python, I'm learning looping in python, how to >>>>> print like in bellow; >>>>> Input:5 >>>>> 12345 >>>>> 2. 4 >>>>> 3 3 >>>>> 4 2 >>>>> 54321 >>>>> Thanks guys >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Django users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/django-users/CAO%3D2VJmeOF5SyMZUFox_hHivTr%3DE%3Dnekj_n7FLOYjGOkPHQrbA%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/django-users/CAO%3D2VJmeOF5SyMZUFox_hHivTr%3DE%3Dnekj_n7FLOYjGOkPHQrbA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/281ee4c1-23bb-4eb2-a8d3-a9bc1a13e078n%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/281ee4c1-23bb-4eb2-a8d3-a9bc1a13e078n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAJhiZB5SR_iyZPeCfBJ8pxs2MR00rWFOSFmprE1y_57Po4rS_w%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAJhiZB5SR_iyZPeCfBJ8pxs2MR00rWFOSFmprE1y_57Po4rS_w%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CANyXpoou%2Bhj-A%3D5WHpcD6fL%3Dpz79SrmcUwU-QBuPuW_KUY%2BE%3Dg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CANyXpoou%2Bhj-A%3D5WHpcD6fL%3Dpz79SrmcUwU-QBuPuW_KUY%2BE%3Dg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD7zeesi-x3xGS_s1Dw3SjXzBSF__dYGtp0o8GGbHsEq%2BvDw7w%40mail.gmail.com.

