daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PostalCode:
  2.  
  3.     def __init__(self):
  4.         self.a = "79-900"
  5.         self.b = "80-155"
  6.  
  7.  
  8.     def split_postal_code(self, a):
  9.         return a.split("-")
  10.  
  11.     def generate_range(self):
  12.         postalCodeA = self.split_postal_code(self.a)
  13.         A2 = int(postalCodeA[0])
  14.         A3 = int(postalCodeA[1])
  15.         postalCodeB = self.split_postal_code(self.b)
  16.         B2 = int(postalCodeB[0])
  17.         B3 = int(postalCodeB[1])
  18.  
  19.         if A2 > B2:
  20.             print('Sorry blad')
  21.             return
  22.        
  23.         for k in range(A2, B2+1):
  24.             for i in range(0, 1000):
  25.                 self.print_code(A2, i)
  26.  
  27.         # for j in range(0, B3 + 1):
  28.         #     self.print_code(B2, j)
  29.  
  30.  
  31.     def print_code(self, a, b):
  32.         if a < 10:
  33.             a = "0" + str(a)
  34.  
  35.         if b < 10:
  36.             b = "00" + str(b)
  37.  
  38.         if b >= 10 and b < 100:
  39.             b = "0" + str(b)
  40.  
  41.         print("%s-%s" % (a, b))
  42.         print("\n")
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. kupadupa = PostalCode()
  50. print((kupadupa.generate_range()))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top