Kit Library / Computer Science / Programming Fundamentals

⚡ Topic Learning Kit

Python Fundamentals: Character Set, Tokens, Variables & Data Types

English 19 leveled MCQs 25 flashcards 9 games Free

Shared by a Veda learner · Generated with Veda AI

Veda Bites

The whole idea, one bite at a time

Veda Bites are swipeable micro-lessons — each one teaches exactly one idea. The bites below come from this kit — swipe through them in the app.

💡 Key Idea

Python Code = Character Set → Tokens → Statements

Every Python program is built from these 3 layers.

Python code is constructed hierarchically: the character set provides valid characters, tokens are the smallest meaningful units, and statements are built from tokens.

↳ Mastering tokens is the key to understanding Python syntax.

📖 Definition

What Is a Character Set?

Python only recognizes these characters.

↳ Any character outside the Python character set is invalid in source code.

📖 Definition

What Is a Token?

Tokens are Python's smallest meaningful units.

↳ Every Python statement is a sequence of tokens.

⭐ Important Fact

Python Has 35 Keywords

35 reserved words you cannot use as names.

Python has exactly 35 keywords — all lowercase except `False`, `True`, and `None`.

↳ Using a keyword as a variable name causes a syntax error.

⚖️ Comparison

Keywords vs Identifiers

One is reserved, the other is yours to name.

↳ Keywords are fixed; identifiers are user-defined and must follow naming rules.

⚙️ Process

Rules for Naming Identifiers

Break these rules and Python throws an error.

↳ Valid identifiers: myVar, _count, Ab123. Invalid: 1var, my-var, for.

⚠️ Common Mistake

Identifiers Cannot Start with a Digit

1var is invalid — here's why.

↳ Digits are allowed inside identifiers, just not as the first character.

📖 Definition

What Is a Literal?

Literals are the fixed values in your code.

↳ In `a = 10`, the value `10` is a numeric literal.

⭐ Important Fact

Three Types of Integer Literals

Python integers come in 3 flavors.

↳ Integer literals can be written in decimal, octal, or hexadecimal notation.

📖 Definition

What Is a Variable?

A variable is a labeled box in memory.

Think of a variable as a container with a label (the name) and contents (the value).

↳ Variables let programs store, retrieve, and update data during execution.

⚙️ Process

How to Assign Values to Variables

Python creates variables on first assignment.

↳ Python declares and initializes variables in a single assignment statement.

⭐ Important Fact

Multiple Assignments in One Line

Assign many variables in one statement.

↳ Python supports chained and unpacked assignments for concise code.

⚠️ Common Mistake

Python Is Case-Sensitive

Name and name are two different variables.

↳ Case-sensitivity is a common source of bugs for beginners.

📖 Definition

What Is an Operator?

Operators act on operands to produce results.

↳ Operators are the verbs of programming — they do things to values.

📖 Definition

What Are Punctuators?

Punctuators structure your Python code.

↳ Punctuators give structure to code — they don't perform operations.

🎯 Exam Tip

Exam Tip: Valid vs Invalid Identifiers

Spot the invalid name in seconds.

↳ Check the first character and keyword status — that catches most invalid identifiers.

🧠 Memory Trick

Remember the 5 Token Types

KILOP — five tokens, one acronym.

Use KILOP to recall the 5 Python token types:

↳ KILOP = Keywords, Identifiers, Literals, Operators, Punctuators.

Smart notes

What you'll study, topic by topic

1

Python Fundamentals: Character Set, Tokens, Variables & Data Types

15 min

