Basic topics in python for beginners
in this article, I would tell you how you can start with learning python if you want to be a python developer
I will list all the topics we will learn in python
Datatypes
datatypes are very important in any programing language we have the following datatypes
Text
string — string is a text representation in python
Numeric
integer — integer is a numeric representation of an integer (1,10,135)
float — float is also a numeric representation but it’s different it includes real numbers or in simple language, if the number has a decimal point it is considered as a float (54.6,62.379,10.0)
Sequence Datatypes
list — the list is a 1-dimensional array that can store multiple values at a time and list is mutable, it can be changed in the future a list is created by [‘a’,’b’, ‘c’]
tuple — tuple is very similar to a list but it is immutable, we cannot change the tuple or the items present in a tuple in future once it’s created it is created by {‘a’,’b’, ‘c’}
set — sets are used to store multiple items in the same variable i.e.
if a set have these elements 1,2,3,2,1,2,1 when we create a set it will show us 1,2,3
Conditional statements
conditional statements to perform a particular task if any value goes true there are 3 conditional statements if, else,elif
if — it has a code of body that runs only if the condition of the if command come to true
else — else runs a body command if the condition is not satisfied by if and elif
Elif — The Elif keyword is used in conditional statements (if statements), and is short for else if. similar to if the command
Loops
a loop runs a code after and after until its condition comes out to be false
there are 2 types of loops in python for and while loop
for — A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
while — In python, a while loop is used to execute a block of statements repeatedly until a given condition is satisfied. And when the condition becomes false, the line immediately after the loop in the program is executed.
Functions
A function is a block of code that only runs when it is called.
You can pass data, known as parameters, into a function.
A function can return data as a result. it can be created by def