What is Python?
Python is the most powerful object-oriented, high-level computer programming language for making any programme by Guido van Rossum.
It is a general-purpose computer programming language. It has a wide range of applications such as Web development, Mathematical and Graphics User Interface.
Python is very easy to learn and understandable among all the computer languages.
Its syntax is very simple to write and read the programming coding.
Computer Applications and Programme that use Python
Features of the Python
- Free where and shareware
- Easy to learn and understand
- It is easy to portable.
- Executable in any Operating System
- High-Level Interpreted Language
- Large Standard Libraries
- Codes length are shorts
Data Types and Variables
x = 23
m =”Rana Mehtab Alam”
m, n = 8, 9
abs (Get output in absolute value)
ceil (round up the numeric value as 9.6 = 10)
cos (cosine in radians)
floor (round down the numeric value)
log (logarithm, base e)
log10 (logarithm, base 10)
sqrt (find the square root of a numeric value)
round (round up the decimal values to the nearest as 1.2 = 1 and 1.9 = 2)
sin (sine, in radians)
max (find the maximum number from numbers list)
min (find the minimum number from numbers list)
Rules of typing commands and defining variables.
Python is a case sensitive software so we type commands and use variables in lowercase.
There is a list of reserve words in Python that we can’t use in the variables.
Constant using in Python
e = 2.7182818…..
pi = 3.1415926….
We use \ to go to next line in python
How to Add comments in Python
#This is a comment line
Typing coding in the Python
print “Rana Mehtab Alam Lunar Computer College”
Rana Mehtab Alam Lunar Computer College
a = “Rana”
|+||Addition||a + b|
|–||Subtraction||a – b|
|*||Multiplication||a * b|
|/||Division||a / b|
|%||Modulus||a % b|
|**||Exponentiation||a ** b|
|//||Floor Division||a // b|
|=||a = 9||a = 9|
|+=||a += 6||a = a + 6|
|-=||a -= 2||a = a – 2|
|*=||a *= 8||a = a * 8|
|&=||a & = 7||a = a & 7|
|>>=||a >> 3||a = a >> 3|
|<<=||a << 1||a = a << 1|
|==||Equal||a == b|
|!=||Not Equal||a != b|
|<||Less Than||a < b|
|>||Greater Than||a > b|
|<=||Lesser and Equal||a <= b|
|>=||Greater and Equal||a >= b|
|and||Both conditions should be true||a<80 and a>70|
|or||Anyone condition should be true||a<80 or a>70|
|not||Returns false if the result is true||not(a<80 and a>70)|
|is||same values for variables||a is b|
|is not||values are not the same||a is not b|