End Code Function Python Questions On For Loop