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...
Lesson 10. As we see in the previous lesson, now we’ll make some algorithms to practice. Those are 10 questions. I recommend that you make this algorithms because it’ll help you in the future. 1- Make an algorithm that reserves how tall is a person and test this conditions: If the Tall is greater than 1.90, printf (“You can play basketball”); If the Tall is smaller than 1.50, printf (“You’re not taller”); if the Tall is greater or equal to 1.50 and smaller or equal than 1.90, printf (“You’re between arrive”); 2- Make an algorithm that works as a game, it may ask to user “What’s the Spanish Capital?” so the user will have available 4 possibility, they’re respectively a) Madrid, b) Barcelona, c) Vigo, d) Sevilla, after will be tested them. Note: use for store the result, a character type variable. If the variable is equal to ‘a’, so printf (“You’re Wright”); Else, so printf (“You’re wrong”); 3- Make an algorithm that works as a table,...
As promised in the last class, I present to you the Loop Do While. First, what’s a Loop? A loop is by definition a command that repeat a action inside code considering some situations. Access the Lesson 2 to more information. Below, see the structure of Do While Command: In others words, we have ‘do’ or make this code, only in the end, it’ll tested, then can happen that the condition be false, but the code will be ran once. Now, see a example with Do While being ran. Below, see the code allow being ran. First the Do While command RUN, after it TEST, remember always! In the next lesson, I will do 5 challenges to you practice. Well, that’s all Folks! See you later!
Comentários
Postar um comentário