Calculate the ERA

A pitcher’s ERA (earned runs average) is calculated by multiplying the number of runs (scores) times total innings in the game (usually 9) and then dividing by the total innings that the pitcher pitched.

Write a function that assumes that there were 9 innings in the game and takes in two numbers that represent the earned runs and the innings pitched. The function should return the ERA.

Relax

Respuesta :

Answer:

In Python:

def returnERA(runs,total):

   ERA = runs *9/total

   return ERA

Explanation:

This defines the function. It receives the number of runs and the total runs as its parameters

def returnERA(runs,total):

This calculates the ERA

   ERA = runs *9/total

This returns the ERA

   return ERA