for a string:
0.1 --> 0.10
0.2 --> 0.20
0.3 --> 0.30
0.35 --> 0.35
Example:
print(str(round(variableB.count('X') /len(variableA), 2)))
I tried print("%.2f" %str(round(variableB.count('X')/len(variableA),2)))
, but I got TypeError: must be real number, not str
then I tried
print ("%.2f" % int(str(round(variableB.count('X') /len(variableA), 2))))
but I got TypeError: invalid literal for int() with base 10: '0.47'
same result with "%02d" %