hashmaps3 solution

This commit is contained in:
mo8it
2024-06-26 01:52:33 +02:00
parent fbc226a510
commit f1bd444792
3 changed files with 122 additions and 45 deletions
+7 -5
View File
@@ -574,16 +574,18 @@ https://doc.rust-lang.org/stable/book/ch08-03-hash-maps.html#only-inserting-a-va
name = "hashmaps3"
dir = "11_hashmaps"
hint = """
Hint 1: Use the `entry()` and `or_insert()` methods of `HashMap` to insert
entries corresponding to each team in the scores table.
Hint 1: Use the `entry()` and `or_insert()` (or `or_insert_with()`) methods of
`HashMap` to insert the default value of `Team` if a team doesn't
exist in the table yet.
Learn more at https://doc.rust-lang.org/stable/book/ch08-03-hash-maps.html#only-inserting-a-value-if-the-key-has-no-value
Learn more in The Book:
https://doc.rust-lang.org/stable/book/ch08-03-hash-maps.html#only-inserting-a-value-if-the-key-has-no-value
Hint 2: If there is already an entry for a given key, the value returned by
`entry()` can be updated based on the existing value.
Learn more at https://doc.rust-lang.org/book/ch08-03-hash-maps.html#updating-a-value-based-on-the-old-value
"""
Learn more in The Book:
https://doc.rust-lang.org/book/ch08-03-hash-maps.html#updating-a-value-based-on-the-old-value"""
# QUIZ 2