Tag Archives: masteries

Nesting of conditional statements #Mastery18 #TC1014

Cómo utilizar condiciones anidadas en python explicado en un video:


Nesting of conditional statements #Mastery18 #TC1014

Submit work via Blog RSS and GitHub #Mastery04 #TC1014

Here the explanation how you can do it:


Submit work via Blog RSS and GitHub #Mastery04 #TC1014

#Mastery21 use of recursion

You use recursion in functions for repetitive algorthms. Basically griting a function inside itself for a sort of loop, making your code smaller and cleaner.

this program is grat example, I have 2 functions and they repeat inside each other, I could have made different functions but they would have recursion in that way. 
#Mastery21 use of recursion

#Mastery21 use of recursion
 my WSQ12 is also a great example of recursion.
in this case the program uses de function gcd to determine the greatest comon divisor, and ans is the gratest common divisor itself, in case that the numbers given by the user are not the same (not x==y), the fuction will call itself but with some changes:

else:
if(x>y):
ans=gcd((xy),y)
else:
ans=gcd(x,(yx))
return ans

other examples of recución are: palindromesstandard deviation

#Mastery21 use of recursion

You use recursion in functions for repetitive algorthms. Basically griting a function inside itself for a sort of loop, making your code smaller and cleaner.

this program is grat example, I have 2 functions and they repeat inside each other, I could have made different functions but they would have recursion in that way. 
#Mastery21 use of recursion

#Mastery21 use of recursion
 my WSQ12 is also a great example of recursion.
in this case the program uses de function gcd to determine the greatest comon divisor, and ans is the gratest common divisor itself, in case that the numbers given by the user are not the same (not x==y), the fuction will call itself but with some changes:

else:
if(x>y):
ans=gcd((xy),y)
else:
ans=gcd(x,(yx))
return ans

other examples of recución are: palindromesstandard deviation

#Mastery21 use of recursion

You use recursion in functions for repetitive algorthms. Basically griting a function inside itself for a sort of loop, making your code smaller and cleaner.

this program is grat example, I have 2 functions and they repeat inside each other, I could have made different functions but they would have recursion in that way. 
#Mastery21 use of recursion

#Mastery21 use of recursion
 my WSQ12 is also a great example of recursion.
in this case the program uses de function gcd to determine the greatest comon divisor, and ans is the gratest common divisor itself, in case that the numbers given by the user are not the same (not x==y), the fuction will call itself but with some changes:

else:
if(x>y):
ans=gcd((xy),y)
else:
ans=gcd(x,(yx))
return ans

other examples of recución are: palindromesstandard deviation

#Mastery09 Basic types.

there are 3 basic tipes in python:

NUMERIC TYPES:

your basic numbers used for math, algebra, and to calculate various values.

The most basic are intergers and floating point numbers.

intergers, used with the function int( ). are numbers with no desimal poin.
and floating point float( ). support decimal point.

and ther is also:

TEXT SEQUENCE TYPES:

witch is srtings. “Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways:”(python.org)

and finally:

SEQUENCE TYPES:

witch is lists, tuples, and ranges. witch are agroup of balues, (it could be a mixture of values for lists and touples). In a group or package used as a single object, with many values inside.

#Mastery09 Basic types.

there are 3 basic tipes in python:

NUMERIC TYPES:

your basic numbers used for math, algebra, and to calculate various values.

The most basic are intergers and floating point numbers.

intergers, used with the function int( ). are numbers with no desimal poin.
and floating point float( ). support decimal point.

and ther is also:

TEXT SEQUENCE TYPES:

witch is srtings. “Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways:”(python.org)

and finally:

SEQUENCE TYPES:

witch is lists, tuples, and ranges. witch are agroup of balues, (it could be a mixture of values for lists and touples). In a group or package used as a single object, with many values inside.

#Mastery09 Basic types.

there are 3 basic tipes in python:

NUMERIC TYPES:

your basic numbers used for math, algebra, and to calculate various values.

The most basic are intergers and floating point numbers.

intergers, used with the function int( ). are numbers with no desimal poin.
and floating point float( ). support decimal point.

and ther is also:

TEXT SEQUENCE TYPES:

witch is srtings. “Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways:”(python.org)

and finally:

SEQUENCE TYPES:

witch is lists, tuples, and ranges. witch are agroup of balues, (it could be a mixture of values for lists and touples). In a group or package used as a single object, with many values inside.

#Mastery22 What type of repetition should I use?

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:

#Mastery22 What type of repetition should I use?x=0
while (x==0):
     print(“Hi”)
     x=int(input(“stop?, 0=no 1=yes”)

Another example.

FOR:

#Mastery22 What type of repetition should I use?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?.

#Mastery22 What type of repetition should I use?


#Mastery22 What type of repetition should I use?

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:

#Mastery22 What type of repetition should I use?x=0
while (x==0):
     print(“Hi”)
     x=int(input(“stop?, 0=no 1=yes”)

Another example.

FOR:

#Mastery22 What type of repetition should I use?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?.

#Mastery22 What type of repetition should I use?