Python doesn't require end of line syntax, such as semi-colons, however, it does require you to define grouped statements by way of whitespace.
What this means is that you will have to tab in the two lines after "for in in range..."
The whitespace was obviously lost when bendingiscool pasted in the code here.
Edit: Should be like this:
import maya.cmds as mc
sel = mc.ls(sl=True)
for i in range(len(sel)):
[tab] polyToSub = mc.polyToSubdiv(sel[i])
#replace the [tab] with an actual tab