Coding with AI

Code Faster. Think Smarter. Ship Better—with AI.

Stop fighting boilerplate and busywork. Coding with AI shows professional Python developers how to use AI tools to accelerate design, coding, testing, debugging, and documentation—without sacrificing quality or control. Learn proven prompts, real workflows, and practical techniques you’ll use on the job every day.

Explore the book ->


Python Programming Basics - Passing a List to a Function

When we talk about functions, we usually pass arguments (variables) into them. But what if you need to pass multiple values? You can use a list. Here’s how to do it. …

Updated November 19, 2023

When we talk about functions, we usually pass arguments (variables) into them. But what if you need to pass multiple values? You can use a list. Here’s how to do it.

# defining the function
def greetings(names):
    for name in names:
        print("Hello, " + name)

# calling the function with a list of names
greetings(['Alice', 'Bob', 'Charlie'])

In this code, we’re passing a list [‘Alice’, ‘Bob’, ‘Charlie’] to the greetings() function.

The function will then print out “Hello, Alice”, “Hello, Bob”, and “Hello, Charlie”. This is a simple demonstration of how you can pass multiple values to a function in Python using a list.

Remember that lists are very versatile in Python, they can hold different kinds of data types (integers, strings, etc.) which makes them perfect for passing to functions when working with complex problems or collections of data.

Coding with AI

AI Is Changing Software Development. This Is How Pros Use It.

Written for working developers, Coding with AI goes beyond hype to show how AI fits into real production workflows. Learn how to integrate AI into Python projects, avoid hallucinations, refactor safely, generate tests and docs, and reclaim hours of development time—using techniques tested in real-world projects.

Explore the book ->