For anyone checking this using python 3:
If you want to print the following output "100% correct"
:
python 3.8: print("100% correct")
python 3.7 and less: print("100%% correct")
A neat programming workaround for compatibility across diff versions of python is shown below:
Note: If you have to use this, you're probably experiencing many other errors... I'd encourage you to upgrade / downgrade python in relevant machines so that they are all compatible.
DevOps is a notable exception to the above -- implementing the following code would indeed be appropriate for specific DevOps / Debugging scenarios.
import sys
if version_info.major==3:
if version_info.minor>=8:
my_string = "100% correct"
else:
my_string = "100%% correct"
# Finally
print(my_string)