Creation and use of dictionaries in Python

This is the last post of the mastery topics, so let’s give everything to it. Dictionaries, they are just another type of data just like lists and tuples. They are indexed by keys, which can be any immutable type, or tuples if they don’t contain any mutable object. You can create them with: {}, there…

Creation and use of ranges in Python

In python there is a function call range which helps you analyze the values inside an interval with a numeric argument. Here is a simple example:   Here is a video: That’s all #Pug#Tec#TC101#Range#NoMore#AlmostDone#Python

Reading and writing of text files

Computers can also read and write, for them to do so we have to first create a .txt file and we do this by typing file = open(“file name”, “action”). The next thing that we can do are the next ones: “w” this is use to write in a .txt file “r” this is use…

Validated user input (ensure correct/expected data entry)

Most of the time we want our program to be able to interact with the user, to ask him questions and him returning input, well, it is very important to validate the input the user is giving so our program doesn’t crash. For example we have a program were the user has to input a…

Creation and use of strings

This is very easy to learn, first to create a string what you should do is enclose all the characters between quotes like this Ex: str1= “Hello”, this is a string already. You can play with the string and updated, change it, add more, print it completely, print it partially etc. Here is a video of…

Lists & Tuples

It is time for us to learn about lists and tuples, this is a very simple topic. Both are sequence type data, referring to the way they behave, as a sequence. The elements that go inside the list and the tuple can be different kind, a string, a number, even another list or tuple. The…

Use of recursion for repetitive algorithms

This time we are going to learn about recursion, what is recursion? Recursion is a method where the solution to a problem is based on solving smaller instances of the same problem or in other words  is a way of programming or coding a problem, in which a function calls itself one or more times in…

Loops, loops, loops …

Is time for us to learn about loops, the loops help us to repeat a piece of code several times instead of writing the code all over again. There are two kinds a while loop and a for loop, the while loop  tests the condition before executing the loop body, while a given condition is…

Nesting of conditional statements

You may think there is no more you must know of the conditional statement, well… You are wrong, there is another knowledge call nesting that must master. Perhaps you didn’t know that in a nested if construct, you can have an if…elif…else construct inside another if…elif…else construct. There may be a situation when you want…

Else and Elif

Continuing with the course, we have the next step that is the else and elif statement. Let’s start with else, in the else statement is where you are going to put the block of code that you want to execute if the conditional in the if statement turns out to be False or 0. Here…

If you click on this post…

This time we are going to see   the conditional if and how does it work. The conditionals statement performed different actions depending on how the boolean was evaluated false or true. The general form of the “if” statement is the follow. If BOOLEAN : STATEMENTS There are some important things to remember about the if…

Modules and libraries

This time we are going to see the Modules or Libraries what are those things, in simple terms they are Python files that contain definitions and statements, this ones can be imported or well created by yourself. To import one of this modules and use it in your program is very easy, you just type…