Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Functions, Packing, and Unpacking Packing and Unpacking Packing

Fradely Dilone
Fradely Dilone
23,549 Points

The result of the tuple is not as in the video on the cli

Code-------- def my_function(*args): for val in args: print(args)

my_function("Hello", "I", "love", "python")

CLI result

python3 functions.py
('Hello', 'I', 'love', 'python')
('Hello', 'I', 'love', 'python')
('Hello', 'I', 'love', 'python')
('Hello', 'I', 'love', 'python')

on the video is

Hello I love python

1 Answer

Ah, don't worry this is a really easy thing to miss. You're function loops through each argument in all arguments. You're currently printing all arguments instead of each argument.

I hope that makes sense. I'm trying to stop short of just giving you the answer, because it always seems to click better when I figure it out, but let me know if it's still confusing.