Postagens

Mostrando postagens com o rótulo Variables

Course Python For Life 4 – Variables

Imagem
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...

Course C Initial – 3rd Variables Part. 2

Imagem
Lesson 3 Part. 2 . Now, as promised, I present for you the last part of variables. In this lesson, we’ll learn to store a variable with the commands in the language. Well, let’s go so. First, see the C program structure below: In this code, we can see that it ask to user type a number, so after, we see ‘scanf’ this is the command to read and stored to a variable in C. Between parentheses, we have a control string ‘%i’, after the ‘&’ symbol and the variable name. So, scanf structure is: scanf(“%control_string”,&variable_name); below, see this table with some data types control strings. Now, we can see create codes with this knowledge. Test them in your compiler because the practice is the way to learn and be a programmer. So, copy this code in your compiler: This algorithm ask the user’s tall and print it. Write this algorithm in your compiler and test how many times you want....

Course C Initial – 3rd Variables Part. 1

Imagem
Lesson 3 Part. 1. Hello again! As promised in the previous class, now I speak about variables in C language. First, what’s a variable? The answer is important because it will help us to learn more and use them. Definition: capable of being varied or changed; alterable. (source: www.dictionary.com). That’s the definition that we need! So, there’s some variables types in C language. They’re: Global; Locale; Constant; Volatil e; Inside each one of those cases, we have in resume, 4 type that can be represent in each or all those cases. Below, you’ll can see its names. c har – ‘a’, ‘b’, ‘c’,...; int – 1, 2, 4, 7,...; float – 7.553279, 8.856347,...; double – 9.5896324789632, 10.5885569347799,... ; There’s variations inside each format, but we’ll see in the future. How we can see above, the type data that the variables types represent. Char is for character data, int is for integer, float is for floating point...