Al-A'raaf • BN-TAFSEER-IBN-E-KASEER
﴿ وَقَطَّعْنَٰهُمْ فِى ٱلْأَرْضِ أُمَمًۭا ۖ مِّنْهُمُ ٱلصَّٰلِحُونَ وَمِنْهُمْ دُونَ ذَٰلِكَ ۖ وَبَلَوْنَٰهُم بِٱلْحَسَنَٰتِ وَٱلسَّيِّـَٔاتِ لَعَلَّهُمْ يَرْجِعُونَ ﴾
“And We dispersed them as [separate] communities all over the earth; some of them were righteous, and some of them less than that: and the latter We tried with blessings as well as with afflictions, so that they might mend their ways.”
Please check ayah 7:170 for complete tafsir.