For Python 3.x, use input(). For Python 2.x, use raw_input(). Don't forget you can add a prompt string in your input() call to create one less print statement. input("GUESS THAT NUMBER!").
How do I use raw_input in Python 3? - Stack Overflow
(Only) when importing in debug mode: name 'raw_input' is not defined
python - Raw_Input() Is Not Defined - Stack Overflow
NameError: name 'raw_input' is not defined
I'm making an interactive menu and this problem apear and I don't know how to fix it, can soemeone please tell me how to fix it or tell me another approach for the error not to apear?
def funcion_uno():
print('Esta es la funcion uno')
def funcion_dos():
print('esta es la funcion dos')
if __name__ == '__main__':
salir = False
print('\033[1;32;40m Menu interactivo de Daft Punk')
mensaje = 'Ingrese la opcion deseada: '
menu = { 'a)': funcion_uno , 'b)': funcion_dos }
while not salir:
print('-'*len(mensaje))
print(mensaje)
for opcion, funcion in menu.iteritems():
print(opcion)
respuesta = raw_input('\nOpcion: ').lower()
salir = respueta == 'exit()'
else:
print('Hasta luego')