-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from code4tomorrow/chrehall68-patch-1
The other JSON practice problem
- Loading branch information
Showing
7 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"favorite foods": { | ||
"Jerry": "ice cream", | ||
"Ben": "ice cream", | ||
"Steven": "eggroll", | ||
"Spongebob": "Krabby Patty" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# use the file "wildlife.json" | ||
# load the data in the JSON file | ||
# add at least one habitat and corresponding animal(s) to the dictionary | ||
# finally, write the updated dictionary to the json file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"China": "pandas", | ||
"Africa": "cheetas", | ||
"North America": "bison", | ||
"South America": "boa constrictor" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"favorite foods": { | ||
"Jerry": "ice cream", | ||
"Ben": "ice cream", | ||
"Steven": "eggroll", | ||
"Spongebob": "Krabby Patty" | ||
}, | ||
"names": [ | ||
"Jerry", | ||
"Ben", | ||
"Steven", | ||
"Spongebob" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# use the file "wildlife.json" | ||
# load the data in the JSON file | ||
# add at least one habitat and corresponding animal(s) to the dictionary | ||
# finally, write the updated dictionary to the json file. | ||
|
||
import json | ||
|
||
a = open("wildlife.json", "r") | ||
x = json.load(a) | ||
a.close() | ||
x["Deepest Peru"] = "Paddington" | ||
n = open("wildlife.json", "w") | ||
json.dump(x, n, indent=4) | ||
n.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"China": "pandas", | ||
"Africa": "cheetas", | ||
"North America": "bison", | ||
"South America": "boa constrictor", | ||
"Deepest Peru": "Paddington" | ||
} |