Unable to read or update hashMap values

I am trying to retrieve values from hashMAp and update them after adding to an integer here is my code:
for players in 1..=num{
println!("Enter the name of player # {}",players);
io::stdin()
.read_line(&mut player_name)
.expect("Failed to read line");
scores.insert(player_name.trim().to_string(),0);
player_name=String::from("");
}
for (key, value) in scores.iter() {
let secret_number = rand::thread_rng().gen_range(1, 6);
let sc = value + secret_number;
println!("Turn {} Dice Roll of Player {} - {} is {} and Total {:?}",turn,count,key,
secret_number,sc);
CurrentRoll = secret_number;

    count += 1;
    scores.insert(key.to_string(),sc);       
 
println!("{:?}-{:?}",key,value);
count = 1;

}
I am getting this error

 for (key, value) in scores.iter() {

| -------------
| |
| immutable borrow occurs here
| immutable borrow later used here
...
54 | scores.insert(key.to_string(),sc);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here

I am not able to undersand

Please edit your post to follow the forum code formatting and syntax highlighting conventions that are listed in a post that is pinned to the top of this forum.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.