<jupyter_start><jupyter_text>A short guide to Python Python is a snake. It is called as "अजगर" in Hindi language. We will be studying Python for the workshop.![alt text](https://img.purch.com/w/660/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzEwMS81MzMvb3JpZ2luYWwvc2h1dHRlcnN0b2NrXzY3OTQ0NTcwNC5qcGc=) But since working with Python is very dangerous, we are going to work with something <NAME> did to make it more safe.**All hail <NAME>!****HAIL!**He made Python this:![alt text](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/2000px-Python-logo-notext.svg.png)Our initial task is to guide you through Python with some basic stuff you might have learnt with C (We don't know if Java *really* helped you understand stuff)<jupyter_code># The zen of Python
import this<jupyter_output>The Zen of Python, by <NAME>

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!<jupyter_text>Remember this, fellas. When you go to a tech conference, you will be asked to repeat the Zen of Python. It's a sort of secret code for people to know you are a Pythonista. To be honest, I was only kidding. The Zen of Python was released as an Easter egg by <NAME>, a prominent Python contributor.   Indentation and whitespaceIn Python, indentation matters a lot. Newbies often report bugs in their code to realise they did not have proper indentation. You might remember nightmares similar to {;} from C but indentation in Python makes code easy to read.<jupyter_code>reality_is_a_simulation = 1
other_global_variable = "This Is a String!"

def pick_a_random_number(random_argument_LOL):
    a_local_variable = "Only the best organically grown local variables!"
    for element in random_argument_LOL:
        if reality_is_a_simulation:
            print("42")<jupyter_output><empty_output><jupyter_text>Python Enhancement Proposal> PEP stands for Python Enhancement Proposal. A PEP is a design document providing information to the Python community, or describing a new feature for Python or its processes or environment. The PEP should provide a concise technical specification of the feature and a rationale for the feature.PEP 8 which how the "default" style rules one should adhere to. The nice thing about PEP 8 is that most editors out there either support it directly or have plugins you can install that will automatically check your code for any failure to comply. PEP 8 while being the most diffuse style is not the only one (i.e. Google Python Style) you should be trying as much to adhere to it whenever it is reasonable to do so. Do not fail however to follow the best advice inside PEP 8:  Strings![alt text](https://rohitmehta355.files.wordpress.com/2015/04/sheldon.jpg)Yes, we will be teaching you graduate physics! Although in a Pythonic way!<jupyter_code>string_1='You are in my spot'
string_2= "Bazinga!"
string_3="""
You went to MIT?
Yes.
My condolences"""
print(string_1+"\n"+string_2+"\n"+string_3)<jupyter_output>You are in my spot
Bazinga!

You went to MIT?
Yes.
My condolences<jupyter_text>Some data structures in Python Lists<jupyter_code>x = [1, 2, 3]
x.append(0) # x is now [1, 2, 3, 0]
y = x[-1] # equals 0
z = len(x) # equals 4
print(z)<jupyter_output>4<jupyter_text>It is often convenient to unpack lists if you know how many elements they contain.Although you will get a ValueError if you don’t have the same numbers of elements on both sides. It’s common to use an underscore for a value you’re going to throw away  TuplesTuples are lists’ immutable cousins. Pretty much anything you can do to a list that doesn’t involve modifying it, you can do to a tuple. You specify a tuple by using parentheses (or nothing) instead of square brackets:<jupyter_code>my_list = [1, 2]
my_tuple = (1, 2)
other_tuple = 3, 4
my_list[1] = 3 # my_list is now [1, 3]
try:
    my_tuple[1] = 3
except TypeError:
    print ("cannot modify a tuple")<jupyter_output>cannot modify a tuple<jupyter_text>DictionariesDictionary associates values with keys and allows you to quickly retrieve the value corresponding to a given key.<jupyter_code>empty_dict = {} 
empty_dict2 = dict()
grades = { "Joel" : 80, "Tim" : 95 } 
try:
    kates_grade = grades["Kate"]
except KeyError:
    print("no grade for Kate!")
joels_grade = grades.get("Joel", 0) # equals 80
kates_grade = grades.get("Kate", 0) # equals 0
no_ones_grade = grades.get("No One") # default default is None<jupyter_output>no grade for Kate!<jupyter_text>Dictionary keys must be **immutable**; in particular, you cannot **use lists as keys**. If you need a multipart key, you should use a tuple or figure out a way to turn the key into a string.  Loops The if elif else<jupyter_code>if you_are_reading_this:
    you_are_learning_Python()
elif you_are_looking_at_this:
    you_are_passing_time()
else:
    you_are_searching_for_more_memes<jupyter_output><empty_output><jupyter_text>For loopThe for is used with iterable, object like list, tuple, strings and dictionaries are all iterable offering you the possibility to loop through their items.<jupyter_code>fibonachi = [ 1, 1, 2, 3, 5, 8, 13]
for n in fibonachi:
    print("It's Fibonacci, not fibonachi")<jupyter_output>It's Fibonacci, not fibonachi
It's Fibonacci, not fibonachi
It's Fibonacci, not fibonachi
It's Fibonacci, not fibonachi
It's Fibonacci, not fibonachi
It's Fibonacci, not fibonachi
It's Fibonacci, not fibonachi<jupyter_text>While + (break)while is used to create a loop that goes on as long as the condition after while is True OR break has been called. A classic example of an infinite while + break:<jupyter_code>while True:
    repeat_this_action()
    if this_is_true_the_loop_will_ends:
        break<jupyter_output><empty_output><jupyter_text>FunctionsFunction, in a way similar to mathematics, is a rule established between 0 or more objects and returning (with a return) a corresponding output. In python a function is defined using def:<jupyter_code>def name_of_the_fucntion(zero_or_more_arguments):
    """
    Docstring describing what the function does
    """
    something_something = blablabla
    return something_something<jupyter_output><empty_output><jupyter_text>![alt text](https://camo.githubusercontent.com/a92b679f3e662988342b0d5d09723d14854b635a/68747470733a2f2f692e726564642e69742f3030383234796377336877792e6a7067)  Import librariesJust like you use the universal `include` Python uses `import` to import libraries neede din the program.<jupyter_code>import numpy as np
import sklearn<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06841018582243634, 'fraction_numerical': 0.025602202339986235, 'mean_word_length': 5.131645569620253, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 44, 'https://': 4, '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': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '579049', 'license': 'MIT', 'n_tokens_mistral': 2388, 'n_tokens_neox': 2207, 'n_words': 936, 'path': 'Footprints_2019/0 - Python Revision/Pre_requisite_guide_for_ML_workshop.ipynb', 'repo_name': 'the-ethan-hunt/Workshop-Content', 'size': '7293'}