I would like to get help on this code to make it valid...
If possible please suggest as it must be changed
Nope not the colon
According to error messages, you seems have invalid invisible characters instead spaces at line 27 begin ( deleting spaces and retyping them fix it ) and next ( fixing line 27, show similar error at line 29: you should fix all one by one :P )
On line 27 there is a error, should that colon not be replace by a comma? But you missed the declaration of the variable?
@Visph: You are probably right on the spot. I already suggested that he should check the spaces for intentations this causes a lot of problems if you switch from usjng spaces and or Tabs.