<jupyter_start><jupyter_text>Snail and wellA snail falls at the bottom of a 125 cm well. Each day the snail rises 30 cm. But at night, while sleeping, slides 20 cm because the walls are wet. How many days does it take to escape from the well?TIP: http://puzzles.nigelcoldwell.co.uk/sixtytwo.htm  Solución<jupyter_code># Assign problem data to variables with representative names
# well height, daily advance, night retreat, accumulated distance

well_height= 125
daily_distance=30
night_distance=20
snail_position=0

# Assign 0 to the variable that represents the solution

days=0

# Write the code that solves the problem
# as long as the snail_position is not yet greater or equal to the well hight, add the daily movement to it and in the last line you add the day summation

while(snail_position <= well_height):
    snail_position = snail_position + daily_distance - night_distance
    days = days + 1


# Print the result with print('Days =', days)
print("Days =", days)<jupyter_output>Days = 13<jupyter_text>Goals1. Treatment of variables2. Use of loop **while**3. Use of conditional **if-else**4. Print in console  BonusThe distance traveled by the snail is now defined by a list.```advance_cm = [30, 21, 33, 77, 44, 45, 23, 45, 12, 34, 55]```How long does it take to raise the well?What is its maximum displacement in one day? And its minimum?What is its average speed during the day?What is the standard deviation of its displacement during the day?<jupyter_code># Assign problem data to variables with representative names
# well height, daily advance, night retreat, accumulated distance

well_height= 125
advance_cm = [30, 21, 33, 77, 44, 45, 23, 45, 12, 34, 55]
night_distance=20
snail_position=0


# Assign 0 to the variable that represents the solution

days=0

# Write the code that solves the problem

while(snail_position <= well_height):
    snail_position = snail_position + advance_cm[days] - night_distance
    days = days + 1


# Print the result with print('Days =', days)

print("days =", days)

# Define the function Displacement by saying you take the daily advancement minus 20 for every item in the advance_cm list

displacement=[advance_cm_item-20 for advance_cm_item in advance_cm]

print(displacement)

# What is its maximum displacement in a day? And its minimum?


print(max(displacement))


print(min(displacement))
# What is its average progress?

print(sum(displacement)/len(displacement))

# What is the standard deviation of your displacement during the day?
import numpy as np

np.std(displacement)<jupyter_output>18.09090909090909
{'fraction_non_alphanumeric': 0.07270606531881804, 'fraction_numerical': 0.03771384136858476, 'mean_word_length': 4.96983758700696, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '107905', 'license': 'Unlicense', 'n_tokens_mistral': 861, 'n_tokens_neox': 748, 'n_words': 332, 'path': 'snail-and-well/snail-and-well.ipynb', 'repo_name': 'AlfredoSte/bcn-feb-2019-prework', 'size': '2572'}