Machine Learning Tutorial Python : 13. Python For Loop

Publicado em: 21 Fevereiro 2019
no canal de: Vinoth QA Academy
1,262
16

#vision2020 #aiforeveryone #python :

"My Vision is to provide "AIFOREVERYONE", by creating free video courses for Artificial Intelligence ,
Machine Learning, Deep Learning and Data Science Aspirants!"

If you wish to support my #vision2020, kindly Like, Subscribe & Share this knowledge to your friends and colleagues.

Follow Me :

Materials: https://aiforevery1.com/numpy/

Udemy : https://www.udemy.com/user/vinoth-rat...

LinkedIn :   / vinothrathinamautomation  

Facebook :   / aiforevery1  

Github : https://github.com/vinothrwins

************************************************************
Playlist:

Artificial Intelligence for Beginners :    • Playlist  

Python for Artificial Intelligence :    • Python for Artificial Intelligence(Data Sc...  

Mathematics for Artificial Intelligence :    • Mathematics for Artificial Intelligence  

Python NumPy for Artificial Intelligence :    • Python NumPy for Artificial Intelligence  

Data Science Process :    • Playlist  

***********************************************************
Agenda :

What is For loop?
For loop with else statement
Looping through String
Range Function
Iterating by Sequence Index
Nested For Loop
12 Sample programs

***************************
Python Loops
***************************

A loop statement allows us to execute a statement or group of statements multiple times.

Python has two primitive loop commands:
• while loops
• for loops

***********
For Loop
***********

The for loop in Python is used to iterate over a sequence (list, tuple, string) or other iterable objects.
Iterating over a sequence is called traversal

***********
Syntax :
***********

for iterating_var in sequence:
statements(s)

The first item in the sequence is assigned to the iterating variable iterating_var.
Next, the statements block is executed. Each item in the list is assigned to iterating_var, and the statement(s) block is executed until the entire sequence is exhausted

********************************
Using else Statement with Loops
********************************

If the else statement is used with a for loop, the else statement is executed when the loop has exhausted iterating the list

**********************
The range() function
**********************

We can generate a sequence of numbers using range() function.
We can also define the start, stop and step size as range(start,stop,step size). step size defaults to 1 if not provided.
This function does not store all the values in memory, it would be inefficient. So it remembers the start, stop, step size and generates the next number on the go.

****************************
Iterating by Sequence Index
****************************

An alternative way of iterating through each item is by index offset into the sequence itself.

****************
Nested For Loop
****************

Python programming language allows to use one for loop inside another for loop

************************************************************
Kindly let me know your feedback for improvement purpose. Feel free to correct any mistakes in case !!

Happy Learning,
Vinoth Rathinam


Nesta página do site você pode assistir ao vídeo on-line Machine Learning Tutorial Python : 13. Python For Loop duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Vinoth QA Academy 21 Fevereiro 2019, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,262 vezes e gostou 16 espectadores. Boa visualização!