Where is my worng | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Where is my worng

d = dict()  d['xyz'] = 123 d['abc'] = 345 for i in d :     print("%s  %d" %(i, d[i]))

28th Apr 2019, 9:41 PM
i dont Know 18
i dont Know 18 - avatar
5 Answers
+ 7
I'm guessing this is Python. Any Python experts? HonFu ?
28th Apr 2019, 9:58 PM
Sonic
Sonic - avatar
+ 5
The code must be copypasted from some editor and that led to trouble: It's all filled with invisible strange whitespace. (You see if you run it here.) You'd have to copy paste the text again unformatted or erase and renew the whitespace manually.
28th Apr 2019, 10:03 PM
HonFu
HonFu - avatar
+ 4
The problem and the solution is already written above there, guys! Tidy up the whitespace and it runs.
29th Apr 2019, 7:01 AM
HonFu
HonFu - avatar
+ 2
d = dict() d['xyz'] = 123 d['abc'] = 345 for i in d : print("%s %d" %(i, d[i]))
28th Apr 2019, 10:42 PM
Diego
Diego - avatar
+ 1
This piece of code is totally correct. What error you are getting?
29th Apr 2019, 6:40 AM
Mrityunjay Tripathi
Mrityunjay Tripathi - avatar