An NBA game runs 48 minutes (Four 12 minute quarters). Players do not typically play the full game, subbing in and out as necessary. Your job is to extrapolate a player's points per game if they played the full 48 minutes.

Write a function that takes two arguments, ppg (points per game) and mpg (minutes per game) and returns a straight extrapolation of ppg per 48 minutes rounded to the nearest tenth. Return 0 if 0.

Examples:
```python
nba_extrap(12, 20) # 28.8
nba_extrap(10, 10) # 48
nba_extrap(5, 17) # 14.1
nba_extrap(0, 0) # 0
```

Notes:
All inputs will be either be an integer or float.
Follow your dreams!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def nba_extrap(ppg, mpg):
	

Solutions:
def nba_extrap(ppg, mpg):
	return round(48.0 / mpg * ppg, 1) if mpg > 0 else 0


def nba_extrap(ppg, mpg):
	try:
		return round(ppg / (mpg * 1.0) * 48, 1)
	except ZeroDivisionError:
		return 0


def nba_extrap(ppg, mpg):
	return 0 if not mpg else round(ppg / float(mpg) * 48, 1)


def nba_extrap(ppg, mpg):
	if mpg == 0:
		return 0
	else:
		avgppm = ppg / mpg
		time = 48 - mpg
		guess = time * avgppm
		whole = guess + ppg
		return round(whole, 1)


def nba_extrap(ppg, mpg):
	return round(48 * ppg / mpg, 1)


def nba_extrap(ppg, mpg):
	try:
		return round(float(ppg) / mpg * 48, 1)
	except:
		return 0


nba_extrap = lambda ppg, mpg: round(ppg / (mpg * 1.0) * 48, 1) if mpg else 0


nba_extrap = lambda p, m: m and round(48.0 * p / m, 1)


from typing import Union

def nba_extrap(ppg: Union[int, float], mpg: int) -> Union[int, float]:
	return 0 if any([not ppg, not mpg]) else round(48 / mpg * ppg, 1)


def nba_extrap(ppg, mpg):
	if ppg == 0 or mpg == 0:
		return 0
	overall_ppg = ppg / mpg * 48
	return float('{:.1f}'.format(overall_ppg))


from decimal import Decimal

def nba_extrap(ppg, mpg):
	return float(round(Decimal(ppg * 48 / mpg), 1))


def nba_extrap(ppg, mpg):
	return float('%0.1f' % (48 * ppg / mpg)) if ppg > 0 else 0


nba_extrap = lambda ppg, mpg: round(48.0 * ppg / mpg, 1)


nba_extrap = lambda a, b: round(a * 48 / b, 1) if b else 0


def nba_extrap(ppg, mpg):
	if ppg != 0 and mpg != 0:
		return float('{0:.1f}'.format(ppg * 48 / mpg))
	else:
		return 0


def nba_extrap(ppg, mpg):
	points_per_min = ppg / mpg
	points_per_game = round(points_per_min * 48, 1)
	return points_per_game


def nba_extrap(ppg, mpg):
	if mpg == 0:
		return 0
	else:
		ppm = ppg / mpg
		full48 = ppm * 48
		return round(full48, 1)


def nba_extrap(ppg, mpg):
	if ppg == 0 or mpg == 0:
		return 0
	pointsPerMinute = ppg / mpg
	ppg = pointsPerMinute * 48
	total = round(ppg, 1)
	return total


def nba_extrap(ppg, mpg):
	extrap = 48 * ppg / mpg
	return round(extrap, 1)
print(nba_extrap(5, 17))


def nba_extrap(ppg, mpg):
	if ppg == 0:
		return 0
	else:
		num = ppg / mpg
		ans = num * 48
		ppg = round(ans, 1)
	return ppg


nba_extrap = lambda p, m: round(p * 48 / m, 1) if m != 0 else 0


import sys

def nba_extrap(ppg, mpg):
	return round(ppg / (mpg + sys.float_info.epsilon) * 48, 1)


def nba_extrap(ppg, mpg):
	uebrig = 48 / mpg
	if mpg != 48:
		loesung = ppg * uebrig
		return round(loesung, 1)
	else:
		print(0)


def nba_extrap(ppg, mpg):
	if ppg == 0 or mpg == 0:
		return 0
	else:
		ppg_extrap = ppg / mpg * 48
	return round(ppg_extrap, 1)


def nba_extrap(ppg, mpg):
	puntos_por_minuto = ppg / mpg
	puntos_totales = round(puntos_por_minuto * 48.0, 1)
	return puntos_totales


def nba_extrap(ppg, mpg):
	full_match = 48
	ppmpm = ppg / mpg
	return round(ppmpm * full_match, 1)


import math

def nba_extrap(ppg, mpg):
	return round(ppg / mpg * 48, 1)


NBA_GAME_TIME = 48

def nba_extrap(points_per_game: float, minutes_per_game: float) -> float:
	if minutes_per_game < 0.001:
		return 0.0
	else:
		return round(points_per_game / minutes_per_game * NBA_GAME_TIME, 1)


def nba_extrap(p, m):
	return round(float(p + (48 - m) / m * p), 1)


def nba_extrap(ppg, mpg):
	if mpg == 0 or ppg == 0:
		return 0
	average = 48 / mpg
	ppg = round(average * ppg * 10) / 10
	return ppg


def nba_extrap(ppg, mpg):
	total_min = 48
	if mpg == 0:
		return 0
	else:
		ppm = ppg / mpg
		res = ppm * total_min
		return round(res, 1)


def nba_extrap(ppg, mpg):
	if not mpg or not ppg:
		return 0
	return round(48 / mpg * ppg, 1)


def nba_extrap(ppg, mpg):
	ppg1 = mpg / 48 * 100
	ppg1 = ppg / ppg1 * 100
	ppg1 = round(ppg1, 1)
	return ppg1


def nba_extrap(ppg, m):
	if m == 0 or ppg == 0:
		return 0
	full = 48 / m
	return round(ppg * full, 1)


def nba_extrap(ppg, mpg):
	try:
		return round(ppg / mpg * 48, 1)
	except ZeroDivisionError:
		print("That can't be...")


def nba_extrap(ppg, mpg):
	x = ppg * 48.0 / mpg
	return round(x, 1)


def nba_extrap(ppg, mpg):
	if ppg == 0:
		return 0
	else:
		full_time = 48
		average_points = ppg / mpg
		total_ppg = round(average_points * full_time, 1)
		return total_ppg


def nba_extrap(ppg, mpg):
	full_ppg = 0
	if ppg == 0:
		return 0
	return round(ppg * 48 / mpg, 1)


def nba_extrap(ppg, mpg):
	try:
		relative_minutes = 48 / mpg
		relative_points = round(ppg * relative_minutes, 1)
	except:
		relative_points = 0
	return relative_points


def nba_extrap(ppg, mpg):
	pts = 0
	if mpg > 0:
		pts = round(ppg / mpg * 48, 1)
	else:
		pass
	return pts