promptdojo_

print and breakpoint — finding the bad value before AI does — step 8 of 9

Write a function find_max(items) that returns the largest number in a list. Inside the loop, print each item and the current best so far in the format seen X, best Y. Then call it on [3, 7, 2, 9, 4] and print the result.

Expected output:

seen 3, best 3
seen 7, best 7
seen 2, best 7
seen 9, best 9
seen 4, best 9
9

full-screen editor opens — close anytime to keep reading.