Chapter 2 - Glossary Flashcards
Variable
A variable is a name that refers to a value.
Expression
An expression is a combination of values, variables, and operators
> > > n + 25
Is this correct.
Yes this this display the value of n+25 in interactive mode.
Difference Between Python Interactive mode and script mode.
> > > miles = 26.2
miles * 1.61
42.182Python Interactive mode is when we run python code from the python terminal. In interactive mode, we don’t want to type print expression, only a variable name is sufficient to print the value of a variable. Script mode is when we save python code in the file as .py extension
Order of Operations
PEMDAS - Order of Precedence
Equal precedence operators evaluated left to right
Multiply & Divide has same precedence
Add & Subtract also has same .
Which Operators works on string.
\+ and * works on strings a = 'Hemant' b = ' Kumar' print(a+b) c = 'Bye ' print(c * 4)
Types of Errors in a Program ?
Syntax Errors
Runtime Errors
Semantic Errors
Assignment
A statement that assigns a value to a variable.
Keyword
A reserved word in programing language
Expression
Expression is a combination of variables, operations and values that yields a result value.
5 * 5 # yields 25
Statement
Statements represent an action or command e.g print statements, assignment statements.
print ‘hello’, x = 1
Execute
To run a statement and do what it says.
Interactive Mode
A way of using the Python interpreter by typing code at the prompt.
Script Mode
A way of using the Python interpreter to read code from a script and run it.
Order of Operations
Operator Precedence table