The snail crawls up the column. During the day it crawls up some distance. During the night she sleeps, so she slides down for some distance (less than crawls up during the day).

Your function takes three arguments:
1. The height of the column (meters)
2. The distance that the snail crawls during the day (meters)
3. The distance that the snail slides down during the night (meters)

Calculate number of day when the snail will reach the top of the column.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def snail(column, day, night):
	

Solutions:
from math import ceil

def snail(column, day, night):
	return max(ceil((column - night) / (day - night)), 1)


snail = lambda c, d, n: -(min(0, d - c) // (d - n)) + 1


def snail(height, day, night):
	(n, r) = divmod(max(0, height - day), day - night)
	return n + 1 + (r != 0)


def snail(column, day, night):
	count = 0
	some = True
	while some:
		column = column - day
		if column <= 0:
			some = False
		column += night
		count += 1
	return count


from numpy import ceil

def snail(column, day, night):
	return max(ceil((column - day) / (day - night)), 0) + 1


def snail(column, day, night):
	heightUpColumn = 0
	daysPassed = 1
	while heightUpColumn < column:
		heightUpColumn += day
		if heightUpColumn < column:
			heightUpColumn -= night
			daysPassed += 1
		elif heightUpColumn >= column:
			return daysPassed


def snail(column, day, night):
	total = 0
	when = True
	n = 0
	while column > total:
		if when:
			total += day
			when = False
			n += 1
		else:
			total -= night
			when = True
	return n


snail = lambda c, d, n: max([i for i in range(c) if i * d - (n * i - n) >= c][0], 1)


def snail(column, d, n):
	k = 1
	v = d
	while v < column:
		v -= n
		v += d
		k += 1
	return k


from math import ceil

def snail(column, day, night):
	return ceil((column - night) / (day - night)) if column - day > 0 else 1