Best Python code snippet using avocado_python
compare_elf_sizes.py
Source:compare_elf_sizes.py
...48 table = []49 header = ["path", "baseline"]50 for i, _ in enumerate(args.file[1:]):51 header.extend(["%s %d" % (args.field, i + 1), "ratio %d" % (i + 1)])52 def compute_row(name, data, field):53 if not field in data[0]:54 return [0] * len(data)55 baseline = data[0][field]56 row = [name, baseline]57 for f in data[1:]:58 row.extend([f[field], float(f[field]) / baseline if baseline else 0.0])59 return row60 for path in sorted(files.keys()):61 file = files[path]62 if len(file) < 2:63 print("%s not present in every elf_sizes.json" % path, file=sys.stderr)64 continue65 if len(set([f["build_id"] for f in file])) == 1:66 print("%s is unchanged" % path, file=sys.stderr)67 continue68 table.append(compute_row(path, file, args.field))69 table.append(compute_row("TOTAL", totals, args.field))70 print(tabulate(table, headers=header, floatfmt=".3f"))71 return 072if __name__ == "__main__":...
pascal.py
Source:pascal.py
...6 s = "*" + s7 else:8 s = "0" + s9 print(s)10def compute_row(r, j):11 v = 012 if j == 0:13 v = 114 else:15 v = (r[j] + r[j-1]) % 716 r[j] = v17 if j > 0: compute_row(r, j-1)18def main():19 h = 4020 r = list(range(h+1))21 for i in list(range(h)):22 r[i] = 023 compute_row(r, i)24 print_row(r, i)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!