Initial release
This commit is contained in:
26
L'escargot courageux.py
Normal file
26
L'escargot courageux.py
Normal file
@@ -0,0 +1,26 @@
|
||||
x = 1170
|
||||
y = 290
|
||||
h = 324*100
|
||||
|
||||
jour = 0
|
||||
alt = 0
|
||||
histo = [0, 0]
|
||||
while True:
|
||||
#Jour, il monte de x
|
||||
alt += x
|
||||
x -= 2
|
||||
print("Fin du jour {} : altitude= {} cm".format(jour, alt))
|
||||
if alt > h:
|
||||
break
|
||||
#nuit, il glisse de y
|
||||
alt -= y
|
||||
|
||||
#pleut-il?
|
||||
if (jour+1)%5 == 0:
|
||||
alt = histo[1]
|
||||
print("Fin de la nuit {} : altitude={} cm".format(jour, alt))
|
||||
|
||||
jour += 1
|
||||
histo = [alt, histo[0]]
|
||||
|
||||
print(jour)
|
||||
Reference in New Issue
Block a user