0
format function accepts only strings??
for j in string.ascii_lowercase: print(" {0} = {1}% ",format(j, round((100*count_char(j)/t), 2))) Traceback (most recent call last): File "<pyshell#110>", line 2, in <module> print(" {0} = {1}% ",format(j, round((100*count_char(j)/t), 2))) TypeError: format() argument 2 must be str, not float
1 Answer
+ 6
Hi Hari
I think the comma (,) before format() should be a period (.). If that doesn't fix the issue, do you mind saving the full code in Code Playground and sharing the link? Thanks!