CHAPTER 1 Flashcards
IN THIS WE ARE GONNA INTRODUCE YOU TO PYTHON
Define Script.
a python program
Define python command.
a python program statement
Define shell.
commands and definitions are executed by the python interpreter.
Python features.
a. simple and easy program structure.
b. portable and free available library.
c. easy for debugging and testing.
d. supports structured and functional programming methods as well as object-oriented programming.
e. provides dynamic type checking and very high-level dynamic data type.
f. it has automatic garbage collection.
g. integration with c++, c, CORBA, java is very easy.
Types of objects.
scalar and non-scalar
Scalar Objects
they are considered invisible objects.
example: int, float, bool, none.
- int
- float
- bool
- none
- used to represent integers(ex:- 3,4, -60, 02).
- used to represent real numbers with decimal points(-0.5, 6.0, 9.9).
- represent two boolean values that are true or false.
- it is a type with a single value.
Non-scalar objects
Strings
Define expression.
combination of operators and objects.
’==’ operator
’!=’ operator
’»>’
to check whether the two expressions are the same or the same two values.
to test whether the two expressions evaluate different values.
it indicates the user to type some code in the shell
a//b
it means it will always return a result of type int since it returns the quotient and ignores the remainder. ex: 7/3 will return 3.
a**b
a raised to the power b. ex: 5**3=125
precedence
Parentheses»_space; Exponent»_space; Unary plus, Unary minus, Bitwise NOT»_space; Multiplication, Division, Floor division, Modulus»_space; Addition, Subtraction»_space; Bitwise shift operators»_space; Bitwise AND»_space; Bitwise XOR»_space; Bitwise OR»_space; Comparisons, Identity, Membership operators»_space; Logical NOT»_space; Logical AND»_space; Logical OR
Define variables.
a way to associate names with objects. it is just a name.
What is an assignment statement?
it is used to assign value to the variable. It associates the name of the variable with the object represented by the expression to the right side of the assignment operator(=).