Python 3D range setting question

Asked 2 years ago, Updated 2 years ago, 25 views

Hello, I'm a student studying Python I have a question about setting the Python 3D range. For example, you want to set a three-dimensional range using a for statement.

When the default value of xyz coordinates is set to (0,0,0),

If you do (x+A, y+A, z+A), you get an error.

I'll divide it into three parts (x+A, y, z) (x, y+A,z) When you write (x, y, z+A), only one-dimensional (linearly) x-axis, y-axis, or z-axis is scoped (ex.(0,0,0) to (0,0,0) or (0,2,0), (0,0,0), (0,0) to (0,0,3)

Is there a code that can set the three-dimensional range of all xyz, such as (0,0,0) through (10,10,10), or I don't know if I'm using the wrong code.

python

2022-09-20 08:57

1 Answers

3 Since it's a dimension... If you write for 3 It should work

for x in range(10 + 1) :
    for y in range(10 + 1) :
        for z in range(10 + 1) :
            print((x, y, z))


2022-09-20 08:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.