#15 For loop in Python || Python Tutorial for Beginner

Code For Kids · Beginner ·🛠️ AI Tools & Apps ·3y ago

Key Takeaways

Explains for loops in Python with syntax and basics for beginners

Full Transcript

hello everyone welcome back to my channel code for kids so today we will learn about for loop in python okay before that i want to inform you one thing one good news in our channel uh i started machine learning project for the kids even you can access that playlist also like uh here we need to first you have to go to our channel like uh code for kids okay this is our channel over here if you will go to the channel playlist you will get our new playlist which is machine learning so you can access this one is okay so let's start our python for loops so first thing we have to search our google collab for python we need to access that and here we have to just click on create new notebook okay so what will happen in that notebook we can do our project click on new notebook so first thing i will explain you what is python for low okay so see first thing why we are using the low so if you want to access anything see we have list we have tuple we have dictionary we have set we have strings so if you want to access all these data so we have one method which is for loop so with the help of our for loop we can iterate all this thing and we can access the data so we can say a for loop is used for iterating over a sequence the sequence can be your list or it can be the tuple or dictionary or dictionary or set or anything okay so now we will see the next part so we can say the for loop is just a keyword like in any other programming language and it work more like an iterator method we can see okay and this is this follow we are using in our object oriented programming language okay so now we will receive an example suppose we have one variable which is animal here we have some values like first see i like dog so i will write dog then we have cat and we have one more animal which is like you can write your favorite animal name i want to write elephant okay after that if you want to access this item what we can do in the for low we can take one variable name suppose for x in you have to write in keyword and what is our variable name here we have animal right you need to take your colon now you can just print x okay so by using your print method we can print anything so here you need to write your variable name now what will happen if i will run this project so you can just stop this video in the comment section write your output okay so what output you will get here you will get dog cat elephants whatever value we declare here you will get the same value okay now we will see the next part suppose if you want to use the break statement here okay what we have to do so i'm little bit lazy so i will copy this code you can take a plus sign here so you will get one more section here in a same program i want to add one condition if x is equal to equal to if i have here talk so what will happen i want to break this okay now if you will run so what output you will get here so here we have to just take one space because so here see if x is equal to equal to dot we need to break means it will not print your further value but if i will write cat here so what will happen it will print your dog and cat as well after the cat whatever we have here it will eliminate that value so this is called as break statement okay so we can say with the help of our break statement we can stop the loop before it has looped through all the items okay so that's why we are using the break statement now we can see the next one which is our continue statement so again i will take one plus code section here and you can use our same example like a in the animal variable we have some values so now we have to add one condition if x equals to equals to the cat so i want to continue if x is equal to equal to cat so i want to continue here so you have to use your continue keyboard and then i want to print my x print and you need to print your value suppose i want to print the x so what will happen now yes suppose i don't want to print here this value and if x equals to equals to cat okay i want to continue first and then we want to print the value okay so now we will see what output you will get here see what you will get here if x equals to equals to cat we need to continue this now here we have to pay so what will happen it will in eliminate this value like your cat value now you will get dog and elephant okay now what will happen if i will write dog here instead of cat if i will write dog and if you will run this so you will get cat and elephant because we have to continue this okay now after that we can use our range function okay so why we are using the range suppose if you want to print anything in a sequence so we can say the range function written as a sequence of number like a starting from by default we have a zero value and it will increment by one by default and whatever number you will specify here that is your last number suppose i want to just write for x in range so range is our inbuilt function here i want to pass the value 6 okay now you need to just print this x so print x now see what will happen what output you will get here run this project you will get see it will start from 0 till 5 because we have a range like a 0 to 6 so in this way we can use our for loop even we can use our else part here suppose if for x in range 6 we need to print x else i want to print we can write any statement like i want to print finished so we can write finished now if i will run this program you will get first your wrench in a spot you will get a finished so in this way we can use our for loop okay so please like share and subscribe our channel and press the bell icon if you want more latest update so thank you so much have a great day bye

Original Description

Introduction to For Loops in Python For loop in Python || Python Tutorial for Beginner Python support basically two types of looping. 1. While loop 2. For loop We have done a lots of practice using while loop. Now we will focus on For loop. For loop in Python has a lots of variant. In this video, we will learn about different syntax of for loop and its basics. For loop is basically used to shorten the code. Query Solved : while loop in python for loop in python range for loop in python array for loop in python with index for loop in python are work on for loop in python is mcq nested for loop in python for loop example
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Code For Kids · Code For Kids · 54 of 60

