Monthly Archives: March 2015

Mastery 18

Nesting of conditional statements

Link to my Video:
https://www.youtube.com/watch?v=tjPAbJV45RM

Mastery 11

Calling Python functions

Link to my Video:

https://www.youtube.com/watch?v=dlPNxxEVI8Y

Mastery 11

Calling Python functions

Link to my Video:

https://www.youtube.com/watch?v=dlPNxxEVI8Y

Mastery 12

Creating Python functions

link to my video: 

https://www.youtube.com/watch?v=YiYudXpQSng


Mastery 12

Creating Python functions

link to my video: 

https://www.youtube.com/watch?v=YiYudXpQSng


Mastery 12

Creating Python functions

link to my video: 

https://www.youtube.com/watch?v=YiYudXpQSng


WSQ13. Babylonian method

For this wsq I had to create a program that asks the user for a floating point or integer number and returns the square root of the number.

The challenge of the program was to perform this task without using the mathematic function for the square root, so, using a bunch of loops we could first give an approximation of the square root of the number, then, getting the average between the approximation and the number divided by the approximation, we get a new aproximation, and we keep doing the same proccess until the new approximation is equal to the last one. There is when we have found our square root of the number provided.

Here is the code for my program: https://github.com/Manuelmv94/TC1014/blob/master/wsq13.py

# TC1017 #WSQ10 – Lists

Mastery17 – Conditional elif

the elif conditional es a combination of the else and if conditionals, it needs a to fulfill a conition like the if conditional but it will be ignored if the condition above is fulfilled like an else conditional.

if we had this conditionals:

if x != 0:

   print(“it’s not a 0”)

if x > 0:

   print(“more than 0”)

if x < 100:

   print(“less than 100”)

and we used 50 as x, the program will print everything since 50 meets each condition but if we change any of the if conditionals after the first to elif the program would ignore them since the first will be true. elif is to stick two statements as one.

Mastery16 – Conditional else

the else conditional goes after an if conditional, when none of the conditionals above is fulfilled then the else conditon is used. for example:

x = 5

if x < 5:

if x > 5:

else:

    print (“it’s a 5”)

the rpogram wil ignore the other conditionals since 5 is not lower or higher than 5 and will use the else.