Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Problem No 10

Assign Multiple Variables

Easy

6 minute session

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.

Code editor
Loading editor…

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.

03:40 AM

Free preview includes 1 Teach Theory response and 1 AI hint per unlocked preview lesson.