def processa(exs_a_rodar): BA = nx.barabasi_albert_graph(N_redes, K_medio) ER = nx.erdos_renyi_graph(N_redes, K_medio / N_redes) if 1 in exs_a_rodar: ex1(BA, ER) if 2 in exs_a_rodar: ex2(BA, ER) if 3 in exs_a_rodar: ex3(BA, ER) if 4 in exs_a_rodar: ex4(BA, ER) if 5 in exs_a_rodar: ex5(BA)
def ex2(): x = 1.0 u = ex1.ex1() y = u z = u string_ret = 'Asocitativitatea este:' a = ((x + y) + z == x + (y + z)) string_ret = string_ret + ' ' + str(a) + '<br>' while (x * y) * z == x * (y * z): x = random.uniform(0, 1.0) y = random.uniform(0, 1.0) z = random.uniform(0, 1.0) string_ret = string_ret + '<br> Valori pentru care inmultirea nu este asociativa: ' + '<br>' + str( x) + ' ' + str(y) + ' ' + str(z) return string_ret
from astrometry.util.file import * if __name__ == '__main__': if False: from matplotlib.cm import register_cmap _antigray_data = { 'red': ((0., 1, 1), (1., 0, 0)), 'green': ((0., 1, 1), (1., 0, 0)), 'blue': ((0., 1, 1), (1., 0, 0)) } register_cmap(name='gist_yarg', data=_antigray_data) bpa = dict(axes_labelsize=14, text_fontsize=12) ex1(plotfilename='ex1.pdf', bovyprintargs=bpa) ex1(exclude=[], plotfilename='ex2.pdf', bovyprintargs=bpa) ex3(plotfilename='ex3.pdf', bovyprintargs=bpa) sd1 = None pfn1 = 'sd1.pickle' if os.path.exists(pfn1): print 'Reading sample data from', pfn1 sd1 = unpickle_from_file(pfn1) sd2 = None pfn2 = 'sd2.pickle' if os.path.exists(pfn2): print 'Reading sample data from', pfn2 sd2 = unpickle_from_file(pfn2)
from astrometry.util.file import * if __name__ == '__main__': if False: from matplotlib.cm import register_cmap _antigray_data = {'red': ((0., 1, 1), (1., 0, 0)), 'green': ((0., 1, 1), (1., 0, 0)), 'blue': ((0., 1, 1), (1., 0, 0))} register_cmap(name='gist_yarg', data=_antigray_data) bpa = dict(axes_labelsize=14, text_fontsize=12) ex1(plotfilename='ex1.pdf', bovyprintargs=bpa) ex1(exclude=[], plotfilename='ex2.pdf', bovyprintargs=bpa) ex3(plotfilename='ex3.pdf', bovyprintargs=bpa) sd1 = None pfn1 = 'sd1.pickle' if os.path.exists(pfn1): print 'Reading sample data from', pfn1 sd1 = unpickle_from_file(pfn1) sd2 = None pfn2 = 'sd2.pickle' if os.path.exists(pfn2): print 'Reading sample data from', pfn2 sd2 = unpickle_from_file(pfn2)
def main(): ex1(r"files\analitics.xlsx", r"files\result1.xlsx") ex2(r"files\result1.xlsx", r"files\result2.xlsx") ex3(r"files\result1.xlsx", r"files\result3.xlsx") ex4(r"files\analitics.xlsx", r"files\result4.xlsx") ex5(r"files\analitics.xlsx", r"files\result5.xlsx")
""" Unit testing for exercises in Python. """ from ex1 import ex1 from ex2 import ex2 # from ex3 import ex3 # from ex4 import ex4 # from ex5 import ex5 # from ex6 import ex6 # from ex7 import ex7 # from ex8 import ex8 # from ex9 import ex9 ex1 = ex1() print('\nEXERCISE 1:') print('===========') ex1.test() print('\n') ex2 = ex2() print('EXERCISE 2:') print('===========') ex2.test() print('\n') print('EXERCISE 3:') print('===========') print('\n') print('EXERCISE 4:') print('===========')