class - Need help allowing live input in a Python shell script -


non-stop speedometer

import time import sys def increase_speed():     x=0     while x>=0:         x=(x)+float(2.5)         time.sleep(1)         print (float(x))  def decrease_speed(): x=0 while x<=0:     x=(x)-float(2.5)     time.sleep(1)     print (float(x))  def lock_speed(): while increase_speed()==increase_speed():     print (increase_speed)   class speedometer(object): """we can increase speed 'w' decrease speed 's' lock speed 'x' or brake 'c"""  setting = input("> ")  if (setting) == str("w"):     increase_speed()  elif (setting) == str("s"):     decrease_speed()  elif (setting) == str("x"):     lock_speed() 

basically, @ point able swap between each variable while code running. figured classes might work, can't seem figure out how keep numbers generating.

thanks help.


Comments