<jupyter_start><jupyter_text>Range Function: a) Iteration method -<jupyter_code>mylist = [1,2,3]
for num in range(10):
    print (num)
for num in range(3,10):
    print (num)
for num in range(0,11,2):
    print (num)<jupyter_output>0
2
4
6
8
10<jupyter_text>b) List method -<jupyter_code>list (range (0,10,2))
list (range (0,11,2))
list (range (3,10))
list (range(10))<jupyter_output><empty_output><jupyter_text>Enumerate Function:<jupyter_code>index_count = 0

for letter in 'abcde':
    print ('At index {} the letter is {}'.format(index_count, letter))
    index_count = index_count + 1
    
# If do not set index_count increment then all letter will be at index = 0
index_count = 0
word = "abcde"

for letter in word:
    
    print (word[index_count])
    index_count += 1
word = "abcde"

for item in enumerate(word):
    print (item)
word = "abcde"

for index,letter in enumerate(word):
    print (index)
    print (letter)
    print ('\n')<jupyter_output>0
a


1
b


2
c


3
d


4
e<jupyter_text>Zip Function: a) Iteration method -<jupyter_code>mylist1 = [1,2,3]
mylist2 = ['a','b','c']
mylist3 = [10,20,30]
for item in zip(mylist1,mylist2):
    print (item)
for num,alpha in zip(mylist1,mylist2):
    print (num)
    print (alpha)
    print ("\n")
for item in zip(mylist1,mylist2,mylist3):
    print (item)
mylist4 = [1,2,3,4,5,6]
mylist5 = ['a','b','c']
for item in zip(mylist4,mylist5):
    print (item)
    
# If lists are uneven, zipping is done until shortest list.
for a,b in zip(mylist4,mylist5):
    print (b)<jupyter_output>a
b
c<jupyter_text>a) List method -<jupyter_code>list (zip (mylist4,mylist5))
list (zip (mylist1,mylist2,mylist3))
list (zip (mylist1,mylist2,mylist3,mylist4,mylist5))<jupyter_output><empty_output><jupyter_text>In operator:<jupyter_code>'x' in ['x','y']
1 in [1,2,3]
'a' in "a basket of apple"
'key1' in {'key1':234}
d = {'key2':10}

print (10 in d.values())
print (10 in d.keys())<jupyter_output>True
False<jupyter_text>Min & Max function:<jupyter_code>mylist = [10,20,30,40,100]
min(mylist)
max(mylist)<jupyter_output><empty_output><jupyter_text>Random Library:<jupyter_code>from random import shuffle
mylist = [1,2,3,4,5,6,7,8,9,10]
shuffle(mylist)
mylist
from random import randint
randint(0,10)
randint(0,10)
mynum = randint (0,20)
mynum
input ("Enter value:")
mynum = input ("Enter value: ")
print ("The value is:", mynum)
result = input ("Your name? ")
print ("My name is", result)
result = int (input ("Fav num: "))
type (result)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15430622009569378, 'fraction_numerical': 0.051834130781499205, 'mean_word_length': 5.241293532338308, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '417821', 'license': 'MIT', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1077, 'n_words': 263, 'path': 'Section 05 - Python Statements/Lec 37 - Useful Operators.ipynb', 'repo_name': 'sansjha4900/Udemy-Python-Notes', 'size': '2508'}