For Loops in Python | Python for Beginners

preview_player
Показать описание

In this series we will be walking through everything you need to know to get started in Python! In this video we learn about For Loops in Python.

Favorite Python Courses:
____________________________________________

SUBSCRIBE!
Do you want to become a Data Analyst? That's what this channel is all about! My goal is to help you learn everything you need in order to start your career or even switch your career into Data Analytics. Be sure to subscribe to not miss out on any content!
____________________________________________

RESOURCES:

Coursera Courses:

Udemy Courses:

*Please note I may earn a small commission for any purchase through these links - Thanks for supporting the channel!*
____________________________________________

SUPPORT MY CHANNEL - PATREON/MERCH

____________________________________________

Websites:
📱Instagram: @Alex_The_Analyst
____________________________________________

0:00 Intro
1:09 Syntax of For Loop
3:03 Variable Name in For Loop
3:28 Looping through a Dictionary
6:21 Nested For Loops
8:45 Outro

*All opinions or statements in this video are my own and do not reflect the opinion of the company I work for or have ever worked for*
Рекомендации по теме
Комментарии
Автор

Looking forward to this. I am a Data Analyst and use the basics of Python/Pandas, but have SO much more to learn

JW-puuk
Автор

I have studied for loop over and over without understanding until today. Thank you so much, Alex, this is so helpful.

erastusmelvin
Автор

Thanks for sharing and glad you chose Jupyter notebook to walk through the for loop tutorial...

casandra_
Автор

With no real experience with Python, as a use case in the Healthcare industry, would you nest for loop a diagnosis and cpt codes commonly associated with the diagnosis then compare what was in { } or not in { }? I guess you could then compare what doctors then usually do what procedures on a diagnosis. BTW, is that something an analyst or scientist be more likely to do! Thanks for breaking this down to the Nub3 level!

rbsorg
Автор

Thanks for your help. I like your videos. I'm wondering what I get if a actually join ....TIA.

chooselife
Автор

I wonder if it has to do with having a newer version of Jupyter, considering how long ago the video was published. I wrote the exact same code on the first example (integers = [1, 2, 3, 4, 5] to follow along, and I got an error message: "name 'integers' is not defined." Any help? By the way, thank you for explaining so well! I love watching your videos.

Update: never mind. I defined 'integers' by adding:
for x in integers:
print(x)

and it worked. I'm leaving this update here in case another novice like me encounters the same issue. ;-) Alex, your videos have been extremely helpful! Thanks!

maddie
Автор

Hi Alex, please what is wrong with this code it seems to be calculating wrongly.
# write a program that asks the user to enter 5 positive integers,
# the program disregards negative values and zeros and makes the user re enter an input if so.
# The program is capable of calculating both sum and product of all the numbers entered .
# after taking the inputs
# it asks the user whether they want to print the sum of the numbers
# or products and then shows the result accordingly

count = 0
sum = 0
product = 1
while count <= 4 :
numbers = int(input("Please enter 5 different inputs: "))
print()
count += 1
if numbers == 0 or numbers < 0 :
print("Please re-enter input")
else:
print("Would you like to multiply of add the total numbers")
choose = input("Choose to multiply or add now: ")
if choose == "add":
for x in range(numbers):
sum = sum + numbers
print(sum)
if choose == "multiply":
for x in range(numbers) :
product = product * numbers
print(product)

JokeJoshua
Автор

hey alex, i just started doing your course the other day and really love it!! i did wanna ask, why did you choose to use jupyter instead of python itself?

potato-sweet
Автор

At timestamp 3:19, for code print(Jelly + Jelly), how come we don't write is print( 'Jelly' + Jelly')? Is Jelly not a string?

danishrushdi
Автор

boring. already a billion python beginner tutorials on the internet.

leschymero