Loop within function

I’m having an issue when trying to create a function that calculates the elements of an array. I want to create an Array 10x6 and every element (ai) is calculated by the same function only the parameters change.
My parameters are Xi, Yi, Zi and each one of them can take 6 different values (that are known to me)
I have written this so far:
Def myfunction(Xi,Yi,Zi):
ai=Xi+Yi+Zi
For i in range(0,6):
Xi=X1
Yi=Y1
Zi=Z1
Print(ai)
(Let’s say X1=1, Y1=2, Z1=0, I just don’t know how to calculate every single a1-a60 with different Xi, Yi, Zi)
Can someone please help?

Hello, @athpa, and welcome to Python Software Foundation Discourse!

When you post code, please format it correctly for posting, so that essential details such as indentation, quote marks, and other features are displayed properly. The code that you posted is not formatted, and therefore, is difficult to understand. One technique for formatting code is to place lines (fences) of three back ticks before and after the code, as follows:

```
# This is example code.
print("Hello, World!")
```

Note that there is also a </> button at the top of the editing window that will format code, after that code has been selected.

Python is case-sensitive. For example, this will not work:

For i in range(0,6):

Instead, you need:

for i in range(0,6):

You might be interested in visiting the following pages, in order to learn more about this forum:

Quercus has mentioned surrounding your code (in posts) with triple
backticks. I think something is also capitalising your first letter.

It appears to me that your for-loop is contained inside your function?

How do you get 60 values? 6 I can imagine (0 through 5). 6x6x6 I can
imagine (0 through 5 for each of Xi, Yi, Zi). It is not clear to
me how you get 10 x 6 combinations?

Here’s a loop which does the 6 x 6 x 6 version:

 for Xi in range(6):
     for Yi in range(6):
         for Zi in range(6):
             print("Xi =", Xi, "Yi =", Yi, "Zi =", Zi)
             ai = Xi + Yi + Zi
             print("ai =", ai)

It does not call a function or store the values in an array. Without
knowing where your 6x10 arrangement comes from, it is hard to write the
code to store values in an array of your desired shape.

Cheers,
Cameron Simpson cs@cskk.id.au