It might make sense to show a different metric (like # of retries, or score of each try) to give scores from different retries more meaning and also display the learning rate as well as the level of knowledge.
Without punishment, students will be encouraged to take the retake exams only to score higher but not necessarily have more knowledge in the subject. They just want to know the type of the questions and how to answer them according to the answer keys.
The test is an indication of how well the students do after having the same learning environment and time to prepare. Having more time to prepare means a disadvantage to people who don't do the retake exams.
Instead showing this data as a different dimension gives more rich data and still allows to discriminate between the students in the fairest way possible. Showing learning rate and level of knowledge seperately gives everyone the opportunity to do well while highlighting fast learners.
The prospect of a resit exam was found to promote lower investments of study time for a first exam and this effect was stronger for participants scoring higher on the cognitive reflection test.
Nijenkamp R, Nieuwenstein MR, de Jong R, Lorist MM (2016) Do Resit Exams Promote Lower Investments of Study Time? Theory and Data from a Laboratory Study. PLoS ONE 11(10): e0161708. https://doi.org/10.1371/journal.pone.0161708