error -IndentationError: unexpected indent on assignment



0
code :
studentRecord = {"name" : "Gagan",
"school": "TSRS",
"age": 12,
"class": 10,
"math": (1,2,3,4,5),
"science": (2,3,4,5,6),
"english": (3,4,5,6,7)}
# Dictionary: name, school, age, class,
# math <- tuples of 5 set of scores, english <- tuple of 5 set of scores,
# science <- tuple of 5 set of scores
# <- Name, School, Class, Math scores at position 2, english @ 3, science @ 4
print studentRecord['name'], studentRecord['school'], studentRecord['class'], studentRecord['math'][1], studentRecord['science'][2]

error :

File "", line 12
print studentRecord['name'], studentRecord['school'], studentRecord['class'], studentRecord['math'][1], studentRecord['science'][2]
^
IndentationError: unexpected indent


1 Answer(s)


0

I think that at the time of copying, a new line character got added before the studentRecord['math'][1]. Remove that character and then it should work fine. Also check for any spaces before the 'print' command.