You are viewing our Forum Archives. To view or take place in current topics click here.
What is an iteration?
Posted:
What is an iteration?Posted:
Status: Offline
Joined: Feb 14, 201212Year Member
Posts: 623
Reputation Power: 29
I have been trying to get into programming for awhile but can't seem to get my head around it, could someone please explain what iteration means?
If any helps i'm using Python.
If any helps i'm using Python.
#2. Posted:
Status: Offline
Joined: Feb 04, 20159Year Member
Posts: 338
Reputation Power: 21
Status: Offline
Joined: Feb 04, 20159Year Member
Posts: 338
Reputation Power: 21
#3. Posted:
Status: Offline
Joined: Jun 18, 201212Year Member
Posts: 775
Reputation Power: 31
Status: Offline
Joined: Jun 18, 201212Year Member
Posts: 775
Reputation Power: 31
Brap wrote I have been trying to get into programming for awhile but can't seem to get my head around it, could someone please explain what iteration means?
If any helps i'm using Python.
Pretty much just means a loop.
In programming your main loops are For loops, do while loops, and do until. The wording/syntax will be slightly different with each language but [ Register or Signin to view external links. ] is some info on loops in python.
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Feb 04, 20159Year Member
Posts: 338
Reputation Power: 21
Status: Offline
Joined: Feb 04, 20159Year Member
Posts: 338
Reputation Power: 21
joeisjoe5 wroteBrap wrote I have been trying to get into programming for awhile but can't seem to get my head around it, could someone please explain what iteration means?
If any helps i'm using Python.
Pretty much just means a loop.
In programming your main loops are For loops, do while loops, and do until. The wording/syntax will be slightly different with each language but [ Register or Signin to view external links. ] is some info on loops in python.
Just in case he doesn't know what a loop is... It means something that repeats. So if you wanted something to run on a timer, it would loop until the timer is stopped.
- 0useful
- 0not useful
#5. Posted:
Status: Offline
Joined: May 18, 201113Year Member
Posts: 16,419
Reputation Power: 24471
Status: Offline
Joined: May 18, 201113Year Member
Posts: 16,419
Reputation Power: 24471
Some examples with Python:
"i" is the iterating variable or iterator for the for loop. When used with a string, the loop will iterate through the string one character at a time. For each iteration, the contents of the loop will be executed with the iterating variable "i". This will print each character of the string to a line.
Loop without an iterator. The number of iterations depends on the condition set for the loop.
shittyString = "Use meaningful names for variables. Variable name must define the exact explanation of its content."
for i in shittyString:
print(i)
"i" is the iterating variable or iterator for the for loop. When used with a string, the loop will iterate through the string one character at a time. For each iteration, the contents of the loop will be executed with the iterating variable "i". This will print each character of the string to a line.
shittyInt = 10
while shittyInt > 0:
shittyInt -= 1
# Code here is iterated until the condition for the while loop is met
Loop without an iterator. The number of iterations depends on the condition set for the loop.
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.