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!

Difficulty: introductory

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):
    return round(ppg * 48.0 / mpg, 1) if mpg 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):
    if mpg == 0: return 0
    return round(48.0 / mpg * ppg,1)

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




def nba_extrap(ppg, mpg):
    return round(48 * ppg/float(mpg), 1) if mpg != 0 else 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

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

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

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

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

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

from typing import Union

def nba_extrap(ppg: Union[int, float], mpg: int) -> Union[int, float]:
    """ Get a straight extrapolation of points per game per 48 minutes game. """
    return 0 if any([not ppg, not mpg]) else round(48 / mpg * ppg, 1)

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

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

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

nba_extrap = lambda ppg, mpg: 0 if mpg == 0 else round(ppg * (48 / mpg), 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

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

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


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

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

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

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

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

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


'''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.'''

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

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):
    return 0 if not mpg else round(ppg * 48 / mpg, 1)

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 ppg == mpg == 0:
        return 0
    else:
        return round((48*ppg)/mpg,1) 

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):
    return 0 if ppg == 0 and mpg == 0 else round(float(48 / mpg) * float(ppg), 1)

def nba_extrap(ppg, mpg):
    return 0 if ppg==0 or mpg==0  else float("%.1f" % ((48/mpg) * ppg))

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



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

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

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

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



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

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

def nba_extrap(ppg, mpg):
    if mpg != 0:
        ttl_scr = round(ppg/mpg * 48, 1)
        return ttl_scr
    else:
        return 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):
    return 0 if mpg <= 0 else round(ppg * (48/mpg), 1)

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

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

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

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

def nba_extrap(ppg, mpg):
    if ppg * mpg == 0:
        return 0
    else:
        return round(ppg*48/mpg,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):
    if mpg == 0 or ppg == 0:
        return 0
    else:
        return round(round((48/mpg)*ppg,1),10)

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

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


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

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

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

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(ppg, mpg):
    alt_ppg = ppg / mpg * 48
    return round(alt_ppg,1)

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

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

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

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 # points per minute
        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, mpg):
    if ppg and mpg:
        return round((ppg / mpg * 48), 1)
    else:
        return 0

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

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

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):
    newppg = (48/mpg) * ppg
    return round(newppg,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):
    return 0 if ppg == 0 or mpg == 0 else round(48/mpg * ppg, 1)

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

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

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

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

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):
    try:
        ppg = ppg/mpg * 48
        return round(ppg, 1)
    except ZeroDivisionError:
        return 0

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

def nba_extrap(ppg, mpg):
    if mpg != 0:
        ppm = ppg/mpg    #point per minute they played
        ppg = round(ppm*48,1)
    else:
        ppg = 0
    return ppg




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

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

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

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

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

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

def nba_extrap(ppg, mpg):
    #try to do the maths
    try:
        #extrapolate the correct int to multiply by
        relative_minutes = (48/mpg)
        relative_points = round(ppg * relative_minutes, 1)
    except:
        #if the mpg is zero, it will fail, so set the final answer to 0
        relative_points = 0
    return relative_points

# 需要考虑保留一位小数，采用round(a,1)的方法，计算部分十分简单。
def nba_extrap(ppg, mpg):
    if mpg != 0:
        ppg = (ppg/mpg)*48
        return round(ppg,1)

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