#!/usr/bin/python class FooBar: def __init__(self): self.x = 1 def a(self): if self.x < 5: self.x += 1 return "hello" else: return "world" f = FooBar() print(f.a()) for x in range(1,8): print(f.a())