Skip to content

Commit 6fa2d4c

Browse files
authored
Update II Variables in Bash Scripting.py
1 parent 850da56 commit 6fa2d4c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Introduction to Bash Scripting/II Variables in Bash Scripting.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,25 @@
236236
# Print out the array length
237237
echo ${#capital_cities[@]}
238238

239+
"""
240+
### Creating associative arrays
241+
242+
Instructions 1/3
243+
244+
In this exercise we will practice creating and adding to an associative array.
245+
We will then access some special properties that are unique to associative arrays.
246+
"""
247+
# Create empty associative array
248+
declare -A model_metrics
249+
250+
# Add the key-value pairs
251+
model_metrics[model_accuracy]=98
252+
model_metrics[model_name]="knn"
253+
model_metrics[model_f1]=0.82
254+
"""
255+
Instructions 2/3
256+
257+
- Create the same associative array (model_metrics) all in one line. (model_accuracy, 98), (model_name, "knn"), (model_f1, 0.82).
258+
Remember you must add square brackets* around the keys!
259+
- Print out the array to see what you created.
260+
"""

0 commit comments

Comments
 (0)