Here is the youtube link to mastery 22: https:/
there a different types of loops and they can be used depending in the situation you are facing.
Here is the youtube link to mastery 22: https:/
there a different types of loops and they can be used depending in the situation you are facing.
Comments Off on #mastery22 https://www.youtube.com/watch?v=ZNS3kFD0mTI
Posted in Blogs, Syndicated, TC1017 Blogs
Tagged #mastery22
Existen tres tipos de loops que puedes utilizar.
For, se usa cuando hay un numero predeterminado de veces que se repetira el Loop.
While, su usa cuando no sabes cuantas veces el loop correra, y no sabes cual sera el resultado.
Recurtition, es cuando nesecitar llamar una funcion dentro de la funcion.
Comments Off on When to use what type of repetition in a program
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #mastery22, #TC1014
Mastery22
while
while (expression):
statement
Comments Off on Learn To Program 2015-04-30 15:24:00
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #LearnToProgram, #mastery22, #TC1014
Mastery22
while
while (expression):
statement
Comments Off on Learn To Program 2015-04-30 15:24:00
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #LearnToProgram, #mastery22, #TC1014
Mastery22
while
while (expression):
statement
Comments Off on Learn To Program 2015-04-30 15:24:00
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #LearnToProgram, #mastery22, #TC1014
The for statement iterates through a collection or iterable object or generator function.
The while statement simply loops until a condition is False.
It isn’t preference. It’s a question of what your data structures are.
Often, we represent the values we want to process as a range
(an actual list), or xrange
(which generates the values). This gives us a data structure tailor-made for the for statement.
Generally, however, we have a ready-made collection: a set, tuple, list, map or even a string is already an iterable collection, so we simply use a for loop.
In a few cases, we might want some functional-programming processing done for us, in which case we can apply that transformation as part of iteration. The sorted
and enumerate
functions apply a transformation on an iterable that fits naturally with the for statement.
If you don’t have a tidy data structure to iterate through, or you don’t have a generator function that drives your processing, you must use while.
Comments Off on When to use what type of repetition in a program
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #222222, #66757f, #8cbf99, #eeeeee, #mastery22, #TC1014
In program i think it’s better to make iterative solutions, i’ll show you why:
Recursive solution:
The difference is that when using a recursion it takes alot of time to print as you can see in the picture, iterative solution printed the answer when recursive solution is still calculating the fibonacci of 100.
It is also convenient to use recursion because an infinite loop occurs with iteration if the loop test never becomes false.
The difference is that iteration ends terminates when the loop condition falls whereas recursion terminates when a base case is recognized.
Here are some of the differences of both: http:/
Gilberto Rogel García
Comments Off on #mastery22 When to use what type of repetition in a program
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #mastery22, #TC1014
When programing, the use of repetition is very usfull, it makes a program shorter, and more efficient.
But there are many types of repetition in Python, witch one should I use?
Here is a qwick guide with my recomendations.
WHILE:
While loops are used when there is a factor that whill be changin ‘n’ times and you want to stop when said factor changes, also if the user is in control of the loop, if the factor is proned to change you use a while loop. (Learn More about While loops).
examples:
x=0
while (x==0):
print(“Hi”)
x=int(input(“stop?, 0=no 1=yes”)
FOR:
For loops are used when you want your process to loop for the amount of time inside a range, When the amount of times it will loop is already pre-determined, either by the user or the programmer, you use a For loop.(Learn more about For loops).
1 example.
RECURSION:
Recursion is used when a function will repeat inside itself, func-ception, it will till a certian answer is reached, this one is tricky because you need to build the fuction with recursion in mind.
My most recent WSQs have been using recursion, so why dont you check that out?.
Comments Off on #Mastery22 What type of repetition should I use?
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #mastery22, #TC1014, ken'sCourse, masteries
When programing, the use of repetition is very usfull, it makes a program shorter, and more efficient.
But there are many types of repetition in Python, witch one should I use?
Here is a qwick guide with my recomendations.
WHILE:
While loops are used when there is a factor that whill be changin ‘n’ times and you want to stop when said factor changes, also if the user is in control of the loop, if the factor is proned to change you use a while loop. (Learn More about While loops).
examples:
x=0
while (x==0):
print(“Hi”)
x=int(input(“stop?, 0=no 1=yes”)
FOR:
For loops are used when you want your process to loop for the amount of time inside a range, When the amount of times it will loop is already pre-determined, either by the user or the programmer, you use a For loop.(Learn more about For loops).
1 example.
RECURSION:
Recursion is used when a function will repeat inside itself, func-ception, it will till a certian answer is reached, this one is tricky because you need to build the fuction with recursion in mind.
My most recent WSQs have been using recursion, so why dont you check that out?.
Comments Off on #Mastery22 What type of repetition should I use?
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #mastery22, #TC1014, ken'sCourse, masteries