0

ive come across a display error. Here is my code

        onerot = 0
        if outerball.pos.x >= (self.r - 0.1):
            if self.rotations == 0:
                stopt = time.time ( )
                onerot = stopt - startt
                print(onerot)
            self.rotations += 1

        # update variable outputs
        timey.text = "time: %1.f" % onerot + " seconds"
        timex.text = "time: %1.f" % self.t + " seconds"
        nmrRotations.text = "rotations: %1.f" % self.rotations

can someone explain how to replace the value of the calculated "onerot" variable in the if statement and replace it with the value of 0 with the onerot variable outside the if statement image shows Onerot value as 0 and the other variables updating

thanks

Samir Hussain
  • 33
  • 1
  • 4
  • 1
    `onerot` is updated only provided `self.rotations == 0` is fulfilled. Is that your intention? – 0Tech Feb 22 '17 at 11:56
  • @0Tech No, my intention is to replace the value of the calculated "onerot" variable in the if statement and replace it with the value of 0 with the onerot variable outside the if statement – Samir Hussain Feb 22 '17 at 16:19
  • Then, fix it as you said :) Unfortunately, I'm not familiar with vpython, so I don't understand the naming conventions like `startt` or `self.r`. Please provide more codes so one can understand what is really going on here. – 0Tech Feb 23 '17 at 03:48

0 Answers0