One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| def bubble_sort(numbers:list)->list: | |
| length = len(numbers) | |
| for i in range(length): | |
| for j in range(0,length-i-1): | |
| if numbers[j]>numbers[j+1]: | |
| numbers[j],numbers[j+1] = numbers[j+1],numbers[j] | |
| return numbers |
| public class LargerDemo { | |
| public static int larger(int x, int y) { | |
| if (x > y) { | |
| return x; | |
| } | |
| return y; | |
| } | |
| public static void main(String[] args) { | |
| System.out.println(larger(-5,10)); |
| import heapq | |
| class TopK(object): | |
| def __init__(self, k): | |
| self.k = k | |
| self.heap = [] | |
| def push(self, elem): | |
| if len(self.heap) < self.k: |
| import os | |
| import numpy as np | |
| import pandas as pd | |
| if __name__ == '__main__': | |
| csv_data = pd.read_csv('../resources/areadata/data.csv') | |
| dict_data = csv_data.to_dict(orient='row') | |
| for elem in dict_data: | |
| do_something(elem) | |
| print(dict_data[3]) |
| # django annoate | |
| #single field | |
| SomeModel.objects.values('gender').annotate(Sum('hotdog_number')) | |
| #mutiple fields | |
| SomeModel.objects.values('gender','age').annotate(Sum('hotdog_number')) | |
| """odrder_by is needed | |
| without order_by | |
| [ |
| data = [ | |
| { | |
| 'id': '1', | |
| 'parent': '', | |
| 'children': [ | |
| { | |
| 'id': '2', | |
| 'parent': '1', | |
| 'children': [ | |
| { |
| items = [ | |
| {"id": "1", "parent": ""}, | |
| {"id": "2", "parent": "1"}, | |
| {"id": "3", "parent": "1"}, | |
| {"id": "4", "parent": ""}, | |
| {"id": "5", "parent": "4"}, | |
| {"id": "6", "parent": "4"}, | |
| {"id": "7", "parent": "4"}, | |
| {"id": "8", "parent": "2"}, | |
| {"id": "9", "parent": "8"}, |
| import bcrypt | |
| def get_hashed_password(plain_text_password): | |
| return bcrypt.hashpw(plain_text_password, bcrypt.gensalt()) | |
| def check_password(plain_text_password, hashed_password): | |
| return bcrypt.checkpw(plain_text_password, hashed_password) |
| import decimal | |
| import time | |
| from functools import reduce | |
| import matplotlib.pyplot as plt | |
| import random | |
| # generate scale number | |
| def scale_random_number(scale): |