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
5113bc4e8dd2db1aef110ca4ce9f041aa460986c
Python
conniechu929/Algos
/removeDuplicates(in-place).py
UTF-8
940
3.796875
4
[]
no_license
# Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. # # Do not allocate extra space for another array, you must do this in place with constant memory. # # For example, # Given input array nums = [1,1,2], # # Your function should return length = 2, wi...
true
01b67a5d0b3a6d204c8d1f00dbad138b7645f287
Python
fancyspeed/semi-lda
/cpp/script/gen_viewable_model.py
UTF-8
1,295
2.859375
3
[]
no_license
#!/usr/bin/python # coding: utf-8 # @author: zuotaoliu@126.com # @created: 2013-12-28 import os import sys def gen(p_in, p_out): num_topics = 0 map = [] sum = [] word_sum = {} for line in open(p_in): sep = line.split("\t") word = sep[0] sep = sep[1].split() if num_topics =...
true
3b2207cfa0ca7475af1d859ac1091d3df2c364fa
Python
jeffli678/cyber262-ctf
/main.py
UTF-8
7,036
2.515625
3
[ "MIT" ]
permissive
import os import itertools import json import datetime from bottle import route, run, template, static_file, post, request, auth_basic import logging import shutil teams = {} max_problem = 0 def read_team_info(info_path = 'team-info.txt'): f = open(info_path).read().splitlines() for line in f: if line...
true
4efe2205e53c2fc6663f7c39c4af791e07dd07bb
Python
AndreyDacenko/traning
/opencv/opredelenie teksta na foto/tran3.py
UTF-8
264
2.609375
3
[]
no_license
import cv2 def threshold_otsu(): img=cv2.imread("Tile_004-003.jpg", 1) img2gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret,final_img=cv2.threshold(img2gray, 70, 150, cv2.THRESH_BINARY+cv2.THRESH_OTSU) cv2.imwrite('thresholded.jpg', final_img) threshold_otsu()
true
a306ec2962649354490edf1037c3fc4b4d22b79c
Python
ycooper/hse_python
/2.14.py
UTF-8
185
3.8125
4
[]
no_license
a = int(input()) b = int(input()) c = int(input()) if c < a: (a, c) = (c, a) if c < b: (b, c) = (c, b) if b < a: (a, b) = (b, a) print("{} {} {}".format(a, b, c))
true
7d44b616c01c282a69e8831d8084d3f5854e9318
Python
seantyh/MWE2019
/tests/test_moe_idiom.py
UTF-8
852
2.90625
3
[]
no_license
import sys sys.path.append("./") import pytest from MWE2019.moe_idioms import MoeIdioms def test_singleton(): moe1 = MoeIdioms() moe2 = MoeIdioms() assert id(moe1.instance) == id(moe2.instance) def test_data_loaded(): moe1 = MoeIdioms() assert len(moe1.instance.idioms) > 0 def test_magic_method()...
true
8937768c0f3eadd5540b762b34be8c6cd6d84a3d
Python
L200170102/prak_ASD_C
/Modul05.py
UTF-8
3,034
3.15625
3
[]
no_license
class Mahasiswa(object): """Class Manusia yang dibangun dari class manusia""" def __init__(self,nama,NIM,kota,us): """Metode inisiasi ini menutupi metode inisiasi di class Manusia""" self.nama = nama self.NIM = NIM self.kotaTinggal = kota self.uangSaku = us clas...
true
107f9ba82e9bcc552316173b8dfc8b3c48f059c5
Python
vocalpy/crowsetta
/src/crowsetta/formats/seq/generic.py
UTF-8
15,100
2.8125
3
[ "BSD-3-Clause", "CC0-1.0", "CC-BY-4.0" ]
permissive
""" Generic sequence format, meant to be an abstraction of any sequence-like format. Consists of :class:`crowsetta.Annotation` instances, each with a :class:`crowsetta.Sequence` made up of :class:`crowsetta.Segment`s. Functions in this module load the format from a csv file, or write a csv file in the generic format....
true
e67d92df88a611a0060f3e9990fdaf9ec4d06f3b
Python
adrienruault/ML_hamolru
/project2/rendu/test_set_formatting.py
UTF-8
1,478
2.640625
3
[]
no_license
import numpy as np from scipy import misc import os import matplotlib.image as mpimg def convert_test_set_to_good_format(): n_images = 50 imgs = np.zeros(shape=[n_images, 608, 608, 3]) imgs_converted = np.zeros(shape=[200, 400, 400, 3]) for i in range(1, n_images +1): img_path = './data/t...
true
8751ccea24df2535cdb357ed915dd16ff755a641
Python
hudiM/LabGame
/devTools.py
UTF-8
932
2.609375
3
[]
no_license
import echo import copy import player import enemy import level import color def paint_dev(showHear=0): try: for pid in player: pid.hearZone = echo.read_zone([pid.x, pid.y], 8) except: pass devMap = copy.deepcopy(level.world) try: for item in list(player.players[sho...
true
7a372f7091719d8b8261d783f5e73ec47910d3ca
Python
DC-SWAT/DreamShell
/firmware/bios/bootstrap/makeprog.py
UTF-8
264
2.796875
3
[]
no_license
#!/usr/bin/env python fd = open("prog.bin", "r").read() for i in range(0, len(fd), 8): sub = map(lambda x:ord(x), fd[i:i+8]) print "\t.byte\t0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x" % \ (sub[0], sub[1], sub[2], sub[3], sub[4], sub[5], sub[6], sub[7])
true
ded6b7e15b88ab740bd449c535c9782090a7e85f
Python
mofei952/cookbook
/c09_meta_programming/p06_define_decorator_that_takes_optional_argument.py
UTF-8
1,033
3.25
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : mofei # @Time : 2019/10/9 19:26 # @File : p06_define_decorator_that_takes_optional_argument.py # @Software: PyCharm """带可选参数的装饰器""" import logging from functools import partial, wraps # 要实现一个装饰器既可以不传参数,比如@decorator,又可以传递可选参数,比如@decorator(x, y, z) def...
true
62b28e33f5e9ead1e86bac35b96ef6568a0a2065
Python
zengxiaoye/webspider
/serch_job/insert_db.py
UTF-8
1,416
2.546875
3
[]
no_license
# coding=utf-8 try: import MySQLdb as mysqldb from MySQLdb import InternalError except ImportError: import pymysql as mysqldb from pymysql.err import InternalError conn_instance_dict = {} DB_CONFIG = { # 'host':'IP', 'port' : 3306, 'user':'自己密码', 'passwd':'666', 'host': 'localhost', 'port': 3...
true
629914fe6ee29d0bf5a0f91624189ec858be0058
Python
MontufarEric/VisibilityDQ
/VisibilityGraph-master/TimeTests/conwayTest.py
UTF-8
960
2.953125
3
[]
no_license
import networkx as nx import numpy as np import time import matplotlib.pyplot as plt def SerieToNetMod(serie): arrG1=[] G=nx.Graph() for Na in range (len(serie)): ya=serie[Na] maxslp=-1000 for Nb in range(Na+1,len(serie)): yb=serie[Nb] slp=(yb-ya)/(Nb-Na) ...
true
3b3caf1c1d71e307f6b886ed3f495a00165ce5ce
Python
sofiadurkan1/ITF-Fundamentals
/python/class_notes/2021_05_26_DERS/ders.py
UTF-8
5,093
4.03125
4
[]
no_license
""" # Sudoku sorusunun cevabı in-class hands-on sudoku = [ [0, 0, 0, 0, 6, 4, 0, 0, 0], [7, 0, 0, 0, 0, 0, 3, 9, 0], [8, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 5, 0, 2, 0, 6, 0], [0, 8, 0, 4, 0, 0, 0, 0, 0], [3, 5, 0, 6, 0, 0, 0, 7, 0], [0, 0, 2, 0, 0, 0, 1, 0, 3], [0, 0, 1, 0, 5...
true
958dc6e261281d8d7a82364b036cb285909037d1
Python
jpwchang/cs153-movie-genre-classification
/collect_data.py
UTF-8
3,862
2.953125
3
[]
no_license
import requests import time import os import sys from urllib.request import urlretrieve from random import choice from PIL import Image url = "https://api.themoviedb.org/3/genre/movie/list" payload = {'api_key': '7f2e30e73b023e51464893ee9ab03b1d', 'language': 'en-US'} response = requests.request("GET", url...
true
dba409ccdf4e2c90b53ba106c96720bb7f74ae18
Python
Manav-Aggarwal/bert-paraphrasing
/baseline/dataset_split_script.py
UTF-8
925
2.53125
3
[]
no_license
import json import copy import random def getJSONObj(filename): with open(filename) as json_file: data = json.load(json_file) return data combined_dataset = getJSONObj('baseline2/train_dev_combined_fasttext.json') data = combined_dataset['data'] random.shuffle(data) total = len(data) train_amt =...
true
a0c926f7f5b16968e72eea4cbf792c2b65b246c5
Python
k-eks/Laue-Script
/lauescript/laueio/pdb_iop.py
UTF-8
18,429
2.703125
3
[]
no_license
""" Created on Mar 25, 2014 @author: jens Module implementing support for PDB formated files. """ from operator import attrgetter from numpy import array from lauescript.types.atom import AtomInterface from lauescript.types.molecule import MoleculeInterface from lauescript.laueio.io import IOP import lauescript.cr...
true
514d01591b769b020e467b179dc74aa6b6556624
Python
andersbogsnes/ml_tooling
/tests/test_results/test_resultgroup.py
UTF-8
3,342
2.75
3
[ "MIT" ]
permissive
import pathlib from typing import List import pytest from sklearn.linear_model import LogisticRegression from ml_tooling.data import load_demo_dataset, Dataset from ml_tooling.metrics import Metrics from ml_tooling.result import Result, ResultGroup class TestResultGroup: @pytest.fixture(scope="class") def d...
true
f8a563f41d4ff1b5e232a66d85226ba8c6b42fc3
Python
RhysDeimel/code_challenges
/advent_of_code/2021/07/solutions.py
UTF-8
1,330
3.53125
4
[]
no_license
import math from collections import Counter def parse(puzzle_input): return [int(num) for num in puzzle_input.rstrip().split(",")] def part1(data): crabs = Counter(data) needed_fuel = {} for group in crabs.most_common(): desired_pos = group[0] total_fuel = 0 for pos, count i...
true
99403bc1a14225044d1ae933371d51f25a260490
Python
ZJWK/Two
/AUTO/perfome_11.py
UTF-8
2,441
3.734375
4
[]
no_license
# 模拟用户行为 ''' 1、需求:需要模拟鼠标操作才能进行的情况,比如单击、双击、鼠标右键、拖拽等操作 2、解决办法:selenium 提供了一个类来处理这类事件:selenium.webdriver.common.action_chains.ActionChains(driver) 3、脚本:from selenium.webdriver.common.action_chains import AchtionChains 4、原理:调用ActionChains不会立即执行,而是将所有的操作顺序放在一个队列里,当调用perform()方法时,队列中的事件会被依次执行 5、写法:支持链式写法和分步写法: ActionChains(d...
true
256c1da3637c940bb084809df3b5de6dfd3938d0
Python
heyengel/architek
/code/merge_data.py
UTF-8
2,493
2.84375
3
[]
no_license
import numpy as np import pandas as pd import glob, boto3 import data_processing, api_utils def merge_data(filenames): ''' INPUT: list, int OUTPUT: dataframe Merge list of files into a single pandas dataframe. ''' df_list = [] for filename in filenames: df_temp = pd.read_pickle(fi...
true
42dc036b245cd938a3a397e92646e0511a03cd87
Python
TheCodeWizard27/MissionEuropa
/input.py
UTF-8
341
2.96875
3
[]
no_license
#Input object speicher input class Input: input_buffer = []; #Fügt gedrückte Taste in Code am Input_buffer hinzu def add_input(self,key): self.input_buffer.append(key); #holt input aus dem buffer def get_input(self): return self.input_buffer[0]; #Löscht erstes element im buffer def rm_input(self): del sel...
true
58cd99cdadc2fcb1fc205d8917193e7a723e5be4
Python
MicAnt64/k-means
/k-means.py
UTF-8
4,130
2.90625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 3 18:29:54 2020 @author: michaelantia """ import numpy as np import matplotlib.pyplot as plt # Create toy data set mu1 = [39, 50] mu2 = [28, 58] mu3 = [27, 40] cov1 = [[10,0],[0,12]] cov2 = [[15,0],[0,17]] cov3 = [[8,0],[0,22]] z1 = np.ones(50)...
true
a7587a22d768fd630353e208c91aa336c3214dcd
Python
koichiHik/prob_robotics
/sensing_model/inverse_model.py
UTF-8
5,494
2.53125
3
[]
no_license
import sys import os sys.path.append(os.pardir) import math # Common Module from common.math_func import my_round from common.container import Coord2D from common.container import MapIntCoord2D # Ray Tracing Module from ray_tracing.ray_tracing_2d import RayTracing2D # Grid Map 2D Module from grid_map.grid_map_2d i...
true
6085e340045fc635d59ebbd36a6ffdefcba9cfc5
Python
dimatkach11/Torno_Subito
/base_python/the_lists.py
UTF-8
4,706
4.40625
4
[]
no_license
# ! the list # ! LISTS # * is an order list of heterogeneous items lista = ['first element', 10.5, 'carbonara', 11, ['ciao', 23], 'last element'] print(lista) # * extract the item from the list print('\n') print(lista[2]) print(lista[4]) print(lista[4][0]) # * to extract the last element print('\n') print(lista[-1]...
true
5a8ccdfc4912d4a0fe7ebdc8ffa8b5f028af4b59
Python
xianlopez/monodepth2_tf2
/test_transformations.py
UTF-8
15,147
2.8125
3
[]
no_license
import tensorflow as tf from scipy.spatial.transform import Rotation as R import numpy as np import cv2 import transformations def test_rotation_from_axisangle(): print('test_rotation_from_axisangle') # The first element in the batch will have the identity rotation, the second element another # more comp...
true
3018c49094cb8d1acecadb0472f136e7effdfd17
Python
coderwithpurpose/ML
/classifiers/svm_classifier_part1.py
UTF-8
3,153
3.109375
3
[]
no_license
from sklearn import svm import csv import random import math import numpy as np def loadCsv(filename): lines = csv.reader(open(filename, "rb")) dataset = list(lines) for i in range(len(dataset)): dataset[i] = [float(x) for x in dataset[i]] return dataset def splitDataset(dataset, splitRatio):...
true
453a65a52552b8d8b0824f86423b33e8bb931047
Python
JoshuaGeraghty-Smith/Poker
/player.py
UTF-8
674
3.078125
3
[ "BSD-3-Clause" ]
permissive
from dataclasses import dataclass, field from card import Hand, PokerHand from abc import ABC, abstractmethod @dataclass class Player(ABC): """ Abstract class for player entities, takes in an id and name on initialization, every player has a chip value and hand object. """ id: int name: str ...
true
8408678516792941588feb7147d207c4182b3465
Python
kssudheesh/anandpython
/chapter3/problem5.py
UTF-8
388
3.625
4
[]
no_license
#Write a program wget.py to download a given URL. The program should accept a URL as argument, download it and save it with the basename of the URL. If the URL ends with a /, consider the basename as index.html. import os import urllib import sys def wget(x): a = os.path.basename(x) if a == "": urllib.urlretrieve(x...
true
bee96786e9cc6f5b5771cebb1e9b7876269f2bb9
Python
AG-Systems/programming-problems
/firecode/Max-Gain.py
UTF-8
208
3.03125
3
[]
no_license
def max_gain(input_list): min_num = min(input_list) max_num = max(input_list) if input_list.index(min_num) < input_list.index(max_num): return max_num - min_num else: return 0
true
169c5895410a1ef2136595c8eb3aea8ee9a07059
Python
TiChuot97/iJudge
/web/eval/scripts/common.py
UTF-8
626
3.5625
4
[]
no_license
# this file contains several helpful utility functions that are used elsewhere import os # convert a string label to a boolean value for comparision def convert_label(s): s = s.strip() if s == 'yes' or s == 'true': return True elif s == 'no' or s == 'false': return False else: r...
true
884d0e2fc01548e9be40ea9d72f6837089d46d83
Python
TAMS-Group/bitbots_behaviour
/bitbots_connector/src/bitbots_connector/capsules/pathfinding_capsule.py
UTF-8
2,694
2.640625
3
[ "BSD-3-Clause" ]
permissive
import rospy import actionlib import math from move_base_msgs.msg import MoveBaseGoal, MoveBaseAction from geometry_msgs.msg import Pose2D from tf.transformations import euler_from_quaternion class PathfindingCapsule: def __init__(self): self.action_client = actionlib.SimpleActionClient('move_base', MoveB...
true
2aeae384baf40e9a34691efdea849045ca3ff772
Python
Tirafen/simple_telnet
/client.py
UTF-8
430
3.015625
3
[]
no_license
import telnetlib tn_ip = "localhost" tn_port = "8686" def telnet(): try: tn = telnetlib.Telnet(tn_ip, tn_port, 15) except: print("Unable to connect to Telnet server: " + tn_ip) return finally: tn.set_debuglevel(100) while True: print("Введите данные в ...
true
f052749c30371afa34280212cd4fe05b7fca7b3d
Python
tabrezi/SBLC
/Exp10.py
UTF-8
461
3.59375
4
[]
no_license
''' Implementation of Multithreaded program ''' from threading import * from time import sleep class A(Thread): def run(self): for i in range(50): print('A') class B(Thread): def run(self): for i in range(50): print('B') def main(): a = A() ...
true
05756856752729a6306ba09734601de47477b04e
Python
anirudhjayaraman/Project-Euler-Solutions
/euler2.py
UTF-8
637
4.125
4
[]
no_license
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. fi...
true
3dd8e74e3890f4fc9d3190f77c17945dd226e441
Python
BeAsYit/vakoms-blog
/blog/models.py
UTF-8
1,197
2.6875
3
[]
no_license
""" Module with models for our database """ from django.db import models # Create your models here. class Blog(models.Model): """ Model for our blogs, parent for Post model """ author = models.ForeignKey('users.CustomUser', on_delete=models.CASCADE) title = models.CharField(max_length=30) def...
true
0e095cfee28e705ba65f0c50fe419094cacf82a0
Python
seongbeenkim/Algorithm-python
/BOJ(Baekjoon Online Judge)/Mathematics/1978_소수 찾기(finding prime numbers).py
UTF-8
378
3.1875
3
[]
no_license
#https://www.acmicpc.net/problem/1978 import sys def check_prime(num): if num < 2: return 0 j = 2 while j*j <= num: if num % j == 0: return 0 else: j += 1 return 1 num = int(sys.stdin.readline()) cnt = 0 prime = list(map(int,sys.stdin.readline().spli...
true
363223ba4e38bd0d5f82839fc4a21d7a6e9eab1a
Python
tomlockwood/gol
/test/test_Game_conways.py
UTF-8
1,759
2.75
3
[]
no_license
import unittest import numpy from lib.gol import * class TestConwaysGameOfLife(unittest.TestCase): def setUp(self): self.r = Rules(rules=[ Rule(alive=False, transitions=[0,0,0,1,0,0,0,0,0]), Rule(alive=True, transitions=[0,0,1,1,0,0,0,0,0]) ]) def test_stable_square(self): ...
true
48c7c08f705c14d6ab8d7d161171ffe03b1d8608
Python
pledru/gene
/convert.py
UTF-8
820
3
3
[]
no_license
import os import argparse import pandas as pd def convert(file): print(file) new_file = file.replace(".csv", ".h5") print(new_file) cvs = pd.read_csv(file, sep=",", index_col=False, header=0, dtype={"genome_pos": int, "A": int, "C": int, "G": int, "T": int, "...
true
2ea6b157d7875dfb41e82269017c818a8dc55ddf
Python
RajaValluru/Weather-Prediction-using-Machine-Learning
/2_settting_up_dataframe.py
UTF-8
4,840
3.34375
3
[]
no_license
#SETTING UP THE DATAFRAME df = pd.DataFrame(records, columns=features).set_index('date') """it is quite helpful to have subject matter knowledge in the area under investigation to aid in selecting meaningful features to investigate paired with a thoughtful assumption of likely patterns in data.""" ...
true
a7c76639b4b8573ad972a60bcbf981c9cf80eeaa
Python
AsclepiusInformatica/distruct
/distruct/tools/math.py
UTF-8
1,537
3.15625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 ##################################### # # Filename : math.py # # Projectname : diSTruct # # Author : Oskar Taubert # # Creation Date : Tue 23 May 2017 17:01:55 CEST # # Last Modified : Mon 30 Jul 2018 03:02:16 PM CEST # ##################################### # TODO rename this module import math...
true
ddcfc63836d32f07660fb2ad46b74539bb22e11c
Python
dariakrav/my_python
/my_programming/lesson 5/random_letter1.py
UTF-8
447
3.953125
4
[]
no_license
import random def letter_game(): s = ['самовар','весна','лето'] word = random.choice(s) word1 =''.join(word) word1 = list(word1) letter = random.choice(word1) a = word.replace(letter, '?') print(a) b= input('Введите букву: ') if b != letter: print('Увы, попробйте в другой р...
true
63ceea58ba058202771d10debf55254f8d21048e
Python
Lianyihwei/RobbiLian
/Lcc/pythonrace/PYA603.py
UTF-8
120
3.203125
3
[]
no_license
nums = [] for i in range(10): num= eval(input()) nums.append(num) nums.sort() print(nums[-1],nums[-2],nums[-3])
true
bc21948f6076bfc1c4fc9c40b3c23f895b8d9d16
Python
kornai/langdeath
/ld/parsers/wikipedia_incubators_parser.py
UTF-8
4,345
2.546875
3
[]
no_license
import re from base_parsers import OnlineParser from ld.langdeath_exceptions import ParserException from utils import get_html, replace_html_formatting class WikipediaIncubatorsParser(OnlineParser): def __init__(self, resdir): self.url = 'http://incubator.wikimedia.org/wiki/Incubator:Wikis' sel...
true
37725d1232b92061f07d07c6db9177eac767687c
Python
fuckfuckfuckfuck/data
/jzt/day.py
UTF-8
556
2.71875
3
[]
no_license
#!/usr/bin/env python import datetime as dtime import re date1 = str(20151028) date2 = str(20151030) tmp = dtime.date.today() num = tmp.year*10000 + tmp.month*100 + tmp.day d1 = re.compile('@date1') d2 = re.compile('@date2') try: fstr = open("/home/dell/data/jzt/day.sql",'r') lines = fstr.readlines() fina...
true
976bf2d7a611e1dae7ba00f291fbb907b04c56b5
Python
joetm/annotation-mgr
/tools/modules/extractMeta.py
UTF-8
2,899
2.828125
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 """ ====================== PDF Metadata Extractor ====================== """ import sys import json from pyPdf import PdfFileReader class MetadataExtractor: """ Metadata Extractor class """ # d...
true
a76dcc51d00505a27c42b7d85d35b623b295e292
Python
chriscainx/mnnpy
/mnnpy/mnn.py
UTF-8
12,481
2.5625
3
[ "BSD-3-Clause" ]
permissive
from os import cpu_count from multiprocessing import Pool from functools import partial import numpy as np from anndata import AnnData from pandas import DataFrame from .utils import transform_input_data, find_mutual_nn, compute_correction from .utils import svd_internal, find_shared_subspace, get_bio_span, subtract_bi...
true
4868fdf9025c6b8227c2092afc4938566d708285
Python
PacktPublishing/Python-Journey-from-Novice-to-Expert
/Module 1/ch5/zip.grades.py
UTF-8
365
3.765625
4
[ "MIT" ]
permissive
# This is not a valid Python module - Don't run it. >>> grades = [18, 23, 30, 27, 15, 9, 22] >>> avgs = [22, 21, 29, 24, 18, 18, 24] >>> list(zip(avgs, grades)) [(22, 18), (21, 23), (29, 30), (24, 27), (18, 15), (18, 9), (24, 22)] >>> list(map(lambda *a: a, avgs, grades)) # equivalent to zip [(22, 18), (21, 23), (29,...
true
401f24bce45aa3a7d8ce41365bb7e4a852c9d3f2
Python
agarwalkaushal/Higher-Education-Recommendation
/plot.py
UTF-8
894
2.859375
3
[]
no_license
from opinionAnalysis import upload from opinionAnalysis import subjectivity from opinionAnalysis import polarity import nltk import pandas as pd import numpy as np import matplotlib.pyplot as plt data = {} data['Month'] = upload data['Subjectivity'] = subjectivity data['Polarity'] = polarity df = pd.DataFrame(data) gr...
true
13f08009e9f717cfa04083c69a507602661366f5
Python
Buggy-Virus/debate-tournament-simulation
/tourney_sim.py
UTF-8
954
2.53125
3
[]
no_license
import debate_functions as df dbtr_num = 16 team_num = dbtr_num // 2 dbtr_mn_mn = 200 dbtr_mn_std = 80 dbtr_std_mn = 80 dbtr_std_std = 60 judge_bias = 70 dbtrs = df.make_debaters(dbtr_num, dbtr_mn_mn, dbtr_mn_std, dbtr_std_mn, dbtr_std_std) teams = df.make_teams(dbtrs, dbtr_mn_mn, dbtr_mn_std) apda_teams = df.copy_te...
true
dc854def008fad1f523dbec2ccc30fc42a24e851
Python
QBatista/covid_suicides_japan
/suicide/extract/suicide_monthly.py
UTF-8
3,661
3.15625
3
[]
no_license
""" A script to scrape data for the number of suicides for different genders and age groups at a monthly frequency from Ministry of Health, Labor, and Welfare (厚生労働省). Ref: https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/0000140901.html """ import os import requests from bs4 import BeautifulSoup from zipfile import...
true
fb0d5826518b0dc43863524ff96d7b2c8becfda0
Python
sophialuo/CrackingTheCodingInterview_6thEdition
/8.10.py
UTF-8
1,434
3.96875
4
[]
no_license
''' Paint Fill: Implement the "paint fill" function that one might see on many image editing programs. That is, given a screen (represented by a two-dimensional array of olos), a point, and a new color, fill the surrounding area until the color changes from the original color) ''' #numbers represent colors; 1 re...
true
ca416d6bd51a7ae352af2c4d30e460b969de2ec8
Python
ylmzsmh/python-calisma
/Kurs/Diğer/python20182019pscarsamba9aoglen/!/new06/new07.py
UTF-8
566
4.0625
4
[]
no_license
#def myfunc(param1,param2): # sonuc=param1+param2 # return sonuc #toplamaSonucu=myfunc(10,20) #print(toplamaSonucu) def topla(x,y): t=x+y # print(t) return t def carp(x,y): ss=x*y # print(ss) return ss s1=input("birinci sayı girin :") s2=input("ikinci sayı girin :") s1=int(s1) s2=int(s2) isl...
true
e3f5c79d4dd53c0b1d20753110e067a2e6181590
Python
newmanships/eBookBuilder
/step2.py
UTF-8
1,845
2.828125
3
[]
no_license
import os import glob import shutil path = './' #Get total amount of chapters list_dir = [] list_dir = os.listdir(path) count = 0 tick = 3 #Use this against the count to write playOrder html_list = [] html_list.append("cover") html_list.append("copyright") for file in list_dir: if file.endswith('xhtml'): count...
true
ecdca85a0eeda5a3443b1376f8ed34d92136645a
Python
Sidharth-Dinesh/Sudoku-Puzzle-Generator-Solver
/sudoku_generator_solver.py
UTF-8
6,282
3.484375
3
[]
no_license
''' SUDOKU SOLVER: Using recursion and backtracking. Algorithm - 0. Define a solving function. 1. Search for the first empty slot(0). 2. Attempt to fill the empty slot with a number from 1-9. 3. If the number is already in the row/col/box, change it. 4. Call the function again. Pr...
true
13e2d752133b7cda7607968e898ce9fe2d96969c
Python
amoudgl/ml-coursework
/Assignment2/weights.py
UTF-8
5,236
2.734375
3
[]
no_license
# compare different weight initialization regimens from __future__ import print_function import numpy as np import os os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=cpu,floatX=float32" from keras import backend as K #Load the dataset from keras.datasets import mnist from keras.models import Sequential from ker...
true
ac5708f1ba572db266654be3417eecc321adceda
Python
mef21/GirlsWhoCode
/Lesson 2 - Conditionals/solutions/sol_exercise3.py
UTF-8
1,147
4.34375
4
[]
no_license
""" WELCOME TO CONDITIONALS SOLUTIONS EXERCISE 3 BEFORE YOU DO ANY CODING COPY THE BELOW TEXT INTO THE .replit FILE language = "python3" run = "cd Conditionals; cd solutions; clear; python3 sol_exercise3.py" For examples please refer to the example3.py file Start with the base code below GOAL: Ask the user for th...
true
589fc1b32427d169e0deae4278fd85afa38b345b
Python
Hiaza/course_work_bd
/analisys.py
UTF-8
3,436
3.046875
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.pipeline import make_pipeline import db_utils from math import radians, cos, sin, asin, sqrt from sklearn.linear_model import LinearRegression, Ridge from sklearn.preprocessing import PolynomialFeatures import numpy as np client = ...
true
aceda1e82f9bccee5427a0c06740a55e509a9348
Python
Kendearoth/mdf2019
/Crypto/crypto.py
UTF-8
1,456
3.234375
3
[]
no_license
#******* #* Read input from STDIN #* Use: echo or print to output your result to STDOUT, use the /n constant at the end of each result line. #* Use: sys.stderr.write() to display debugging information to STDERR #* ***/ import sys lines = [] for line in sys.stdin: lines.append(line.rstrip('\n')) N = int(lines[0]) ...
true
1e840323c32b68a7a9197c7edcc504b8d32f4521
Python
Jim-Luo/spiderForACMProblem
/spider/testForRe.py
UTF-8
361
2.59375
3
[]
no_license
import re from bs4 import BeautifulSoup import urllib2 download=urllib2.urlopen('http://acm.zju.edu.cn/onlinejudge/showProblems.do?contestId=1&pageNumber=1') text=download.read() print text soup=BeautifulSoup(text,'html.parser',from_encoding='utf-8') res=soup.find_all('a',href=re.compile(r'/onlinejudge/showProblems\.do...
true
27d26dd4685c5873406b755def4363bfee50984a
Python
opensourceyouthprogramming/h5vcc
/external/chromium/native_client_sdk/src/tools/quote.py
UTF-8
6,701
2.796875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import optparse import re import sys verbose = False def quote(input_str, specials, escape='\\'): """Returns a quoted version...
true
2fd6728597638fe035760facb60b56ede38be98f
Python
chopardda/LDAS-NLP
/pba/bert_features.py
UTF-8
8,478
3.125
3
[ "Apache-2.0" ]
permissive
# Based on code from UDA [https://github.com/google-research/uda/tree/master/text/bert] # coding=utf-8 # Copyright 2019 The Google UDA Team Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Lice...
true
28fa6d5085fa764d47d791354e8b1d584bff0323
Python
Gowtham0303/smartfoodplate
/read_arduino.py
UTF-8
306
2.875
3
[]
no_license
import serial import struct def getweight(): ser = serial.Serial('/dev/ttyACM0',9600) while True: read_serial=ser.readline() head=read_serial[0:2] # print(read_serial[0:2]) data=read_serial[2:] if(head=="FF"): return str(int(str(data),16)) #print(getweight())
true
fc41211610ece17772d762058bf0ecef6c3c998d
Python
kandarpksk/codemotion-las2018
/backend/phase1.py
UTF-8
12,297
2.703125
3
[]
no_license
def process(image, path, name, flag): red = (0,0,255) #p! lightgray = (150,150,150) #p! debug = False fraction = 1./10 # distance (as fraction of smaller dimension) to cluster within import cv2 import numpy as np import itertools, operator def minima(lol, f=operator.itemgetter(1)): return list(next(iterto...
true
2396c695bba541f7646c7dc57d29b70607a4fd29
Python
CEsarABC/Python-CI-
/Python fundamentals/Lists(inserting elements).py
UTF-8
401
4.28125
4
[]
no_license
# this is a list names = ['cesar', 'pablo', 'roger', 'jason', 'gabi', 'nicolas', 'kit'] print(names[2:4]) print(names[::2]) del names[0] print(names) names.insert(0, 'jhon') print(names) names.insert(4, 'ray') print(names) names.append('oscar') print(names) # .sort() function will sort alphabetically the item...
true
2bf1a12d77cb61cf3ef0ae10ce815ab579debb0a
Python
kookou/chatbot_project
/전처리/crawler/preprocessor.py
UTF-8
1,790
3
3
[]
no_license
from haversine import haversine, Unit import pandas as pd import folium class Preprocessor: pass # csv파일 불러옴 file_path = r'./../../data/csv/gangnam.csv' df = pd.read_csv(file_path, sep=',', encoding='utf-8-sig') # print(df) # print(df.columns) # print(df['nickname']) ### 닉네임에 따라 데이터 필터링 ### # 해당 조건을 만족하면 true...
true
6f272170e9b61f57afd83b14479d5af31886229a
Python
codeAligned/kickstart
/kickstart/2018 Round A/scrambled_words(S).py
UTF-8
721
3.0625
3
[]
no_license
def makeString(s1, s2, n, a, b, c, d): x = [ord(s1), ord(s2)] for i in xrange (2, n): x.append((a * x[i-1] + b * x[i-2] + c) % d) s = [s1, s2] + [chr(97 + (i % 26)) for i in x[2:]] return "".join(s) def findWord(word): m = len(word) for i in xrange(n - m + 1): if word[0] == S[i] and word[m-1] == S[i+m-1]: ...
true
cd4ce4d6818ad7569e91904ef8a689b151a99366
Python
AIPHES/live-blog-summarization
/summarize/nnsum/nnsum/metrics/perl_rouge.py
UTF-8
1,776
2.828125
3
[ "Apache-2.0" ]
permissive
import pathlib from ignite.exceptions import NotComputableError from ignite.metrics.metric import Metric import rouge_papier class PerlRouge(Metric): """ Calculates the average rouge score using the original perl rouge script. """ def __init__(self, summary_length, remove_stopwords=True, ...
true
55644828cfadf2d242060222d630f9cae4879ef7
Python
kys0808/2020_1
/B411038_김영수_gradient_cross_entropy.py
UTF-8
2,487
3.09375
3
[]
no_license
import numpy as np from functions import sigmoid, softmax y1 = np.array([0.1, 0.05, 0, 0.6, 0, 0.1, 0, 0.4, 0.05, 0]) t1 = np.array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0]) t1_label = np.array([3]) y2 = np.array([[0.1, 0.05, 0, 0.6, 0, 0.1, 0, 0.4, 0.05, 0], [0.1, 0.05, 0, 0.06, 0, 0.1, 0, 0.4, 0.5, 0]]) t2 = n...
true
924b5ecb6975159ffc75597fcfa57e454521cac7
Python
samuhs/Distancias-Fila
/fila.py
UTF-8
330
3.15625
3
[]
no_license
class Fila: def __init__(self): self.fila= [] def criar_fila(self,tamanho,item): self.fila.append(item) def fila_nao_esta_vazia(self): return (len(self.fila) == 0 ) def colocar_fila(self, x): self.fila.append(x) def sair_fila(self): return self.fil...
true
4b43a9ecf98281663a0128293714d9f4bb2d5b38
Python
Bug38/AoC
/2021/day15.py
UTF-8
2,513
2.953125
3
[ "MIT" ]
permissive
from copy import deepcopy import utils data = utils.getLinesFromFile("day15.input") # data = ['1163751742','1381373672','2136511328','3694931569','7463417111','1319128137','1359912421','3125421639','1293138521','2311944581'] data = [[int(x) for x in data[y]] for y in range(len(data))] # map = [[int(x) for x in d] fo...
true
2242fd4f0e85a7ebae79230c59d563e194cfca41
Python
11lomag11/backend_python
/Lesson_4_Testing/gcd.py
UTF-8
457
3.71875
4
[]
no_license
def gcd(m: int, n: int) -> int: m = abs(m) n = abs(n) if m == 0 and n == 0: raise Exception("Нет общего делителя для двух нулей") if m == 0 and n != 0: return n if n == 0 and m != 0: return m if n == 1 or m == 1: return 1 if m == n: return ...
true
1fb475b21e43d03d09931ecaee4649aebb74091c
Python
CodingDojoOnline-Nov2016/JeremyFeder
/Python1/Multiples.py
UTF-8
300
3.609375
4
[]
no_license
# Part 1 for num in range (1, 1000+1): if num % 2 != 0: print num # Part 2 for multiple in range (5, 1000000+1): if multiple % 5 == 0: print multiple # Part 1b for num in range (1, 1000+1, 2): print num # Part 2b for multiple in range (5, 100+1, 5): print multiple
true
ecb27531e17ca782b2ded35333fe870e43586ca1
Python
J-Ulian/books
/import.py
UTF-8
688
3.078125
3
[]
no_license
import os import csv from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker # Set up database engine = create_engine(os.getenv("DATABASE_URL")) db = scoped_session(sessionmaker(bind=engine)) # Insert row by row with open('books.csv', mode='r') as csv_file: csv_reader = csv....
true
a4798c8023c36a08078adfdcfdec9ccf5420adbb
Python
ZJUZQ/Net_caffe
/official_examples/5_pascal-multilabel-with-datalayer/pascal-multilabel-with-datalayer.py
UTF-8
10,616
2.59375
3
[]
no_license
import sys import os import numpy as np import matplotlib.pyplot as plt from copy import copy import argparse sys.path.append("pycaffe/layers") # the datalayers we will use are in this directory. sys.path.append("pycaffe") # the tools file is in this folder ## % matplotlib inline plt.rcParams['figure.figsize'] = (6,...
true
289992206b467aec8dc927ceb16a25c5d5078f53
Python
P3n9W31/Leetcode
/Python/#500_Keyboard Row.py
UTF-8
857
3.46875
3
[]
no_license
class Solution: def findWords(self, words): """ :type words: List[str] :rtype: List[str] """ row1 = ['q','w','e','r','t','y','u','i','o','p'] row2 = ['a','s','d','f','g','h','j','k','l'] row3 = ['z','x','c','v','b','n','m'] ans = [] for word in...
true
512d7a92ea2be4af2666f58de7b5c2c605b360ec
Python
zwh42/SpiderVerse
/DoubanTop250/douban_top250/douban_top250/spiders/douban_book_top250.py
UTF-8
1,571
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from lxml import etree from ..items import Book class DoubanBookTop250Spider(scrapy.Spider): name = 'douban_book_top250' allowed_domains = ['douban.com'] start_urls = ['https://douban.com/'] def start_requests(self): for i in range(0, 10): url...
true
5cd0d40cd1470249bdbb5e7b13632cee67515c74
Python
cenuno/random_python
/python/02_distance_function.py
UTF-8
739
3.953125
4
[]
no_license
import numpy as np def calculate_distance(a, b, c=2, verbose=True): """ Calculates the distance of two arrays. Returns a float. """ if verbose and c==1: print("Calculating the Manhattan distance:") elif verbose and c==2: print("Calculating the Euclidean distance:") elif verbos...
true
23fb82f9221c576d8e488697b31527fb9264d5ea
Python
aadityachapagain/Descent_py
/hackerrank/dynamicAarray.py
UTF-8
2,136
3.359375
3
[ "MIT" ]
permissive
""" ____ _ _ | _ \ _ _ _ __ __ _ _ __ ___ (_) ___ / \ _ __ _ __ __ _ _ _ | | | | | | | '_ \ / _` | '_ ` _ \| |/ __| / _ \ | '__| '__/ _` | | | | | |_| | |_| | | | | (_| | | | | | | | (__ / ___ \| | | | | (_| | |_| | |____/ \__, |_| |_|...
true
b23e5f1e2bf3430ea048860d04009f67f06ec346
Python
roylanceMichael/compling_572_advancedstats_washington
/hw2/src/reportFiles.py
UTF-8
1,706
2.859375
3
[]
no_license
def reportModelFile(modelFile, rootS): with open(modelFile, "w") as outputF: for tree in rootS.reportTree(): outputF.write(tree + "\n") def reportSysFile(sysFile, rootS, vectorInstances): with open(sysFile, "w") as outputF: for vectorInstance in vectorInstances: outputF.write(rootS.reportClassificationResu...
true
6a4414d1a4d4ad75c63cf9a36d99451023643a13
Python
bjkim777/working
/QC/moving-average/moving-average.py
UTF-8
1,313
2.890625
3
[]
no_license
import os import sys import argparse COUNT_DEPTH={} def GetOpts(): parser = argparse.ArgumentParser(description = '') #parser.add_argument('-a', '--arg1', type=str, default='.', metavar='<arg1>', help= 'description') parser.add_argument('-f', '--file', required=True, metavar= '<file>', help= 'samtools depth fil...
true
b1d65698b216f31ab9f833007d9cc04b89c0420d
Python
dundunmao/LeetCode2019
/792. Number of Matching Subsequences.py
UTF-8
979
3.453125
3
[]
no_license
class Solution: def numMatchingSubseq(self, S: str, words) -> int: res = 0 heads = [[] for i in range(26)] for word in words: heads[ord(word[0]) - 97].append(Node(word, 0)) for c in S: old = heads[ord(c) - 97] heads[ord(c) - 97] = [] f...
true
cd9acf8e671b76c6433bc94bb326acce61b3f871
Python
ChirnilK/Image_compression
/cv.py
UTF-8
1,345
3.3125
3
[]
no_license
import cv2 import sys """This is the code using built-in function of OpenCV to compress a grayscale image. I commented out some codes for measuring the execution time.""" def compressOpencv(filename, n=2): """This function requires two imputs, filename and n. n is the number that you want to ...
true
e3a2d304741ada35ad84791d39e1df60b3ade655
Python
Evanjelik/Priklady
/06.Kvadraticka_rovnica.py
UTF-8
672
3.84375
4
[]
no_license
import math print('Vypocitam ti kvadraticku rovnicu.\nZadaj koeficienty a,b,c do tvaru kvadratickej rovnice ax^2 + bx + c = 0\n') a = input('Zadaj koeficient a: ') while not a != 0: print('a nesmie byt nula') a = input('Zadaj koeficient a: ') b = input('Zadaj koeficient b: ') c = input('Zadaj koeficient c: ...
true
81e4bbfb8a8eb6cee2f8dbf9b2457af91cd5dec0
Python
fzachariah/Gluster-Dashboard
/glusterDashboard-master/gitlab/lib/python3.5/site-packages/perceval/backend.py
UTF-8
7,343
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Bitergia # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This ...
true
237db761c1381f83ec468701f4112e840fb320cd
Python
samuraigrin/msu-prac
/5th_semester/ml/hw_10_21/functions_vectorised.py
UTF-8
1,839
3.109375
3
[]
no_license
import numpy as np def prod_non_zero_diag(X: np.ndarray) -> int: """ Compute product of nonzero elements from matrix diagonal, return -1 if there is no such elements. Return type: int / np.integer / np.int32 / np.int64 """ y = np.diag(X)[np.diag(X) != 0] res = 1 fl = -1 for ...
true
96349d781ffb83ae4ed971b1a7cbd7ca9ce75794
Python
lsn199603/leetcode
/32-子集.py
UTF-8
1,116
4.0625
4
[]
no_license
""" 给你一个整数数组 nums ,数组中的元素 互不相同 。返回该数组所有可能的子集(幂集)。 解集 不能 包含重复的子集。你可以按 任意顺序 返回解集。 输入:nums = [1,2,3] 输出:[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] 深度优先遍历 回朔算法 """ nums = [1,2,3] res = [] length = len(nums) if length == 0: print(nums) # def dfs(i, temp): # res.append(temp) # for j in range(i, length): # ...
true
5d862df327d47e88d9b705111cddb7e6576521ed
Python
caroline877382836/test
/PythonScripts/ReadTxtToExcel.py
UTF-8
888
2.9375
3
[]
no_license
import xlwt import os mypath = "D:/" textfile = [ os.path.join(mypath,f) for f in os.listdir(mypath) if os.path.isfile(os.path.join(mypath,f)) and '.txt' in f] def is_number(s): try: float(s) return True except ValueError: return False style = xlwt.XFStyle() style.num_format...
true
99d45f5debbd1d88a060fbc368aa115ca92b4992
Python
CityManager/start_flask
/a00_tutorial/tutorial_test.py
UTF-8
2,261
2.84375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # _*_ coding:utf-8 _*_ import os import tempfile import unittest import tutorial __author__ = 'CityManager' # The Testing Skeleton class TutorialTestCase(unittest.TestCase): def setUp(self): # 测试用例中的测试方法执行前的初始化操作 # 1/创建临时文件 用于临时数据库文件 # 2/关联 待测试应用对象 # 3/执行 待测...
true
02dfccf40ca55f7ad7269679ee03a8e1f207c1cd
Python
tomek-rej/hashnote
/hashnote_ui/helper.py
UTF-8
1,419
3.0625
3
[]
no_license
from hashnote_ui.models import Filter class FilterProcessor: def coarse_filter_using_hashtag(self, hashnotes, filter_value): """ This function finds all records in the HashNote table that contain the term <filter_value> """ return hashnotes.filter(content__icontains=filter_...
true
b817bd56731cfc728dd83b5b55a38c3ff2963b6b
Python
fengbaoheng/leetcode
/python/1008.construct-binary-search-tree-from-preorder-traversal.py
UTF-8
1,622
3.625
4
[ "MIT" ]
permissive
# # @lc app=leetcode.cn id=1008 lang=python3 # # [1008] 先序遍历构造二叉树 # from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # 递归构造二叉树, 在于如何找到1个根节点值,m个左子树节点值,n个右子树节点值 # 对于先序遍历, 根节点值总为第1个 # 在剩余的值中, 依据二叉搜索树的性质:...
true
dddc998de24dfffbe235606db40fd9a471e36872
Python
infogrind/kindle-vocab
/lookup.py
UTF-8
1,027
2.984375
3
[]
no_license
#!/usr/bin/python import sys from DictionaryServices import * def main(): try: infile = sys.argv[1].decode('utf-8') except IndexError: errmsg = 'You did not enter any terms to look up in the Dictionary.' print errmsg sys.exit() try: with open(infile) as f: ...
true
bdbcef4266b1036f92e8dee786cb5100151efb34
Python
oumayb/NeighConsensus
/model/model.py
UTF-8
2,993
2.515625
3
[ "MIT" ]
permissive
import torch from neighConsensus import NeighConsensus, MutualMatching, MutualMatchingSoftMax from util import featureL2Norm, featureCorrelation from FeatureExtractor.ResNet18 import ResNetConv4, ResNetConv5 import torchvision.models as models from torch import nn class NCNet(torch.nn.Module): def __init__(self, ...
true
6c6a8e01c7c4f434030b3e7f692e730b640ebaea
Python
Sagisurya/leetcodepractice
/addlinkedlists.py
UTF-8
940
3.265625
3
[]
no_license
class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: head = ListNode() x = l1.val + l2.val head.val = x%10 carry = x//10 current = head current1 = l1.next current2 = l2.next while current1 is not None or cu...
true
362cabe157e457b85118aa489cde4d1a335e6901
Python
mcanearm/code_eval
/longestLines/longestLines.py
UTF-8
591
3.171875
3
[]
no_license
import sys input_file = sys.argv[1] text_dict = {} with open(input_file) as i: count = 0 for line in i: count += 1 if count == 1: N = int(line.strip()) else: line_count = len(line) if line_count in text_dict: text_dict[line_count].appe...
true
8221cd95de00bdc366c34840fa06b86b1239ece6
Python
hakon55/TMA4265_project1
/main.py
UTF-8
3,883
3.5
4
[]
no_license
import random from statistics import mean import numpy as np import matplotlib import matplotlib.pyplot as plt # Task 1 d) def simulate_timesteps(): # Variables given by task beta = 0.05 gamma = 0.20 N = 1000 N_s = list() N_i = list() rand_prob = 0 counter = 0 while counter < N: ...
true
65483f3e25b459ae743d33fb45c5db2832d04e7a
Python
aea7/dataeng
/python/builtins.py
UTF-8
502
4.21875
4
[]
no_license
# range nums = range(0,10) nums = list(nums) print(nums) print(list(range(0,11,2))) # equals to following nums_list2 = [*range(0,11,2)] print(nums_list2) # enumerate names = {'Kramer', 'Elaine', 'George', 'Newman', 'Apo'} # or ['', ''].. # Unpack an enumerate object with a starting index of one indexed_names_unp...
true
9a6d0f7fc6ee53ffe43e9407db933d39097a9002
Python
Averiandith/jubilant-ahri
/swap_case.py
UTF-8
123
3.671875
4
[]
no_license
def swap_case(s): return "".join([char.lower() if char.isupper() else char.upper() for char in s])
true
31b2033065d22a5dba3d4e4dc53075abce1f95df
Python
flothesof/advent_of_code2018
/Problem 08.py
UTF-8
1,923
3.5
4
[ "MIT" ]
permissive
from collections import namedtuple Node = namedtuple('Node', 'children metadata') def parse(subtree): nchildren = subtree[0] nmeta = subtree[1] if nchildren == 0: metadata = subtree[2:2+nmeta] remainder = subtree[2+nmeta:] return Node([], metadata), remainder else: pare...
true