Best Python code snippet using locust
task3_plotter.py
Source:task3_plotter.py
1import os2import json3import matplotlib.pyplot as plt4def file_reader():5 epoch_list = [0, 0.33, 0.66, 1]6 file1 = open("task3_test_acc.txt", "r")7 task3_test_acc = json.load(file1)8 file1.close()9 file2 = open("task3_train_acc.txt", "r")10 task3_train_acc = json.load(file2)11 file2.close()12 file3 = open("task3_val_acc.txt", "r")13 task3_val_acc = json.load(file3)14 file3.close()15 file4 = open("task3_test_loss.txt", "r")16 task3_test_loss = json.load(file4)17 file4.close()18 file5 = open("task3_train_loss.txt", "r")19 task3_train_loss = json.load(file5)20 file5.close()21 file6 = open("task3_val_loss.txt", "r")22 task3_val_loss = json.load(file6)23 file6.close()24 return task3_test_acc, task3_val_acc, task3_train_acc, task3_test_loss, task3_val_loss, task3_train_loss25if __name__ == "__main__":26 epoch_list = [0, 0.33, 0.66, 1]27 file1 = open("task3_test_acc.txt", "r")28 task3_test_acc = json.load(file1)29 file1.close()30 file2 = open("task3_train_acc.txt", "r")31 task3_train_acc = json.load(file2)32 file2.close()33 file3 = open("task3_val_acc.txt", "r")34 task3_val_acc = json.load(file3)35 file3.close()36 file4 = open("task3_test_loss.txt", "r")37 task3_test_loss = json.load(file4)38 file4.close()39 file5 = open("task3_train_loss.txt", "r")40 task3_train_loss = json.load(file5)41 file5.close()42 file6 = open("task3_val_loss.txt", "r")43 task3_val_loss = json.load(file6)44 file6.close()45 os.makedirs("plots", exist_ok=True)46 # Save plots and show them47 plt.figure(figsize=(12, 8))48 plt.title("Cross Entropy Loss")49 plt.plot(epoch_list, task3_val_loss, label="Validation loss")50 plt.plot(epoch_list, task3_train_loss, label="Training loss")51 plt.plot(epoch_list, task3_test_loss, label="Testing Loss")52 plt.legend()53 plt.savefig(os.path.join("plots", "final_loss.png"))54 plt.show()55 plt.figure(figsize=(12, 8))56 plt.title("Accuracy")57 plt.plot(epoch_list, task3_val_acc, label="Validation Accuracy")58 plt.plot(epoch_list, task3_train_acc, label="Training Accuracy")59 plt.plot(epoch_list, task3_test_acc, label="Testing Accuracy")60 plt.legend()61 plt.savefig(os.path.join("plots", "final_accuracy.png"))...
Технологии виртуальной, дополненной и смешанной реальности.py
Source:Технологии виртуальной, дополненной и смешанной реальности.py
1#ÐÐ»Ñ Ð·Ð°Ð´Ð°Ð½Ð¸Ñ 1:2coord_1 = "97 2 74" # ÐооÑдинаÑÑ3radius_1 = 24 # РадиÑÑ45#ÐÐ»Ñ Ð·Ð°Ð´Ð°Ð½Ð¸Ñ 2:6coord_2 = "33 71 71" # ÐооÑдинаÑÑ7radius_2 = 36 # РадиÑÑ8height_2 = 15 # ÐÑÑоÑа9color_2 = "#3b05e3" # ЦвеÑ1011#ÐÐ»Ñ Ð·Ð°Ð´Ð°Ð½Ð¸Ñ 3:12width = 116 # ШиÑина13height = 22 # ÐÑÑоÑа14depth = 10 # ÐлÑбина15indent = 7 # ÐÑÑÑÑп (... ближайÑего ÑебÑа паÑаллелепипеда ÑоÑÑавлÑл ...)16ledge = 3.8 # ÐÑÑÑÑп (... гÑани паÑаллелепипеда и вÑÑÑÑпало на ...)1718192021#ÐиÑего не ÑÑогай ниже!!!22print('УпÑажнение 1:')23print('<a-sphere position="'+ coord_1 + '" radius="' + str(radius_1) + '"></a-sphere>' + '\n')24print('УпÑажнение 2:')25print('<a-cylinder position="' + coord_2 + '" radius="' + str(radius_2) + '" height="' + str(height_2) + '" color="' + color_2 + '"></a-cylinder>' + '\n')26print('УпÑажнение 3:')27task3_1_1 = (width - 4 * indent) / 428task3_1_2 = (height - 2 * indent) / 229if (task3_1_1 > task3_1_2):30 task3_1 = task3_1_231else:32 task3_1 = task3_1_133task3_2 = depth + ledge34task3_3_1 = width / 435task3_3_2 = ledge / 236if (task3_1 % 1 == 0):37 task3_1 = int(task3_1)38if (task3_2 % 1 == 0):39 task3_2 = int(task3_2)40if (task3_3_1 % 1 == 0):41 task3_3_1 = int(task3_3_1)42if (task3_3_2 % 1 == 0):43 task3_3_2 = int(task3_3_2)44print(task3_1)45print(task3_2)46print('<a-cylinder position="' + str(task3_3_1) + ' 0 ' + str(task3_3_2) + '" radius="' + str(task3_1) + '" height="' + str(task3_2) + '" color="#FFC65D" rotation="90 0 0"></a-cylinder>')
...
slove.py
Source:slove.py
...28 variant2_task3 = dbworker.get_task_value(user_id, 'variant2_task3')29 lvl_1_task3 = dbworker.get_task_value(user_id, 'lvl_1_task3')30 lvl_2_task3 = dbworker.get_task_value(user_id, 'lvl_2_task3')31 worksheet = workbook.add_worksheet('Ðадание 3')32 tasks.task3(worksheet, dataset_task3, variant1_task3, variant2_task3, lvl_1_task3, lvl_2_task3)33 # close workbook file...
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!!