Missing int() casting?

I know the code provided works, but wouldn't it be better to explicitly cast string to int when setting key's value in the dictionary?

player_scores[player_name] = int(player_points)
  • Nathan Lovato replied

    In this specific project, we never need or use integer values: we are only working with strings. So I would not recommend converting back and forth to integers. It'd just be an extra step we wouldn't benefit from.

    Notes that in a different project, you would likely not be working with a string in the first place, but instead adding to the score throughout the players' gameplay sessions. So in that case your score would naturally be an int, and you wouldn't need to convert it to an int.