Variables, expressions, statements TRB CSI › Python Programming › variables, expressions, statements,

Variables, expressions, statements

Variable A variable is a name used to store or refer to a value in a program.

Premium — locked Beginner 24 min 213 cards 38 programs 11 MCQs v3
This is a premium lesson. You can see the shape of every card — unlock to read them. Unlock
Definition

Variable A variable is a name……

Premium This card is part of the premium lesson. Unlock
Program
Example
Explanation

Here: x → Variable name 10 → Value Simple definition: Value-க்கு ஒரு பெயர் கொடுத்து அதை progr……

Premium This card is part of the premium lesson. Unlock
Explanation

then: x + y produces: 30 Simple definition: ஒரு value/result கொடுக்கும் ……

Premium This card is part of the premium lesson. Unlock
Program
Example
Explanation

This is an assignment stateme……

Premium This card is part of the premium lesson. Unlock
Explanation

This is a function-call statement used to display the……

Premium This card is part of the premium lesson. Unlock
Simple Explanation

இந்த three concepts-ஐ ஒரு real-life example-ல பார்க்கலாம். Suppose: price = 100 quantity = 3 total = price * ……

Premium This card is part of the premium lesson. Unlock
Flow

Variable Flow Value ↓ Variabl……

Premium This card is part of the premium lesson. Unlock
Program
Example
Explanation

10 ↓ Assigned to x ↓ Use x anywhere Expression Flow Values / Variables ↓ Operators applied ↓ Expr……

Premium This card is part of the premium lesson. Unlock
Program
Example
Program
Example
Explanation

or: variable operator variabl……

Premium This card is part of the premium lesson. Unlock

Definition

Variable என்பது ஒரு value-ஐ r……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

name = "Python" Here: name → ……

Premium This card is part of the premium lesson. Unlock
Simple Explanation

Variable-ஐ ஒரு labelled box ப……

Premium This card is part of the premium lesson. Unlock
Program
Example
Explanation

Conceptually: age → 25 Later:…

Premium This card is part of the premium lesson. Unlock
Syntax
Examples
Important

Python-ல் variable create செய்ய தனிய……

Premium This card is part of the premium lesson. Unlock
Program
Example
Explanation

Python automatically understa……

Premium This card is part of the premium lesson. Unlock
Important

Python is Dynamically Typed…

Premium This card is part of the premium lesson. Unlock
Program
Example
Explanation

Later: x = "Python" Python al……

Premium This card is part of the premium lesson. Unlock
Explanation

x = 100 x → variable name = →……

Premium This card is part of the premium lesson. Unlock
Explanation
Variable naming

Valid Variable Names age = 25 student_name = "Kumar" mark1 = 90 _total = 100 All valid. Invalid Variable Name……

Premium This card is part of the premium lesson. Unlock
Important

Variable Naming Rules Variable name can contain letters. It can contain digits. It can contain underscore _. ……

Premium This card is part of the premium lesson. Unlock
Common Mistake

Wrong: student-name = "Arun" Python i……

Premium This card is part of the premium lesson. Unlock
Memory Trick

Variable: Name = Value…

Premium This card is part of the premium lesson. Unlock
Program
Example
Remember

Left side → Name Right side →……

Premium This card is part of the premium lesson. Unlock

Multiple Assignment

Python can assign multiple va……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

x, y, z = 10, 20, 30 Equivalent to: x = 10 ……

Premium This card is part of the premium lesson. Unlock
Explanation

a, b = 10, 20…

Premium This card is part of the premium lesson. Unlock

Variable Reassignment

A variable value can be chang……

Premium This card is part of the premium lesson. Unlock
Program
Example

Why? Latest assignment replaces the ea……

Premium This card is part of the premium lesson. Unlock

Definition

Expression என்பது values, variables, operators, or function calls சேர்ந்த ஒரு com……

Premium This card is part of the premium lesson. Unlock
Simple Explanation

Expression = Calculation or v……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

5 + 4…

Premium This card is part of the premium lesson. Unlock
Output
Result

அதனால் இது expression.…

Premium This card is part of the premium lesson. Unlock
Flow

Operand ↓ Operator ↓ Operand ……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

10 + 20 10 → Operand…

Premium This card is part of the premium lesson. Unlock
List

- → Operator…

Premium This card is part of the premium lesson. Unlock
Explanation

