
Learn how to download and install anaconda for python. We will install anaconda on windows 10, 64 bit.
Learn to launch Anaconda Jupyter Notebook.
You will learn how python program accepts input from the user.
In this lecture, you will learn to take input from the user in python.
Here, you are going to understand how to take integer input.
How to take in the form of floating point number. You will understand this concept in this lecture.
How to take list as input in python?
In this video lecture, you will understand this concept. We will give empty list as input , then the user will feed elements by specifying total number of items in the python list. Then this list will be given to program as input.
You are going to know about the types of input with the help of type function in python.
In this lecture, we will take multiple values as input. We will feed different data type values to input function, then we will display the output on screen.
Here, we are going to take multiple lines as input. We will give many lines to the input function in python using while loop.
You will learn about basic introduction of variables. You will also know about the types of variables, such as local and global variables. Students will know about declaration of variables in python. This lecture also includes that how to delete variable name in python.
Variable in python tells us that it is reserved memory location used to store values. You will learn how to assign a single value to several variables simultaneously. This video lecture consists of slides in Microsoft power point presentation.
How to create variable names? You will learn how to explicitly declare and assign names to python variables. There is no need to declare any special type to declare it.
You will know how to specify the type or casting variables in python. We will use int, string, and float types functions to cast the type. Single quotes or double quotes can be used to declare a variable.
In the end of this lecture, we will know how to delete a variable in python.
How is Python memory efficient?
How python saves memory?
These are the questions that we will deal in this video lecture. We will discuss about object referencing in python. We will do this by assigning a variable to a value then we will print its id. In the next step, we will assign another variable to existing container or bucket. Then, we will print its identity too. In the end, we will not assign these variables to those containers and then learn how python collects garbage values and clears memory locations.
What are illegal variable names?
You will learn that variable names are case-sensitive. You will also learn about overwriting of variables. We can not use keywords as variable name. Special characters such as $, &, *, and @ etc are not allowed in the beginning of variables names. We can't use "-" dash character within, instead we must use "_" hyphen to make all things legal while naming conventions in python. The ' back tick character is also not allowed. Violation of these rules will result in syntax error in python. It will raise an error that it is invalid syntax, if you use illegal names in python.
Python has a set of reserved words that can not be used as variable names. In this lecture, you will learn about these keywords and their functions in python.
Previously, we had 33 keywords in python but n new versions the number changed to 35 keywords. Two new reserved words named as "with" and "yield" were introduced in python 3.5. And it will continue to increase in new versions of python.
These words include: and, as, assert, break, class, continue, def, del, elif, else, except, false, finally, for, from, global, if, import, in, is, lambda, none, nonlocal, not, or, pass, raise, return, true, try, while, with, and yield.
Some words are verboten in python. It means they are not allowed or not permitted while programming. In this video lecture, you will learn about the use of keywords as variable name. You will come to know that how it will generate an error in python.
In the end, we will print the list of keywords with the help of importing "keyword module".
How to check complete list of keywords in python?
In this lecture, you will learn this by the use of help ( ) function. We will display entire list of 35 keywords/ reserved words that are used in python language. We will display this with the "keyword.kwlist method".
We can use multi word variable names in python.
Camel Case
Each word, except the first, starts with a capital letter:
myVariableName = "abc"
When using CamelCase names, capitalize all letters of an abbreviation (e.g. HTTPServer)
Pascal Case
Each word starts with a capital letter:
MyVariableName = "ABC"
Snake Case
lower_case_with_underscores
Introduced by Gavin Kistner in ruby community 2004.
In this lecture, you will learn how to assign multiple values to a single variable in python. If you have different values packed in a list or a tuple then you can assign them to different variables. You will also get knowledge about legal variable names in python in this video lecture.
Global variable is created without any function. You will learn to create this with global keyword also. This lecture will elaborate the use of local variables in python too. This learning material explains the difference between local and global variables with the help of coding examples.
In this programming example, you are going to know how to print an output with "hello world program". You may learn how to print a specific result on the output screen.
You are going to learn how to print an output in python. You will check the printing of integers, numbers, strings, floats. In this lecture, you will learn printing text with a variable. We will concatenate two variables and assign to the third and after that we will display the output on the computer screen in jupyter notebook.
Python program to swap two variable numbers without using temporary variable. We will take the input numbers from the user with the user prompt and then swap those numbers by changing their places and then assigning with the help of assignment operator. In the end we will display swapped numbers.
Swapping of two numbers with the temp variable. We are going to swap two numbers with third variable temp, and then display the numbers after swapping. We will take values of numbers from the user in this program.
Learn how to split a single variable into multiple values in python. We will split a single sentence variable into different words with the variable.split( ) method. We can specify the splitter in this case by passing different characters as a splitter into the parameters of function.
In this lecture , we will declare variable without value using none type as placeholder. You will learn how to set several variables to none.
You will learn about the lifetime of a variable. A variable’s lifetime is the period of time for which it resides in the memory.
A variable that’s declared inside python function is destroyed after the function stops executing. So the next time the function is called, it does not remember the previous value of that variable.
Not all variables are accessible from all parts of our program, and not all variables exist for the same amount of time. Where a variable is accessible and how long it exists depend on how it is defined.
We call the part of a program where a variable is accessible its scope, and the duration for which the variable exists its lifetime.
A variable which is defined in the main body of a file is called a global variable. It will be visible throughout the file, and also inside any file which imports that file.
Global variables have unintended consequences because of their wide-ranging effects. A variable which is defined inside a function is local. It is accessible from the point at which it is defined until the end of the function, and exists for as long as the function is executing.
The variables that are local to a method are created the moment the method is activated and are destroyed when the activation of the method terminates.
In this lecture, you will learn about variables in concise.
Variables are referred to "buckets" where information can be maintained. Python also uses a variable to store the information.
Variables can be declared by any name or even alphabets like a, aa, abc, etc. Variables can be re-declared even after you have declared them for once
In Python you cannot concatenate string with number directly, you need to declare them as a separate variable, and after that, you can concatenate number with string
Python constants can be understood as types of variables that hold the value which can not be changed. Usually Python constants are referenced from other files. Python define constant is declared in a new or separate file which contains functions, modules, etc.
Types of variables in Python or Python variable types : Local & Global. Declare local variable when you want to use it for current function. Declare Global variable when you want to use the same variable for rest of the program. To delete a variable, it uses keyword "del".
Operators are the constructs which can manipulate the value of operands. Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator. And the whole procedure is called as operation.
Types of Operator:
Python language supports the following types of operators.
Arithmetic Operators
Comparison (Relational) Operators
Assignment Operators
Logical Operators
Bitwise Operators
Membership Operators
Identity Operators
Python expressions only contain identifiers, literals, and operators.
Identifiers: Any name that is used to define a class, function, variable module, or object is an identifier. Literals: These are language-independent terms in Python and should exist independently in any programming language. In Python, there are the string literals, byte literals, integer literals, floating point literals, and imaginary literals. Operators: In Python you can implement the following operations using the corresponding tokens.
A sequence of operands and operators, like a + b - 99, is called an expression. We can create complex expressions by combining objects and operators.
2+3 is an expression with one operator that is "+". We can also put in more than one.
They are different from statement in the fact that statements do something while expressions are representation of value. In this lecture, we will learn about Generator expression, Conditional Expressions, Dictionary comprehension, and List comprehension.
Here you will get a quick overview of the available operators in python along with their functions. You will learn about plus, minus, multiplication, division, modulus, bitwise and, bitwise or, right shift, and left shift operators.
You will also know about bitwise xor, bit wise invert, less than, greater than, less than or equal to, greater than or equal to, != (not equal to), not (boolean NOT), and (boolean AND), or (boolean OR), // (divide and floor), and ** (power) operators in python.
In this lecture you are going to learn about Add and Assign+=, Subtract AND +-, Multiply AND: *=, Divide AND: /=, and Modulus AND: % = operators in python.
You will learn Divide(floor) AND: //=, Exponent AND: **=, Performs Bitwise AND& =, l =Performs Bitwise OR, ^ = Performs Bitwise xOR, Bitwise Right Shift and Assign: >>=, and Bitwise Left Shift and Assign: << = operators in python.
Here you will know about PEP 8 compliant operations in python. It was written in 2001 by Guido van Rossum, Barry Warsaw, and Nick Coghlan. PEP stands for Python Enhancement Proposal. We will check modulus with negative numbers, and division by zero error.
In this video lecture, you will learn about relational and comparison operators in python. The <, <=, >=, and > operators are numerical comparison operators. Relational operator is a programming language construct that tests some kind of relation between two entities.
Logical operators are conjunctions that you can use to combine more than one condition. We have three Python logical operators.
(1)AND:
Returns true if both conditions are met.
Returns false if one of the conditions is false.
(2)OR:
Returns True if one of the statements is true.
(3)NOT:
Reverse the result, returns False if the result is true.
Membership operators are used to test if a sequence is presented in an object:
IN: Returns True if a sequence with the specified value is present in the object.
Not In: Returns True if a sequence with the specified value is not present in the object
Identity operators are used to compare the objects. If two operands have the same identity, it returns True. Returns True if both variables are the same object.
Python not with ‘in’ example: In this example, I will show you how to use the ‘not’ operator with ‘in’. For that, a numeric list of six items is created. This is followed by using a for loop to iterate through the list elements and display their values.
After that, we will use an if statement to omit certain numbers to be displayed. There, the not operator is used with the ‘in’.
The ‘3 +4’ is a Python expression. It contains one operator and two operands. However, a more complex statement can include multiple operators.
To evaluate complex expressions, Python lays out the rule of precedence. It governs the order in which the operations take place.
You have heard about BODMAS somewhere in your school. In Python, however, we come across PEMDAS:
Parentheses
Exponentiation
Multiplication
Division
Addition
Subtraction
Python interpreter evaluates operators with higher precedence first. Except the exponent operator (**) all other operators get evaluated from left to right.
Many operators have left-to-right associativity. When two operators share an operand and the operators have the same precedence, then the expression is evaluated according to the associativity of the operators.
For example, since the ** operator has right-to-left associativity, a ** b ** c is treated as a ** (b ** c). The / operator has left-to-right associativity, a / b / c is treated as (a / b) / c.
All operators except the exponent (**) support the left-to-right associativity.
The data types in python are Int, Float, complex, List, Tuple, Range, Dict, Set, Frozenset, bool, Bytes, Bytearray, and Memoryview. These may be numeric, sequence, mapping types, set, or binary data types.
You can get the data type of a variable with the type ( ) function. The type() function is mostly used for debugging purposes.
int (signed integers) are often called just integers or ints. They are positive or negative whole numbers with no decimal point. Integers in Python 3 are of unlimited size. Python 2 has two integer types - int and long. There is no 'long integer' in Python 3 anymore.
How big is an int?
The size of an int was limited to 32 bits in Python 2. This could store integer in the range -2,147,483,648 to 2,147,483,647. A long could range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
In Python 3, the long data type doesn’t exist. It can be even greater than 64-bits.
In this lecture, you will also learn about integer overflow. This is a situation where a number is in need of more space than a computer allows for it. With Python, you don’t have to worry about this.
Exponential numbers: You can write an exponential number using the letter ‘e’ between the mantissa and the exponent. Here, you will learn about exponents in python.
Printing a number in scientific notation formats the number as a float, followed by "e+" and the appropriate power of 10. Such as 45600000 in scientific notation results in "4.56e+07".
In this video lecture you will learn using str.format() to suppress scientific notation. Call str.format(num) with str as "{:.nf}" to represent num in decimal format with n places following the decimal point.
In this lecture, you will learn to display a decimal in scientific notation. We will import import Decimal from decimal module to perform this operation.
Here you will be able to perform different operations on integers such as addition, subtraction, multiplication, division, and modulo operations. You will also learn about floor division in python.
In this lecture, you will know the art of using modulus operator with negative number.
Here this lecture will discuss how to take input from the user and then add two numbers prompted by the user.
In this program code, you would be able to generate a random number in python. You can do this within a given range by importing the random module random.randint ( ).
Floating point real values are also known as floats. They represent real numbers and are written with a decimal point dividing the integer and the fractional parts. Floats may also be in scientific notation, with E or e indicating the power of 10.
You will learn how to add, subtract, multiply, and divide two floating point numbers. You will know about modulo and remainder operations too.
In this lecture, you will be taught how to add two floating point numbers in python. We will use sum ( ) method to add two floats.
In this lecture, we will add two floats in python that are prompted by the user. The user will give the input numbers and the program will add these floats and then display the result.
You would be able to take input in the form of kilometers and then with the help of a formula you can convert km to miles in python.
Python code to demonstrate float values. We will print infinity with floating point numbers.
Python provides operations involving fractional numbers through its fractions module. A fraction has a numerator and a denominator, both of which are integers. This module has support for rational number arithmetic.
Python stores floats with 'bits'. We can't represent some floats accurately. This is the problem you have here. It is like trying to write 1/3 in decimal with a limited amount of decimals places perfectly accurately.
Decimal numbers cannot accurately represent a number like 1/3, so you have to round to something like 0.33. And 0.33 + 0.33 + 0.33 don't add up to 1 accurately.
If you really need your results to add up exactly, especially when you work with money: use a special decimal datatype. It is possible for rounding errors in the input numbers to cancel each other out in the following case:
print (0.1+0.4)
In that case, the result (0.5) can be represented exactly as a floating-point number.
In other cases like 0.1 + 0.3, the result actually isn’t really 0.4, but close enough that 0.4 is the shortest number that is closer to the result. Many languages then display that number instead of converting the actual result back to the closest decimal fraction.
Float contains less significant digits than double or long double. So, floats suffer from larger rounding errors. While binary floating-point numbers are better for computers to work with, sometimes they are just not appropriate.
Each language has its own solution to some problems. In this lecture, you will learn about the following methods to tackle with the above stated problem:
Limited-Precision Decimal
Arbitrary-Precision Decimal
Symbolic calculations
Decimal Library
Complex (complex numbers) − are of the form a + bJ, where a and b are floats and J represents the square root of -1. The real part of the number is a, and the imaginary part is b.
In this video lecture, you will know how to create complex in python. Creating complex without complex function will also be explained in this video.
We have no representation in the world of Real Numbers where the square of a number gives a negative result. For representing such situation we need Imaginary Numbers. Complex numbers in python help us in this regards.
In this lecture, you will know about Square of ἰ
i² = -1
How??
i = √-1
i²= (√-1)²
i² = -1
This means
i⁴ = +1,
i⁶ = -1,
i⁵ = ἰ,
i⁷ = -i
In this lecture, we will perform addition, multiplication, subtraction, and division operations on complex numbers in python. You will also know that multiplication of conjugate is a square multiplied by b square.
A string is a sequence of characters. A character is simply a symbol. Computers do not deal with characters. Computers deal with numbers in binary as a combination of 0s and 1s internally.
Strings are amongst the most popular types in Python. We can create them simply by enclosing characters in quotes. Python treats single quotes the same as double quotes. Creating strings is as simple as assigning a value to a variable.
The conversion of character to a number is called encoding, and the reverse process is decoding. American standard code for information interchange ASCII and Unicode are some of the popular encodings used.
Strings can be created by enclosing characters inside a single quote or double-quotes. Triple quotes can be used in Python but generally used to represent multiline strings and docstrings.
In this lecture, you will learn how to create a string in Python?
Creating a String with single quotes, double quotes, and triple quotes is explained in this tutorial's video.
Python's triple quotes helps strings to span multiple lines, including verbatim NEWLINEs, TABs, and any other special characters.
The syntax for triple quotes consists of three consecutive single or double quotes.
You will learn about String Special Operators.
Concatenation: Adds values on either side of the operator.
Repetition: Creates new strings, concatenating multiple copies of the same string.
Slice: Gives the character from the given index.
Range Slice: Gives the characters from the given range.
Membership In: Returns true if a character exists in the given string.
Membership Not in: Returns true if a character does not exist in the given string.
Raw String: Suppresses actual meaning of Escape characters.
Format: Performs String formatting.
How to concatenate one or more strings?
How to multiply a string?
Learn the answers to these questions.
String membership test: You will learn if a character is in string or not.
How to remove or strip whitespace from a string?
In, this lecture, you will learn how to replace a character with other in a string and convert a string in uppercase and lowercase.
Remove Whitespace from a string:
White space is the space before and/or after the actual text, and very often you want to remove this space.
The strip() method removes any whitespace from the beginning or the end.
Replace String
The replace() method replaces a string with another string.
How to change or delete a string?
Updating a character in a string
How to delete a character from a string?
How to update entire string?
How to delete an entire string?
Strings are immutable. This means that elements of a string cannot be changed once they have been assigned.
In Python, Updation or deletion of characters from a String is not allowed. Deletion of entire String is possible with the use of del keyword.
Deletion of entire string
We cannot delete or remove characters from a string. But deleting the string entirely is possible using the del keyword.
Splitting a string: The split() method returns a list where the text between the specified separator becomes the list items.
The split() method splits the string into sub strings if it finds instances of the separator.
Indexing of strings:
In python, a String is a sequence of characters, and each character in it has an index number associated with it. Indexing begins at 0. String provides an [] operator to access any character in the string by index position. We pass the index position in the square brackets, and it will return the character at that index. This index position can be a positive or negative int value.
Negative indexing of strings: We know that string indexing starts at 0, if we give the value as -1 in the square brackets then we can get the last element of the string. This is called as the negative indexing of the string.
What is Data Slicing?
Data Slicing is the process of accessing a subset of a given sequence of data. We can also use data slicing, to divide a large dataset into smaller pieces for fast processing. Smaller data sets makes the code efficient thus save execution time, memory and screen time.
Syntax
data_sequence_name[start:stop:steps]
Accessing Values in Strings, Slicing of strings:
Python does not support a character type. These are treated as strings of length one, thus also considered a substring.
How to access a substring of given length from the start of the string. How to do that?
Basically we want to access a substring of given length from the start of the string. How to do that?
string = "alpha bravo charlie"
# Get First 3 character of a string in python
first_three_chars = string[0:3]
print('First 3 character : ', first_three_chars)
We sliced the string from 0 the index position to (3 -1) index position and we got a substring containing the first three characters of the string.
How to get Last N characters in a string?
In this video lecture, you will learn to fetch last n characters from the string. We will slice the string with negative numbers.
How to use steps in slicing the string?
Get first N characters in a string
In python, apart from index position, subscript operator, i.e. [] can accept a range too i.e.
string[start_index_pos: end_index_pos: step_size]
start_index_pos: Index position, from where it will start fetching the characters
end_index_pos: Index position till which it will fetch the characters from string
step_size: Interval between each character
In this lecture, you will learn how to cut zeros and ones from a string with the help of strip method.
Add string in a certain position in Python
Python Strings are immutable. However, it is possible to create a new string that has the inserted character.
hash = "355879ACB6"
hash = hash[:4] + '-' + hash[4:]
print hash
As strings are immutable another way to do this would be to turn the string into a list, which can then be indexed and modified. However, to get the list back to a string, use .join() using an empty string.
You will learn to add two binary strings in python.
Here, you are going to check how many times a substring appears in a string. We will use count () method to count the number of occurrence of a sub string in python strings.
Check if a string is empty or not.
You will learn to check similarity of two strings using SequenceMatcher. We will also use ratio() to count similarity among strings.
Python program to find character from given ASCII number.
Learn how to convert any letter to corresponding ascii value in python. We will use ord( ) function for this.
String summary: Strings are arrays of bytes representing Unicode characters.
Python does not have a character data type, a single character is simply a string with a length of 1.
In Python, a string is a series of characters.
Python strings are immutable.
Use quotes, either single-quotes or double-quotes to create string literals.
Use the backslash character \ to escape quotes in strings.
Use raw strings r'...' to escape the backslash character.
Use f-strings to insert values of variables into a literal string.
Place literal strings next to each other to concatenate them. And use the + operator to concatenate string variables.
Use the str[n] to access the character at the position n of the string str.
Use the len() function to get the size of a string.
Use slicing to get a substring from a string.
String formatting is the way we organize instructions so that Python can understand how to incorporate data in the creation of strings.
Square brackets can be used to access elements of the string.
Basic introduction to Python lists:
We will discuss how to create, access, slice, and reassign list in Python. Then we will apply functions to them. we will also discuss Python List Operations and Concatenation of lists.
Python has 4 built-in data types to store collections of data. These are Tuple, Set, and Dictionary. The fourth one is list. Lists are created using square brackets. A list can contain different data types. Here is the example of a list with strings, integers and boolean values:
list1 = ["mars", 100, False, 40, "anaconda"]
Python Programming Language doesn’t have arrays. We use lists to hold a sequence of values, A Python list is a collection of values used to store multiple items in a single variable.
Lists qualities and specifications: List items are ordered, changeable, and allow duplicate values.
(1) The list is changeable, meaning that we can change, add, and remove items in a list after it has been created. We will give examples in later lectures.
(2) List items can be of any data type. A list can contain different data types:
(3) Since lists are indexed, lists can have items with the same value. Lists allow duplicate values.
(4) When we say that lists are ordered, it means that the items have a defined order, and that order will not change.
If you add new items to a list, the new items will be placed at the end of the list.
How to create a list in python? In this lecture, you are going to learn about List creation with the help of list constructor.
Lists are created using square brackets.
Create a List:
my_list = ["swordfish", "goldfish", "mahi-mahi"]
print(my_list)
The list() Constructor
It is also possible to use the list() constructor when creating a new list.
How to access items in lists? In this lecture, you will learn to perform Indexing on lists. List items are indexed and you can access them by referring to the index number.
Negative indexing in lists: Negative indices- The indices can be negative as well. A negative index means traversal from the end of the list.
In this lecture, we will apply negative indexing on different dog breeds that are in the form of list.
Slicing of a list: List slicing refers to accessing a specific portion or a subset of the list for some operation while the original list remains unaffected. Syntax of list slicing:
list_name[start:stop:steps]
In this course named python 4 you, you will learn much more.
Here, you are going to perform slicing operations on list with negative numbers.
Steps in slicing a list: We can do list slicing in three ways:
By passing just the start or stop parameter.
By passing the start and stop parameter.
By passing the start, stop, and steps parameters.
The stop and steps are optional parameters. The start represents the index from where the list slicing begins. Its default value is 0, i.e. it begins from index 0.
The stop represents the last index up to which the list slicing will go on. It is the index of last element in the list.
The steps represent the number of steps, i.e after every n number of steps, the start index is updated and list slicing is performed on that index,
How to add elements / items to a list: Lists are mutable. We can add items in lists. If we want To add an item to the end of the list, we will have to use the append() method.
You can add any iterable object (tuples, sets, dictionaries etc.) to a list. Python4 you is the best video tutorial on internet to provide you with the best learning content on any forum.
How to change the items of a list? If you want to change the value of a specific item, just refer to the index number.
You will learn how to remove specified Item from the list? After watching this python learning material, you will be able to remove Specified Index from the list.
We can remove elements from a list in backward manner by specifying negative index values in the pop method.
How to delete an entire list in python?
How to clear the list in python?
What is the difference between clearing and deleting the list python?
How to sort a list alphabetically?
Ascending sort of a list
Descending sort of a list
List objects have a sort() method that will sort the list alphanumerically, ascending, by default.
Reverse ordering of a list: How to reverse an entire list with reverse function?
In the list sort reverse = true method, we had reversed a string and arranged it in the descending order.
But what we are going to do now is different. The reverse function. It will reverse the entire string, no matter what is the order.
Case Insensitive Sort of a list:
If you want a case-insensitive sort function, then use str.lower as a key function.
How to join python lists? There are several ways to join, or concatenate, two or more lists in Python. One of the easiest ways are by using the + operator. Another way to join two lists are by appending all the items from list2 into list1, one by one. But we will discuss this in loop section.
We can also use the extend() method, which purpose is to add elements from one list to another list.
Reassigning a Python List: Python Lists are mutable that means you can reassign its items, or you can reassign it as a whole.
In this video lecture we will do the following things on lists:
Reassigning the whole Python list
Reassigning a single element
Reassigning a few elements
You can reassign a Python list by assigning it like a new list.
How to create multidimensional lists?
Lists within lists
How to access an element in multidimensional lists?
In this lecture, we will perform some operations on lists. We will use in , not in operators too.
There are some built-in functions in Python that you can use on python lists. A function is what you can apply on a construct and get a result. A method is what you can do to it and change it. To call a method on a construct, you use the dot-operator(.). Python supports some built-in methods to alter a Python list.
len(): It calculates the length of the list.
max(): It returns the item from the list with the highest value.
sum(): It returns the sum of all the elements in the list.
min(): It returns the item from the Python list with the lowest value.
sorted(): It returns a sorted version of the list, but does not change the original one.
any(): It returns True if even one item in the Python list has a True value. It returns False for an empty iterable.
all(): It returns True if all items in the list have a True value.
list(): It converts a different data type into a list.
Iterating on a list: Python list can be traversed with a for loop in python.
Know why does the Python list index start at 0?
In this lecture you will learn to create an empty list in python.
Find the largest number in a list without max function.
Find the biggest number in a list using max function.
Smallest number in a list python using list append And for loop plus min () function.
Python program to find smallest number in a list using list sort method.
You are going to learn summary of Lists in python.
A list is an ordered collection of items.
Use square bracket notation [] to access a list element by its index. The first element has an index 0.
Use a negative index to access a list element from the end of a list. The last element has an index -1.
Use list[index] = new_value to modify an element from a list.
Use append() to add a new element to the end of a list.
Use insert() to add a new element at a position in a list.
Use pop() to remove an element from a list and return that element.
Use remove() to remove an element from a list.
Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python. A tuple is a collection which is ordered and unchangeable. Tuples are written with round brackets. Python Tuples are like a list. It can hold a sequence of items. The difference is that it is immutable.
A tuple can have any number of items and they may be of different types (integer, float, list, string, etc.).
Tuple Items:
Tuple items are ordered, unchangeable, and allow duplicate values.
Tuple items are indexed, the first item has index [0], the second item has index [1] etc.
Ordered:
When we say that tuples are ordered, it means that the items have a defined order, and that order will not change.
Unchangeable:
Tuples are unchangeable, meaning that we cannot change, add or remove items after the tuple has been created.
Allow Duplicates:
Since tuple are indexed, tuples can have items with the same value.
Advantages of Tuple over List: Tuples are quite similar to lists, both of them are used in similar situations. However, there are certain advantages of implementing a tuple over a list. Below listed are some of the main advantages:
We generally use tuples for heterogeneous data types and lists for homogeneous data types.
Iterating through a tuple is faster than with list.
Tuples that contain immutable elements can be used as a key for a dictionary. With lists, this is impossible.
If we have data that does not change, implementing it as tuple will make write protected.
How to create a python tuple?
Tuple constructor: To declare a Python tuple, type a list of items separated by commas, inside parentheses. Then assign it to a variable.
Creating a tuple with a single item:
Until now, we have seen how easy it is to declare a Python tuple. But when you do so with just one element, it may create some problems.
The tuple() Constructor: It is also possible to use the tuple() constructor to make a tuple. We can also use the tuple() method to make a tuple.
How to create an empty tuple? In this section, you will learn to create empty tuple and also nested tuple.
You will learn about packing and unpacking of python tuples.
How to pack and unpack tuples in python?
Python Tuples Packing: You can also create a Python tuple without parentheses. This is called tuple packing.
Python Tuples Unpacking: Python tuple unpacking is when we assign values from a tuple to a sequence of variables in python.
Learn accessing tuple elements in python. Also learn about Indexing tuples in python. To access an entire tuple in python, just type its name. Or, pass it to the print statement.
To get a single item from a Python tuple, use its index in square brackets. Indexing begins at 0. Negative indexing means start from the end.
Learn slicing through python tuples. Specify negative indexes if you want to start the search from the end of the tuple. Now, let’s look at negative indexing. Unlike positive indexing, it begins traversing from the right.
How to Delete a Python Tuple? Python tuple is immutable. This also means that you can’t delete just a part of it. You must delete an entire tuple, if you want.
Reassigning tuples in python: Python tuple is immutable. So let’s try changing a value in this lecture.
Tuple functions in python:
A lot of functions that work on lists work on tuples too. A function applies on a construct and returns a result. It does not modify the construct.
#tuple functions
len(): Like a list, a Python tuple is of a certain length. The len() function returns its length.
max(): It returns the item from the tuple with the highest value. We can’t apply this function on the tuple cat, because we cannot compare rest of items to a list. So let’s take yet another tuple in Python.
min( ): Like the max() function, the min() returns the item with the lowest values.
sorted( ): This function returns a sorted version of the tuple. The sorting is in ascending order, and it doesn’t modify the original tuple in Python. We will check new tuple for the rest of functions
any(): If even one item in the tuple has a Boolean value of True, then this function returns True. Otherwise, it returns False.
all(): Unlike any(), all() returns True only if all items have a Boolean value of True. Otherwise, it returns False.
sum(): This function returns the arithmetic sum of all the items in the tuple. However, you can’t apply this function on a tuple with strings.
tuple(): This function converts another construct into a Python tuple. Let’s look at some of those.
Python Tuple Methods:
Python has two built-in methods that you can use on tuples.
Python Count( ) Method: Returns the number of times a specified value occurs in a tuple
Python Index ( ) Method: Searches the tuple for a specified value and returns the position of where it was found
Python For Loop Tuple: In this lecture, you will learn to iterate on tuples with the help of loop.
How to create nested tuple in python?
In this lecture, you are going to create nested tuples python. Python tuple may also contain other constructs, especially, lists. it is a collection of items, and items can be anything.
Python tuple operations include membership test, Logical operations, concatenation, multiplication, Joining Two Tuples.
Concatenation is the act of joining. To join two or more tuples you can use the + operator.
We can apply the ‘in’ and ‘not in’ operators on items to check membership. This tells us whether they belong to the tuple. This lecture also includes Identity operators and logical operations.
Tuples are immutable sequences, typically used to store collections of heterogeneous data.
The main difference between lists and tuples is that the tuples are immutable, while the lists are mutable.
We can initialize a tuple using a pair of parentheses () and values inside separated with commas.
We can initialize a tuple using the tuple built-in function.
We can iterate over tuples using a simple for-loop.
We can do common sequence operations on tuples like indexing, slicing, concatenation, multiplication, getting the min, max value and so on.
We can unpack values from a tuple
Use a tuple instead of a list when you need a constant set of values and all you need to do with it is iterating through it.
Why should you take this course?
400+ Unique Lectures
35+ Hours of Video Content
Low Price but Splendid Course
Hundreds of Code Chunks
Unseen, Unique Examples
Regular Updates
Full Money Back Guarantee
24/7 Message Support
If you find better course than this then message us and get this course 100% free! But it is a challenge for you that you can't find such a unique course at this price on any forum or site on the internet. So, watch the “Free Preview video lectures” for better understanding of the course material and get enrolled.
Indeed, Udemy is flooded with python courses, but this course covers the gaps that are left by others. The main focus of this course is that it covers every minor and major topic in the python language.
There is full 30 day money-back guarantee if you for some reason don’t want to continue with this course but this is never going to happen that you will leave as this is the well structured course and will engage you till you get your course completion certificate.
Python 4 you course includes tons of examples for Python programming. This is one of the most popular courses on Python programming on Udemy. You can build the skills that are required to get best programming job or get senior software developer position.
What would be the outcome after attending this course?
Whether you are a High School student learning the basics of Python or a Machine Learning enthusiast or a Data Analyst or a Programmer using python frameworks like DJango, Flask, CherryPy, PyCharm, this course will help you in mastering the art of Python. At the end of the course you’ll be able to apply for Python programming positions as well as move on to specific areas of Python, such as machine learning and artificial intelligence.
Get familiar with the Python
Learn to install Python
Learn the use of variables & know keywords and illegal variable names
Get basic knowledge of Python expressions
Work with input and output functions in Python
Get informed how to use operands
Use the different types of operators such as Identity, Membership, Logical, etc.
Execute your first python code
Learn data types such Int, Float, Complex
Work on Sets and dictionaries
Know advanced features of sequence types such as Strings, Lists, and Tuples
Understand the use of conditional statements such as If, If Else and Elif ladder
Define loop constructs such as While and For loop
Learn to create Range, and general python Functions
Pass Command line arguments to functions
Create and use Lambdas
Get know how to create Decorators, Iterators, and Generators
Learn Object Oriented Programming
Implement classes and know to create objects
Apply inheritance, polymorphism and encapsulation
Learn to cope up with Errors and Exceptions
Read and Write files
Deal with date and time with the help of date time module
Learn Python to be able to create your own Python apps quickly
Get started with Machine Learning, Data Science with solid foundation in Python programming.
Apply your Python knowledge
Who this course is for:
This course is aimed at complete beginners who have never programmed before. This course is best for you if you have limited programming experience and starting from zero programming skill as you will learn enough to write applications. It will also help expert developers to increase their knowledge. So this Udemy Course is suitable for anyone who wants to learn python from the beginning. This course is for:
Beginners who are getting started with Python
Intermediate level Developers who want to learn python readily
Experienced programmers who want to fill in knowledge gaps
Does the course get updated?
Usually, most of courses on Udemy don’t get updated after release. But this course will continuously update.
What exactly you are going to learn?
Guido Van Rossum developed python and the promise of pythonanywhere is fulfilled well. We can automate the boring stuff with python such as automating emails and can do other things.
Python programming language is widely being used for finance, data analysis, data science, and deep learning. Indeed, this programming language is for everybody. With the help of this you can learn data science from scratch. People on the internet search best way to learn python or try to find best book to learn python but I assure you that this video tutorial is going to help you a lot.
You will learn in this video tutorial:
Variables Section:
In the variables section, you will learn the basic introduction to variables. You would be able to check if a keyword is a variable including complete list of keywords used in python. Illegal variable names, reserved words, object referencing, and information related to multiple words variable names is also included. We will swap two numbers with temp variable and without any third variable. In the end, you will know the complete summary and the meaning of lifetime of a variable.
Operators Section:
In Operators section, you will learn about basic tokens, operator symbols, expressions, and associativity of operators in python. Use of logical, identity, and membership operators along with assignment, relational, and comparison operators is also explained in this part of course. You will get light on arithmetic operations on operands too.
Data Types Sections:
This section includes many sections such as Integer section, float, complex,… and every section has multiple video lectures to elaborate the concept of data types used in python.
You will get familiar with integers, exponential numbers, integer operations, and use of scientific notation plus decimal numbers. In float part, get knowledge on floating point operations, python fractions, and float arithmetic. Also know how to create complex numbers with complex function and use of complex operations. Logic behind the complex numbers is also explained perfectly.
Strings section comprises the creation, concatenation, modification, and updating of string. Methods used to update and delete from strings is the key feature of this section. We will split a string using different slicing methods. You will get to know the indexing with positive and negative numbers. Use of steps in string slicing is also a part of this tutorial. You would be able to add, concatenate two strings and we will also check their similarity. We will work on finding a character from ascii number, and also convert any letter to ASCII number.
Learn to create, access, slice, delete, and reassign tuples. Tuple functions, operations, and methods is also the part of this section.
Sets also have a vital role in the data types used in python. Set iteration, methods, functions, and intersection of set is explained there.
Lists section includes the specifications of lists in python. How to create a list? Slicing lists with negative numbers, use of steps, and indexing is also included. How to add list items? Delete from and remove list items is also part of this section. Reverse ordering, case insensitivity, reassigning, and iterating lists in python are the key features of this part of tutorial. Find the largest and smallest item using built-in-functions.
Dictionaries are such types that have key value pairs that contain data. You can remove an element from dictionary. Python dictionary comprehensions explain creation of dict. Aliasing, copying, use of dictionaries in pythons is also mentioned in this module. You can learn how to unpack elements from it.
Data type conversion:
Data type conversion has two types: implicit conversion and explicit conversion. Learn about type casting. Binary, octal, hexadecimal conversion is also elaborated. Check type equality and convert decimal to binary.
Conditional statements:
Conditional statements comprise If Else Elif statements. Conditional statements are unary or binary selections. You will learn truthy and falsy statements along with multiple statements. We will also perform multiple tests with the use of conditions and logical operations such as AND, OR, NOT. Programs to calculate leap year, factorial, prime number, and even odd are also explained. In switch case, get introduction to switches using a class and a dictionary.
Loops:
This section covers for and while loops in python. Python 4 you video course will introduce you to the creation of these loop structures. You can learn to use break, continue, and pass statement in loops. Know about iteration and sorting with for loop and while loop. Also learn the difference between for and while loops.
Collections:
Counters:
This module contains Collections.UserList, and Collections. UserString. Counters creation, use, accessing, and updating is the key feature of this portion. Updating counter and reassigning counts is nicely exemplified. Get most common values and understand the use of elements() while counting. You can also append counters along with arithmetic.
Ordered Dict:
How ordered dictionaries are different from regular dictionaries? How to create Ordered Dict? Know the use of move_to_end, popitem method in OrderedDict.
Default Dictionary:
Get familiar with default factory function, __missing__() method, and benefits of Default Dict. How to use list and int as default factory? Get complete information on the creation and use of default dictionaries.
Named Tuples:
Are you familiar with named tuples? If not, then no need to worry as this section will highlight the creation, use, benefits, and working of named tuples. You will be introduced to access and conversion operations on NamedTuples. _fields and _field methods are also in this section of python tutorial.
ChainMap:
If you want to encapsulate multiple dictionaries in one unit, then use chainmap. New_child and reversed methods are also used in chainmaps and you will get to know how to use these in chain maps.
Deque:
You can add or delete elements from both ends in a deque. This section explains how to reverse and rotate a deque. How to use extend, extendleft, and rotate methods.
Functions:
How to apply built in functions? What are lamdas, range, and recursion. How to create functions? Learn all about function there. IPO notation, and composition of functions is also elaborated. Watch the creation of function with keyword arguments, default, and arbitrary arguments. Higher order functions such as map, reduce, filter, and sorted in python are also part of this section.
Classes & Objects:
Define a class and create an object. Understand the concepts of init function, self parameter, public, private, and protected class.
Iterators:
What is an iterator? How to loop through an iterator using iter ( ) and next( ) methods? What is the relationship between generators and iterators? Get the answers to all these questions.
Decorators:
How to decorate your code with the help of pie syntax and chaining decorators? Learn about general purpose decorator and reusing decorators.
Differences:
In this section you will know the difference between docstrings and comments; generators vs iterators; list vs tuple vs dictionary; return statement vs print statement; Generators vs normal functions, and much more.
Docstrings:
They are used to document a program code. Get understanding of docstrings for functions, classes, and python module.
Modules:
Math Module: Learn basic methods that are used in the math module. Also learn to import modules.
More Lectures will be added! Stay tuned!
What if you have questions?
You will get full support even after the enrollment in to this course. All your questions will be answered on first priority basis. Because I am here to just serve you.
Are you ready?
Enrol now using the “Add to Cart” button on the right. There is a 100% refund for you in case of any inconvenience.