Python Revision - Section VI - Modules and Packages
Modules In order to create a new module, we’ve just to create a new .py file with the module name and then import it using the Python file name using the import command. import foo Packages Pa...
Modules In order to create a new module, we’ve just to create a new .py file with the module name and then import it using the Python file name using the import command. import foo Packages Pa...
Shell Script After losing some seconds copy-pasting and editing old files to creating new posts, I decided to automate this routine. #! /bin/bash # Check if the input is in the correct format if...
Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects. Each object is an instance of a class. Each class is defined by its attributes and its methods. Attribut...
Map Function The map function allows us to map a function to an iterable object. def square(num): return num**2 my_nums = [1,2,3,4] map(square, my_nums) To obtain the mapp...
*args When a function parameter starts with an asterisk, it allows for an arbitrary number of arguments, and the function takes them in as a tuple of values. def myfunc(*args): return sum(arg...
If we iterate over a list of tuples, we can get each element of each tuple through what we called unpacking: list = [(1,2), (3,4)] for (t1, t2) in list: print (t1, t2) The same behaviour is ...
Numbers In Python we just have: integers and floating-point numbers. Strings Immutability: Once a string is created, the elements within it can not be changed or replaced. Methods: ...
Hi there! First of all, thank you for being here! Let me introduce myself to you: I’m Daniel, a Brazilian computer engineer As you may have noticed, this is just an attempt at a personal blog. I ...