I have a small 2D game and I want to print a message when it's finished. The code is in Python and I used both Pygame and Tkinter for 2D graphic. When the game is finished it shows the message below:
messagebox.showinfo('Finish','Mouse ate all cheese slices.\nPolicies saved to file.')
I have a variable called steps and I need to show it in that window but it raise an error when I tried it like this:
messagebox.showinfo('Finish','Mouse ate all cheese slices after {steps}.\nPolicies saved to file.')
Update: Using f-string solved the problem:
messagebox.showinfo('Finish',f'Mouse ate all cheese slices after {steps}.\nPolicies saved to file.')