<jupyter_start><jupyter_text>***First Task***<jupyter_code># List comprehension for price 'med'
med = [x for x in range (len(price)) if price[x]=='med']
med<jupyter_output><empty_output><jupyter_text>***Second Task***<jupyter_code># list comprehension for price 'med' and passengers
med_pas = [numberofpassengers[x] for x in med]
med_pas<jupyter_output><empty_output><jupyter_text>***Third Task***<jupyter_code>#list comprehension for price 'high' and maintenance not 'low'
high_notlow = [x for x in range(len(price)) if price[x]=='high' and maintenancecost[x]!='low']
high_notlow<jupyter_output><empty_output><jupyter_text>***Fourth Task***<jupyter_code>#original list
nlist = [[1,2,3],['A','B','C'],[4,5],['D','E']]
#new list
flist = [y for x in nlist for y in x]
flist<jupyter_output><empty_output><jupyter_text>***FIfth Task***<jupyter_code># Function converts a list to a dict object
def makedict(mylist, x):
    if x <= len(mylist):
        newdict = {}
        newdict = {'A'+str(i):mylist[i] for i in range(0, x)}
        return (newdict)
    else:
        return 'shut down my computer ASAP and call 911'
makedict(luggagecapacity,50)<jupyter_output><empty_output><jupyter_text>***Last***<jupyter_code>#using new function for price and luggage
pricedict = makedict(price,7)
print(pricedict)
luggagedict = makedict(luggagecapacity,7)
print(luggagedict)
print(pricedict['A4'])
print(luggagedict['A4'])<jupyter_output>med
{'fraction_non_alphanumeric': 0.15918653576437589, 'fraction_numerical': 0.010518934081346423, 'mean_word_length': 7.394117647058824, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 24, '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}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '23614', 'license': 'MIT', 'n_tokens_mistral': 554, 'n_tokens_neox': 537, 'n_words': 119, 'path': 'R_Li_W3_assn.ipynb', 'repo_name': 'ak47m1a1/DBDA-python', 'size': '1426'}