Could Also Use A Value
Could Also Use A Value
the + and - operators are evaluated last (also from left to right). You can use parentheses to override the
usual precedence if you need to.---[PYTHON follows PEMDAS i.e. Parenthesis, Exponents, Multiplication,
Division, Addition, Subtraction; PEMD(IqR)AS]
Python executes code from left to right & from top to bottom
If you ever see the error message SyntaxError: EOL while scanning string literal, you probably forgot the
final single quote character at the end of the string
Expressions consist of values (such as 2) and operators (such as +), and they can always evaluate (that is,
reduce) down to a single value. That means you can use expressions anywhere in Python code that you
could also use a value.
An assignment statement consists of a variable name, an equal sign (called the assignment operator),
and the value to be stored.
A variable is initialized (or created) the first time a value is stored in it. When a variable is assigned a new
value, the old value is forgotten. This is called overwriting the variable. Variable names are case-
sensitive. It is a Python convention to start your variables with a lowercase letter [Same is the case with
commands].
You can name a variable anything as long as it obeys the following three rules:
The line print('Hello world!') means “Print out the text in the string 'Hello world!'.” When Python
executes this line, you say that Python is calling the print() function and the string value is being passed
to the function. A value that is passed to a function call is an argument.
(1)The input() function always returns a string, even if the user enters a number. (2) The int() function is
also useful if you need to round a floating-point number down for ex, int(9.99)=9. (3) You can also use
this function to put a blank line on the screen; just call print() with nothing in between the parentheses .
(4) Round function in python rounds up value only on the basis of mod value of a number and not it’s
sign i.e. round(99.99) is equal to 100 and round(-99.99) is equal to -100.[Detail:
https://docs.python.org/3/tutorial/floatingpoint.html#tut-fp-issues ] (5)The function len() returns the
length (the number of items) of an object. The argument may be a sequence (such as a string, bytes,
tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).