0% found this document useful (0 votes)
19 views

Python Firat 4chapters

Uploaded by

updyrahmanm153
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Python Firat 4chapters

Uploaded by

updyrahmanm153
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Python Programming

Chapter One: Python Programming


1. Python: is computer programming language often used to build websites, software, and
conduct data analysis.
2. Python used for: Web Development (Server-side), Software Development, Mathematics,
and System Scripting.
3. What is a programming language: Programming language is a set of commands,
instructions, and other syntax use to create software programs.
4. History of Python: Python was invented by Guido van Rossum in 1991 at CWI in
Netherland.
5. What can Python do:
 Python can be used on a server to create web applications.
 Python can be used alongside software to create workflows.
 Python can connect to database systems. It can also read and modify files.
 Python can be used to handle big data and perform complex mathematics.
6. Why we use Python:
 Python works on different platforms (Windows, Mac, Linux,).
 Python has a simple syntax similar to the English language.
 Python has syntax that allows developers to write programs with fewer lines than
some other programming languages.
7. Python Syntax compared to other programming languages:
 Python was designed for readability.
 Python uses new lines to complete a command.
 Python relies on indentation, using whitespace, to define scope.
8. Features of python:
 Easy to Learn and Use.
 Cross-platform or Platform independent.
 Free and open source.
 Object-Oriented Language.
 High level language.
9. Python IDE:
 PyCharm.
 IntelliJ Idea.

1 | Page
Python Programming

 Microsoft Visual Studio.


Chapter Two: Variables and Data types
1. Identifiers: is a name given to a variable, function, class or module.
2. Rules for writing identifiers:
 Identifiers can be a combination of letters in lowercase or uppercase or digits or an
underscore.
 Identifier can begin with an alphabet.
 Identifier cannot start with a digit but is allowed everywhere else.
 Keywords cannot be used as an identifier.
3. Keywords: are a list of reserved words that have predefined meaning.
4. Variables: is a container for storing data values.
5. Multi Words Variable Names:
 Camel Case: Each word, except the first, starts with a capital letter.
 Pascal Case: Each word starts with a capital letter.
 Snake Case: Each word is separated by an underscore character.
6. Types of variables:
 Local variable: is a variables that are created inside of a function.
 Global variable: is a variables that are created outside of a function.
7. Data types: specify the type of data like numbers and characters to be stored and
manipulated within a program.
 Integer:
1. Int: is a whole number, positive or negative, without decimals, of unlimited
length.
2. Float: is a number, positive or negative, containing one or more decimals.
3. Complex: as the imaginary part.
 String: A string consists of a sequence of one or more characters, which can include
letters, numbers, and other types of characters.
 Boolean: Binary and evaluates to either true or false.
 Type (): To verify the type of any object in Python, use the type() function.
8. Comments:
 Single-line comment (#): It makes all text following it on the same line into a
comment.

2 | Page
Python Programming

 Multiline Comments (‘‘‘’’’):If the comment extends multiple lines.

Chapter Three: Operators


1. Operators: are special symbols in python that carry out arithmetic or logical
computations.
2. Arithmetic operator: Used to perform common mathematical operations.
3. Comparison Operators: are used to compare two values.
 Equal operator: If the values of two operands are equal, then the condition becomes
True.
 Not Equal operator: if values of two operands are not equal, then the condition
becomes True.
 Greater than operator: If the value of left operand is greater than the value of right
operand, then condition becomes True.
 Less than operator: if the value of left operand is less than the value of right
operand, then condition becomes True.
 Greater than or equal operator: if the value of left operand is greater than or equal
to the value of right operand, then condition becomes True.
 Less than or equal operator: if the value of left operand is less than or equal to the
value of right operand, then condition becomes True.
4. Assignment operator: used to assign values to a variable.
 Simple assignment operator: simply assigns the value of its right operand to the
variable on the left.
 Addition Assignment: Adds the value of right operand to the left operand and
assigns the result to left operand.
 Subtraction Assignment: Subtracts the value of right operand from the left operand
and assigns the result to left operand.
 Multiplication Assignment: Multiplies the value of right operand with the left
operand and assigns the result to left operand.
 Division Assignment: Divides the value of right operand with the left operand and
assigns the result to left operand.
 Remainder Assignment: Computes the remainder after division and assigns the
value to the left operand.

3 | Page
Python Programming

 Floor Division Assignment: produces the important part of the proportion of its operands where the
 Exponentiation Assignment: Evaluates to the result of raising the first operand to
the power of the second operand.
5. Logical operators: The logical operators are used for comparing or negating the logical
values of their operands and to return the resulting logical value.
 AND operator: Performs AND operation and the result is True when both operands
are True.
 OR operator: Performs OR operation and the result is True when any one of both
operands is True.
6. Bitwise operators: treat their operands as a sequence of bits (zeroes and ones) and
perform bit by bit operation.
7. AND Binary: Result is one in each bit position for which the corresponding bits of both
operands are 1s.
8. OR Binary: Result is one in each bit position for which the corresponding bits of either
or both operands are 1s.
9. Indentation: is the visual structure of how your code is laid out.

Chapter Four: Conditionals


1. If/Else Statements: evaluates test expression and will execute the body of if only when
the test condition is True.
2. If/Elif/Else Statements: It allows us to check for multiple expressions.
3. Nested if statements: is If/Elif/Else statement inside another If/Elif/Else statement.
4. While Loops: Lets us repeat code as long as something is true.
5. Else in While loop: can run a block of code once when the condition no longer is true.
6. For Loops: run until a certain condition is met.
7. Else in For Loop: specifies a block of code to be executed when the loop is finished.
8. Break Statements: allows you to exit a loop when an external condition is met.
9. Continue Statement: used to end the current iteration in the loop.

4 | Page
Python Programming

5 | Page

You might also like