<commit_before>import json
# from pprint import pprint

with open('products.json') as data_file:
    data = json.load(data_file)
    products = data['products']

computer = []
keyboard = []

for index, item in enumerate(products):
    string = str(item)
    if "computer" in string:
        computer.append(item)
    else:pass
    if "keyboard" in string:
        keyboard.append(item)
    else:pass

computerVarients = []

for item in computer:
    computerVarients.append(item['variants'])

keyboardVarients = []

for item in keyboard:
    keyboardVarients.append(item['variants'])

computerDetails = []

for index, item in enumerate(computerVarients):
    for index, item in enumerate(item):
        computerDetails.append(item)

keyboardDetails = []

for index, item in enumerate(keyboardVarients):
    for index, item in enumerate(item):
        keyboardDetails.append(item)

computerWeight = []
computerPrice = []

for item in computerDetails:
    computerWeight.append(float(item['grams']))
    computerPrice.append(float(item['price']))

keyboardWeight = []
keyboardPrice = []

for item in keyboardDetails:
    keyboardWeight.append(float(item['grams']))
    keyboardPrice.append(float(item['price']))

# print all the arrays.
print computerPrice
print computerWeight
print keyboardPrice
print keyboardWeight


import itertools
# for r in itertools.product(a, b): print r[0] + r[1]<commit_msg>Tuples!<commit_after>import json
# from pprint import pprint

with open('products.json') as data_file:
    data = json.load(data_file)
    products = data['products']

computer = []
keyboard = []

for index, item in enumerate(products):
    string = str(item)
    if "computer" in string:
        computer.append(item)
    else:pass
    if "keyboard" in string:
        keyboard.append(item)
    else:pass

computerVarients = []
computerDetails = []
keyboardVarients = []
keyboardDetails = []

for index, item in enumerate(computer):
    computerVarients.append(item['variants'])
for index, item in enumerate(computerVarients):
    for index, item in enumerate(item):
        computerDetails.append(item)
for index, item in enumerate(keyboard):
    keyboardVarients.append(item['variants'])
for index, item in enumerate(keyboardVarients):
    for index, item in enumerate(item):
        keyboardDetails.append(item)

computerWeightAndPrice = []
keyboardWeightAndPrice = []
for item in computerDetails:
    computerWeightAndPrice.append((float(item['grams']),float(item['price']),(item['id'])))
for item in keyboardDetails:
    keyboardWeightAndPrice.append((float(item['grams']),float(item['price']),(item['id'])))

print "ComputerWeightAndPrice Appended=============="
print "keyboardWeightAndPrice Appended=============="
import itertools


permutation = []

for r in itertools.product(computerWeightAndPrice, keyboardWeightAndPrice):
    permutation.append( ( int(r[0][0] + r[1][0]), round((r[0][1] + r[1][1]),4), str(r[0][2])+ " and " +str(r[1][2])))

print permutation

# sumAllPrice = [sum(x) for x in zip(*permutation)]
# print sumAllPrice
{'fraction_non_alphanumeric': 0.1371841155234657, 'fraction_numerical': 0.004922874958976042, 'mean_word_length': 4.884169884169884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4747434', 'n_tokens_mistral': 948, 'n_tokens_neox': 919, 'n_words': 225}