The semester is has ended, there’s just final exams to do, this course was a great experience I hope more people has the chance to enjoy a kind of course like this one that Ken offer to us. Thank you Ken
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 is also a function dict() inside you put all the elements that you want inside the dictionary.Here is an example of a dictionary:
tel={'jack':4098,'sape':4139}
Here is a cool video:
That’s all of the semester, i have completed my mastery topics #PUG#Tec#TC101#TheEnd#Dictionaries
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 number, how we validate that that input will be indeed a number, we can use the try…except….else block, here is how:
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.
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 difference between them is that the list is between [ ] and can be modify and the tuple is between parenthesis () and can’t be modify.
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 its body.
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 TRUE, it will repeat a statement or a group of statements. On the other hand, we have the for loop that executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
Here is an example of for loop:
and for while loop:
That will be all here is a video for better understanding:
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 to check for another condition after a condition resolves to true, this is what is call nesting, a conditional inside another conditional.
Here is an example:
Here is a youtube video:
That’s all #Pug #Nesting #If #Python #ISC #Tec #TC101