Is with a great honor that I present the newest course in this blog. Now we’ll study the Python programming language. With this course, you’ll have new horizons and possibilities, so share this newest with your friends and follow us by e-mail for reserves the newest. Subscribe us if you desire. So, see you later to study python language.
As promised in the previous class, I present to you this lesson about variables. First we need to answer some questions. First, what’s a variable? The answer is: a variable is a space inside a memory, it save data and in programming languages, it also works for change the data inside it. Python is an high-level language, an high-level language is nearer of programmer, or human language like English for example. Python is simple! See below the variable declaration in languages like C, C++ or Java: This is the variable declaration structure, but in Python, we don’t need of this structure. So, declare the type isn’t required, but we need to initializer the variable. Below, see the variable declaration structure in Python: That’s enough, here we have the variable declaration in Python language. This structure is: variable_name = a_value, it can be a string too, or just a character. Test it in your interpreter, joyful! If you want to use other...
Switch is other way to selections commands, it test a variable integer or character, (it cans not use a float or double for example), with cases. See below its structure: Read the image. A switch command is use when we have a finite number of possibilities. In C, we can use switch how many time we desire. Other point is which switch allows breaks in the code. So see below breaks being running. As we can see, the case can use with breaks, since 1 to 7 for example. But it’s limited. Note: in Switch Command, we can’t test conditions as in if-else, so the form case 2<4 is invalid to switch. In case, never forget to put break; it’s the signal to the compiler that what’s inside case, had finished. In default, it’s not required. Now, see an alternative structure to switch command: That works, but it isn’t required. So I prefer use the previous way. Note: Switch and If Else can be interconnected, but be careful with this. I...
Comentários
Postar um comentário