I would like to know how to pass the list of the function "repeat_question" to the function "main". I try with "return name" but it does not happen. In what failure?
def main():
print('escribe algunos nombres y luego presiona enter:')
a = []
repite_pregunta(a)
print('los nombres que escribiste son:')
print (a)
def repite_pregunta (nombre):
nombre = []
re_ingresar = True
while re_ingresar:
nombre.append(input())
if name[-1] == '' :
re_ingresar = False
return nombre
main()
Example of output I would like:
escribe algunos nombres y luego presiona enter:
juan
pepe
rafael
los nombres que escribiste son:
['juan','pepe','rafael']
the ouput with the current code:
escribe algunos nombres y luego presiona enter:
juan
pepe
rafael
los nombres que escribiste son:
[]