Hello, I would like to be able to instantiate the class Sala
below using as arguments the return of the choose_sala()
function:
The ideal would be to call on the return of the function the initialization of class Sala
, but I did not succeed so far.
The simplified example follows:
Python 3
class Sala:
def __init__(self, ano, turma):
self.ano = ano
self.turma = turma
print(" Sala Escolhida foi... ")
def say_hello:
print("Hello!")
r1 = [] # desnecessário!
def choose_sala():
r1 = ['8A']
r1 = "".join(r1)
print(r1)
print(r1[0], " ", r1[1]) #para poder usar casa letra separadamente, não deu certo usando a lista normal.
return r1
I wish I could use:
a = Sala(choose_sala())
a.say_hello() # teste da classe