Two moving objects A and B are moving accross the same orbit (those can be anything: two planets, two satellites, two spaceships,two flying saucers, or spiderman with batman if you prefer).
If the two objects start to move from the same point and the orbit is circular, write a function that gives the time the two objects will meet again, given the time the objects A and B need to go through a full orbit, Ta and Tb respectively, and the radius of the orbit r. 
As there can't be negative time, the sign of Ta and Tb, is an indication of the direction in which the object moving: positive for clockwise and negative for anti-clockwise.

The function will return a string that gives the time, in two decimal points.
Ta and Tb will have the same unit of measurement so you should not expect it in the solution. 

Hint: Use angular velocity "w" rather than the classical "u".

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def meeting_time(Ta, Tb, r):
	

Solutions:
def meeting_time(Ta, Tb, r):
	if Ta == 0:
		return '{:.2f}'.format(abs(Tb))
	elif Tb == 0:
		return '{:.2f}'.format(abs(Ta))
	else:
		return '{:.2f}'.format(abs(Ta * Tb / (Tb - Ta)))


def meeting_time(Ta, Tb, r):
	return str(abs(Tb)) + '.00' if Ta == 0 else str(abs(Ta)) + '.00' if Tb == 0 else str(round(abs(Ta * Tb / (Ta - Tb)), 4)) + '0' if Ta != 0 and Tb != 0 and (len(str(round(abs(Ta * Tb / (Ta - Tb)), 4))[str(round(abs(Ta * Tb / (Ta - Tb)), 4)).index('.') + 1:]) == 1) else str(round(abs(Ta * Tb / (Ta - Tb)), 2))


def meeting_time(ta, tb, r):
	if ta == 0:
		return '{:.2f}'.format(abs(tb))
	if tb == 0:
		return '{:.2f}'.format(abs(ta))
	else:
		return '{:.2f}'.format(abs(ta * tb / (tb - ta)))


def meeting_time(Ta, Tb, r):
	print(Ta, Tb, r)
	if Ta == Tb == 0.0:
		return '{:.2f}'.format(0.0)
	pi = 3.14
	len = 2 * pi * r
	if Ta != 0:
		sa = len / Ta
	else:
		sa = 0.0
	if Tb != 0:
		sb = len / Tb
	else:
		sb = 0.0
	if Ta == -Tb:
		return '{:.2f}'.format(abs(float(len / (sa + sb))))
	else:
		return '{:.2f}'.format(abs(float(len / (sa - sb))))


def meeting_time(Ta, Tb, r):
	if Ta == Tb:
		return '0.00'
	if Ta == 0:
		return '{:.2f}'.format(abs(Tb))
	if Tb == 0:
		return '{:.2f}'.format(abs(Ta))
	return '{:.2f}'.format(abs(Ta * Tb) / abs(Ta - Tb), 2)


def meeting_time(Ta, Tb, r):
	if Ta == 0 and Tb == 0:
		return '0.00'
	if Ta == 0:
		return '%.2f' % abs(Tb)
	if Tb == 0:
		return '%.2f' % abs(Ta)
	if Ta > 0 and Tb > 0 or (Ta < 0 and Tb < 0):
		return '%.2f' % (Ta * Tb / abs(abs(Ta) - abs(Tb)))
	if Ta > 0 and Tb < 0 or (Tb > 0 and Ta < 0):
		return '%.2f' % (abs(Ta * Tb) / abs(abs(Ta) + abs(Tb)))


def meeting_time(Ta, Tb, r):
	if Ta == 0:
		if Tb == 0:
			return '0.00'
		else:
			return str(abs(Tb)) + '.00'
	if Tb == 0:
		return str(abs(Ta)) + '.00'
	if Ta == Tb:
		return '0.00'
	Aa = 360 / Ta
	Ab = 360 / Tb
	if Aa > 0 and Ab > 0:
		return str(format(abs(360 / abs(Ab - Aa)), '.2f'))
	elif Aa < 0 and Ab < 0:
		return str(format(abs(360 / abs(Ab - Aa)), '.2f'))
	else:
		return str(format(abs(360 / (abs(Ab) + abs(Aa))), '.2f'))


def meeting_time(Ta, Tb, r):
	return f'{round(1 / abs(1 / Ta - 1 / Tb), 2):.2f}' if Ta and Tb else f'{max(abs(Ta), abs(Tb)):.2f}'


def meeting_time(Ta, Tb, r):
	return f"{1 / abs(1 / (Ta or float('inf')) - 1 / (Tb or float('inf')) or float('inf')):.2f}"