Yes of course can give you a lot of lessons in life, in terms of financial losses that can teach you how to value money in a matter of time. Because thar time you are engaged in gambling is you are not thinking to earn money for your family and the only thing you aim is to win and not lossing. If we generally analyze the whole idea here, you didn't expect to loss and yet you really loss because gambling always make's you loss rathen than winning. Having a bigger lossea that cannot be recovered by playing again will certainly give you a nice lessons that will also give you the principle of not joining gambling bets anymore; life will be change as well.
sometimes gambling can learn you lessons in life for example, if you gamble and loss all the money that you have and you risk the money for an important expenses you could be tell to yourself that incase you gamble your money and loss overthink that next time you would not gamble your money that you have for an important expenses and that could bring a lesson from you.
That is indeed something you learn from gambling but not because gambling taught you a lesson it is more of you learned it through your own mistakes in gambling. Though, this are some of the situations a gamblers should never be in. It is not something that should have been done by any gambler since it is total common sense! You do not gamble with money that is intended for something else since if you lose it then the money is gone and you cannot pay for what it was intended for.