Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14155

TypeError: not all arguments converted during string formatting in dictionary key value

$
0
0
a = input("enter the message")a = list(a)b = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m","n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",",", ".", "?", "!", "@", "#", "$", "%", "^", "&", "*","0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]d = {}for i in a:    c = 0    for j in b:        if i == j:            d[j] = c # Use dictionary assignment instead of update        c = c + 1print(d)e = ""for i in d.keys():    print(i)    if i % 2 == 0:        c = int(i / 2)        f = 0        for j in b:            if c == f:                e = e + j    else:        c = int((i - 1) / 2)        f = 0        for j in b:            if c == f:                e = e + jprint(e)

I don't know how to fix it. I am new to the programming and i don't have much idea.please help me how to fix it.I know that in dictionary keys are integer but still it give the error.it give TypeError: not all arguments converted during string formatting


Viewing all articles
Browse latest Browse all 14155

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>