Hi @taodai,
That’s because from v0.8 msg.sender is by default a non-payable address, whereas in prior versions it is payable by default. You can find all of the changes that were implemented for each new version in the Solidity documentation, and this particular one is explained in the 9th bullet point in the New Restrictions section of Solidity v.0.8.0 Breaking Changes, which you will find here: https://docs.soliditylang.org/en/v0.8.4/080-breaking-changes.html#new-restrictions.
As you can see in the same bullet point in the documentation I’ve linked to above, the actual explicit conversion of msg.sender into a payable address is done as follows:
payable(msg.sender);
This synatx has been used to convert non-payable addresses to payable ones since Solidity v0.6. You could then assign this to a variable, but it is often not necessary. For example, in your withdraw() function you can use it directly as follows:
payable(msg.sender).transfer(amount);
Apart from this, your solution to the assignment is very well coded
You have added all of the additional lines of code needed to solve the problem with the withdraw function, and all of the statements in the function body are in the correct order to reduce security risk:
- check inputs (require statements)
- effects (update the contract state)
- external interactions
It’s important to modify the contract state for the reduction in the balance…
balance[msg.sender] -= amount;
before actually transferring the funds out of the contract to the external wallet address…
payable(msg.sender).transfer(amount);
… just in case there is an attack after the transfer, but before the state is modified to reflect this operation. You’ll learn about the type of attack this prevents, and how it does it, in later courses. We wouldn’t expect you to know this at this early stage, though, so I’m just telling you for extra information, in case you haven’t already seen this explanation in some of the other posts in this discussion topic. But it’s great that you’re already getting into good habits in terms of smart contract security 
Let me know if anything is unclear, or if you have any further questions.
You’re making great progress! 