Invalid Syntax code

Question:

# Set the background color
arcade.set_background_color(arcade.color.AMAZON)

    # Set the viewport boundaries
    # These numbers set where we have 'scrolled' to.
    self.view_left = 0
    self.view_bottom = 0
    **print(f"Total wall blocks: {len(self.wall_list)}")**

def on_draw(self):
    """
    Render the screen.
    """

Invalid Syntax keeps coming up when the code is run in it’s entirety. I am usually quite good at fixing problems in Python code for my students but this is stumping me. We use Python 3.4.4

Asked By: Stuart Walsh

||

Answers:

The f string syntax is only available in Python 3.6. Try

print("Total wall blocks: {}".format(len(self.wall_list)))

PS I’m assuming that you’re using the ** around your print for emphasis. If not, remove them as well

Answered By: aydow
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.