Issue
Solved: Thanks for your helps. i'm working dictionary and hash codes in one page, and there was a block problem. i thought, my logic is wrong but i checked all page, and i fixed blocks. its works fine right now.
Here's my problem:
d = {}
d['a'] = 'alpha'
d['b'] = 'beta'
missing_key = 'x' in d
if missing_key == True:
print ("The key, you are looking for was successfully found!")
else:
print ("The key, you are looking for was not found!")
print ("Here are keys in database:")
for k, r in enumerate(d.keys(), start=1)
print ("Key {}: {}".format(k, r))
that for
condition works perfectly. but i cant run that if
condition. Where am i doing wrong ? Thanks for your help.
Getting this error:
File "C:/Python/dictionary-hash.py", line 33
if missing_key == True:
IndentationError: unexpected indent
also i'm using "Python 3.6" and "Anaconda Spyder"
Solution
There's nothing wrong with the logic in your code. Since the error is an IndentationError
, it must be because you're using inconsistent indentation on that if
line. Make sure that the indentation on each line is consistent (using same number of spaces/tabs). Probably there is a space at the beginning of that line that is causing the error.
Answered By - Henry Woody
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.