Lecture 1
Python programming language
Python programming
language
Python is a powerful general-purpose programming language. It is
used in web development, data science, and so on. Fortunately for
beginners, Python has simple easy-to-use syntax. This makes Python
an excellent language to learn to program for beginners.
Python integrated development
environment(IDE)
1 2
) )
Online Sublim
3 compiler 4 e
) )
PyChar Visual Studio
Installing Python programming
language
Python prompt
To start playing with Python, we need to open up a command line on your computer. Type
in python on Windows or python3 on Mac OS/Linux and hit
enter.
command-line
Python numbers
Python supports integers, floating-point numbers and complex numbers. They are
defined as int, float, and complex classes in Python.
Integers and floating points are separated by the presence or absence of a decimal
point. For instance, 5 is an integer whereas 5.0 is a floating-point number.
Complex numbers are written in the form, x + yj, where x is the real part and y is the
imaginary part.
We can use the type() function to know which class a variable or a value belongs to
and isinstance() function to check if it belongs to a particular class.[1]
Python numbers examples
Lists
Python list is a data structure, which can store information in various types. Python list
has ready methods for manipulating the list. Example:
Lists examples
Python list is a data structure, which can store information in various types. Python list
has ready methods for manipulating the list. Example:
Dictionaries
A dictionary is similar to a list, but you access values by looking up a key instead of a
numeric index. A key can be any string or number.
Sets
Set operations
А)
Ә)
Example
Tuples
Example
Python arithmetic operators
Example
Python assignment operators
Python comparison operators
Python logical operators
Python if statement
Python if statement is used when piece of code should be executed if some condition is
satisfied. Otherwise that piece of code will not be executed. The syntax of if statement
is:
Python indentation
Python relies on indentation (whitespace at the beginning of a line) to define scope in
the code. Other programming languages often use curly-brackets for this purpose.
Several conditions
Used resources
1)https://www.programiz.com/python-programming/numbers
2)https://docs.python.org/3/tutorial/datastructures.html
3)https://www.w3schools.com/python/python_sets.asp
4)https://www.datacamp.com/community/tutorials/python-if-elif-else?
utm_source=adwords_ppc&utm_medium=cpc&utm_campaignid=14989519638&utm
_adgroupid=127836677279&utm_device=c&utm_keyword=&utm_matchtype=&utm_
network=g&utm_adpostion=&utm_creative=332602034361&utm_targetid=aud-
438999696719:dsa-
429603003980&utm_loc_interest_ms=&utm_loc_physical_ms=9070290&gclid=Cj0K
CQiAip-PBhDVARIsAPP2xc0cjW_qGnMGsGR5TDJYMgFHV9Be-
gISDbezCnocGzr_CF_lar1fHukaAgp4EALw_wcB