-1
I’m making a program to calculate a certain time, with a probability of something happening and going wrong, but I’m getting
Nameerror: name 'tempo_ida' is not defined
variable h is defined as 0.
and then the error occurs in that part of the code
tempo_ida[h] = (random.randrange(3600, 18000) / prob_capC ) # calcula-se
tempo_ida[h] = random.randrange(3600, 18000)
tempo = tempo_ida[h]
how do I fix it?
Hello, try to take a look here
– William Teixeira
When you do
tempo_ida[h] = ...
, you are already trying to access the variabletempo_ida
in position[h]
, but the variable was probably not set before. Hence the error that the variable was not set.– AlexCiuffa
then, I had already put h = 0, before this time_ida[h] of the post, in case I would have to put before something like time_ida = 0 too?
– PrismaticSun