Pin It

Python terminology

TIP: To quickly find a term, paste the word in the search box above the table and press enter.

TERM

DEFINITION

Windows Command Prompt

An interpreter (Windows Command Prompt) is a computer program that translates code (program instructions) written using one of many high-level programming languages on the fly. Windows 10 and other older version of Windows includes the Command Prompt as part of the operating system.  The advantage of an interpreter is that it can immediately execute high-level programs (from Python in our case).

Literals

Literals are constant values of built-in types like integers, floats, strings, lists etc...

Integer literals: -1, 0, 1, etc

Float literals:  3.5, -2.4, etc

String literals: "hi", "book", etc

List literals: [1, 2, 3], etc

 

None

Instead of Null, in Python we have None keyword. The None keyword is used to define a 'empty' variable. None represents the lack of a value. If we set a variable = None, This means that we want the variable to exist, but it does not contain a value at this point in time. None is not the same as zero, false or empty string. Having the None value assigned to a variable, simply means that a variable does not have any
value at all.

var1 = None;
print(None)

OUTPUT: None

 

Expression

Think of this phrase in order to determine what is an expression in Python;

"Anything that python needs to evaluate (calculation required to determine the value of) is an expression." Another words, if Python has to calculate in order to derive a value, it's an expression.

Anything that evaluates to a value is an expression.

An expression can be a combination of values, variables and operators (eg; x = 5).

A value on its own is considered an expression (eg; 5)

When a variable is tied to a value (x = 5), the 'x' is NOT an expression because it is tied to the value of 5.

a = 1
b = 2
print(a+b) # a+b is an expression

a = 1
b = 2
print(a-b) # a-b is an expression

a = 1
b = 2
print(a*b) # a*b is an expression

a = 1
b = 2
print(a/b) # a/b is an expression

a = 1
b = 2
print(a%b) # a%b is an expression

Is 'a' an expression in  'a=1'? No this is NOT an expression. Anything on the left of the assigement operator cannot be an expression. The variable name 'a' is tied to the value of 1. The 1 is an expression. Summary: Whatever is tied to a value is NOT an expression. The variable name 'a' is tied to the value of 1, therefore it is NOT an expression.

 

 

Statement

One or several lines of python code that an interpreter can execute are called statements.

Statement examples;

break => break statement

x = 2 => Assignment statement
An assignement statement consists of an expression on the right-hand
side and a variable to store the result on the left hand side.

x=5
if x <10:
     Print('Smaller') => this is a conditional statement

print(x) => print statement

Other statement examples;

if statement

for statement

while statement

 

Sequential vs conditional steps

When Python executes a code in sequencial steps, it means that it executes one line of code after the other, as shown below. For example;

x=2
print(x)

The above 2 lines of code are sequential because they are read by Python one after the other.

x=2
if x<10:
   print('x is less than 10')
if x>10
   print('x is greater than 10')

The 1rst, 2nd and 4th line are sequential steps, while the 3rd and 5th lines are conditional steps. Once you see an indentation in the code, this is a conditional step. Another words, in this example, the first conditional step is only executed if the 2nd line - if x<10:- evaluates to true. If it does not evaluate to true, the 3rd line is skipped, thus that is why it's called a conditional step.

 

String literal

A string literal is a sequence of characters enclosed in single or double quotes. For example, the string 'Hello World!' that is within the print function is called a string literal.

HTTP Request

HTTP refers to Hypertext Transfer Protocol. The message that is sent by a client to a server is what is known as an HTTP request. By client we mean that when a user enters a url into the browser, the browser sends a GET request to our server.  When our server replies to a GET request from the browser, the server responds by sending a response to the browser.

If you get http statuts code 304;  Go to Chrome browser’s menu; More Tools / Clear browsing data
Refresh home page.