This topic introduces the foundational building blocks of Python: the character set (valid characters), tokens (smallest units like keywords, identifiers, literals, operators, punctuators), variables (named memory locati…

  • A character set is the set of valid characters a language recognises.
  • The Python character set has five families: letters, digits, special symbols, white spaces, and other characters (ASCII/UNICODE).
  • Letters in the character set are A–Z and a–z.

Full explanation, worked examples & memory tricks in the app

Leveled MCQ practice

Try the smart MCQs from this kit

All 19 questions, laddered from warm-up to topper-level, each with its answer and the reasoning behind it.

Warm-up · 8 questions

Q1. Which of the following best defines the Python character set?

Beginner
A The set of valid characters Python recognises
B The symbols used only in comments
C The list of all keywords in Python
D The rules for naming variables

Answers and explanations are in the Veda app.

Q2. Which of these is NOT one of the five families of the Python character set?

Beginner
A Digits
B Letters
C White spaces
D Operators

Answers and explanations are in the Veda app.

Q3. What is the smallest individual unit in a Python program called?

Beginner
A Character
B Expression
C Token
D Statement

Answers and explanations are in the Veda app.

Q4. How many keywords does Python have?

Beginner
A 35
B 30
C 25
D 40

Answers and explanations are in the Veda app.

Q5. Which of these is a valid identifier in Python?

Beginner
A _value
B for
C my-var
D 123ab

Answers and explanations are in the Veda app.

Q6. In the expression 3 + 5 = 8, what is the operator?

Beginner
A 8
B 3
C 5
D +

Answers and explanations are in the Veda app.

Q7. Which of the following is a punctuator in Python?

Beginner
A and
B :
C True
D +

Answers and explanations are in the Veda app.

Q8. Python has 35 keywords, all lowercase except False, True and None.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 7 questions

Q9. A student writes: x = 10. What is x in this statement?

Intermediate
A An identifier and a variable name
B A keyword
C A literal
D A punctuator

Answers and explanations are in the Veda app.

Q10. Which statement about Python keywords is correct?

Intermediate
A There are 25 keywords in Python
B Keywords are user-defined names
C All keywords are lowercase except False, True and None
D Keywords can be used as variable names if capitalised

Answers and explanations are in the Veda app.

Q11. Which of these is a literal?

Intermediate
A =
B if
C age
D "Hello"

Answers and explanations are in the Veda app.

Q12. What happens when you type help() and then keywords in the Python shell?

Intermediate
A It lists all punctuators
B It lists all operators
C It lists all Python keywords
D It lists all identifiers in your program

Answers and explanations are in the Veda app.

Q13. Which of the following correctly assigns the same value to two variables?

Intermediate
A x == y == 5
B x, y = 5
C x + y = 5
D x = y = 5

Answers and explanations are in the Veda app.

Q14. A programmer names a variable myVariable. Another writes myvariable. What is true?

Intermediate
A Both are keywords
B Both are invalid identifiers
C They are two distinct variables because Python is case-sensitive
D They refer to the same variable

Answers and explanations are in the Veda app.

Q15. Which of these is NOT a valid identifier?

Intermediate
A ab123
B _123
C 123ab
D A_1

Answers and explanations are in the Veda app.

Topper level · 4 questions

Q16. Which statement best explains why keywords cannot be used as variable names?

Advanced
A They are reserved with fixed meaning, so using them would make code ambiguous
B They contain special characters
C They are too short to be useful names
D They are always uppercase

Answers and explanations are in the Veda app.

Q17. Given the variable assignment `x = 5 + 3`, identify the tokens in this statement and classify them correctly. Which combination of tokens is accurate?

Advanced
A Operator: `=`, Identifier: `x`, Literal: `3`, Operator: `+`, Literal: `5`
B Identifier: `x`, Operator: `=`, Literal: `5`, Operator: `+`, Literal: `3`
C Identifier: `x`, Operator: `+`, Literal: `5`, Operator: `=`, Literal: `3`
D Literal: `5`, Operator: `=`, Identifier: `x`, Operator: `+`, Literal: `3`

Answers and explanations are in the Veda app.

Q18. Evaluate the following variable assignments: `a = 10`, `b = 20`, `c = a + b`. What will be the data type of `c` after these assignments?

Advanced
A NoneType
B Integer
C String
D Float

Answers and explanations are in the Veda app.

Q19. If you attempt to use a keyword as a variable name in Python, what will be the outcome? Analyze the following code snippet: `if = 10`.

Advanced
A The code will execute and assign 10 to `if`.
B The variable `if` will be created but will not hold any value.
C A SyntaxError will be raised.
D The code will execute but `if` will be ignored.

Answers and explanations are in the Veda app.

Flashcards

Tap a card to flip it

25 flashcards in this kit — the app reviews them with spaced repetition so the right card returns on the right day.

Learning games

Play your way through this kit

Every game is built from this kit's own content — scores feed your mastery, so playing counts as studying.

🎮

Word Match

Built from this kit's own content

🎮

True False

Built from this kit's own content

🎮

Memory Match

Built from this kit's own content

🎮

Flashcard Battle

Built from this kit's own content

🎮

Speed Quiz

Built from this kit's own content

🎮

Guess Term

Built from this kit's own content

🎮

Sequence Builder

Built from this kit's own content

🎮

Categorization

Built from this kit's own content

🎮

Revision Battle

Built from this kit's own content

Playable in the app

Study it properly — free, in the app

The full Veda Bites deck, complete notes, spaced-repetition flashcards, leveled MCQs, tests and games for this kit — plus Daily Facts and the Arena, every day.