def __init__(self): self.__exitProgram = False self.__exitMenu = False print( "Bienvenido a Radio Streamer.\n" "Copyright ©2019. All rights reserved. Julián Software Foundation.\n" ) functions = Methods() while not self.__exitProgram: while not self.__exitMenu: try: print("Menú Principal.\nSeleccione una acción:") numMenu = int( input( "\t1. Elegir emisora para reproducir\n" "\t2. Mostrar lista de emisoras disponibles\n" "\t3. Mostrar lista de emisoras detallada, con sus links\n" "\t4. Agregar emisora\n\t5. Eliminar emisora\n\t6. Salir del programa\n" "Su elección: ")) if numMenu == 1: functions.selectRadio() elif numMenu == 2: functions.showRadios() elif numMenu == 3: functions.showDetailedRadios() elif numMenu == 4: functions.addRadio() elif numMenu == 5: functions.deleteRadio() elif numMenu == 6: self.__exitProgram = True self.__exitMenu = True print("\nPrograma cerrado con éxito, ¡Hasta luego!") else: print( "\nError, opción no existente. Por favor elija una opción válida.\n" ) self.__exitMenu = False except: print( "\nError, opción no existente. Por favor elija una opción válida.\n" ) self.__exitMenu = False pass
def test_search(self): # get the returned values from search() in Methods class list_res = Methods().search() # turn the resultproxy (var self.result in search() ) object into a dictionary called dict_res1 i = 0 dict_res1 = {} for _r in list_res[0]: dict_res1[i] = _r i += 1 # compared the values in the dict_res1 with var self.res in search() under the same key s = 0 while s < i: for key, val in list_res[1]: self.assertEqual(val, dict_res1[i][key]) s += 1
import sqlite3 import Student import Methods methods = Methods.Methods() while True: print("""Press (a) to display all students Press (b) to create a new student Press (c) to update an existing student Press (d) to delete a student Press (e) to query students Press (q) to quit""") command = raw_input("Enter your decision: ") if command == "a": methods.print_all() elif command == "b": methods.create_student() elif command == "c": methods.update_student() elif command == "d": methods.delete_student() elif command == "e": methods.query() elif command == "q": print("Exiting program...")
#Imports from Methods import * import numpy as np #Variables S = 1.0 #[n/cm2/s] SigmaT = 1.0 #[cm-1] SigmaS = 0.5 #[cm-1] length = 50.0 #[cm] n = 200 delta = length / n #Iterations mesh = np.linspace(0, length, n + 1) Q = np.zeros(len(mesh)) phi = np.zeros(len(mesh)) psi1 = np.zeros(len(mesh)) psi2 = np.zeros(len(mesh)) psi3 = np.zeros(len(mesh)) psi4 = np.zeros(len(mesh)) # print(delta) # print(mesh) M = Methods() phi[:] = 1 M.step(S, SigmaT, SigmaS, mesh, delta, Q, phi, psi1, psi2, psi3, psi4) # M.charac() M.diamond(S, SigmaT, SigmaS, mesh, delta, Q, phi, psi1, psi2, psi3, psi4) # M.linear_discont()