testcases added and code refined according to PEP8