Introduction to Programming Python and C++

Tag Archives: #Mastery17

#Mastery7 and #Mastery17 #TC1017

Link#Mastery07 and #Mastery17 #TC1017

#Mastery17

This is very similar than the last one, but with the difference is that with elif we can evaluate more than 2 conditions For example: I’m using the same example but the elif is included.  

Mastery15 & Mastery16 & Mastery17

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 […]

Mastery #17

Mastery 17: Use of “switch” as a conditional

Here is the video: https://youtu.be/y_x2daj04qo
Thanks for watching !!!

Use of ‘elif’ and ‘else’ Python3

Mastery about how to use elif and else! watch it!

Masteries #17 and #21

Here’s my video of me explaining masteries#17 and #21. Enjoy.

Mastery17

Use of “switch” as a conditional Here is the link to my video:

Mastery 17

Mastery 17

On this mastery I’ll show you what and how to use the conditional switch in C++.

Switch is a statement that tests a variable for equality in a list of given conditions. It is somehow a summarized version of IF when you have a lot of conditions. 

This flow chart may help you understand better, and this webpage too:

The default syntax of switch goes like this:

switch (expression)
case “condition” : outcome
[default:statement]    //This is used when the variable input isn’t a valid option.

So, for the purpose of this mastery, lets create a program were the user can input his points on masteries so far and tell him if his good or screwed. Do as follows:

  1. Create our “basic” program.
  2. Inside the int, declare a char variable with an assigned value.
  3. Use switch to condition the outcome and tell the user if his good or screwed.

Your program should look something like this:

Now let’s test it:

Let’s just play with another value:

Great! Now you know what and how to use switch conditional.

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).