Hey everyone! I’ve noticed that the following code runs fine:
My question is that when I use a string as a key in this way, but put a colon after it…is the key a symbol or a string?
Thanks!
Hey everyone! I’ve noticed that the following code runs fine:
My question is that when I use a string as a key in this way, but put a colon after it…is the key a symbol or a string?
Thanks!
Given that it is still in quotes it would be a string, as in contains data. A symbol identifies data. Also, the colon would prefix the symbol.
... = {
:Little_Miss_Sunshine => 5
}
My fellow students and I have encountered same result when setting up the Hash with movies key value pairs
when typed in
movies = {
Avatar: 3.5,
Theyear: 4.7
}
it does not allow passing the first challenge. Instead, it asked “have you defined a variable called choice?”
Only later we found out that we would need to also completed the second challenge on the same page to go to next unit.
Can someone check if there is a bug there? We spent so much time on just figuring out what went wrong with our Hash code, while there was not really any differences with the suggested solution.