+ 1
Where is my worng
d = dict() d['xyz'] = 123 d['abc'] = 345 for i in d : print("%s %d" %(i, d[i]))
6 odpowiedzi
+ 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.
+ 4
The problem and the solution is already written above there, guys!
Tidy up the whitespace and it runs.
+ 2
d = dict()
d['xyz'] = 123
d['abc'] = 345
for i in d :
print("%s %d" %(i, d[i]))
+ 1
This piece of code is totally correct. What error you are getting?