<jupyter_start><jupyter_text>Data Science lies at the intersection of :- Hacking Skills- Math and Statistics Knowledge - Substantive Expertise Python is well suited for learning Data Science :- It's Free.- It's relatively easy to code in and, in particular, to understand.- It has lots of useful data science related libraries. >Python uses *__indentation__* to delimit the execution of block of code<jupyter_code>#example
for i in [1,2]:
    print(i)
    for j in [1,2]:
        print(j)
        print(i+j)
    print(i)

print("Loop completed")
#indentation is ignored while working with inside parentheses and brackets

bracket_example = (1 + 2 + 3 + 4 + 5 + 6 + 7)
bracket_example
#indentation also makes our code easier to read

list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

easier_to_read_list_of_lists = [[1, 2, 3],
                              [4, 5, 6],
                              [7, 8, 9]]

print(list_of_lists)
print(easier_to_read_list_of_lists)<jupyter_output>[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]<jupyter_text>> We can use a *__backslash ( \ )__* to indicate that a statement continues onto the next line.<jupyter_code>a = 2 + \
3
print(a)<jupyter_output>5<jupyter_text>Modules- Modules is collection of statements and definitions.- Modules are used to break larger programs into small manageable and organized files.- One can create modules on their own(module = example.py & module_name = example) or you can even install & import third party modules.<jupyter_code>import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>> Let's create one module on our own def add(a,b):    """    This module is used to add two numbers    """    result = a + b    return result<jupyter_code>import example
example.add(5,4)<jupyter_output><empty_output><jupyter_text>Functions- A function is a set or block of code which runs only when it is called.- *__def__* keyword is used to define a function.- A function takes inputs which are known as parameters and gives out outputs which is result.- Defining a function for writing any program is a good programming habit.- A function also contains docstrings which basically tells us about the use of the function.<jupyter_code>def multiply_by_two(x):
    """
    This function will multiply the input by 2
    """
    result = x * 2
    return result
multiply_by_two(25)
def double(x):
    """
    Multiply x by 2
    """
    return x*2<jupyter_output><empty_output><jupyter_text>> Python functions are amazing. We can assign them to variables and then pass variable into the functions.<jupyter_code>def apply_to_one(f):
    """
    Calls the function f with 1 as its argument.
    """
    return f(1)
#refers to the previously defined function
my_double = double
x = apply_to_one(my_double)
print(x)<jupyter_output>2<jupyter_text>> We can also create functions using Lambda<jupyter_code>y = apply_to_one(lambda x:x+4)
print(y)<jupyter_output>5<jupyter_text>> Function parameters can also be given default arguments which only need to be specified when you want a value other than the default.<jupyter_code>def my_message(message="Hello World!"):
    """
    This function will print the message when called.
    """
    print(message)
my_message()
my_message("Hello World! Let's code in python")
def full_name(first="John",last="Doe"):
    """
    This function is for displaying first name and last name
    """
    print(first + " " + last)
full_name()
full_name("Sudhanshu","Mukherjee")
full_name(first="Dudh")<jupyter_output><NAME>
<NAME>
<NAME>
{'fraction_non_alphanumeric': 0.0996060776589758, 'fraction_numerical': 0.017726505346088915, 'mean_word_length': 4.12987012987013, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '491636', 'license': 'Apache-2.0', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1101, 'n_words': 420, 'path': '1 - Introduction, Modules and Functions.ipynb', 'repo_name': 'sudhanshumukherjeexx/data_science_from_scratch_joel_grus', 'size': '3571'}