Python help

ok i decided to work on a small game to learn some python and i sorta of wanted the object to jump but i used the wrong kinda of motion and he sort of just keeps going up when i hold down the jump button.

here is my python text

cont = GameLogic.getCurrentController()
own = cont.getOwner()

#Sensors:

forward = cont.getSensor(“Up”)
backward = cont.getSensor(“Down”)
turnleft = cont.getSensor(“Left”)
turnright = cont.getSensor(“Right”)
ascend = cont.getSensor(“Jump”)

#Actuators

motion = cont.getActuator(“motion”)

#Process

speed = 5
rspeed = 0.02
walk = 0
turn = 0
jspeed = 50
stand = 0

if forward.isPositive() :
walk = speed
if backward.isPositive() :
walk = -speed
if turnleft.isPositive() :
turn = rspeed
if turnright.isPositive() :
turn = -rspeed
if ascend.isPositive() :
stand = jspeed

motion.setForce(0, 0, stand, 1)
motion.setLinearVelocity(0, walk, 0, 1)
motion.setDRot(0, 0, turn, 1)
GameLogic.addActiveActuator(motion, 1)

you need a plane/cube for the ground make it have the property ground or something along those lines. connect a collision sensor prop: ground ------ Python controller
you have to get the sensor collision or whatever you called it so it will end up like this

cont = GameLogic.getCurrentController()
own = cont.getOwner()

#Sensors:

forward = cont.getSensor("Up")
backward = cont.getSensor("Down")
turnleft = cont.getSensor("Left")
turnright = cont.getSensor("Right")
ascend = cont.getSensor("Jump")
<b>ground = cont.getSensor("ground")</b>

#Actuators

motion = cont.getActuator("motion")

#Process

speed = 5
rspeed = 0.02
walk = 0
turn = 0
jspeed = 50
stand = 0

if forward.isPositive() :
    walk = speed
if backward.isPositive() :
    walk = -speed
if turnleft.isPositive() :
   turn = rspeed
if turnright.isPositive() :
   turn = -rspeed
if ascend.isPositive() :
   <b> if ground.isPositive():  </b>  # I think this is what makes the object jump if not
        stand = jspeed                  # add the bolded if statement at the right line 

motion.setForce(0, 0, stand, 1)
motion.setLinearVelocity(0, walk, 0, 1)
motion.setDRot(0, 0, turn, 1)
GameLogic.addActiveActuator(motion, 1)

Hmm, this didn’t exactly work cause now nothing works but ill keep looking for an answer.

if you post a .blend I’ll have a look