20 → Operand Result → 30 oper……

Premium This card is part of the premium lesson. Unlock
Important

Operand Operator வேலை செய்யும……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

10 + 20 10 → Operand 20 → Ope……

Premium This card is part of the premium lesson. Unlock
List

- → Operator…

Premium This card is part of the premium lesson. Unlock
Explanation

Expression: x * y If: x = 10 ……

Premium This card is part of the premium lesson. Unlock

Types of Expressions

Algorithm

1. Arithmetic Expression…

Premium This card is part of the premium lesson. Unlock

Used for mathematical calcula……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

x + y Operators: + - * / % **……

Premium This card is part of the premium lesson. Unlock
Output
Result
Algorithm

1. Relational / Comparison Ex……

Premium This card is part of the premium lesson. Unlock

Used to compare values.…

Premium This card is part of the premium lesson. Unlock
Explanation
Example

10 > 5…

Premium This card is part of the premium lesson. Unlock
Output
Result
Quote
Operators
Quote

=…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Logical Expression…

Premium This card is part of the premium lesson. Unlock

Uses logical operators.…

Premium This card is part of the premium lesson. Unlock
Explanation
Example

10 > 5 and 20 > 10…

Premium This card is part of the premium lesson. Unlock
Output
Result

Operators: and or not…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. String Expression…

Premium This card is part of the premium lesson. Unlock
Explanation
Example

"Hello" + " Python"…

Premium This card is part of the premium lesson. Unlock
Output
Result
Algorithm

1. Function Call Expression…

Premium This card is part of the premium lesson. Unlock
Program
Example
Output
Result
Important

Expression must produce a value. ……

Premium This card is part of the premium lesson. Unlock

Expression Evaluation

Python follows operator prece……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

2 + 3 * 4 Python does multipl……

Premium This card is part of the premium lesson. Unlock
Output
Result
Important

Parentheses can change evalua……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

(2 + 3) * 4 First: 2 + 3 = 5 ……

Premium This card is part of the premium lesson. Unlock
Common Mistake

Students may think: 2 + 3 * 4 is: 5 * 4 =……

Premium This card is part of the premium lesson. Unlock
Memory Trick

Expression: Values + Operator……

Premium This card is part of the premium lesson. Unlock

Definition

Statement என்பது Python execute செய்யும் ஒரு comp……

Premium This card is part of the premium lesson. Unlock
Simple Explanation

Teacher student-க்கு: "Write your name." என்று ஒரு complete instructi……

Premium This card is part of the premium lesson. Unlock
Flow

Statement ↓ Python reads it ↓……

Premium This card is part of the premium lesson. Unlock
Explanation

Some examples: Assignment sta……

Premium This card is part of the premium lesson. Unlock
Syntax
Print/function call statement
Syntax
Import statement
Syntax
Conditional statement

Common Types of Python Statements

Algorithm

1. Assignment Statement…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Expression Statement…

Premium This card is part of the premium lesson. Unlock

A function call can be used a……

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Conditional Statement…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Loop Statement…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Import Statement…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Return Statement…

Premium This card is part of the premium lesson. Unlock

Inside a function: return x…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Break Statement…

Premium This card is part of the premium lesson. Unlock

break Stops a loop.…

Premium This card is part of the premium lesson. Unlock
Algorithm

1. Continue Statement…

Premium This card is part of the premium lesson. Unlock

continue Skips current loop i……

Premium This card is part of the premium lesson. Unlock
Explanation

x = 10 Assignment statement. y = 20 Assignment statement. total = x +……

Premium This card is part of the premium lesson. Unlock
Comparison
Variable vs Expression vs Statement
Comparison

Easy Example total = price * quantity Here: total → Variable pri……

Premium This card is part of the premium lesson. Unlock
Important

இந்த line மிகவும் முக்கியம்: x = ……

Premium This card is part of the premium lesson. Unlock
Important

- → Operator…

Premium This card is part of the premium lesson. Unlock
Important

10 + 20 → Expression x = 10 +……

Premium This card is part of the premium lesson. Unlock
Common Mistake
Error 1

= and == confuse செய்வது…

Premium This card is part of the premium lesson. Unlock
Practice
Assignment

x = 10 Means: 10 value-ஐ x-க்……

Premium This card is part of the premium lesson. Unlock
Comparison

x == 10 Means: x value 10-க்க……

