Accessing values defined inside functions

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

When you post code within these discussions, please be sure to format it, so that important details such as indentation are displayed properly. One way to do this is to place lines of three back ticks before and after the code, as follows:


```
# example code
for i in range(10):
    print("Hello World!")
```

There is also a </> button at the top of the editing window for formatting code, after it has been selected.

Have you considered either declaring the variables global or making their values available outside the functions via return statements? If you would like to return multiple values, you can enclose them within a tuple.

We hope you enjoy the discussions here. You might be interested in taking a look at the following pages:

EDIT (February 19, 2022):

To return values in a tuple, you can use this as a final statement in the s1s2hklBaye function:

  return s1hklBaye, s2hklBaye

Then, outside the function, you can assign the returned values to variables, as follows:

s1Baye, s2Baye = s1s2hklBaye(1,1,0)