This repository has been archived on 2019-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
s1-tp/S1/TP 4/rebours.py
2014-10-10 00:02:58 +02:00

32 lines
629 B
Python

# PREUD'HOMME BONTOUX Geoffrey - PeiP 12 - 2014/2015
# TP n°4 donné le 3/10/2014 - Compte à rebours
# http://www.fil.univ-lille1.fr/~wegrzyno/portail/Info/Doc/HTML/tp_iteration_conditionnelle.html
# [Q1] Programmez une procédure nommée compte_a_rebours
def compte_a_rebours(depart):
"""
Affiche le décompte jusque 0 à partir de depart.
CU : depart entier > 0
"""
assert(type(depart) is int and depart > 0), \
"depart doit être un entier supérieur à 0"
for i in range(depart, -1, -1):
print(i)
# [Test]
# >>> compte_a_rebours(10)
# 10
# 9
# 8
# 7
# 6
# 5
# 4
# 3
# 2
# 1
# 0