Variable name:

Variable name in Python can only contain letters (a - z, A - B), numbers or underscores (_).


However, the first character cannot be a number. Hence, you can name your variables user_car or user_car2 but not 2user_car.


variable names are case sensitive so user_car is not the same as user_Car or User_car or User_Car.

Variable name:

Special words can’t be used because these words are built in as a part of python expressions and functions like print, input, if, while, for etc.


These words are (False, class, finally, is, return, None, continue,For, lambda, try, True, def, from, nonlocal, while, and, with, as, elif, if, else, or, yield, assert, import, pass, break, except, in, raise)

Operators types :

Assignment Operators:

give you new value of variable

x = x + 5 can be coded by another way as x + = 5

x = x – 5 can be coded by another way as x - = 5

Logic operators : give you False or True

x > 5 x more than 5 or x >= 5 x more than or equal to 5

x < 5 x less than 5 or x >= 5 x less than or equal to 5

also

x != 5 x not equal to 5

Arithmetic Operators:

Suppose x = 3, y = 2

Addition:

x + y = 5

Subtraction:

x - y = 1

Multiplication:

x*y = 6

Division:

x/y = 1.5

Floor Division:

x//y = 1 (rounds down the answer to the nearest whole number)

Modulus:

x%y = 1 (gives the remainder when 3 is divided by 2)

Exponent:

x**y = 9 (3 to the power of 2)

Python data types:

Integers:

integers are numbers with no decimal parts, such as -3, -1, -2

, 0, 6, 10 etc.

To declare an integer in Python, simply code as following :

Variable_name = interger value

Examples:

user_car_speed = 100

car_ number_plate= 123569


Python data types:Floats

Floats are numbers that have decimal parts, such as 1.56, -0.0056,

10.015

To declare a float in Python, you will code as following:

Variable_name = float value


Examples:

user_car_speed = 100.55

User_height = 1.72



Python data types: strings

String are composed of elements like letters, numbers, special characters to build a text. To declare a string, you can either use variable_name = ‘string’ (single quotes)

Variable_name = “string” (double quotes)

Example:

user_car_speed = ‘100’ or user_car_speed = “100”

user_car_color = ‘red !?’ or user_car_color = “red !?”




Casting in python:

Casting in python is converting one data type to another data type.

Using build_in python functions int(), float(), and str()

Examples:

user_car_speed = “ 100.55 ”

float (user_car_speed) = 100.55

int(float (user_car_speed) ) = 100

int(user_car_speed) = 100