#!/usr/bin/env python x = 0 def inc() : global x x += 1 print x def dec() : global x x -= 1 print x while True : a = input('1 : inc, 2 : dec ?') if a == 1 : inc() elif a == 2 : dec() else : break