Premium This card is part of the premium lesson. Unlock
Common Mistake
Error 2

Variable name quotes உள்ளே எழ……

Premium This card is part of the premium lesson. Unlock

Because "x" is string. Correc……

Premium This card is part of the premium lesson. Unlock
Common Mistake
Error 3

Undefined Variable Wrong: print(total) without ……

Premium This card is part of the premium lesson. Unlock
Common Mistake
Error 4

Expression and Statement same என்று நினைப்பது Express……

Premium This card is part of the premium lesson. Unlock
Common Mistake
Error 5

Invalid Variable Name Wrong: ……

Premium This card is part of the premium lesson. Unlock
Memory Trick

Variable Variable = Name x Expression Expression = Calculate x + y Statement Stateme……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 1

A variable is a name that ref……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 2

The assignment operator is: =…

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 3

An expression produces a valu……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 4

A statement is a complete ins……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 5

In: x = a + b a + b is an exp……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 6

The complete: x = a + b is an……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 7

Python variable names are cas……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 8

Variable names cannot begin w……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 9

Python keywords cannot normal……

Premium This card is part of the premium lesson. Unlock
TRB Point
TRB Point 10

= means assignment, while == ……

Premium This card is part of the premium lesson. Unlock
Interview Point
Question 1

What is a variable in Python? Answer A variable is a name that……

Premium This card is part of the premium lesson. Unlock
Interview Point
Question 2

What is an expression in Python? Answer An expression is a……

Premium This card is part of the premium lesson. Unlock
Explanation
Example

x + y…

Premium This card is part of the premium lesson. Unlock
Interview Point
Question 3

What is a statement? Answer A statement is a complete instruc……

Premium This card is part of the premium lesson. Unlock
Interview Point
Question 4

What is the difference between = and ==? Answer = is the assignment opera……

Premium This card is part of the premium lesson. Unlock
Interview Point
Question 5

Is x + y an expression or statement? Answe……

Premium This card is part of the premium lesson. Unlock
Interview Point
Question 6

In result = x + y, what is the expression? Answ……

Premium This card is part of the premium lesson. Unlock
MCQ

Which is a valid variable ass……

Premium This card is part of the premium lesson. Unlock
MCQ

Which of the following is an ……

Premium This card is part of the premium lesson. Unlock
MCQ

In: x = 10 + 20 Which is the ……

Premium This card is part of the premium lesson. Unlock
MCQ

What is the value of x? x = 1……

Premium This card is part of the premium lesson. Unlock
MCQ

Which is an invalid variable ……

Premium This card is part of the premium lesson. Unlock
MCQ

What does = represent in Pyth……

Premium This card is part of the premium lesson. Unlock
MCQ

Which operator checks equalit……

Premium This card is part of the premium lesson. Unlock
MCQ

What is the output? x = 5 y =……

Premium This card is part of the premium lesson. Unlock
MCQ

What is the output? x = 10 pr……

Premium This card is part of the premium lesson. Unlock
MCQ

What is the result? 2 + 3 * 4…

Premium This card is part of the premium lesson. Unlock
MCQ 11

Which statement assigns the same value to three variables? A. x,……

Premium This card is part of the premium lesson. Unlock
MCQ

What is the output? a = 10 b ……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 1

Create three variables: name ……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 2

Write an expression to add: 2……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 3

Find the variable, expression, and statement: total = price * quantit……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 4

Find the output: x = 5 y = 2 ……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 5

Find the output: x = 10 x = x……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 6

Correct the invalid variable:……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 7

What is the difference? x = 10 and: x ……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 8

Evaluate: 10 + 2 * 5 Answer: ……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 9

Evaluate: (10 + 2) * 5 Answer……

Premium This card is part of the premium lesson. Unlock
Practice
Practice 10

Write a program using: two variables one a……

Premium This card is part of the premium lesson. Unlock
Program
Example
Summary

Variable என்பது value-ஐ refer செய்யும் பெயர். Variable assignment = operator மூலம் செய்யப்படுகிறது. Python va……

Premium This card is part of the premium lesson. Unlock
Quick Revision

Variable → Name referring to a value x = 10 → Assignment x → Variable 10 → Value = → Assignment operator Expr……

Premium This card is part of the premium lesson. Unlock
Text size
17px
Theme
Contents
Print / PDF
Program