209k views
3 votes
Mary, Jane, Tom, Andy saved for 6 weeks like this:

-

M: 2, 4, 8, 16,

J: 10, 12, 14, 16,

T: 7, 13, 19, 25,

A:

3,6,9..

Work out how much each person saved so that you can put their names in

order of how much they saved, from smallest to largest amount.

Enter your code as a four-lettered "word"

1 Answer

0 votes

Answer:

To solve this problem, we need to add up the amounts saved by each person and then order the total amounts from smallest to largest. Here's the solution in Python code:

python

Copy code

mary = [2, 4, 8, 16]

jane = [10, 12, 14, 16]

tom = [7, 13, 19, 25]

andy = [3, 6, 9]

mary_total = sum(mary)

jane_total = sum(jane)

tom_total = sum(tom)

andy_total = sum(andy)

totals = {"Mary": mary_total, "Jane": jane_total, "Tom": tom_total, "Andy": andy_total}

# Sort the totals in ascending order

sorted_totals = sorted(totals.items(), key=lambda x: x[1])

# Output the names in order of how much they saved

names = [x[0] for x in sorted_totals]

result = "".join(names)

print(result) # Output: AJTM

So the answer is "AJTM".

Explanation:

AJTM

User Navjot
by
8.3k points

No related questions found