Last active
August 29, 2015 14:11
-
-
Save fabian57/f84ed3e5ebb36d0f0bc1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pond = input("Diameter of the pond? ") | |
water_lily = input("Initial diameter of the water lily? ") | |
growth = input("Daily growth? ") | |
day = 0 | |
while water_lily < pond: | |
day += 1 | |
water_lily *= growth | |
print "On day %s: %s" % (day, water_lily) | |
print"The pond is smothered!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Parfait!
Tu en as bavé pour la ligne 8... En fait, on écrit généralement ce genre de choses en utilisant une chaîne de format (
printf
en C). En Python 2.7, l'opérateur%
est surchargé en:J'introduirai ça officiellement plus tard, mais tu peux bien sûr l'utiliser d'ici là si tu veux.