Python 101
Hello readers!!✨👋🏼 Here is my 12th-week blog as an intern in a software development company. For the past couple of weeks, we’ve been working with open source, but this last week more than being focus on doing open-source issues, I tried to understand and learn python. Here is some of what I’ve been learning as a newbie with python. Also, it’s helping me to find more challenging issues to work on next.

First of all, I’ve been going through the next concepts on REPL (Read-evaluate-print loop). You can use it in Visual Studio Code (extension). REPL is another terminal, and you can use it to test assumptions, little bits of code, and get an instant result. Let’s start with the basic concepts and their explanation:

Functions: To start a function, you need to start the function definition (def), then the name. For example, “def variable_name():”

Functions can also accept no arguments, for instance:

Accepting arguments: If there is no control flow, then everything after “return” is ignored.

Function Arguments:

Lists: Used for storing similar items and in cases where items need to be added or removed. An empty list can be defined as “[ ]” or “List_name( )” and it will always start in the position 0. Let’s see an example of updating an item in a list:

Also, there are two ways of sorting number in python. Let’s see some examples with this list “lottery_num = [1, 4, 34242, 78, 11]”:

Using “Sorted”: what this method does is make a copy of the list and return the values sorted.

if we want to save the copy we just need to define a variable, for example, “x=sorted (lottery_num).”

2. Doing it in place: This will actually modify the list

Adding items to a list: To add items we will used “append”

Extend: We use “extend” to combine two lists. “names.extend(colors)” where “colors” is the list that will be combined into “names.”

List lookups: It looks for the value and position inside a list.

Index: “.index” tells you in what position the item is.

Count: “.count” tells you how many items with the same name are on the list.

Change and remove an item:

Tuples: Lightweight collection that is used to keep track of related but different items “Immutable.” Tuples are perfect for containers that need an immutable key aka a key that can’t be changed.

Unpacking tuples: Are great to quickly consolidate information. To unpack “(“Max”, 10, “Math”, 9.5)” we need to declare variables for each item, for instance, it would look like this: “name, age, subject, grade = student”

if we don’t want to save one of the values as a variable, we can use underscore “_.” Example: name, age, subject, _ = subject

I know I wrote a lot about basic concepts, but from my experience, it’s better to start filling the voids or getting strong basics. To be able to start with something more challenging.
['Mariana Yañez']
['Python3', 'Python', 'Python Beginner']