• Register
0 votes
49 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 ?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

0 votes

Answer:

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

11 6 4
34,950 points

Related questions

0 votes
1 answer 49 views
49 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)
asked Jan 23, 2020 jwilliam 3.9k points
0 votes
3 answers 573 views
573 views
Problem : I am getting below error maximum recursion depth exceeded while calling a python object
asked Oct 21, 2019 peterlaw 6.9k points
0 votes
1 answer 1.9K views
1.9K views
Problem : I had to remove a +CompatEnvVars from following : SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire As it said it was an invalid command or something. So having removed that and following a instructions to a nail it get below error: ... maximum permissible length. (Error code: ssl_error_rx_record_too_long) I am very new to SSL, any advice on what is going wrong?
asked Jan 17, 2020 jwilliam 3.9k points
0 votes
1 answer 3 views
3 views
Problem Hey, I need help from you. Is there any way to call python from java. I mean how can we run a python program from java.
asked 3 days ago chris jordan 2.2k points
0 votes
2 answers 1.1K views
1.1K views
Problem : I am new to Py 3.5. This code was working properly in Python 2.7: with open(fname, 'rb') as f: lines = [x.strip() for x in f.readlines()] for line in lines: tmp = line.strip().lower() if 'some-pattern' in tmp: continue # ... code After upgrading to 3.5, I'm getting the: TypeError: a bytes-like object is required, not 'str'
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
1 answer 18 views
18 views
Problem I am building an application using PHP 7.2. One of its features is ability to upload files, which are stored on the server but for some files I am getting: file size exceeded the maximum size permitted I get this error message for the files, which are larger than 2M. It ... ! I guess it is related to some php.ini black magic, but I am new in php, what should I do to resolve this issue?
asked Nov 12, 2020 alexh 2.2k points
0 votes
1 answer 34 views
34 views
Problem: I have fundamental knowledge in PHP. Now days I keep getting this PHP error: Fatal error: Maximum execution time of 300 seconds exceeded. I have already tried setting up my max_execution_time and also my max_input_time settings in the php.ini for ... max_input_time settings to five seconds and then my script will run way beyond the five seconds before again face the same above error.
asked Aug 3, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 40 views
40 views
Problem : I am very new to XAMPP, MYSQL and phpMyAdmin. I have the MYSQL table which contains nearly the 7 million records. When I try to access the big table from my phpMyAdmin I always face below error: Fatal error: Maximum execution time of 30 seconds ... a maximum execution time to the maximum possible value. I am very confused about this error so looking for help on this XAMPP error.
asked May 18, 2020 Martin K 6.6k points
0 votes
1 answer 40 views
40 views
I'm trying to create an application in Python 3.2 and I use tabs all the time for indentation, but even the editor changes some of them into spaces and then print out "inconsistent use of tabs and spaces in indentation" when I try to run the program. How can I change the spaces into ... tyvärr, du är för ung, prova något annat") return 0 elif self.alder >= 10: print("Gå in om du törs!") print(" ")
asked Oct 25, 2020 psandprop 2.4k points
0 votes
2 answers 42 views
42 views
1 I am unable to install Python 3.6 on Windows 7 Professional Edition 32 bits the install dialog points me to the log file whose content is as follows: [1398:1318][2018-05-30T01:15:25]i001: Burn v3.10.3.3007, Windows v6.1 (Build 7600: Service Pack 0), ... 1 is required to continue installation How can I solve this error ? Should I install a different version of Windows in order to make this work ?
asked Oct 24, 2020 psandprop 2.4k points