Python Course Material

imaginor-labs 15 June 19
Technology Comments

What is python ?

High level programming language , super easy to grasp . 3rd most popular programming language in the world . Developed by Monty Python in 1990 .Very popular in Google ,Nasa etc . Even Us, use it like oxygen .

Processed at run time by interpreter . there is no need to compile it .

What Does “Interpreted Language” Mean?

Python is an interpreted language, which means that the written code is not actually translated to a computer-readable format at runtime. Whereas, most programming languages do this conversion before the program is even run. This type of language is also referred to as a “scripting language” because it was initially meant to be used for trivial projects.

The concept of a “scripting language” has changed considerably since its inception, because Python is now used to write large, commercial style applications, instead of just banal ones.

A long list of modern web applications and platforms rely on Python, including Google’s search engine, YouTube, and the web-oriented transaction system of the New York Stock Exchange (NYSE).

In fact, Python is so powerful that NASA uses it for their equipment and space machinery. How cool is that?

Python is also used behind the scenes to process a lot of elements you might need or encounter on your device(s) – mobile included. These include things like processing text, displaying numbers or images, solving complicated equations, or storing data.

Advantages of learning python ??

1) Python can be used in the development of prototypes, and it can help speed up the concept to creation process because it is so easy to use and read.

2) Python is ideal for general purpose tasks such as data mining, and big data facilitation.

3) Developers of all skill levels tend to stay more organized and productive when working with Python when compared to languages like C# and Java.

4) Python is easy to read, even if you’re not a skilled programmer so it is ideal for use among multi-programmer and large development teams, especially those with coding inexperienced team members.

5) Django is a complete and open source web application framework and it is powered by Python. Frameworks – like Ruby on Rails – simplify the development process, by allowing developers to work with snippets of existing code called modules. These code packets can be modified and repurposed as necessary across multiple projects.

6) Since Python is an open source language and is community developed, it has a massive support base. Millions of like-minded developers work with the language on a regular basis. In addition, the community continuously works together to improve upon core functionality. This is also a great way to network with other developers.

7) Python continues to receive official enhancements and updates as time progresses. This is a great way to implement new functionality and meet evolving development standards.

8) AI and Data science

What Jobs Call for Knowledge of Python?

Once you’re experienced in the Python language, some of the jobs or careers where you can expect to find work are:

  • Software Engineer
  • Django Back-End Developer
  • Data Engineer
  • Django or Python Developer
  • Application Reliability Engineer
  • Full-Stack Developer
  • AI/ML Engineer.
  • Computer Vision
  • AI researcher

Keep in mind these are merely a handful of examples. There are many more opportunities and some of them will require knowledge of other languages, applications, and development tools.

Lets Make our hands dirty ??

Will enable you to be confident in python at least . :P

