I am a beginner in programming and I have the following situation:
-
I have a class called TEST. Within this class has the RANDOM function.
-
I have a second class called CHECK. Within this class you have the CHECK function.
-
I want the output of the TEST function to be used in the VERIFY function.
-
In the code below every time I run the VERIFY function, it calls the TEST function again. This brings me to a new value.
-
How do I REUSE the output of the TEST function?
=========
import random
class teste():
def __init__(self, x = 0):
self.x = x
def aleatorio(self):
a = random.randint(0,100)
return a
class verificar():
def __init__(self, y = 0):
self.y = y
def verifica(self):
b = teste().aleatorio()
return b
print (teste().aleatorio())
print (verificar().verifica())
==========
In advance, I thank everyone for their willingness to help.