# recursionerror: maximum recursion depth exceeded while calling a python object

37 views

## Problem:

I am new to python programming and I am little bit bit confused about some things like I wrote a code:

``````def random():
a = random.randint (0, x+1)

b = random.randint (0, y+1)

c = random.randint (0, z+1)

outer_function(a,b,c)

if outer_function(a,b,c) is True:
Break

if outer_function(a,b,c) is False:
random()``````

which gives me following error:

``````RuntimeError: maximum recursion depth exceeded while calling a Python object
IndentationError: expected an indented block``````

I am confused about those things, why is this error shown to me ?

In your program tou are using randint function but you did not import it .

So you should write something like:

``Import random``

or

``from random import randint``

So your code should be like:

``````import random

def random():

a = random.randint (0, x+1)

b = random.randint (0, y+1)

c = random.randint (0, z+1)

outer_function(a,b,c)

if outer_function(a,b,c) is True:
break

if outer_function(a,b,c) is False:
random()``````

or

``````from random import randint

def random():

a = random.randint (0, x+1)

b = random.randint (0, y+1)

c = random.randint (0, z+1)

outer_function(a,b,c)

if outer_function(a,b,c) is True:
break

if outer_function(a,b,c) is False:
random()``````

Happy coding

## Related questions

44 views
Problem : I am trying to write my first program in Vpython and I have to make the simulation of mixing two gases. First I had the problem with borders, but now when my balls(that represents a gas particles) stay within a border there is the sth different wrong. ... ) for j in range(0,len(self.listOfBalls)): self.listOfBalls[j].pos=poruszanie(self.listOfBalls,self.listOfBalls[j].pos,self.numCell,0)
482 views
Problem : I am getting below error maximum recursion depth exceeded while calling a python object