Will do this entire program using actual challenges and coding .

  1. Make a github profile . will help you in your job search .( https://github.com/ )
  2. Download anaconda (https://www.anaconda.com/download/)

Lets get started :

Data Structure :

Primitive Data Structures

These are the most primitive or the basic data structures. They are the building blocks for data manipulation and contain pure, simple values of a data. Python has four primitive variable types:

  • Integers
  • Float
  • Strings
  • Boolean

In the next sections, you'll learn more about them!

Integers

You can use an integer represent numeric data, and more specifically, whole numbers from negative infinity to infinity, like 4, 5, or -1.

Float

"Float" stands for 'floating point number'. You can use it for rational numbers, usually ending with a decimal figure, such as 1.11 or 3.14.

Note that in Python, you do not have to explicitly state the type of the variable or your data. That is because it is a dynamically typed language. Dynamically typed languages are the languages where the type of data an object can store is mutable.

Strings

Strings are collections of alphabets, words or other characters. In Python, you can create strings by enclosing a sequence of characters within a pair of single or double quotes. For example: 'cake', "cookie", etc.

You can also apply the + operations on two or more strings to concatenate them, just like in the example below:

Python has many built-in methods or helper functions to manipulate strings. Replacing a substring, capitalising certain words in a paragraph, finding the position of a string within another string are some common string manipulations. Check out some of these:

Boolean

This built-in data type that can take up the values: True and False, which often makes them interchangeable with the integers 1 and 0. Booleans are useful in conditional and comparison expressions, just like in the following examples:

Data Type Conversion

Sometimes, you will find yourself working on someone else's code and you'll need to convert an integer to a float or vice versa, for example. Or maybe you find out that you have been using an integer when what you really need is a float. In such cases, you can convert the data type of variables!

To check the type of an object in Python, use the built-in type() function, just like in the lines of code below:

Implicit Data Type Conversion

This is an automatic data conversion and the compiler handles this for you. Take a look at the following examples:

In the example above, you did not have to explicitly change the data type of y to perform float value division. The compiler did this for you implicitly.

That's easy!

Explicit Data Type Conversion

This type of data type conversion is user defined, which means you have to explicitly inform the compiler to change the data type of certain entities. Consider the code chunk below to fully understand this:

There's an obvious mismatch.

To solve this, you'll first need to convert the int to a string to then be able to perform concatenation.

Note that it might not always be possible to convert a data type to another. Some built-in data conversion functions that you can use here are: int(), float(), and str().

Arrays:

First off, arrays in Python are a compact way of collecting basic data types, all the entries in an array must be of the same data type. However, arrays are not all that popular in Python, unlike the other programming languages such as C++ or Java.

In general, when people talk of arrays in Python, they are actually referring to lists. However, there is a fundamental difference between them and you will see this in a bit. For Python, arrays can be seen as a more efficient way of storing a certain kind of list. This type of list has elements of the same data type, though.

In Python, arrays are supported by the array module and need to be imported before you start inititalizing and using them. The elements stored in an array are constrained in their data type. The data type is specififed during the array creation and specified using a type code, which is a single character like the I you see in the example below:

List

Lists in Python are used to store collection of heterogeneous items. These are mutable, which means that you can change their content without changing their identity. You can recognize lists by their square brackets [ and ] that hold elements, separated by a comma ,. Lists are built into Python: you do not need to invoke them separately.

Note: like you have seen in the above example with x1, lists can also hold homogeneous items and hence satisfying the storage functionality of an array. This is fine unless you want to apply some specific operations to this collection.

Python provides many methods to manipulate and work with lists. Adding new items to a list, removing some items from a list, sorting or reversing a list are common list manipulations. Let's see some of them in action:

  • Add 11 to the list_num list with append(). By default, this number will be added to the end of the list.

Use insert() to insert 11 at index or position 0 in the list_num lis

Tuples

Tuples are another standard sequence data type. The difference between tuples and list is that tuples are immutable, which means once defined you cannot delete, add or edit any values inside it. This might be useful in situations where you might to pass the control to someone else but you do not want them to manipulate data in your collection, but rather maybe just see them or perform operations separately in a copy of the data.

Let's see how tuples are implemented:

Dictionary

Dictionaries are exactly what you need if you want to implement something similar to a telephone book. None of the data structures that you have seen before are suitable for a telephone book.

This is when a dictionary can come in handy. Dictionaries are made up of key-value pairs. key is used to identify the item and the value holds as the name suggests, the value of the item.

Sets

Sets are a collection of distinct (unique) objects. These are useful to create lists that only hold unique values in the dataset. It is an unordered collection but a mutable one, this is very helpful when going through a huge dataset.

Files

Files are traditionally a part of data structures. And although big data is commonplace in the data science industry, a programming language without the capability to store and retrieve previously stored information would hardly be useful. You still have to make use of the all the data sitting in files across databases and you will learn how to do this.

The syntax to read and write files in Python is similar to other programming languages but a lot easier to handle. Here are some of the basic functions that will help you to work with files using Python:

  • open() to open files in your system, the filename is the name of the file to be opened;
  • read() to read entire files;
  • readline() to read one line at a time;
  • write() to write a string to a file, and return the number of characters written; And
  • close() to close the file.

Files Handling

https://docs.python.org/3.4/tutorial/inputoutput.html#reading-and-writing-files

Loops in python

https://www.tutorialspoint.com/python/python_loops.htm

Conditional Statement :

https://www.studytonight.com/python/conditional-statements

Class in python :

https://www.programiz.com/python-programming/class

Function in python :

https://www.datacamp.com/community/tutorials/functions-python-tutorial

Interactive coarse material :

https://www.hackerrank.com/domains/python?filters%5Bsubdomains%5D%5B%5D=py-introduction

Solo learn Python :

https://www.sololearn.com/Course/Python/

Pandas Tutorial :

https://www.listendata.com/2017/12/python-pandas-tutorial.html?1

Numpy Tutorial :

https://www.datacamp.com/community/tutorials/python-numpy-tutorial

Comments:

Add a Comment:



Recent Posts: