How could we have initialized myphonebook so that it would accept integers as values?


myphonebook = Dict(“Jenny” => “867-5309”, “Ghostbusters” => “555-2368”)


Just use integers instead of strings.


Will that always evaluate the -


Yes, since an integer cannot contain -.
What exactly do you want to do?

Maybe you are asking how to remove the - from a string. You can do that eg with the replace function, and then use the parse function to convert it to an integer.

parse(Int, replace("555-1234", r"\D"=> ""))

Feature creep: :wink:

julia> parse(Int, replace("+1(800)555-1234", r"\D"=> ""))

parse(Int, replace("555-1234", "-" => ""))


Is this your home work assignment?


no, it just is a exercise, i learn it by myself