x = 10 # Simple expression (variable assignment) result = x + 5 # Expression with an operator name = "Raj" # String expression
+
-
*
/
a = 5 b = 10 sum = a + b # a and b are operands, + is the operator
//
%
**
x = 10 y = 3 result = x ** 2 + y # 10^2 + 3 = 103
first_name = "Raj" last_name = "Kumar" full_name = first_name + " " + last_name # "Raj Kumar" greeting = "Hello, " * 3 # "Hello, Hello, Hello, "
True
False
==
!=
>
<
>=
<=
age_raj = 25 age_ram = 30 is_raj_older = age_raj > age_ram # False
and
or
not
is_student = True is_employed = False can_apply = is_student and not is_employed # True
in
not in
names = ["Raj", "Ram", "Anand", "Bala"] is_karthik_present = "Karthik" in names # False
is
is not
x = 10 y = 10 is_same = x is y # True (for small integers, Python reuses memory)
age_raj = 25 age_ram = 30 total_age = age_raj + age_ram # 55
first_name = "Suresh" last_name = "Kumar" full_name = first_name + " " + last_name # "Suresh Kumar"
marks_anand = 85 marks_bala = 90 is_anand_higher = marks_anand > marks_bala # False
is_karthik_student = True is_karthik_employed = False can_karthik_apply = is_karthik_student and not is_karthik_employed # True
names = ["David", "Kannan", "Siva", "Ramesh"] is_sujatha_present = "Sujatha" in names # False
x = "Sathish" y = "Sathish" is_same_person = x is y # True (strings are interned in Python)
()
result = 10 + 5 * 2 # 20 (multiplication is evaluated first) result = (10 + 5) * 2 # 30 (parentheses override precedence)
# Less readable total = (x + y) * (a - b) / (c ** 2) # More readable sum_xy = x + y diff_ab = a - b square_c = c ** 2 total = (sum_xy * diff_ab) / square_c