You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First name,Started,Salary
Bob,21 Jun 2007,80000
Jane,4 Apr 2011,105000
Cathy,17 Mar 2019,
John,18 Sep 2018,45000
average-salaries.bento:
Average salary for file path (path is text):
Declare people-file as csv file
Declare person as csv record
Declare total-salaries as a number
Declare total-people as a number
Declare salary as a number
Declare average-salary
Open csv file path as people-file
Until people-file has no more records do
Read next record from people-file into person
Set salary to person column "Salary"
# Only include salaries that are known.
Unless salary is zero do
Add salary to total-salaries
Increment total-people
Done
done
Divide total-salaries by total-people into average-salary
Display average-salary as currency
$ bento average-salaries.bento -- average salary for file "people.csv"$76666.67
No description provided.
The text was updated successfully, but these errors were encountered: