blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
44dae8bb6e4004e76a2b7c96a8b12ff2dd961b7f
Python
atrox3d/python-corey-schafer-tutorials
/03-python practical examples/07-advanced logging.py
UTF-8
5,791
3.234375
3
[]
no_license
# # https://youtu.be/jxmzY9soFXg # ######################################################################################################### # DEBUG: Detailed information, typically of interest only when diagnosing problems. # INFO: Confirmation that things are working as expected. # WARNING: An indication that somet...
true
25e6a6637fb4c1c54d3365ff5a462e8dc1700a18
Python
vilus/learning_telegram
/weather/tests/test_parser.py
UTF-8
779
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- import pytest from ..demultiplexer import get_weather_location, check_params def test_get_weather_location(): params = {'message': {'text': '/say Bangkok weather: {0}'}} assert get_weather_location(params) == 'Bangkok' def test_check_params(): params = { 'update_id': 1, ...
true
8d4a2081d86027990d03a552bb37148d1cdb94bf
Python
kiramipt/dash_news
/app.py
UTF-8
10,442
2.625
3
[]
no_license
import random import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go from plotly.colors import DEFAULT_PLOTLY_COLORS import pandas as pd from datetime import date from dash.dependencies import Input, Output external_stylesheets = ['https://codepen.io/chrid...
true
0fb05d0fef20b2e794aec5c13ef29cfa0f7ffc04
Python
beOk91/baekjoon2
/baekjoon15726.py
UTF-8
84
2.546875
3
[]
no_license
a,b,c=map(int,input().strip().split()) print(max(a/1000*b//c*1000,a/1000//b*c*1000))
true
cde950d1b0d8ab503b7060c3d1d27135bdbee5f7
Python
jpramos123/Artigo-CC5661
/accuracy.py
UTF-8
1,681
2.90625
3
[]
no_license
import numpy as np import math as math class accuracy: def __init__(self, clusters, lessons): self.num_dim = np.shape(clusters)[1] self.num_klus = np.shape(clusters)[0] self.num_lessons = np.shape(lessons)[0] self.seeds = clusters self.lessons = lessons #Euclidian Dis...
true
8386cfa51473bcb8cb7ecf3c0132e655afa5f7db
Python
dodosman/PredictX_plane_flights
/calculations.py
UTF-8
1,299
3.21875
3
[]
no_license
import geopy.distance import pandas as pd class FlightDistance: def read_cvs(self): df = pd.read_csv("Flight Distance Test.csv") return df def dep_coordinates_together(self): df = self.read_cvs() dep_coordin_together = list(zip(df['Departure_lat'], df['Departure_lon'])) return dep_coordin_...
true
b85da377d3f362d7049f3c2d6571f35542042d03
Python
CristianCuartas/Python-Course
/Bases Python/06-arreglos.py
UTF-8
633
4.03125
4
[]
no_license
lenguajes = ['Python', 'Kotlin', 'Java', 'JavaScript'] print(lenguajes[3]) # Ordenar los elementos lenguajes.sort() print(lenguajes) # Acceder un elemento dentro de un texto aprendiendo = f'Estoy aprendiendo {lenguajes[3]}.' print(aprendiendo) # Modificando valores lenguajes[2] = 'PHP' # Agregar elementos lenguaje...
true
1b21ac1102e1c193579d5f37e6cd079c624ec3ef
Python
GilbertQ/Python
/Tarea_01.py
UTF-8
666
4.03125
4
[]
no_license
#Calcular el sueldo líquido de una persona # 100 100 100 => 275.34 nombre = input ("Ingrese el nombre del empleado : ") puesto = input ("Ingrese el puesto de {}: ".format(nombre)) sueldob = input("Ingrese el sueldo base de {}: ".format(nombre)) bonificacion = input("Ingrese el valor de la bonificacion de {}: ".for...
true
2290017b189a194f46dd15e31784015da5088e03
Python
Aasthaengg/IBMdataset
/Python_codes/p02819/s996325275.py
UTF-8
285
2.9375
3
[]
no_license
x = int(input()) eratostenes = [True] * 10**6 for i in range(2, len(eratostenes)): if eratostenes[i]: for j in range(i * 2, len(eratostenes), i): eratostenes[j] = False for i in range(x, len(eratostenes)): if eratostenes[i]: print(i) exit()
true
af192c72373736e32f4c064c34c327932f29532e
Python
shashankrnr32/WaveCLI
/plot/wave.py
UTF-8
1,372
2.78125
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
#!/usr/bin/env python3 # ============================================================================= # Developer : Shashank Sharma(shashankrnr32@gmail.com) # License : MIT License # Year : 2019 # ============================================================================= # =========================================...
true
80ba09381f6826f282683a285374f66d092ea13a
Python
codemedici/crypto
/vigenere_brute.py
UTF-8
762
3.0625
3
[]
no_license
import itertools import vigenereCipher, freqAnalysis letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] dictionary = [ ''.join(c) for c in itertools.permutations(letters, 3) ] ciphertext = "AZAXVHEFWVWOUWQCFEMHKARAZEJVNLCBFOVMMMBMSNHBAUGKZMBJGIEOWZWWWB...
true
a87f5ff8bdac2294c20578adb954e73929e942e5
Python
fiso1011/HydroBA
/Sandtrap.py
UTF-8
11,460
2.578125
3
[]
no_license
import numpy as np import RawMaterial as c_rm class Sandtrap: def __init__(self,input_data): self.sandtrap_data=input_data.input_dict["sandtrap_data"] ["dict"] self.sandtrap_material=input_data.input_dict["sandtrap_material"]["dict"] self.total_sandtrap_cost #import relevant Dicts ...
true
5acdc62487cfd3cf7d70e85af139dceaaa2e8440
Python
patinbsb/Main
/irc/twitch.py
UTF-8
3,946
2.96875
3
[]
no_license
"""This script attempts to use the activity of the chat room of a video stream to gauge and log the interesting events which occur""" import socket import string import time from time import localtime, strftime import urllib import json import datetime time.clock() '''Setting up info for irc connection''' # IRC conne...
true
eb2c144e3b573df18d8d46b72476d4d3ef648621
Python
elifoster/Miscellaneous
/other/dice.py
UTF-8
806
3.6875
4
[]
no_license
import random import time import sys import gc def loop(): lo = input("Would you like to roll again? (0 for yes, 1 for no)\n") while True: if lo == str(0): run() elif lo == str(1): print("Done") sys.exit() def run(): number = input("How many sides would ...
true
4fc05debb26b0849812235774023e165a5e7f8ba
Python
towithyou/master-agent-rpc
/master/agent.py
UTF-8
750
2.75
3
[]
no_license
import datetime from common.state import * class Agent: '''客户端注册的信息需要封装, 提供一个信息存储的类, 数据存储在类的实例中''' def __init__(self, id, hostname, ip): self.id = id self.hostname = hostname self.ip = ip self.regtime = datetime.datetime.now() # 服务器生出注册时间 self.state = WAITING # 可以在注册的时...
true
109cbfd693fa0cb6a468b3ab3a805a94c42f449c
Python
JaeWorld/PS_everyday
/BOJ/11779.py
UTF-8
1,121
3.25
3
[]
no_license
# BOJ 11779 최소비용 구하기 2 # 다익스트라 알고리즘 import sys import heapq input = sys.stdin.readline INF = 987654321 def djikstra(start, graph, n, parent): dist = [INF]*(n+1) dist[start] = 0 queue = [] heapq.heappush(queue, [0, start]) while queue: d, v = heapq.heappop(queue) for a, w in gra...
true
1c48f1c8934a1cfe8ff018172b601bf50933a4e3
Python
IINemo/isanlp
/src/isanlp/processor_spacy.py
UTF-8
7,013
2.9375
3
[ "MIT", "Python-2.0" ]
permissive
import spacy from . import annotation as ann class ProcessorSpaCy: """ Wrapper around spaCy - The NLP library for multiple languages. Performs: 1. Tokenization, sentence splitting. 2. POS-Tagging, morphological analysis, lemmatizing. 3. Dependency parsing. 4. Named entity recognition. US...
true
429642deb2400f4b2ab53aeab6173f4e8ea9fca7
Python
surim-wang/kidney
/source/2020-07-11_imageTOtext.py
UTF-8
13,046
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jul 11 21:11:18 2020 @author: SURIMWANG """ #%% 이미지 txt로 가져와서 한줄씩 들어온 데이터 전처리하기 import numpy as np import pandas as pd import os os.chdir('D:/MNIST/source') from PIL import Image import pytesseract #test_kor= pytesseract.image_to_string(Image.open('../image/test_img3.png'...
true
05651b9197f064ed95edae3eb9a4d5f00803cf17
Python
apple/coremltools
/coremltools/converters/mil/mil/types/get_type_info.py
UTF-8
2,123
2.734375
3
[ "MIT", "BSD-3-Clause" ]
permissive
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from .type_spec import FunctionType, Type from .type_void import void def get_python_method_type(py...
true
a37ca072ab79b25b0522b18d403bc6faaf4c3ad3
Python
44Schwarz/resume-storage
/api/tests.py
UTF-8
557
2.84375
3
[]
no_license
import unittest from django.test import TestCase # Create your tests here. class TestParseText(unittest.TestCase): def test_regex(self): import re from .tasks import RE_PATTERN test_string = 'A-B Company (2015-01-11 - 2018-07-26; laboris nisi ut aliquipc,fdmf2f ea commodo conse).' ...
true
2adb753aa9c81c01d80142e68746034dda8a2907
Python
mrulle/python_course_solutions
/06-conditional_statements/random_sentence.py
UTF-8
2,481
3.5
4
[]
no_license
# adjectives from: http://www.enchantedlearning.com/wordlist/adjectives.shtml # nouns from: http://www.talkenglish.com/vocabulary/top-1500-nouns.aspx # verbs from: http://www.linguasorb.com/english/verbs/most-common-verbs/ import random ''' adjectives are 1 word per line nouns has a line format of 'word frequency type...
true
57697da5b3d4a87938f0234655647b6643763560
Python
abigail-Moore/GBS-analysis
/new_subj_rtd.py
UTF-8
1,185
2.828125
3
[]
no_license
#! /usr/bin/env python InFileName = "rtd.mIDs" OutFileName = "rtd_0001of0001_subj.fa" SubjectSeqs = [ ] SplitLine = [ ] AllUniqued = 0 UniqSubjects = 0 WrittenSeqs = 0 InFile = open(InFileName, 'rU') for Line in InFile: Line = Line.strip('\n').strip('\r').split() AllUniqued += 1 if len(Line) > 2: NewSeq = Line[...
true
0991f5edbb67b88d2913c2b99dc1bc490a77233c
Python
bwang8482/LeetCode
/Google/305_Number_of_Islands_II.py
UTF-8
2,840
4.15625
4
[]
no_license
""" A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by connec...
true
2acb1d381ba428603bebdf81074e1b505da81b0d
Python
xingyunsishen/Python_CZ
/tom.py
UTF-8
846
3.875
4
[]
no_license
#-*- coding:utf-8 -*- class Cat(object): def __init__(self, new_name, new_age): print('\033[0;31;42m ======哈哈哈=======\033[0m') self.name = new_name self.age = new_age def __str__(self): return '\033[0;33;43m %s 的年龄:%d\033[0m'%(self.name, self.age) def eat(self): ...
true
326e91c1f7f0289b9878730a4d9d973a181dc49e
Python
jiadaizhao/LeetCode
/1201-1300/1252-Cells with Odd Values in a Matrix/1252-Cells with Odd Values in a Matrix.py
UTF-8
432
2.90625
3
[ "MIT" ]
permissive
class Solution: def oddCells(self, n: int, m: int, indices: List[List[int]]) -> int: rows = [False] * n cols = [False] * m countRow = countCol = 0 for r, c in indices: rows[r] ^= True cols[c] ^= True countRow += 1 if rows[r] else -1 cou...
true
a8513dba9129ce3622e1fb262936da74dbf40937
Python
barryntklc/pysqlite
/pysqlite_manager/Objects/NodeList.py
UTF-8
2,589
3.15625
3
[]
no_license
import pysqlite_manager from _winapi import NULL from .Node import Node # NodeList # Stores the connection information for a bunch of Nodes. # class NodeList(object): Nodes = [] def __init__(self): self.Nodes = [] # print("Nodelist created.") # Add # Adds a Node to the NodeList if does...
true
9260f4791bb789c7ef8035858c277bb0a1b8bd3e
Python
furuolan/Chest-X-ray-Disease-Diagnosis-using-Faster-R-CNN
/Code/src/image_to_array.py
UTF-8
732
2.875
3
[]
no_license
import time import cv2 import numpy as np import pandas as pd def convert_images_to_arrays(file_path, df): lst_images = [l for l in df['Image_Index']] return np.array([np.array(cv2.imread(file_path + img, cv2.IMREAD_GRAYSCALE)) for img in lst_images]) def save_to_array(arr_name, arr_object): return ...
true
3eb8c92b8597176ec6615434f13d786ddc4cbd60
Python
AnnMertens/Project_Boontje
/boontje/htmltags_to_corpus.py
UTF-8
8,144
3.375
3
[]
no_license
""" html corpora opdelen in zinnen en woorden en deze zinnen in een lijst teruggeven als corpus""" import nltk.data import make_corpus import filefunctions from nltk.tokenize import word_tokenize import tagging import glob # variabele tagger maken #tagger_conll = tagging.tagger_conll2002('b') tagger_alpino = tagging.t...
true
feac20b4d18b6d91546c7028c878c372cdd4a1ac
Python
ratalex/pyNastran
/pyNastran/bdf/utils.py
UTF-8
17,745
2.8125
3
[]
no_license
""" Defines various utilities including: - parse_patran_syntax - parse_patran_syntax_dict - Position - PositionWRT - TransformLoadWRT """ from __future__ import print_function, unicode_literals from copy import deepcopy from typing import List, Union, Dict, Tuple, Optional import numpy as np # type: ignore from ...
true
3752f06271de1f722d94bfaee78b2bd9a4623ca0
Python
ksons/ln.py
/ln/triangle.py
UTF-8
2,685
2.75
3
[ "MIT" ]
permissive
from pyrr import Vector3 from .hit import Hit, NoHit from .box import Box from .ray import Ray from .path import Paths from .util import vector_min, vector_max EPS = 1e-9 class Triangle: def __init__(self, v1=None, v2=None, v3=None): self.v1 = Vector3() if v1 is None else Vector3(v1) self.v2 = ...
true
ea5bb1314fe7d97aba14114cfcd1d3964cd3608e
Python
purusoth-lw/my-work
/36.multiple Inheritance.py
UTF-8
1,253
3.859375
4
[]
no_license
""" Multiple Inheritance: ===================== many parent class But only one child class syntax: ======= class Class1: statements class Class2: statements class Class3(Class1,class2): statements class Father: cash1=50000 def show1(self): print("Father cash :",self...
true
3b90a8f957de622c93c40d604ddf3a0029eff406
Python
francoisleroux16/MRN_Final
/testdata.py
UTF-8
27,016
2.90625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Tue Sep 22 18:36:26 2020 @author: Francois le Roux This script is regarding everything relating to the test data """ import numpy as np import matplotlib.pyplot as plt from scipy import interpolate import importing def cubic(x,val1,val2): tck = interpolate.splre...
true
67a941b7ff7fe9c9786de722aeb5d7305739c608
Python
lawiet019/foodie
/foodieProject/users/utils.py
UTF-8
7,115
2.859375
3
[]
no_license
import random from PIL import Image, ImageDraw, ImageFont, ImageFilter from string import ascii_letters,digits from .models import UserProfile from django.core.mail import send_mail from django.conf import settings import configparser from datetime import datetime from .models import EmailVerifyRecord import jwt from d...
true
0e0888d583a11f2bb48108675c7f1dcf40ca6835
Python
Lodewic/DuPont-hackathon
/src/enzyme_hackathon/utils.py
UTF-8
5,358
2.9375
3
[]
no_license
import numpy as np import tensorflow as tf import pandas as pd from keras import backend as K from keras import Model from keras.layers import Input, Dense, Flatten, Dropout, BatchNormalization from keras.optimizers import Adam from keras.regularizers import l2 from sklearn.preprocessing import LabelEncoder, OneHotEnco...
true
370f3d6f2dec1fb1d4ff280930b831930b079b1e
Python
nileshmahale03/Python
/Python/5 Tuples.py
UTF-8
1,084
4.3125
4
[ "MIT" ]
permissive
#Tuple #ordered #indexed #Immutable #Faster than list t = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday") print(t) print(type(t)) #t.append(20) AttributeError: 'tuple' object has no attribute 'append' print(t[2]) print(t[-1]) print(t[1:3]) print(len(t)) print(t.count("Monday")) print(t.index("Friday")...
true
88f0c96ae54c8810920b11236cc288b05059c353
Python
dantin/daylight
/dcp/002/solution.py
UTF-8
1,594
3.96875
4
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- class Solution(): """Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. re...
true
43e9e072be0561a97cd91948a3b4430e95d25ed9
Python
starbt/pic_link
/pic_link.py
UTF-8
2,593
2.71875
3
[]
no_license
from __future__ import division from PIL import Image import numpy import numexpr import os import os.path import random path = r'/home/xcv/learning_python/scrapy/picture' bigPhoto = r'/home/xcv/learning_python/scrapy/big.jpg' aval = [] W_num = 25 H_num = 25 W_size = 360 H_size = 640 alpha = 0.3 #获得所有照片信息 def getA...
true
520cc3699a1fc2f9f7252fa0728c936382f90cf5
Python
zsmountain/lintcode
/python/stack_queue_hash_heap/545_top_k_largest_numbers_ii.py
UTF-8
2,502
4.25
4
[]
no_license
''' Implement a data structure, provide two interfaces: add(number). Add a new number in the data structure. topk(). Return the top k largest numbers in this data structure. k is given when we create the data structure. Have you met this question in a real interview? Example s = new Solution(3); >> create a new data...
true
493ed3820055157e7531dfba8d6fbcf537f812dc
Python
cRAN-cg/Competitive
/code/python/basic/a_very_big_sum.py
UTF-8
141
3.09375
3
[]
no_license
#!/usr/bin/python3 env import sys n = int(input().strip()) arr = [int(arr_vals) for arr_vals in input().strip().split(" ")] print(sum(arr))
true
817a54ec999d608bc04b607a1f00ff58db3dc290
Python
ylashin/deep-learning-workshop
/Sample10/TrainLocalModel.py
UTF-8
916
3.09375
3
[]
no_license
import pickle import os import pandas import numpy as np from sklearn.svm import SVC from sklearn.model_selection import train_test_split # create the outputs folder os.makedirs('./outputs', exist_ok=True) # load input dataset from a DataPrep package as a pandas DataFrame inputDf = pandas.read_csv('data.csv') # load...
true
c0694a38e64600b75757cebec9d79df815fdaf7b
Python
deggs7/py-practice
/sweet/attr_pass.py
UTF-8
807
3.1875
3
[ "Unlicense" ]
permissive
class Test(object): name = 'origin' t = Test() all = [ 'a', 1, t, ['a', 'b', 'c'], ('x', 'y', 'z'), { 'name': 'abc', 'desc': 'xyc' } ] def change(n): print id(n) if type(n) == str: n = 'b' elif type(n) == int: n =...
true
86c4b48c5cc516f538a3b442bfdba6df5f3e64ac
Python
kennethnym/covid19-alarm
/server/routes/alarms/daily_brief.py
UTF-8
2,582
3.25
3
[ "MIT" ]
permissive
""" This module handles daily brief processing. """ import logging import datetime from typing import Dict, Any import pyttsx3 from server.api.weather import fetch_weather from server.api.news import fetch_news_headlines from server.api.covid import fetch_covid_data __speech_engine = pyttsx3.init() def daily_brie...
true
c62cfb446a03c57dc1235e36000b298661b6ed1c
Python
DanishKhan14/DumbCoder
/Python/strings/shortestPalind.py
UTF-8
697
4.15625
4
[]
no_license
""" Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation """ # [TLE] Method 1: Brute Force. Keep adding one char at a time in rev order class Solution(object): def shortestPalind...
true
8ba4095cd60eeb07d9b9db3a925250dede5a5f0b
Python
ad54/aws_rest_api
/rest_lambda_function.py
UTF-8
2,925
3.234375
3
[]
no_license
"""This is the lambda function for rest api , which will provide data from dynamo db. You need to pass the name of the sport and team. It will provide recent reords of the team. If the searched sport is not availble, it will list all the available, the same for the searched team. """ import boto3 import json from boto...
true
19044ffe2c5b2cc6f609dd9f3ea48962e9ff7562
Python
ace12358/100knock
/test65_2.py
UTF-8
526
2.609375
3
[]
no_license
#coding:utf-8 import sys,os noun100 = [] for line in open(sys.argv[1]): noun100.append(line.strip().split()[0]) files = os.listdir('/Users/kitagawayoshiaki/Dropbox/100knock/my100knock/work_dir_n') #指定したパスのディレクトリ内のファイルをリストとして返す for file in files: for line in open("work_dir_n/"+file): list = line.strip().split("\t...
true
f08faf6b04c2fcc85178bf2161cb32b523d83b73
Python
fzero17/college_wish
/src/test.py
UTF-8
523
2.75
3
[]
no_license
import sqlite3 db_file = './utils/database/de/2016.db' conn = sqlite3.connect(db_file) conn.text_factory = str c = conn.cursor() res = c.execute("select name from sqlite_master where type='table' order by name;") table_list = res.fetchall() COUNT = 0 for table_name in table_list: cursor = c.execute("SELECT c...
true
68aa779993c14e0f654c0fbf458bb7e0bc39a8d2
Python
wangyf/AH-RJMCMC
/make_AH_IL_comparison.py
UTF-8
4,216
2.6875
3
[ "MIT" ]
permissive
# Script to make a comparison plot from the RJ-MCMC output # of the AH and IL methods. # The script assumes that the current directory contains the AH-output, and the directory with the IL-output is specified. # We also assume that the comparison is direct - i.e. that all parameters and data are shared between the two...
true
6ef05fc6e8bd533d8b3689911a62f31f4db98d49
Python
destroyer7/puf_iot
/Protocol1Full/DriverOnlineServer.py
UTF-8
3,993
2.703125
3
[]
no_license
#---------------------- DriverOnlineServer.py---------------------- import sys from OnlineServerSocket import ServerSocket # For Server-Client communication using TCP sockets from OnlineServerCrypto import ServerCrypto # For Cryptographic Functions from IOTDatabase import database_server # For the Database def device...
true
cd6b5e62eee818e61ea77c07b725244655e5727b
Python
miaofa/PythonScriptsForWork
/bin2bin/uifor2019.py
UTF-8
5,000
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- # 全部UI设计 # 默认的输出目录是桌面,针对Linux的还没有添加(最好是home目录) import tkinter as tk from tkinter.filedialog import askdirectory, askopenfilename from tkinter import scrolledtext import os import conversion class UI(object): def __init__(self, master): self.master = master ...
true
bfe2f246e4e30aac57c0f9542e9a10723a8579c1
Python
asolberg/CJ-2012-Prelim
/B - Dancing with the Googlers/dancing.py
UTF-8
4,630
3.671875
4
[]
no_license
# Problem # # You're watching a show where Googlers (employees of Google) dance, and then each dancer is # given a triplet of scores by three judges. Each triplet of scores consists of three # integer scores from 0 to 10 inclusive. The judges have very similar standards, so it's # surprising if a triplet of scores con...
true
691404d715a2931e22d99e1caf0a19d98d70f0e8
Python
LadyM2019/Python-Fundamentals-Softuni
/05. Dictionaries - Exercises/05. Social Media Posts.py
UTF-8
1,070
3.5
4
[ "MIT" ]
permissive
def Post(postName): socialMedia.__setitem__(postName,list([0,0])) def Like(postName): socialMedia[postName][0] += 1 def Dislike(postName): socialMedia[postName][1] += 1 def Comment(postName,commentator,content): socialMedia[postName].append(f"* {commentator}: {content}") socialMedia = dict() while...
true
9afcbfcc8d83b5715ef9353de3c385cfac902871
Python
Sladge17/linear_regression
/teacher.py
UTF-8
1,867
2.796875
3
[]
no_license
import sys import numpy as np def check_argv(argv): argv_len = len(argv) if not argv_len: return 'data.csv' if argv_len != 1: print("\033[31mNeed only one dataset\033[37m") exit() return argv[0] def read_data(source): try: data = np.genfromtxt(source, dtype=np.uint32, delimiter=',')[1:] except: print(...
true
48795a26e884322189b14aa425dc3a7670f650a2
Python
ww35133634/chenxusheng
/ITcoach/xlrd_xlwt处理数据/第9章 Python函数技术/9.7 递归函数写法及应用/9.7.1.py
UTF-8
242
3.390625
3
[ "AFL-3.0" ]
permissive
# def fact(x): # if x==1: # return 1 # else: # return x+fact(x-1) # # print(fact(5)) def con(l): if len(l)==0: return '' else: return con(l[:len(l)-1])+'-'+l[-1] print(con(['a','b','c','d']))
true
ca7d6bbd4e41c591d6e280b481e7e3227cddca8e
Python
tedchou12/connect-pm-server
/src/pm_server/modules/security.py
UTF-8
1,560
2.546875
3
[]
no_license
from flask import make_response, request, session from datetime import date, datetime, timedelta from .db import db import time import random import string class security : def __init__(self): self.table = 'security' self.valid_duration = 60 * 10 def get_hash(self) : obj_database = db(...
true
a2d6a9d2a033aa5ad5d1cc057f40b400855b8c6f
Python
ElTrackiras/KeyboardTrainer
/main.py
UTF-8
7,406
3.40625
3
[]
no_license
import pygame import random pygame.init() class LetterBoxes: monster_img = pygame.image.load('Assets/Monster.png') all_boxes = list() box_font = pygame.font.SysFont("monospace", 30) def __init__(self, x, y, letter): self.image = LetterBoxes.monster_img self.x = x self.y = y ...
true
f00c2fedad62050629a90f32b1d9472f0b4154a7
Python
siberowl/AI_CP365
/src/Adaline/Adaline.py
UTF-8
1,234
2.734375
3
[]
no_license
import numpy as np import pandas as pd class Adaline: def __init__(self): return None def fit(self, data, labels): self.data = data self.labels = labels self.nexamples = data.shape[0] self.nfeatures = data.shape[1] ws = np.ones((self.nfeatures,1)) lr = 0....
true
bf557469d6acda997412d01f02bc55663b4a2c30
Python
zkroliko/Abyssal-Destructor
/abyssaldestrucion/client/Client.py
UTF-8
5,912
2.53125
3
[]
no_license
import paho.mqtt.client as mqtt import sys import random from ControllerUtil import ControllerUtil from Topics import Topics, main_topic from SerialStub import * from threading import Thread import Message import thread import time import serial class Client: def on_message(self, client, obj, msg): # if ...
true
53d67df26ea5e4b491f0c8951eab0025e94c03b7
Python
dbconfession78/interview_prep
/leetcode/14_longest_common_prefix.py
UTF-8
1,568
3.78125
4
[]
no_license
""" Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Output: "fl" Example 2: Input: ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input st...
true
fec4aaaa79a96677673c14ec804a11439ca637a6
Python
yehudit96/coreferrability
/classifiers/significance_test/create_data_for_AP_significance_test.py
UTF-8
2,262
2.8125
3
[]
no_license
import os import sys import random import argparse import _pickle as cPickle from random import choices from tqdm import tqdm random.seed(1) from svm_classifier import * parser = argparse.ArgumentParser(description='Creating data for statistical significance tests') parser.add_argument('--rules_path', type=str, ...
true
c88f845952f56e96430ad1829f1f19a7f522e973
Python
YifanXu1999/AI-Learning
/Trust Region Policy Optimization/TRPO Project/CartPole A2C/agent.py
UTF-8
2,296
2.609375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jan 28 20:12:19 2020 @author: yifanxu """ from model import Actor from model import Critic import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import hp import torch.distributions as distributions import gym ...
true
46b24c38c760ebad267d81f82c14929bd28ab235
Python
pzmrzy/LeetCode
/python/reverse_integer.py
UTF-8
403
3.0625
3
[]
no_license
class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ flag = 1 if (x < 0): x = -1 * x flag = -1 result = 0 while (x > 0): result *= 10 result += x % 10 x /= 10 ...
true
bd71839e7eb8b1c6840fe8f23ce4bd1edcb50918
Python
LuminousCL/Iris_kmeans
/Iris_kmeans_decisiontree.py
UTF-8
804
3.234375
3
[]
no_license
#############鸢尾花数据集的决策树分析############# from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn.datasets import load_iris import matplotlib.pyplot as plt iris = load_iris() x_train,x_test,y_train,y_test = train_test_split(iris.data,i...
true
52f37705e21ffa6dd7e6a2513743e5bfd7df4101
Python
Marist-CMPT120-FA19/-Jim-Moehringer--Project-3
/tree.py
UTF-8
233
3.6875
4
[]
no_license
def main(): height=int(input("Enter the height of the tree: ")) h= height hashtag= 1 while h >0: print(' ' * (h-1) + "#" * (hashtag)) h -=1 hashtag +=2 print(" " * (height-1) + "#") main()
true
1f4663b8540a7d1ebe098eb1cfa7c1b7b9c0ca3e
Python
LeytonYu/python_algorithm
/sword art online/图/广度优先遍历.py
UTF-8
399
3.515625
4
[]
no_license
def bfs(graph,start): explored,queue=[],[start] explored.append(start) while queue: v=queue.pop(0) for i in graph[v]: if i not in explored: explored.append(i) queue.append(i) return explored G = {'0': ['1', '2'], '1': ['2', '3'], '2'...
true
920de34e0d208ffe4c83b3dfb75a93004efb5119
Python
ehdusjenny/music
/music/data/musicnet.py
UTF-8
9,398
2.59375
3
[]
no_license
#import config import numpy as np from tqdm import tqdm import torch import os import csv import pickle from intervaltree import IntervalTree import scipy from scipy.io import wavfile import pretty_midi class Memoize(object): def __init__(self, file_name, func): self.file_name = file_name self.func...
true
bcbbf956b590b9d4b50444cd6e1103fcfd46d9e5
Python
ygperez/CIS-024C-HW
/helperfunctions.py
UTF-8
270
3.71875
4
[]
no_license
import math import sys def add(x,y): print "Add = ", x+y def diff(x,y): print "Subtract = ", x-y def product(x,y): print "Product = ", x*y def greatest(x,y): if x>y: print "x is greater than y" if y>x: print "y is greater than x"
true
8285fb7c6412df9a64a5c43f5aefa4dc8dfb5f7f
Python
Arcprm4/HelloGit
/ABC121/C.py
UTF-8
294
2.8125
3
[]
no_license
def MAP(): return list(map(int,input().split())) n,m = MAP() lst = [MAP() for _ in range(n)] lst = sorted(lst,key = lambda x:x[0]) q = 0 ans = 0 for i in lst: if q+i[1]<m: q+=i[1] ans+=i[0]*i[1] else: ans += (m-q)*i[0] break print(ans)
true
af9059fa3577c707612c39263d59fdfddfda65e6
Python
enesgrahovac/kaggle
/nlp_tutorial/first.py
UTF-8
1,132
3.5
4
[]
no_license
import spacy nlp = spacy.load('en') doc = nlp("Yo! My name is Enes, hello computer! How're you doing today?") for token in doc: print(token) print(f"Token \t\tLemma \t\tStopword".format('Token', 'Lemma', 'Stopword')) print("-"*40) for token in doc: print(f"{str(token)}\t\t{token.lemma_}\t\t{token.is_stop}")...
true
01f31dbdd5584992d6359773a976bf7f5726fe62
Python
yabirgb/hashcode
/2018/main.py
UTF-8
1,543
3.28125
3
[ "MIT" ]
permissive
import sys from car import Car from plan import * from ride import Ride def get_info(filename): """ Function that gets the input Return: params: A tuple with the input params rides: A list with all the rides info """ with open(filename) as f: #get the first line of the inpu...
true
b692bd7714ffeb2d415bab7c184af949ffb5ea9b
Python
leosamuel64/MPSI
/IPT/1-Python/TP2/ex11.py
UTF-8
297
3.578125
4
[]
no_license
def sentenceToWords(sentence): liste = [] word = "" for i in range (0,len(sentence)): if sentence[i] != " ": word += sentence[i] else : liste.append(word) word = "" liste.append(word) return liste print(sentenceToWords("Arthur le glomorphe à rayure marche à vive allure"))
true
a3508b93ffe2d46d5af3ba5a259f3c411ac48319
Python
daniloBlera/ProjetoPSD-RSI
/StreamProcessing/post_structure_processing.py
UTF-8
2,488
2.53125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from datetime import datetime from pyspark import SparkContext from pyspark.streaming import StreamingContext from pyspark.streaming.mqtt import MQTTUtils import pika sc = SparkContext("local[5]", "Jesus Christ that's Jason Bourne") ssc = StreamingContext(sc, 1) ssc.checkpoint("/tmp/spark-str...
true
3944e7245529b6dc0f22ff555bc6894795f19f42
Python
jenjouhung/DHD_Classifier
/train.py
UTF-8
3,739
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import pickle from keras.utils import to_categorical from keras.callbacks import EarlyStopping import dataload import param from model import birnn #from model import att_birnn WORD2IDX_FILE = param.WORD_BASED_WORD2IDX_FILE if param.USE_WORD_DATA else param.CHAR_BASED_WORD2...
true
bf41f22545e55b76fbed7dbfe7d5f91ff392bab7
Python
JackRogersMacro/ABM_Macro
/SimpleMacro3.py
UTF-8
17,602
2.671875
3
[]
no_license
""" Simple Macroeconomic Model with Satisficing Behaviour Authors: Hyun Chang Yi and Sarunas Girdenas LastModified: 04/06/2014 """ # from datetime import datetime # import this to calculate script execution time # startTime=datetime.now() from random import randrange, choice, randint from random import uniform as unif...
true
f57092e40334c6d4ea4fb7ca2a785a85e8ff667a
Python
jackyjsy/SGGAN
/data_loader.py
UTF-8
4,733
2.75
3
[ "MIT" ]
permissive
import torch import os import random from torch.utils.data import Dataset from torch.utils.data import DataLoader from torchvision import transforms from torchvision.datasets import ImageFolder from PIL import Image import numpy as np def to_categorical(y, num_classes): """ 1-hot encodes a tensor """ # print(y...
true
e9d4d9ec84a2625c650510033e980fa4cb6de437
Python
vancun/nifi_factory
/sandbox/explore_jinja2/basic_jinja.py
UTF-8
1,356
3.328125
3
[]
no_license
""" >>> from jinja2 import Template >>> tpl = Template(u'Greetings, {{ name }}! I am from {{ location }}.') >>> tpl.render(name='Mr. Arda', location='Amsterdam') 'Greetings, Mr. Arda! I am from Amsterdam.' Template variables could also be passed as a dictionary. >>> tpl.render({'name': 'Arthur', 'location':'Stockholm...
true
258cbf2c0b477c80736d41cf3c03066b0809f198
Python
finiteautomata/tp-aa
/helpers.py
UTF-8
1,014
2.984375
3
[]
no_license
#! coding: utf-8 """Auxiliares varios.""" from sklearn.metrics import precision_score, accuracy_score, f1_score, recall_score, roc_auc_score import pandas as pd from data_builder import load_test_data scores = [ precision_score, accuracy_score, f1_score, recall_score, roc_auc_score ] def add_pre...
true
5eab3b4632de0ee5968842ebba1c87f3345b4173
Python
AnasTaherGit/Electronic
/Arduino/PySerial/ReadValue.py
UTF-8
1,101
2.9375
3
[]
no_license
import serial import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib import style def Voltage(x, in_min=0, in_max=1023, out_min=0, out_max=5): return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min Arduino = serial.Serial('COM7', 9600) fig = plt.figure() ax1 =...
true
6af269448984ee21b98f31ef3a9f32ac11939bc8
Python
sklx2016/Repeat-Buyers-Prediction
/split_date.py
UTF-8
2,340
2.78125
3
[ "MIT" ]
permissive
#-*-coding:utf-8-*- ''' 将usr_log按用户、商户和类别拆分为多个文件 ''' import csv import os ''' #记录已存在的date.csv date_dictionary = {} #将words写入date.csv文件最后一行,文件打开采用'a'模式,即在原文件后添加(add) def writeByDate(date,words): file_name = date+".csv" os.chdir('../data/date/') if not date_dictionary.has_key(date): date_diction...
true
bf4fc48a86c1dbffb1fab7ba4c6724eeb0f57429
Python
mal2/Project-Simulation
/fusim16/PCA/pca.py
UTF-8
10,183
3.34375
3
[]
no_license
import numpy as np import scipy.spatial.distance as dst import tempfile # For memory mapped class attributes class PCA: """ Apply principal component on a given data set for the plain purpose of dimensionality reduction. Attributes ---------- data: 2D numpy.ndarray Data matrix of dime...
true
daa5a3fe740eaf2a40689d9d94ea23c1f21059ed
Python
mendrugory/monkey-note-bot
/app/telegram/api.py
UTF-8
768
2.84375
3
[ "MIT" ]
permissive
import json import requests from app.settings import TOKEN TELEGRAM_URL_API = 'https://api.telegram.org/bot' def __build_url(method): url = '{}{}/{}'.format(TELEGRAM_URL_API, TOKEN, method) return url def __post(url, body, params=dict()): """ Internal post :param url: :param body: :pa...
true
630fa1acec386f39345d4d0213a3b18de4da65aa
Python
edwardsemisotov/homework
/snowfall.py
UTF-8
1,162
2.875
3
[]
no_license
# -*- coding: utf-8 -*- import random import simple_draw as sd snowflake_list = [] def sd_spawn_snowflake(): x_point = random.randint(10, sd.resolution[0] - 10) snowflake_len = random.randint(10, 40) speed = snowflake_len / 5 return [x_point, sd.resolution[1], snowflake_len, speed] de...
true
f20d19c45124aa335b2d78c22e19efd1cbb6e4ca
Python
countessellis/pythonpractice
/practicepython_ex7.py
UTF-8
100
2.984375
3
[]
no_license
#!/usr/bin/python a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] print [ b for b in a if b % 2 == 0 ]
true
3dcc5654fd78d2980a40052edb5a69ad2738b39f
Python
williamjameshandley/williamjameshandley.github.io
/assets/students/timeline.py
UTF-8
2,495
2.703125
3
[]
no_license
#!/usr/bin/env python from collections import Counter from students import students import matplotlib.pyplot as plt import os import datetime import numpy as np grey = '#bbbbbb' plt.rcParams['axes.edgecolor'] = grey plt.rcParams['xtick.color'] = grey plt.rcParams['ytick.color'] = grey plt.rcParams['ytick.color'] = grey...
true
835fb1084c7db85515eae6ce36c7bb31c2e5f5a0
Python
rickgithacker/pythonclass
/quicktest.py
UTF-8
117
3
3
[]
no_license
fruit='banana' fl = len(fruit) index = 0 while index < fl: print index, fruit[index] index = index +1
true
d9b765539ae1871986158ca9aedbcb180ab8c37f
Python
Tanvir-Aunjum-Sunny/gltf-blender-importer
/addons/io_scene_gltf/mesh.py
UTF-8
9,298
2.984375
3
[ "MIT" ]
permissive
import bmesh import bpy def convert_coordinates(v): """Convert glTF coordinate system to Blender.""" return [v[0], -v[2], v[1]] def primitive_to_mesh(op, primitive, name, layers, material_index): """Create a Blender mesh for a glTF primitive.""" attributes = primitive['attributes'] me = bpy.da...
true
ffa95541a193ce440badc3adcc084d78bee6e954
Python
svmldon/IE_507_Modelling_lab
/LAB 05/lab05ex2b.py
UTF-8
974
3.234375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Aug 23 17:45:21 2017 @author: svmldon """ import random from math import floor, ceil a=[]*12 rand = float(0) q = 0 while q < 5000: q = q + 1 rand = ceil(12*(random.random())) if rand == 1: a[0]+= 1 elif rand == 2: a[1...
true
bc1daf18bf1227cc083715724ad8099d47417d31
Python
Roman43407/Sem-1
/Lab 11/zad3.py
UTF-8
160
3.6875
4
[]
no_license
import math a = input("Podaj kąt") sin = math.sin(int(a)) cos = math.cos(int(a)) tg = math.tan(int(a)) ctg = 1/tg print(sin) print(cos) print(tg) print(ctg)
true
47d646ec13e426d6fca2afe6b920c7a0f33ba8c4
Python
ride80/scrappy-functions
/Scrappy2.1.py
UTF-8
1,290
2.625
3
[]
no_license
import bs4 from urllib2 import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'https://www.newegg.com/global/se/Product/ProductList.aspx?Submit=ENE&N=100829626&IsNodeId=1&bop=And&PageSize=96&order=BESTMATCH' #my_url_2 = 'https://www.newegg.com/Desktop-Graphics-Cards/SubCategory/ID-48/Page-2?Tid=7709&Pa...
true
01532951d2fba32b33a520778920d74e04b4ff6e
Python
JMGONB/Mirepositorio
/mi_proyecto_agosto/src/api/server.py
UTF-8
1,840
2.828125
3
[]
no_license
import os,sys import json import pandas as pd from flask import Flask,render_template,redirect,request,jsonify # ---------------------- # $$$$$$$ SERVER $$$$$$$$ app = Flask(__name__) #Inicializa el servidor @app.route("/") def default(): return "<h1>soy la ruta por defecto</h1>.<p>Añadir get_json?id= para ob...
true
97f15bdeafc4d5900af5ec59f112b7a5525fc847
Python
Dimen61/leetcode
/python_solution/DepthFirstSearch/98_ValidateBinarySearchTree.py
UTF-8
1,234
3.328125
3
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isValidBST(self, root): """ :type root: TreeNode :rtype: bool """ # traversal...
true
841735d89a2018ccfe55d7414963f3c08cca0c49
Python
colinclement/varibayes
/varibayes/opt/adadelta.py
UTF-8
2,471
3.28125
3
[ "MIT" ]
permissive
""" adadelta.py author: Colin Clement date: 2017-10-18 This is an implementation of the ADADELTA adaptic learning rate stochastic gradient descent optimizer as described in https://arxiv.org/abs/1212.5701 """ import numpy as np class Adadelta(object): def __init__(self, obj_grad_obj, rho=0.9, eps=1e-6): ...
true
ed6f2f054f13e094e2d57c45e24d2a0624a8ffd7
Python
adamb70/RomUtilityScripts
/RomUtilityScripts/WorldGen/Environment/GenerateEnvironementFiles.py
UTF-8
1,381
2.5625
3
[]
no_license
from .DataImporter import ProceduralItemGroupSheetHandler, GrowableItemGroupSheetHandler def generate_item_groups(outfile='Output/ItemGroups.sbc', handler=None): ss = ProceduralItemGroupSheetHandler() if not handler else handler ss.write_item_groups(ss.get_item_group_dict(), outfile) return outfile def ...
true
6b6759c8ad5f925f54d9bd605978f455ec070fc1
Python
kariulele/epita-image
/cours/2020/ing2/bigdata/lesson7 Graphics/dash_fertility.py
UTF-8
8,510
2.609375
3
[]
no_license
import dash import dash_core_components as dcc import dash_html_components as html import pandas as pd import numpy as np import plotly.graph_objs as go START = 'Start' STOP = 'Stop' def get_data(): incomes = pd.read_excel('data/GDPpercapitaconstant2000US.xlsx', index_col=0).round() children = pd.read_excel(...
true
e47403b0d88387c91b54a94ab35c3df1081891af
Python
daniele-salerno/Gender-Classifier-CV
/3_image_gender_classifier.py
UTF-8
1,660
3.5
4
[]
no_license
############################### """ Part 3 of 4 Script used for testing the model previus saved with some random images from internet """ ############################### import cv2 from tensorflow.keras.models import load_model SCALE = (200, 200) model = load_model('model.h5') face_cascade = cv2.CascadeClassifier(...
true
be289912a071b4931c29b00287db4c1a31a9a053
Python
cladren123/study
/AlgorithmStudy/백준/4 N과 M 시리즈/N 과 M (1).py
UTF-8
1,132
3.78125
4
[]
no_license
""" 2 브루트포스 문제 대비, N과 M은 확실하게 마스터 하자. """ n, m = map(int, input().split()) used = [0] * m visited = [0] * n card = [] """ n 은 가짓수 m 은 하나씩 뽑는다. 입력 3 1 3개 중에서 하나 고르기 n 개 중에서 m 개 고르기 즉 n과 m은 n개 중에서 m개 고르기. 모든 경우의 수를 고르기. used 는 m개 고를걸 담는다 visited 는 n개, 즉 전체에 방문하는 것을 통해 모든 경우의 수를 확인 card는 이제 뼈대가 들어오면 생기는 몸?...
true
8812283ed58bc7521743af51e10698018191b911
Python
rhutuja3010/function
/given 2 no. find max number.py
UTF-8
237
3.53125
4
[]
no_license
# def max(a,b): # if a > b: # return a # else: # return b # print("max number =",max(30,40)) def hello(name,mgs = "how are you"): print("hello",name,mgs) hello ("friend",",have a nice day") hello("friend")
true
67de6e18a5add7320d21c26f2fd8812c24139290
Python
passionzhan/design_pattern
/adapter.py
UTF-8
799
2.71875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*-# #------------------------------------------------------------------------------- # PROJECT_NAME: design_pattern # Name: adapter.py # Author: 9824373 # Date: 2020-08-19 15:24 # Contact: 9824373@qq.com # Version: V1....
true
a3c2a5c4a88204757168015eaf9188da7a2eb02c
Python
ethanluckett/csci531-conniption
/play_test.py
UTF-8
2,720
3.3125
3
[]
no_license
#!/usr/bin/env python from board_class import BoardState from expand import breadth from search import alpha_beta_search from cevaluate.evaluate import evaluate_full #from evaluate import Evaluator import functools import random import sys #eval = Evaluator() def human_move(state): print('P1 flips:', state.p1_fl...
true
f472ab4b199045a469d184065a3e838750a3903b
Python
skuxy/Advent-Of-Code-codes
/2017/day7.py
UTF-8
1,936
3.46875
3
[]
no_license
#! /usr/bin/env python3 class node: def __init__(self, name, value): self.name = name self.value = value self.parent = None self.children = [] def assign_parent(self, parent): self.parent = parent def assign_child(self, child): self.children.append(child) ...
true
bb9d35ce9ac87ee6f00b982d0375794c0c7e4a35
Python
hyfgreg/leetcode
/118.yanghuiTriangle.py
UTF-8
925
3.640625
4
[]
no_license
# -*- coding: utf-8 -*- """ 给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。 在杨辉三角中,每个数是它左上方和右上方的数的和。 示例: 输入: 5 输出: [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] """ # 动态规划, 每一行的数字都和上一行的数字有关 from typing import List class Solution: def generate(self, numRows: int) -> List[List[int]...
true