20 lines
341 B
Plaintext
20 lines
341 B
Plaintext
raw_data = (read 'examples/assets/seaCreatures.json')
|
|
sea_creatures = (from_json raw_data)
|
|
|
|
data = {
|
|
creatures = []
|
|
total_clams = 0
|
|
dolphin_clams = 0
|
|
}
|
|
|
|
for creature in sea_creatures {
|
|
data.creatures += creature.name
|
|
data.total_clams += creature.clams
|
|
|
|
if creature.type == 'dolphin' {
|
|
data.dolphin_clams += creature.clams
|
|
}
|
|
}
|
|
|
|
data
|