This error occurs because in Python 3, the print statement requires parentheses. In Python 2, the print statement can be used without parentheses.

To resolve this issue, you can change the print statement in your code to use parentheses. For example, change print astr to print(astr).

If you want to run this code in Python 2, you can save the code as a .py file and then run it in a Python 2 environment. In Python 2, print astr is valid syntax.

To avoid confusion, it's recommended to use the same coding style in both Python 2 and Python 3, using parentheses to call the print function.

Python 3 SyntaxError: Missing parentheses in call to 'print'