1 #Scratch Tutorial 1 | How to create your own Scratch account #codeforkids #scratch #Game Development
#Scratch Tutorial 1 | How to create your own Scratch account #codeforkids #scratch #Game Development
Code For Kids
2 #Scratch Tutorial 2 ||How to enable Share Button option in Scratch #codeforkids #scratch #game
#Scratch Tutorial 2 ||How to enable Share Button option in Scratch #codeforkids #scratch #game
Code For Kids
3 Fish Moving inside an Ocean 🌊🌊 #codeforkids #scratch 🥰
Fish Moving inside an Ocean 🌊🌊 #codeforkids #scratch 🥰
Code For Kids
4 Scratch Programming | Fish Aquarium game | #codeforkids #scratch #game
Scratch Programming | Fish Aquarium game | #codeforkids #scratch #game
Code For Kids
5 Draw the circle in scratch#codeforkids #scratch #game
Draw the circle in scratch#codeforkids #scratch #game
Code For Kids
6 Draw Circles in Scratch || How do you draw shapes on Scratch? #codeforkids #scratch #game #coding
Draw Circles in Scratch || How do you draw shapes on Scratch? #codeforkids #scratch #game #coding
Code For Kids
7 How to Make a Dino Jump Game in Scratch | Tutorial #codeforkids #scratch #game
How to Make a Dino Jump Game in Scratch | Tutorial #codeforkids #scratch #game
Code For Kids
8 Scratch Tutorial || How to Make a Catch Game in Scratch.|| Scratch Tutorial for absolute beginer
Scratch Tutorial || How to Make a Catch Game in Scratch.|| Scratch Tutorial for absolute beginer
Code For Kids
9 Scratch Tutorial || Day 1
Scratch Tutorial || Day 1
Code For Kids
10 Scratch Tutorial || Day 2  (DJ System , Dance and Story writing)
Scratch Tutorial || Day 2 (DJ System , Dance and Story writing)
Code For Kids
11 How to Make A Maze Game in Scratch 3.0 | Scratch 3.0 Tutorial |Scratch Tutorial for begineer
How to Make A Maze Game in Scratch 3.0 | Scratch 3.0 Tutorial |Scratch Tutorial for begineer
Code For Kids
12 Scratch Tutorial || Day 3
Scratch Tutorial || Day 3
Code For Kids
13 Scratch Tutorial || Day 4
Scratch Tutorial || Day 4
Code For Kids
14 Scratch Tutorial | Cat And Mouse Game | Scratch Tutorial for  Beginner
Scratch Tutorial | Cat And Mouse Game | Scratch Tutorial for Beginner
Code For Kids
15 Scratch Tutorial || Day 5
Scratch Tutorial || Day 5
Code For Kids
16 how to make dress up game on scratch || Scratch Tutorial for Beginner
how to make dress up game on scratch || Scratch Tutorial for Beginner
Code For Kids
17 How to Make a Pong Game in Scratch || Scratch Tutorial for Beginner
How to Make a Pong Game in Scratch || Scratch Tutorial for Beginner
Code For Kids
18 Scratch Tutorial || Day 6(part 1)
Scratch Tutorial || Day 6(part 1)
Code For Kids
19 Scratch Tutorial || Day 6( Part 2)
Scratch Tutorial || Day 6( Part 2)
Code For Kids
20 Scratch Tutorial || Day 7
Scratch Tutorial || Day 7
Code For Kids
21 Scratch Tutorial || Day 8
Scratch Tutorial || Day 8
Code For Kids
22 How to Make Piano Game || Learn to Use Music Extension || Scratch Tutorial || Day 8
How to Make Piano Game || Learn to Use Music Extension || Scratch Tutorial || Day 8
Code For Kids
23 How to Make Piano Game || Learn to Use Music Extension ||Scratch Tutorial for beginner
How to Make Piano Game || Learn to Use Music Extension ||Scratch Tutorial for beginner
Code For Kids
24 Scratch Tutorial || Day 9
Scratch Tutorial || Day 9
Code For Kids
25 Scratch Tutorial || Draw Shapes #shorts #codeforkids #youtubeshorts
Scratch Tutorial || Draw Shapes #shorts #codeforkids #youtubeshorts
Code For Kids
26 Scratch Tutorial |How to Draw Shapes in Scratch #scratch #scratchtutorials #codeforkids
Scratch Tutorial |How to Draw Shapes in Scratch #scratch #scratchtutorials #codeforkids
Code For Kids
27 Day 10|| Scratch Tutorial
Day 10|| Scratch Tutorial
Code For Kids
28 Scratch Tutorial || Archery Tutorial
Scratch Tutorial || Archery Tutorial
Code For Kids
29 #1 || Thunkable  Beginner Tutorial  Platform Overview
#1 || Thunkable Beginner Tutorial Platform Overview
Code For Kids
30 App Development ||Tutorial 2 || how to add button in Thunkable || Thunkable for beginner #codeforkid
App Development ||Tutorial 2 || how to add button in Thunkable || Thunkable for beginner #codeforkid
Code For Kids
31 App Development || Tutorial 3||  Beginner Tip "Change screens with a button click" in Thunkable
App Development || Tutorial 3|| Beginner Tip "Change screens with a button click" in Thunkable
Code For Kids
32 Scratch Tutorial ||
Scratch Tutorial ||
Code For Kids
33 Thunkable Tutorial || Using Camera and Image Recognition components with Thunkable
Thunkable Tutorial || Using Camera and Image Recognition components with Thunkable
Code For Kids
34 Build a Translator App with Thunkable ||Thunkable App Development || Tutorial 5||
Build a Translator App with Thunkable ||Thunkable App Development || Tutorial 5||
Code For Kids
35 Thunkable Beginner Tutorial #6  || Web Viewer|| Redirecting App
Thunkable Beginner Tutorial #6 || Web Viewer|| Redirecting App
Code For Kids
36 #1 World in Python || Python Tutorial || Python Programming || Google Colab
#1 World in Python || Python Tutorial || Python Programming || Google Colab
Code For Kids
37 #2 Python Tutorial for Beginners | User input in Python | Command Line Input | Python Variable
#2 Python Tutorial for Beginners | User input in Python | Command Line Input | Python Variable
Code For Kids
38 #3 Python  Comments | How To Write Comments In Python | Python Tutorial For Beginners |
#3 Python Comments | How To Write Comments In Python | Python Tutorial For Beginners |
Code For Kids
39 #4 Python Tutorial for Beginners | Data Types in Python
#4 Python Tutorial for Beginners | Data Types in Python
Code For Kids
40 #5 Numbers & Typecasting in python | Python Tutorial
#5 Numbers & Typecasting in python | Python Tutorial
Code For Kids
41 #6  Strings Tutorial | How To Use Strings In Python | Python Tutorial | Python Training |
#6 Strings Tutorial | How To Use Strings In Python | Python Tutorial | Python Training |
Code For Kids
42 #7 Slicing And Other Functions In Python | Python Tutorials For Absolute Beginners.
#7 Slicing And Other Functions In Python | Python Tutorials For Absolute Beginners.
Code For Kids
43 #8 Boolean in Python | Python Tutorial for Begniner
#8 Boolean in Python | Python Tutorial for Begniner
Code For Kids
44 #9 Python Tutorial for Beginners | Operators in Python
#9 Python Tutorial for Beginners | Operators in Python
Code For Kids
45 #10  Lists And List Functions | Python Tutorials For Absolute Beginners
#10 Lists And List Functions | Python Tutorials For Absolute Beginners
Code For Kids
46 #11 Tuple in Python | Python Tutorial
#11 Tuple in Python | Python Tutorial
Code For Kids
47 #12  In Python | Python Sets Tutorial | Python Tutorial for Beginners | #python #pythonprogramming
#12 In Python | Python Sets Tutorial | Python Tutorial for Beginners | #python #pythonprogramming
Code For Kids
48 #13 If Elif Else Statement in Python || Python Tutorial for Beginners |
#13 If Elif Else Statement in Python || Python Tutorial for Beginners |
Code For Kids
49 #14  While Loop in Python ||Python Tutorial for Beginners
#14 While Loop in Python ||Python Tutorial for Beginners
Code For Kids
50 Python Tutorial for addition of 2 numbers #shorts #youtubeshorts #codeforkids #pythonprogramming
Python Tutorial for addition of 2 numbers #shorts #youtubeshorts #codeforkids #pythonprogramming
Code For Kids
51 Python Tutorial for absolute Beginner|| While loop #pythonprogramming #shorts #youtubeshorts
Python Tutorial for absolute Beginner|| While loop #pythonprogramming #shorts #youtubeshorts
Code For Kids
52 Machine learning for the kids with Scratch || Machine Learning for kids ||Day 1
Machine learning for the kids with Scratch || Machine Learning for kids ||Day 1
Code For Kids
53 # Tutorial 1 || Machine Learning for kids | Image Classification example | Girl and boy
# Tutorial 1 || Machine Learning for kids | Image Classification example | Girl and boy
Code For Kids
#15 For loop in Python || Python Tutorial for Beginner
#15 For loop in Python || Python Tutorial for Beginner
Code For Kids
55 # Tutorial 2 || Machine Learning for kids | Smart Home Automation | Turn On the Fan
# Tutorial 2 || Machine Learning for kids | Smart Home Automation | Turn On the Fan
Code For Kids
56 #Tutorial 3 || Snapchat Filter in Machine Learning|| Machine Learning for the kids ||
#Tutorial 3 || Snapchat Filter in Machine Learning|| Machine Learning for the kids ||
Code For Kids
57 #Tutorial 4 || Image Identification || Machine Learning for the  kids|| Tiger , Elephant, boy
#Tutorial 4 || Image Identification || Machine Learning for the kids|| Tiger , Elephant, boy
Code For Kids
58 Scratch Tutorial || Apple Catcher Game || Fruit Catcher|| catch game in Scratch
Scratch Tutorial || Apple Catcher Game || Fruit Catcher|| catch game in Scratch
Code For Kids
59 Scratch Tutorial || How to record audio in Scratch || Scratch Tutorial for beginner ||
Scratch Tutorial || How to record audio in Scratch || Scratch Tutorial for beginner ||
Code For Kids
60 Scratch Tutorial || how to translate language in scratch || Scratch tutorial for beginner
Scratch Tutorial || how to translate language in scratch || Scratch tutorial for beginner
Code For Kids

Related Reads

Up next
Scrape ANY Website With AI For Free - Best AI Web Scraper
AI Andy
Watch →