Python : Zip Code based dispatch

Dear All,

I have just started learning Python. I have worked for 20+ years in supply chain management.
I am trying to create an system, below is the business requirement, please help me to create the program.

Help me learn to write logic.

Kind regards,

@anilrajpal2929 try this code for a console-based place search:-

import urllib.request, urllib.parse, urllib.error
import json
import ssl

api_key = False
# If you have a Google Places API key, enter it here
# api_key = '[Your API Key]'

if api_key is False:
    api_key = 42
    serviceurl = ''
else :
    serviceurl = ''

# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

while True:
    address = input('Enter location: ')
    if len(address) < 1: break

    parms = dict()
    parms['address'] = address
    if api_key is not False: parms['key'] = api_key
    url = serviceurl + urllib.parse.urlencode(parms)

    print('Retrieving', url)
    uh = urllib.request.urlopen(url, context=ctx)
    data =
    print('Retrieved', len(data), 'characters')

        js = json.loads(data)
        js = None

    if not js or 'status' not in js or js['status'] != 'OK':
        print('=== Failed To Retrieve ===')

    print(json.dumps(js, indent=4))

    lat = js['results'][0]['geometry']['location']['lat']
    lng = js['results'][0]['geometry']['location']['lng']
    print('lat', lat, 'lng', lng)
    location = js['results'][0]['formatted_address']