Jump to content

For loop in Python

Go to solution Solved by Slottr,

It means for every item in cmds it will perform that print statement 

 

So for example, heres another for loop:

x = [a,b,c,d]

for i in x:
	print(i)
    
    
#output#

a
b
c
d

 

It means for every item in cmds it will perform that print statement 

 

So for example, heres another for loop:

x = [a,b,c,d]

for i in x:
	print(i)
    
    
#output#

a
b
c
d

 

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 9600X || GPU: RX 9070 XT|| Memory: 32GB || Cooler: Peerless Assassin || PSU: RM850e|| Case: Lian Li A3

Link to comment
https://linustechtips.com/topic/1048933-for-loop-in-python/#findComment-12431720
Share on other sites

Link to post
Share on other sites

On 3/27/2019 at 2:41 PM, Yoo Song Won said:

Thanks a lot!! Appreciate it!

Realized I made a small goof in the print statement, should be:

print(i)

#not

print(x[i])

 

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 9600X || GPU: RX 9070 XT|| Memory: 32GB || Cooler: Peerless Assassin || PSU: RM850e|| Case: Lian Li A3

Link to comment
https://linustechtips.com/topic/1048933-for-loop-in-python/#findComment-12431764
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×