Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/feed-rss2.php on line 8
‘#Mastery15’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 26 Nov 2015 05:09:28 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ #Mastery15 #Mastery16 y #Mastery18 #TC1017 https://kenscourses.com/tc101fall2015/2015/mastery15-mastery16-y-mastery18-tc1017/ Thu, 26 Nov 2015 05:09:28 +0000 https://eduardotorresb.withknown.com/2015/mastery15-mastery16-y-mastery18

Link

y

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery15 & Mastery16 & Mastery17 https://kenscourses.com/tc101fall2015/2015/mastery15-mastery16-mastery17/ Thu, 26 Nov 2015 01:22:14 +0000 http://5nbppkkyj.wordpress.com/?p=184 ]]> Conditionals are generally a way to check something. The classic “if” example is easy to understand. The syntax helps you understand it a bit. A normal if statement would look like this:

if(condition):

do something
Let’s see an example with food because I’m hungry. My code will basically ask if the food is ready by having the user input dictate its state of readiness (that explains the variable name) and then my conditional if checks the data to perform an action, it prints “yay” if the food is ready. But the operator = helps me know if the user input is right. We can evaluate other values by using other operators such as < > to compare values.
readiness = input(“Is the food ready? “)

if(readiness == “yes”):

print(“yay”)
We can also combine two conditionals in an if statement by using the Boolean operation and. I added a new value which is my food temperature so my conditional are always met and my if statement will work.
readiness = input(“Is the food ready? “)

temperature = input(“Is the food hot? “)

if(readiness == “yes”) and (temperature == “yes”):

print(“yay”)
The same can be done with the operation or. What or does is it basically combines two conditionals and the action will be executed if either conditions are met. So in this case it doesn’t matter if our readiness or temperature are not hot or ready if one of them is true our action will be executed.
readiness = input(“Is the food ready? “)

temperature = input(“Is the food hot? “)

if(readiness == “yes”) or (temperature == “yes”):

print(“yay”)
So my values were checked and my program acted accordingly. But what if the value is not what I asked for? There is an operator called else that solves this problem. In this case, else doesn’t have to include a condition because we don’t care about anything else, we just want to have our food right? All I have to do is write else below my if statement without an indentation and tell my else what to do.
readiness = input(“Is the food ready? “)

if(readiness == “yes”):

print(“yay”)

else:

print(“hurry up, I’m hungry”)
There is another conditional that is a mixture of else and if and it must be typed between your if and else. It is called elif. It basically sets up another conditional so it is a lot more like it but it is still like else.
readiness = input(“Is the food ready? “)

if(readiness == “yes”):

print(“yay”)

elif(readiness == “yep”):

print(“yay”)

else:

print(“hurry up, I’m hungry”)

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 15 y 16 https://kenscourses.com/tc101fall2015/2015/mastery-15-y-16-4/ Wed, 25 Nov 2015 22:45:07 +0000 http://estebanpg.wordpress.com/?p=77

]]>
https://creativecommons.org/licenses/by/4.0/
Use of the conditional “if” and Use of “else” with a conditional https://kenscourses.com/tc101fall2015/2015/use-of-the-conditional-if-and-use-of-else-with-a-conditional-3/ Wed, 25 Nov 2015 18:42:02 +0000 http://juanmele.wordpress.com/?p=127 Here is the link and video to youtube to see this Mastery

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 15 and 16 https://kenscourses.com/tc101fall2015/2015/mastery-15-and-16/ Wed, 25 Nov 2015 09:14:34 +0000 http://ivancortes96.wordpress.com/?p=112 ]]>
  • Use of the conditional “if”
  • Use of “else” with a conditional
  • Here is the link to my video:

    ]]>
    https://creativecommons.org/licenses/by/4.0/
    Masteries 15 & 16 https://kenscourses.com/tc101fall2015/2015/masteries-15-16-7/ Mon, 23 Nov 2015 14:32:44 +0000 http://hrglez.wordpress.com/?p=295 ]]>

    Use of the conditional “if”

    Use of “else” with a conditional

    ]]>
    https://creativecommons.org/licenses/by/4.0/
    Mastery 15 y 16 https://kenscourses.com/tc101fall2015/2015/mastery-15-y-16-2/ Fri, 30 Oct 2015 23:53:25 +0000 http://fernyalanis.wordpress.com/?p=67

    ]]>
    https://creativecommons.org/licenses/by/4.0/
    Mastery 15 & 16 https://kenscourses.com/tc101fall2015/2015/mastery-15-16-2/ Thu, 29 Oct 2015 03:31:05 +0000 http://choza973.wordpress.com/?p=88 If and Else, really simple code, simple explanation.

    ]]>
    https://creativecommons.org/licenses/by/4.0/
    Use of IF and ELSE in C++ https://kenscourses.com/tc101fall2015/2015/use-of-if-and-else-in-c/ Thu, 29 Oct 2015 03:14:51 +0000 http://myfreakingcrazythoughts.wordpress.com/?p=152 Continue Reading →]]> IF.

    As you might know, an if statement is the one that allows the user to control if a program enters a section of code or not based on whether a given condition is true or false. One of the important functions of the if statement is that it allows the program to select an action based upon the user’s input.

    Without a conditional statement such as the if statement, programs would run almost the exact same way every time. If statements allow the flow of the program to be changed, and so they allow algorithms and more interesting code.

    When using an If statement it is important to know that the possible return will always be true or false, according to the parameters that the user gave to the program. This parameters will be declared with operators which are the ones who check if the condition is true or false.

    For example:

    >     Greater than              5 > 4 is TRUE
    
    <     Less than                 4 < 5 is TRUE
    
    >=    greater than or equal     4 >= 4 is TRUE
    
    <=    less than or equal        3 <= 4 is TRUE
    
    ==    Equal to                  5 == 5 is TRUE
    
    !=    not equal to              5! = 4 is TRUE
    

    When a condition is true the result will be 1 and when the condition result to be negative the return will be 0.

     

    Basic structure of an IF statement.

    If (TRUE) {
    
    Execute the next statement}
    

     

    As you can see, the structure is pretty clear. Inside the parenthesis there are the conditions and outside there are the actions that the program will do if the statement is true.

    ELSE.

    This statement works when we want to give an alternative response when our IF condition results to be false. So this statement basically says what we want to do if our first statement isn’t true.

    An ELSE structure will look like this:

    If (TRUE) {
    
      // execute these statements if TRUE
    
    }
    
    Else {
    
      // execute these statements if FALSE
    
    }
    

    ELSE IF.

    But what happen if we want to declare two or more conditions of IF? That is the situation when we use ELSE IF. When we use an “else if” statement following an if statement and its body; that way, if the first statement is true, the “else if” will be ignored, but if the if statement is false, it will then check the condition for the else if statement. If the if statement was true the else statement will not be checked. It is possible to use numerous else if statements to ensure that only one block of code is executed.

    For example:

    If (<condition>) {
    
    // execute these statements if <condition> is TRUE
    
    }
    
    Else if (<another condition>) {
    
    // execute these statements if <another condition> is TRUE and
    
    // <condition> is FALSE
    
    }
    

    Thank’s for the support of cprogramming.com, it really helped me a lot!

    -The admin.

    ]]>
    https://creativecommons.org/licenses/by/4.0/
    Mastery 15 & 16 – Use of the conditional “if” and “else” https://kenscourses.com/tc101fall2015/2015/mastery-15-16-use-of-the-conditional-if-and-else/ Thu, 29 Oct 2015 02:45:57 +0000 http://andreandradec.wordpress.com/?p=205

    ]]>
    https://creativecommons.org/licenses/by/4.0/