Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PostalCode:
- def __init__(self):
- self.a = "79-900"
- self.b = "80-155"
- def split_postal_code(self, a):
- return a.split("-")
- def generate_range(self):
- postalCodeA = self.split_postal_code(self.a)
- A2 = int(postalCodeA[0])
- A3 = int(postalCodeA[1])
- postalCodeB = self.split_postal_code(self.b)
- B2 = int(postalCodeB[0])
- B3 = int(postalCodeB[1])
- if A2 > B2:
- print('Sorry blad')
- return
- for k in range(A2, B2+1):
- for i in range(0, 1000):
- self.print_code(A2, i)
- # for j in range(0, B3 + 1):
- # self.print_code(B2, j)
- def print_code(self, a, b):
- if a < 10:
- a = "0" + str(a)
- if b < 10:
- b = "00" + str(b)
- if b >= 10 and b < 100:
- b = "0" + str(b)
- print("%s-%s" % (a, b))
- print("\n")
- kupadupa = PostalCode()
- print((kupadupa.generate_range()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement