+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Complete Python Developer in 2021 : Zero to Mastery :::
Python Community :
Join by clicking here: https://discord.gg/nVmbHYY
Trainers : Blog to stay up-to-date with whats new in Python
https://zerotomastery.io/blog/?tag=PM
ACADEMY : ZTM : https://zerotomastery.io/courses
Python Cheat Sheet : https://github.com/aneagoie/ztm-python-cheat-sheet
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Section 1: Introduction ::
1. Course Outline
2. Join Our Online Classroom!
3. Exercise: Meet The Community
Section 2: Python Introduction ::
4. What Is A Programming Language
5. Python Interpreter
There are two types of translator "Interpreter" & "Compiler"
1. Interpreter : An interpreter is a translator that translates you code line by by
2. Compiler : Compiler is one that take the entire file of code , translates and then compiles it
We can download it from the python.org
The interpreter that you are downloading is a code that is written in "C" language and it it called the
- CPYTHON . -- Written in C language
- JYTHON -- Written in Java labguage
- pypy -- Is written in python
- IRON-PYTHON -- Which is written for the .NET framework
But when you are download from python.org the official language is CPYTHON
We
are downloading a machine that takes our python code we are going to
write and it goes to the interpreter which we download using CPython .
And this CPYTHON is going to create something called a byte . This byte
code prints hello world
The CPYTHON is going to create something
called the byte code , byte code is closer to machine code it used the
cpython vm machine - something that run the code and this runs on our
machine
so when we are downloading the cpython and cpythonvm
6. How To Run Python Code
What are going to use in our learning
- Terminal
- Code Editiors (Sublime text / visual studio code)
- IDEs (Pycharm and Spider )
- Jupyter Notesbooks
Instead of download this we ca n go to ........." repl.it " -- Create an account here . It allows to save python files online. Or you can use glot.io
repl.it / glot.io
Here you can write your programs online - This is an online interpreter.
or you can use
glot.io instead
7. Note: Jumping To Developer Environment ::
8. Our First Python Program ::
We are using repl.it to write the program . This creates main.py . Any file which has the py extension is a python file .
print("") or print('')
name = input("Enter Your name : " )
print(name)
print("Hellllloooooooo ' + name)
9. Latest Version Of Python ::
Dicusses that Repl updates the latest version of the python a little late , so you may not find the latest version of python .
10. Python 2 vs Python 3 ::
The
difference between python 2 and python 3 . A programming language is
contently updated . No programming language is complete . In 2008 , the
founder and the community wanted to create python 3 .
11. Why So Many Languages? ::
Python,
Java and Javascript is more than enough for getting many jobs and this
is mostly most of the people can learn. 3 languages
Python is slower than languages like C++, C# or JAVA . You dont have to write python code for low level systems .
Python
may be slow but does one thing very well, developer productivity . You
would use python in scenarios when you want to do machine learning , you
want to build a webserver , may be you want to do data visualizations.
Build script that processes thousands of excel files , in that case you
are going to use python.
12. Exercise: How Does Python Work? ::
Go to the community : https://discord.gg/nVmbHYY
connect with a buddy and explain -- How python works ..nothing special in this lesson .
13. ZTM Python Cheat Sheet ::
The trainer has a blog where he updates new things about python if you want to update to date with python follow this link : https://zerotomastery.io/blog/?tag=PM
16. Learning Python ::
For any programmer to master any language there are four key things that he needs to master , including python
- Terms of that language - words / definitions that you have to got to memories (Statements /variables / instantiation /
- Datatypes of the language (what sort of data can a program hold )
- Actions (Such as store this data / retrieve this data and perform some action on it)
- Best
Practices : There are good ways of writing python code and there are
bad ways, when we build our applications and programs .
17. Python Data Types ::
- int
- float
- bool for boolean
- str - stands for string
- list
- tuple
- set
- dict
A
datatype is a value in Python , we need to know how to manipulate a
language , create / store / change , remove this data from the machine.
Class data types
After
the fundamental data type we also have something called classes. : So
beyond the fundamental datatype as listed above we can create our own.
So these will be custom types . I can create a datatype and I can name
it anything I like
example : supercar
Specialized Datatypes : These are not build into python but are special packages or modules that we can use it from libraries
Another type is "None" datatype, an idea of 0 in math / or absents of value
18. How To Succeed ::
In
order to get the most out of the course, I encourage you to code along
with me throughout the next sections. Watching videos may help, but
nothing beats hands on practice and actually coding to develop your
skills and make you comfortable with Python. Let's get started!
19. Numbers ::
print(4 + 6)
What is the type of 4 + 6
print(type(4 + 6)) / type command to ask what datatype is this ?
print(type(6 + 4))
print(type(6 * 2))
print(type(6 / 2))
print(type(6 - 2))
print(type(6 - 2))
A floating point number is a number with a decimal point .
print(type(0.44131)) -- answer is float
A float takes a lot more space in memory than an integer datatype
print ( 2 ** 2) -- This mean 2 to the power of 2
print ( 2 // 4) -- This gives out the integer rounding the figure to an integer.
)
print( 5 % 4) -- What is the reminder of this division (modular operator)
20. Math Functions ::
round is an in build function
round(2.1) -- the rounds the figure and give . This will not give out any result we need to include print command as below to see an output
print(round(3.1)) : returns a round up figure
print (abs(-23)) : This return an absolute number which is a no negative number .
To learn more on Python - Math Function : Google : Python3 math functions
The
programmer says many of them he has never ever used in his programming
career. Some of them you will never use it in your career , the key is
to know how to google them when you needs them
21. DEVELOPER FUNDAMENTALS : :
Tells you how to avoid the mistake that he did while he started as a programmer . Important think
to know is that you cannot memories everything . Every programmer uses google .
- Don't
read the dictionary, there a thousand things that one cannot memorize ,
such as the in build functions. There is a standard library for
in-build functions, datatype that you will not use 99 percent of the
times. and so on.
22. Operator Precedence ::
different operator has precedence over different ones
for instance
20 + 3 * 4 = > this gets multiplied first and the gets added. the multiplication get the first preference.
20 - 3 * 4 = > same here multiplication first
print
((20-3) + 2 ** 2) ==> Here the first preference will be 20-3 which
is covered in parenthesis , then the next precedence will be 2 ** 2 and
finally you have " + 2 " that gets added to the finally
Precedence
- ()
- **
- * /
- + -
Exercise: Operator Precedence ::
Throughout
the course, we will have many exercises to help you learn. Moving
forward, these exercises will be attached to each video (if it has an
exercise) which can be accessed in your Udemy video player under
"resources". To get you comfortable using this feature, and the online
Repl.it we are going to use, you can see the exercise for this lesson
attached. Good luck and see you in the next video!
For more information: https://support.udemy.com/hc/en-us/articles/229603648-How-to-Access-And-Use-The-Course-Player
24. Optional: bin() and complex ::
There
another set of datatype " complex " -- we won't be learning about this
data type , for we will only be using this when you are doing really
really complex math . Complex number is equivalent to a real number.
But this something that you don't need to worry 99% of the time.
The variable store the values for int , float as binary numbers in memory .
You
can use : an action or a function you can use in python called bin -
stands for binary. which gives the binary representation of that number
such as integer
print(bin(5))
// The binary number for 5 is 101 , in our example we get 0b101 the b
indicated by python is to indicate it is a binary number .
if you want to covert a binary number to an integer
print(int('0b101' , 2) - 2 is the base number indicating that it is a binary number
25. Variables ::
Variables store information that can be used in our programs , lets say in a quiz you have score 190
and you want to store it in a variable, you can name the variable anything .
iq = 190
Variable are called "Snake-Case" - means it is all lower case and the is space they don't exist we use underscore
- Variable must start with a lower case or an underscore
- Variables can be anything (letters / numbers / underscore )
- Case Sensitive
- Don't
over write keywords -- mean we cannot do this print(print) // because
the print keyword is already defined in python programming for some
function.
print = 190
print(print) -- this wont work .
https://www.w3schools.com/python/ -- Looks for what are keywords .
The
good practice of coding is to make variable names descriptive , so if a
new developer comes and sees it . He is understands it easily .
iq = 190
user_age = iq / 4
print(user_age)
once again assign it to another variable
iq = 190
user_age = iq / 4
a = user_age
print(a)
Constants :: There is an idea of constants . And constants are things that never change in a program
#constant
PI = 3.14 -- The varibles in caps-lock is to indicate that it is a constant and it is not meant to change.
You can still over write like below
PI = 3.14
PI = 0 // This is overwriting the earlier value .
But as a good practice you wouldn't change the value of constants
Variable starting with double underscore -- are called dunder (cross-verify name) . There are allowed to be touched .
NOte** : Do not create a variable starting with two underscore. You can do it indeed . But it is generally not a good practice .
Naming
a variable is one of the most important skill you have as a programmer .
So many time when the programmer does not make the variable names
descriptive and this makes it difficult for a new programmer to adopt
understand the code easy. Make variable naming simple so that the code
reads like English .
a, b, c = 1, 2 ,3 // This is another way to assign values to variables .
a, b, c = 1, 2 ,3
print(a)
print(b)
print(c)
print(a,b,c)
26. Expressions vs Statements ::
Expression in the below statement
iq = 150
user_age = 1q /5 -- The one marked in red is called "expression" , this produces the value
" user_age = 1q /5 " -- This is a statement - the entire line of code
27. Augmented Assignment Operator ::
some_value = 5
some_value = ( some_value + 2)
print(some_value)
using an Augmented assignment operator
some_value += 2 // You will be doing the same thing as some_value = ( some_value + 2)
or
some_value -= 2 // With the minus sign it with subtract 2 from the some_value
You cannot do a direct some_value -= 2 // the some_value must be assigned with some value to perform this operation. meaning to say it should have a defined value already
Comments
Post a Comment