The most interesting thing about python language is sort of all rounded. Due to its readability which is easy and the fact that it has very many applications including data engineering. In this post, we will discuss the most important concepts in the python language.
Python, builds the code structure using whitespace and indentation.
The comments are just as crucial as the code itself, because they explain why a piece of code was produced
The comments are ignored by the Python interpreter when it runs the code.
A single line comment in Python starts with the hash symbol (#), which is followed by the comment.
Python uses identifiers, or names, to designate variables, functions, modules, classes, and other types of objects.
An identifier's name must begin with a letter or an underscore. After that, only underscores or alphanumeric characters are allowed.
Keywords are words that have special meaning in python. Python has a special module keyword that outlines all the keywords that are used in the Python Language.
If statements are conditional statements. Below is the summary of the different if statements:
When you want to run a code block based on a condition, use the if statement.
If you want to execute a different code block if the condition is not True, use the if...else statement.
When you wish to check multiple conditions and execute the associated code block after the condition that evaluates to True, use the if...elif...else statement.
A code block can be performed a predetermined number of times by using the for loop statement.
To alter the loop, use the range(start, stop, step).
If a condition is True, use the Python while loop statement to run a code block.
A named, reusable chunk of code called a function in Python executes a command or returns a value.
Create a new function by using the def keyword. The function definition and body make up a function.
A function may have 0 parameters or more. You must pass a function the same amount of arguments if it has one or more parameters.
A function can do a task or give back a value. If you want to return a value from a function, use the return statement.
An orderly group of elements is referred to as a list.
If you want to retrieve a list element by its index, use the square bracket notation . The index of the first element is zero.
To reach a list element from the list's end, use a negative index. The final component has an index of -1.
To change an entry from a list, use list[index] = new value.
To add a new element to the end of a list, use the append() method.
To insert a new element at a certain location in a list, use insert().
To remove an entry from a list and return it, use the pop() function.
To eliminate an element from a list, use remove().
Tuples are immutable lists.
Use tuples when you want to define a list that cannot change.
A Python dictionary is a group of key-value pairs, each of which has a corresponding value.
In order to access a value by its key, use square brackets or the get() method.
To remove a key-value pair by the key from a dictionary, use the del statement.
To iterate through the keys, values, and key-value pairs in a dictionary, use a for loop.
This post includes a summarization of some most important concepts as a beginner in Python.