<jupyter_start><jupyter_text>range is a great way to make lists for loops.<jupyter_code>mylist = list(range(0,20))
mylist<jupyter_output><empty_output><jupyter_text>list is used to show the list and assigning it to a varialbe may or may not be necessary range is a generator function which means it will generate information and not need to save it in memory.   enumerate means to count how many times you've looped / iteratad.  enumerate is a special function that gives you a short cut for doing this.  If you wanted to count each step of the iteration of a string, you'd could do it as shown below:<jupyter_code>index = 0

for letter in 'abcde':
    print('At index {} the letter is {}'.format(index, letter))
    index +=1<jupyter_output>At index 0 the letter is a
At index 1 the letter is b
At index 2 the letter is c
At index 3 the letter is d
At index 4 the letter is e<jupyter_text>With enumerate, you save a few lines.<jupyter_code>for i, letter in enumerate('abcde'):
    print(f'At index {i} the letter is {letter}')<jupyter_output>At index 0 the letter is a
At index 1 the letter is b
At index 2 the letter is c
At index 3 the letter is d
At index 4 the letter is e<jupyter_text>So let's try combining some of our tools like using range and enumerate.<jupyter_code>for i in enumerate(range(0,20)):
    print(i)<jupyter_output>(0, 0)
(1, 1)
(2, 2)
(3, 3)
(4, 4)
(5, 5)
(6, 6)
(7, 7)
(8, 8)
(9, 9)
(10, 10)
(11, 11)
(12, 12)
(13, 13)
(14, 14)
(15, 15)
(16, 16)
(17, 17)
(18, 18)
(19, 19)<jupyter_text>zip is a function used to create lists of tuples by "zipping" up two lists.<jupyter_code>lst1 = list(range(0,20))
lst2 = list(range(100,120))
lst3 = list(zip(lst1,lst2))
lst3<jupyter_output><empty_output><jupyter_text>We can use the "in" function to check to see if an object is in our list.<jupyter_code>(7,107) in lst3<jupyter_output><empty_output><jupyter_text>Note that it must be the object and not part of the object.<jupyter_code>100 in lst3<jupyter_output><empty_output><jupyter_text>In order to unzip, use the opposite syntax plus and asterick.  Instead of lst3 = list(zip(lst1,lst2))We would write lst1, lst2 = zip(*lst3) as shown below with new variables to show it works.<jupyter_code>lst4, lst5 = zip(*lst3)
lst4<jupyter_output><empty_output><jupyter_text>min and max will provide just that for a list<jupyter_code>min(lst4)
max(lst4)<jupyter_output><empty_output><jupyter_text>random is important for providing all sorts of random number generating capabilities to your code, but it may not work for all data types depending on how you use it.  First, you must import what you want.  You can see a list by using tab.<jupyter_code>from random import shuffle<jupyter_output><empty_output><jupyter_text>shuffle can randomly shuffle a list, but if errors on a tuple<jupyter_code>mylst = list(range(0,11,2))
shuffle(mylst)
mylst
from random import randint<jupyter_output><empty_output><jupyter_text>randint will provide a random number in a given range.<jupyter_code>randint(10,20)<jupyter_output><empty_output><jupyter_text>Input will get input to return to you, but I don't know what it can do with it<jupyter_code>input('say something')<jupyter_output>say somethingblah
{'fraction_non_alphanumeric': 0.09179197994987469, 'fraction_numerical': 0.03822055137844611, 'mean_word_length': 5.5699588477366255, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '422885', 'license': 'Unlicense', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1112, 'n_words': 434, 'path': 'Misc operators.ipynb', 'repo_name': 'Luzyviento/Class_Notebook', 'size': '3192'}