Python Introductions(Tips)
https://br.freepik.com/fotos-gratis/script-de-programacao-texto-codificando-palavra_16459664.htm#query=programa%C3%A7%C3%A3o&position=2&from_view=search

Python Introductions(Tips)


Before we start here, I feel the need of give some friendly warnings!

tension

  • No one knows everything. By the way, if anybody said that knows too much content about a subject, presents to him/her the Dunning-Kruger effect. I've made, I make and I'll make lots of mistakes! And I will always be glad to receive any feedback about anything you deem necessary about whatever you want. I leave here, my sincere thanks in advantage for that!
  • My approach is a little bit comic, overall. As you could saw above(with the gif), I've like to thing that little of humor could be useful to treat tough themes, transforming those heavy airs into an environment of greater freedom and didactics.
  • Don't don't lose faith in yourself. I know, this is not an article about self-compassion (even though it can be applied in any area), nonetheless as Bon Jovi would say:

When you can't do what you do
You do what you can
This ain't my prayer, it's just a thought

And never forget to have a nice day(I am aware, I'm such a big fun)! Our area of expertise demands a lot of practice, studies and among other things patience! So when you feel discouraged because you can't understand/do something, STOP, breathe , go relax through your favorite hobbies and come back with this Winston Churchill quote in mind:

Success consists of going from failure to failure without loss of enthusiasm.


OBS: The cover image theme is about JavaScript text, but was the only free one which I've found in https://www.freepik.com/home.


Where and how to start if I want to learn Python?

Well, contrary to what you may be thinking, there is no single way, it is more relevant to think about what is most effective in your case. There are people who prefer to read, others watch video classes, others even a combination of the two and so on. At the end of the article I will leave some suggestions of material for the most diverse learning palates, hence the power is yours(PLANET, Captain)! Now, considering that you already have chosen what material fits to you, there are some agreements which may be good to follow in your practice conduit.

Before Start the Code

pro_developer

It's helpful (not to mention indispensable) that in Python there are some built-in data types, conditional statements and that will be by your side until the end of time (or energy, whichever comes first).

  • Number: there are three numeric types, integer(int), float and complex;
  • Strings: strings in python are surrounded by either single quotation marks, or double quotation marks;
  • Booleans: booleans represent one of two values, True or False;
  • Lists: lists are used to store multiple items in a single variable;
  • Tuples: tuple items are ordered, unchangeable, and allow duplicate values;
  • Sets: set items are unordered, unchangeable, and do not allow duplicate values;
  • Dictionaries: a dictionary are used to store data values in key:value pairs;
  • Range( ): the range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.
  • Python Conditions and If statements: supports the usual logical conditions from mathematics;
  • Repetition Structures;

  1. Python For Loops: for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
  2. Python While Loops: With the while loop we can execute a set of statements as long as a condition is true.

  • Python Functions: A function is a block of code which only runs when it is called.

Object Oriented Programming(OOP) in Python

Object-oriented programming is a programming paradigm that provides a means of structuring programs so that properties and behaviors are bundled into individual objects. Concept dictionary:

  • Class: "General" entity that we define based on the problem we want to solve;
  • Object: "Specific" entity, created from the rules defined by the "general" entity. Think of the class as the mold and the object the sculpture that the mold makes;
  • Instance: You know when we create an object from a class! Then! We say that this object is an instance of this class;
  • Attribute : An attribute is information about an instance that you have created;
  • Message : The way objects interact - calling each other's functions. A call like this is a message sending to another object;
  • Abstraction: It refers to always creating entities that will do the actions that will solve your problem;
  • Encapsulation:It refers to being able to instantiate an entity and send messages to it without knowing how it works inside.

class in python
https://stackoverflow.com/questions/54261914/uml-diagram-in-python-3-7

The Virtual Environment

The python virtual environment is what we create and initialize at the beginning of each project, as it will allow you to build the entire algorithm with all your libraries, modules and packages in a directory separate from the rest of your computer's memory. To create it, just type in your  Interface Message Processor (IMP):

$ python3 -m venv .venv
        

Then, you have to activate it:


$ source .venv/bin/activate
        
easy peasy

Easy peasy, right? Always remember to check that it is enabled (a small ".venv" should appear on the left side of your command prompt) once your machine has rebooted, before starting writing again. Now your environment is ready for fun!

Installing Python Modules in the Virtual Environment

Assuming that your environment is already initialized and your code is running, you will eventually need some specific package, which will provide to you useful functions and behaviors for the purpose of your program. Following the idea of the beginning, in the command line type:


$ python3 -m pip install "some_package"
        

Once this is done, you can check all the packages installed by the command:


$ pip freeze
        


Running Python files

Once your application starts to take on a certain proportion, you will probably opt for some kind of construction architecture to make things more understandable (even because you won't be the only one who will read it). When that happens (and it will, believe me), python gives you mechanisms to work more fluidly. It may be the case that you want to run some file with your pc's pytohn interpreter, , which allows you to write code (in your preferred text interpreter, I recommend VSCode) and run it simultaneously, to do so, you may be helpful run your file in the prompt using:


$ python3 -i "file_name.py"
        


Auxiliary Bibliography and Other Teaching Materials

Most of the content I used to create this material has already been referenced through links to their respective URLs. Now I will put some other sources that may be interesting to consult:

  • Data Science From Scratch(GRUS, Joel);
  • Python for Data Analysis(MACKINNEY, Wes);
  • Python courses from Udemy plataform;
  • Python videos and channels from YouTube;

As you can see there is no rule, there is only what works in each case, it's up to you to choose which path to take!

I've got the power

So, what now?

There is still a lot to be said and studied, little grasshopper, but I believe and have faith that from here there is already a direction in which you can start walking and remember that every great construction started with a simple brick (or stone block, depending on the era, but it was understandable). I hope that with this information I can, somehow, facilitate or even help in your career, it would make me really happy. If this really helped, leave a like, subscribe to the channel and... woops, wrong platform! See you around!

No alt text provided for this image



To view or add a comment, sign in

More articles by Pedro de Almeida Alves

  • React.JS Hooks

    A journey through React.JS Hooks Introduction My purpose in this article is to contemplate, in a simple and direct way,…

Others also viewed

Explore content categories