You need to move the definition of dict
post_details
to inner loop. You always update the same dict during the loop, so the elements are same.port_details = {} # not here for first_range_port in range(int(first_range_start), int(first_range_end)+1): port_details = {} # put it here port_details['port'] = first_range_port port_details['customer'] = customer print(first_range_port, customer) port_list.append(port_details)