Gravity with space bar control, acceleration.

So I’m having some troubles with my gravity system…

Right now, this is my code

	def upt_gravity(self, task):
		if self.turn:
			self.player.setZ(max(self.player.getZ() + self.zSpeed * self.dt, -900))
			print self.player.getZ(), self.zSpeed

		if self.keys['space'] == True:
			self.turn = False
			self.player.setZ(max(self.player.getZ() - self.zSpeed * self.dt, -900))


		return task.cont

this code just makes my player fall down and whenever I press space bar, it goes up until I let go of my space bar.

What I want to know is that how do I make my player go up and comes down whenever I press space bar?

Also, I would like to know how to put an acceleration to my jump. Thanks.

viewtopic.php?f=8&t=4068
example in this topic seems not available, here is a mirror:
panda3d.org.ru/_fr/0/simple-fps.zip

p.s. it’s strange - three new topic on forum with the similar requests, please, do not think that I am robo… This Program Has Performed an Illegal Operation and Will Be Shut Down.