Lesson guide
What this Python exercise practices
Assign Multiple Variables is a beginner practice lesson that focuses on functions, parameters, return values. It is designed to be solved in about 6 minutes with examples, starter code, and test feedback.
Prerequisites
- Python variables
- Function parameters
- Return values
Difficulty and time
- Level
- Beginner
- Estimated time
- 6 minutes
Related public exercises
Summary
Use a single assignment statement to bind multiple variables at once. Practice tuple unpacking and returning multiple values.
Problem statement
Given three input values, assign them to variables a, b, and c using one multiple-assignment statement (e.g., a, b, c = ...). Return the three variables as a tuple (a, b, c). The goal is to practice assigning multiple variables on a single line.
Task
Learn how to assign several variables in one line using multiple assignment and return them as a tuple.
Examples
Assign three integers
Input
assign_multiple(1, 2, 3)
Output
(1, 2, 3)
Explanation
All three inputs are assigned to a, b, c in one line and returned as a tuple.
Input format
A function call assign_multiple(x, y, z) with three values.
Output format
Return a tuple (a, b, c) containing the three assigned values.
Constraints
Inputs can be any valid Python values (numbers, strings, lists, None, etc.). Keep the assignment to a single multiple-assignment statement.
Samples
Sample input 0
assign_multiple('a', 'b', 'c')
Sample output 0
('a', 'b', 'c')
Explanation 0
Strings are assigned and returned in the same order.
AI assistant
Ask me anything!
Need help? I can explain the core idea behind this problem, review your current code, and give targeted hints. Use “Teach Theory” for the concept, “Get AI hint” for a quick scaffold nudge, or ask a specific question below.
Chat history is temporary and will not be saved.
Free preview includes 1 Teach Theory response and 1 AI hint per unlocked preview lesson.