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
9e0094ca5cdba49d0ba1a770d46c3decc1f86ac3
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2722/60614/281084.py
UTF-8
114
3.484375
3
[]
no_license
num=int(input()) for i in range(num): if int(input())%5==0: print("YES") else: print("NO")
true
8019583bd16b98f94b9352c6ca302dfa54de7149
Python
Remuranun/pyro-bot
/pyrobot/bot/updatedb.py
UTF-8
498
2.59375
3
[]
no_license
import bsddb import urllib2 idb = bsddb.hashopen('items.db') dburl = 'http://svn.eathena.ws/svn/ea/trunk/db/item_db.txt' dbtext = urllib2.urlopen(dburl).read() dblines = dbtext.split('\n') dblines = filter(lambda a: not a.startswith('//'), dblines) for k in idb: del idb[k] for line in dblin...
true
2d8aa14abf5d406cab36745c433918b12f0e0550
Python
CSshengxy/DAN-Caffe
/DesignLayer/AffineTransformLayer.py
UTF-8
2,233
2.84375
3
[ "MIT" ]
permissive
import caffe import numpy as np IMGSIZE = 112 class AffineTransformLayer(caffe.Layer): def setup(self, bottom, top): if len(bottom) != 2: raise Exception("Need two inputs to compute the transform image") def reshape(self, bottom, top): top[0].reshape(1,1,imageHeight,imageWidth) ...
true
e33dd4e79858ffb39a187c09d7149396b8881038
Python
alexandraback/datacollection
/solutions_5652388522229760_0/Python/chongkong/counting_sheep.py
UTF-8
544
3.6875
4
[]
no_license
def sheep_count(n): if n == 0: return 'INSOMNIA' remaining_digits = set(range(10)) for i in range(1, 91): current_sheep = str(n * i) for ch in current_sheep: if int(ch) in remaining_digits: remaining_digits.remove(int(ch)) if len...
true
4dfc20f7a22b441bd1d3097e2347d57a50b4f9d5
Python
wuying1995/Machine-learning
/线性回归/SimpleLineareRegression (2).py
UTF-8
647
3.0625
3
[]
no_license
import numpy as np class simpleLinearRegression: def __init__(self): self.a_=None self.b_=None def fit(self,x_train,y_train): x_mean=np.mean(x_train) y_mean=np.mean(y_train) num=(x_train-x_mean).dot(y_train-y_mean) d=(x_train-x_mean).dot(x_train-x_mean) ...
true
1bb8efd853af60568d90f2c3e047619053259585
Python
aryanpodium777/movie-trends-be
/dao_director.py
UTF-8
1,881
2.78125
3
[]
no_license
from connection import Connection from model.director import Director from model.analytics import AnalyticsDoughnut , AnalyticsBar from singleton import Singleton class DirectorDao(metaclass=Singleton): connection = Connection() def fetchDirectorByMovieinfoId(self,movieinfoId): query = "SELECT id,name FROM `movie...
true
51aff5529fb321746cfe96150d4e0706ce1522e3
Python
RoybOG/CalcFarm2.0
/Calc_farm_database_analyser.py
UTF-8
39,666
2.859375
3
[]
no_license
import sqlite3 import os import json import enum class ColumnData(enum.Enum): cid = 0 name = 1 type = 2 notnull = 3 dflt_value = 4 pk = 5 def handle_path(path): valid_path = '/'.join(list(filter(lambda x: len(x) > 0, path.replace('\\', '/').split("/")))) # print(valid_...
true
d94ad7c460648099b33d871a33ea969b34c0b943
Python
frankieliu/problems
/leetcode/python/599/sol.py
UTF-8
1,415
3.96875
4
[]
no_license
Python, 5 lines, O(n) time, O(n) space https://leetcode.com/problems/minimum-index-sum-of-two-lists/discuss/103658 * Lang: python3 * Author: Matti * Votes: 1 ``` class Solution(object): def findRestaurant(self, list1, list2): """ :type list1: List[str] :type list2: List[str] ...
true
29664ecd5f49d2a96c5bb622adc03b689a3f0f8b
Python
ConceptCodes/python-throwaways
/address_book.py
UTF-8
1,544
3.484375
3
[]
no_license
import re class Contact: def __init__(self, name: str, number: str, address: str): self.__name = name self.__number = number self.__address = address def validate_number(self, number: str) -> bool: return re.match(r'^(\+0?1\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$',number) @p...
true
62eb90fdd03ce89c535b03029ebe775420f22068
Python
delock/RobotControl
/bottom_half/test.py
UTF-8
307
2.6875
3
[ "MIT" ]
permissive
import serial import sys import time print ("command is \"" + sys.argv[1] + "\"") ser = serial.Serial('/dev/ttyACM0', 9600) ser.write(bytes(sys.argv[1]+"\n", "utf-8")) while True: val = ser.readline() string = val.decode("utf-8"); print (string) if (string == "+OK\r\n"): break
true
1aca617060f55247badca1ee6b347e9e7d771830
Python
MelissaChen15/quant
/factors/BasicFactor.py
UTF-8
8,676
2.5625
3
[]
no_license
# __author__ = Chen Meiying # -*- coding: utf-8 -*- # 2019/4/5 17:01 import numpy as np import pandas as pd from factors.sql import pl_sql_oracle import datetime from factors.util import datetime_ops """ 基础因子类 """ class BasicFactor(object): def __init__(self, factor_code, name, describe): self.factor_cod...
true
9b38ef18fc99eda5c8e68b5b16f370f8dd258c56
Python
mariosky/databook
/ejemplos/peliculas_taquilleras/mbg.py
UTF-8
515
2.703125
3
[ "MIT", "CC-BY-SA-3.0", "Apache-2.0" ]
permissive
from re import sub from decimal import Decimal import numpy as np import seaborn as sns import matplotlib.pyplot as plt file = open('gross.dat') data = [(title, Decimal( sub(r'[^\d.]', '', budget)),Decimal( sub(r'[^\d.]', '', gross))) for title, budget, gross in [line[:-1].split('|') for line in file ]] ...
true
67d9dfa7bd47bbeac0575f458be84e920b02a109
Python
Shreyash-310/Sololearn_practice
/pandas_prac_2.py
UTF-8
686
3.4375
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt # df['month'] = pd.to_datetime(df['date'],format="%d.%m.%y").dt.month_name() data = { 'width': [2, 2, 7, 1, 9], 'height': [3, 1, 4, 6, 2] } df = pd.DataFrame(data) # print(df) df['area'] = df['width'] * df['height'] print(df) df[['area', 'width', 'h...
true
8649db2c7c87e0f4e627cada8f099f7eb4168541
Python
triatebr/aprenda-raspberryPI
/Push2button2leds_05-04-2018/push2button2leds.py
UTF-8
1,128
3.328125
3
[]
no_license
#Definindo da biblioteca GPIO import RPi.GPIO as GPIO from time import sleep #Aqui definimos que vamos usar o numero de ordem do pino, e não o numero que refere a porta #Para usar o numero da porta, é preciso trocar a definição "GPIO.BOARD (ex. Pino 12)" para "GPIO.BCM (ex.GPIO 18)" GPIO.setmode(GPIO.BOARD) # Setand...
true
52271a77d6d9fdd2addd8b209e4ce394b8f3bfba
Python
tbmihailov/ScreenPy
/screenpy/screenpy_tests.py
UTF-8
1,740
2.71875
3
[]
no_license
from screenpy.screenpy_common import * print('testing SETTING') t1 = ' EXT. THE JUNGLE - INDY\'S RUN - CLOSE ANGLE - DAY' t2 = ' Indy disappears into the foliage. PAN TO an instant later, the leaves ' t3 = ' EXT. THE URUBAMBA RIVER - DUSK' t4 = """ An amphibian p...
true
f4686fb55a4d83303787c0cd7a84b4aed4a900b9
Python
ilia-makhonin/python-simple-example
/python-data-structure-master/linked_list.py
UTF-8
1,531
3.84375
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.next = None def get_data(self): return self.data def get_next(self): return self.next def set_next(self, next_link): self.next = next_link def __str__(self): return 'NODE data: {}; NODE ne...
true
5748980b07b31fb36e308a073481979ac254af60
Python
HuangChain/job
/sample/new_job/tests/test_home.py
UTF-8
892
2.671875
3
[]
no_license
from .suite import BaseSuite from urllib import parse class TestHomePage(BaseSuite): def test_home_page(self): res = self.client.get(self.url_for('front.home')) self.assertIn(b'Welcome to Stoya', res.data) self.assertIn(b'</form>', res.data) def test_invalid_keyword(self): test_keys = ['#1', '@#$', '高级%&',...
true
925b1be64a44b69dccc386a2b97a44316981e650
Python
Lawlighty/Python
/python项目实例/GlidedSky闯关/basic2/多进程求和.py
UTF-8
269
2.890625
3
[]
no_license
a = [1,2,3,4,5,6] from multiprocessing.pool import ThreadPool def sum(a,b): return a+b mlist = [] pool = ThreadPool(processes=5) for i in a: async_result = pool.apply_async(sum,(1,i)) res = async_result.get() mlist.append(res) print(mlist)
true
006eacc1e276984db5b1cf78ff1c071336c7278e
Python
luozhaoyu/leetcode
/majority2.py
UTF-8
949
3.03125
3
[ "MIT" ]
permissive
class Solution: # @param {integer[]} nums # @return {integer[]} def majorityElement(self, nums): if len(nums) % 3 == 0: minus = len(nums) / 3 - 1 else: minus = len(nums) / 3 res = {} for i in nums: if i in res: res[i] += 1 ...
true
cfd2d5a63359bbc2e6e63533b25bdba568b82e31
Python
AbbyGeek/CodeWars
/8kyu/Beginner Series 2 Clock.py
UTF-8
65
2.59375
3
[]
no_license
def past(h, m, s): return (h*1000*60*60)+(m*1000*60)+(s*1000)
true
ea7bf0f6bd988c6336bac5ad350cb7e0fe643dcc
Python
randbrown/euler
/357/357.py
UTF-8
1,381
3.46875
3
[ "MIT" ]
permissive
import sys from sys import argv import math import time start = time.time() def sieve(n): # allocate an extra one to handle the d+n/d max value s = [True] * (maxValue+2) sq = int(math.sqrt(n)) for j in range(2, sq+1): if s[j] == True: for i in range(2*j, n, j): s[i...
true
1caaaa452c1854f4f82a9ac1e675bdf4ae63d888
Python
Acciorocketships/PybulletGame
/GameClient.py
UTF-8
1,147
2.546875
3
[]
no_license
from PlayerClient import PlayerClient from GameServer import GameServer from Visualiser import Visualiser import torch import threading import time class GameClient: def __init__(self, remote=False, gameserver=None, clienthost='localhost', serverhost='localhost'): self.playerclient = PlayerClient(remote=remote, g...
true
1e6208d3b8b58af53ee1291268074d25061264ec
Python
Time-Magic/Traning_code
/BOSTON/boston_LinearRegression.py
UTF-8
1,526
2.9375
3
[]
no_license
import matplotlib.pyplot as plt from sklearn.datasets import load_boston from sklearn.decomposition import PCA from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.preprocessing.data import StandardScaler bostondata = load_boston() # 导入boston数据 boston_X =...
true
4b23709c0a7dec25a1cdda96e39831ffb1571928
Python
sgs-nlp/persian-natural-language-processing
/nvd/extractor.py
UTF-8
8,377
2.765625
3
[]
no_license
from json import loads from math import log as logarithm import os from classification.settings import BASE_DIR STOP_WORDS_PATH = os.path.join(BASE_DIR, 'nvd', 'persian.stopword.json') class Stopwords: def __init__(self, stopwords_list: list = None) -> None: """ in kelas baraye modiriyate stop wo...
true
6d39b4c423ef52bb5e9bdc9ae3c9f23e9c02ea07
Python
philipluk/ftrack_performance_tests
/performance_test.py
UTF-8
21,378
2.65625
3
[]
no_license
#! /usr/bin/env python """ Performance testing script for FTrack. Tests the ftrack_api vs sqlalchemy vs MySQLdb performing similar queries. `setup_*` functions are run once and their corresponding `test_*` may be run multiple times to get timing averages. """ import time import timeit import gc global_data = dict( ...
true
fab6172b42577a3dce3b7f8880008888880003b0
Python
kibitzr/kibitzr
/tests/unit/notifiers/test_python.py
UTF-8
889
2.59375
3
[ "MIT" ]
permissive
import pytest from kibitzr.notifier.factory import CompositeNotifier from ...compat import mock from ...helpers import SettingsMock @pytest.fixture() def settings(): """Override native settings singleton with empty one""" return SettingsMock.instance() def test_python_unicode_is_handled(settings): con...
true
2a5985c102bbdf120cde7baaf79787f917be98b3
Python
Stumpbeard/bts-crawler
/btscrawler.py
UTF-8
2,300
2.984375
3
[ "MIT" ]
permissive
import sqlite3 import re import urllib.request import sys import html import codecs boyTotals = { "Rap Monster": 0, "Suga": 0, "J-Hope": 0, "V": 0, "Jimin": 0, "Jungkook": 0, "Jin": 0 } outfile = codecs.open(sys.argv[1], 'w', 'utf-8', 'ignore') def getMemberLines(d, color, member, lyrics):...
true
4f25d7890805026b1aeb44ec65c43eeed0d94b62
Python
vivekshingate/python_intermediate_project
/q03_create_3d_array/build.py
UTF-8
307
2.671875
3
[]
no_license
# %load q03_create_3d_array/build.py # Default Imports import numpy as np # Enter solution here def create_3d_array(): #specify desired dimensions dim1 = 3; dim2 = 3; dim3 = 3 elements = dim1*dim2*dim3 variable = np.arange(elements).reshape(dim1,dim2,dim3) return variable
true
360c43e6312698ebb5ef609803db5651a5214537
Python
jafo2128/mikrotik-profiler
/mikrotik_connector.py
UTF-8
699
2.59375
3
[]
no_license
""" Here we just call the mikrotik profile api and send the data retrieved to the database """ from librouteros import connect from librouteros.login import plain def mk_connect( username: str="admin", password: str="", host: str="localhost", timeout: int=10, port: int=28728 ): """ simple...
true
f5fe4585964b1d83953a7d976d83f243e4bfd366
Python
syedroshanzameer/Data-Mining
/Support Vector Machine/GaussianNB.py
UTF-8
533
2.53125
3
[]
no_license
from sklearn import datasets iris = datasets.load_iris() from sklearn.naive_bayes import GaussianNB gnb = GaussianNB() import numpy as np from sklearn.cross_validation import train_test_split X_train, X_test, y_train, y_test = train_test_split(iris.data,iris.target) y_pred = gnb.fit(X_train,y_train).predict(X_test) ...
true
00c3c2e714fe9fe3cf4ddafac5d0e65e72c7c347
Python
andalenavals/Un_courses_and_projects
/Numerical_methods/EDO/ecuacioneulermejorado.py
UTF-8
505
2.703125
3
[]
no_license
from pylab import * from numpy import * k=.1 m=1 dt=0.1 def dvdt(x): return -k*x/m def dxdt(v): return v x=.1 v=0 t=0 xl=[] vl=[] tl=[] for i in range(1000): xl.append(x) vl.append(v) tl.append(t) vo=v xo=x k1=dt*dxdt(vo) j1=dt*dvdt(xo) x1=x+(dt/2)*(dxdt(vo)+dxdt(k1)) v1=v+(dt/2)*(dvdt(xo)+dvdt(j1)) k2...
true
4e9ae3e25cfb08698febbc2d4325e8dc7e256323
Python
madri308/New-Flower
/flowerView.py
UTF-8
6,795
2.90625
3
[]
no_license
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) from matplotlib.backend_bases import key_press_handler from matplotlib.figure import Figure import matplotlib.pyplot as plt from tkinterStuff import * from controller import * from flowerComponents import * import math impor...
true
c854f205c4e1842c1aa08d928cd9f44cb272828d
Python
BoxHen/ABLS-Autonomous-Beacon-Location-System
/Rover/ultrasonics/test/infrared_test.py
UTF-8
335
3.015625
3
[]
no_license
#!/usr/bin/env python import RPi.GPIO as IO IO.setwarnings(False) IO.setmode (IO.BCM) IO.setup(2,IO.OUT) #GPIO 2 - LED as output IO.setup(14,IO.IN) #GPIO 14 - IR sensor input while 1: if(IO.input(14)==True): #No object detected IO.output(2,False) #led OFF if(IO.input(14)==False): #object detected IO.output(2...
true
ea1f2c05db9e9fbbcf1ea9f89557aac0b038d23b
Python
JinZjt/UCSD-Algorithm-Toolbox-coursera
/placing_parentheses.py
UTF-8
1,149
3.1875
3
[]
no_license
# Uses python3 import numpy as np def evalt(a, b, op): if op == '+': return a + b elif op == '-': return a - b elif op == '*': return a * b else: assert False def minandmax(i,j,dataset,M,m): Min = 999999 Max = -999999 for k in range(i,j): a = evalt(M...
true
a2225ff30e4ceadf69610b75d86cbdfe2463a36f
Python
fta090/fftaa
/cogs/yazankazanır.py
UTF-8
490
2.75
3
[]
no_license
import discord import random from discord.ext import commands @client.command(aliases=["gay-test"]) async def howgay(ctx, kullanici: discord.User = None): if not kullanici: kullanici = ctx.author embed = discord.Embed() embed.title = "gay r8 machine" embed.description = f"{'You are' if kulla...
true
2984a4a2a4c1c20b1376baa24121126166fd2f47
Python
rasql/tk-tutorial
/docs/basic/template.py
UTF-8
342
2.75
3
[]
no_license
"""Use this template to start an App.""" import tkinter as tk import tkinter.ttk as ttk from tklib import * class Demo(App): def __init__(self, **kwargs): super().__init__(**kwargs) App.root.title = 'Tk application template' Label('Demo application', font='Arial 24') if __name__ == '__mai...
true
99398c7975234e548fc8cb8ddc6b9f3dfdcd3bcd
Python
pestirA/GuruDemo
/IOTEmail.py
UTF-8
3,722
2.796875
3
[]
no_license
''' This is a sample Lambda function that sends an email on click of a button. It requires these SES permissions. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ses:GetIdentityVerificationAttributes", "ses:SendEmail", ...
true
09541acba88397ec71042f53e0eebdcb2b78b915
Python
eogiesoba/Python_Practice
/DataScience/Python_Beginner/5_list_operations.py
UTF-8
2,047
4.375
4
[]
no_license
#Because our data is in a CSV file, we'll need to read the file in before we can work with it. #In an earlier mission, we read a CSV file into a list, and we'll do the same here. f = open("la_weather.csv", 'r') data = f.read() rows = data.split('\n') weather_data = [] for row in rows: split_row = row.split(",") ...
true
f8e82260a932f3c3f4ee81f9b7f327d6d66f8b21
Python
theAI-samurai/Image_processing_Learning
/Scratch_Detection/classification_decision.py
UTF-8
1,074
2.859375
3
[]
no_license
import numpy as np import cv2 def unique_counts(channel_img): ele, count_ele = np.unique(channel_img, return_counts=True) return list(ele), list(count_ele) def identifying_right_value(value, counts): v = value c = counts for ind, ele in enumerate(v): if ele == 0 or ele < 7: d...
true
a3ba65052114b42753094c6ec0ec6d00dbc9298f
Python
ifpb-cz-ads/pw1-2020-2-ac04-team-amandamichel
/questao_17.py
UTF-8
740
4.15625
4
[]
no_license
''' Modifique o programa anterior de forma a ler um número n. Imprima os n primeiros números primos. >> Questao anterior: Escreva um programa que leia um número e verifique se é ou não um número primo. Para fazer essa verificação, calcule o resto da divisão do número por 2 e depois por todos os números ím...
true
9159a3cd0c4797623291d66ab0ede4a0299500cb
Python
LvanHeumen/MAL_webscraper
/parsedata.py
UTF-8
2,234
3.59375
4
[]
no_license
# Data parsing for the scraped data. # Load relevant libraries import json import logging import os import time # Logger setup logging.basicConfig(level=logging.INFO, filename='parser.log', filemode='w',format='%(asctime)s - %(levelname)s - %(message)s') # Class definition class DataParser: def __init__(self, fi...
true
4d44ec7e1281bb9253790bfa03eba36874a82ae6
Python
SpaghettiToastBook/echoes-patching-library
/scly_common.py
UTF-8
6,375
2.546875
3
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
# Source: http://www.metroid2002.com/retromodding/wiki/Scriptable_Layers_(Metroid_Prime_2) import dataclasses import struct from util import unpack_ascii, pack_ascii __all__ = ("Connection", "Property", "PropertyStruct", "ScriptObject") @dataclasses.dataclass(frozen=True) class Connection: _struct = struct.Str...
true
71b3beed8b8f168cc4b8f4b69c384012e2341a10
Python
Shachafinho/brainstorm
/brainstorm/formats/binary/user_information.py
UTF-8
728
2.546875
3
[]
no_license
import construct from brainstorm.common import UserInformation _user_information = construct.Struct( 'id' / construct.Int64ul, 'name' / construct.PascalString(construct.Int32ul, 'utf8'), 'birth_date' / construct.Timestamp(construct.Int32ul, 1, 1970), 'gender' / construct.PaddedString(1, 'utf8'), ).co...
true
558eb0f43cf55e1ada10d727e99c007aeaf86841
Python
saltastro/saltqueue
/saltqueue/block.py
UTF-8
725
2.90625
3
[]
no_license
# Licensed under a 3-clause BSD style license - see LICENSE.rst #This module implements the base NDData class. __all__ = ['Block'] class Block(object): """Block describes an observing Block as defined for SALT. Parameters ----------- blockid: int Integer value for block ID in the database ...
true
0058f809a071e91afa97352c109a61f695cb0729
Python
AlvaroArratia/curso-python
/proyecto1/notas/Nota.py
UTF-8
2,063
3.078125
3
[]
no_license
import mysql.connector from datetime import datetime from conexion import conectar database, cursor = conectar() class Nota: id_usuario: int titulo: str nota: str def __init__(self, id_usuario, titulo, nota): self.id_usuario = id_usuario self.titulo = titulo self.nota = nota...
true
52ef47621671809556bcb93af766d11a35b7d161
Python
ecaoili24/AirBnB_clone_v2
/2-do_deploy_web_static.py
UTF-8
1,112
2.546875
3
[]
no_license
#!/usr/bin/python3 """ Fabric script based on the file 1-pack_web_static.py that distributes an archive to the web servers """ import os.path from fabric.api import * from fabric.contrib import files env.user = "ubuntu" env.hosts = ['34.74.200.157', '107.20.131.122'] def do_deploy(archive_path): """distributes a...
true
fe9a62bd356252be5ec86f4a1a498fec41f2fb53
Python
cparrett300/Data-Science
/logisticRegression.py
UTF-8
3,350
2.9375
3
[]
no_license
import numpy as np import matplotlib matplotlib.use('TkAgg') from matplotlib import pyplot as plt from softMax import softMax def Sigmoid(z): return 1/(1+ np.exp(-z)) D = 2 K = 2 N = int(K * 1e3) X0 = np.random.randn((N//K), D) + np.array([2,2]) X1 = np.random.randn((N//K),D) + np.array([0,-2]) X2 = np.random.ran...
true
e9239fe39c650601a0621e42eb3ff9a7c329f168
Python
Crootcovitz/Kurs_iSAPython
/dzien5/fun7.py
UTF-8
162
3.09375
3
[]
no_license
imie = 'Ola' def wypisz_imie(): # global lepiej nie używać global imie duze_imie = imie.upper() return duze_imie print(imie) print(wypisz_imie())
true
0091b68da05cafbcee0a22a83d98354629cb1866
Python
JWiryo/HackerRank
/Python/Strings/CountString.py
UTF-8
300
3.3125
3
[]
no_license
import re def count_substring(string, sub_string): return len([m.start() for m in re.finditer('(?={})'.format(sub_string), string)]) if __name__ == '__main__': string = raw_input().strip() sub_string = raw_input().strip() count = count_substring(string, sub_string) print count
true
1370073d5dbe7423ad1f94f7fc97b1c00f306915
Python
Vincc/automataDemo
/gameAiDemo.py
UTF-8
1,817
3.1875
3
[]
no_license
from automaton import * import pygame from time import sleep class Enemy(Automaton): PlayerNear = Event("wander","follow") PlayerFar = Event("follow","wander") box_1x,box_1y = 200,200 box_2x,box_2y = 30,30 pygame.init() box_2=Enemy(initial_state="wander") size = width, height = 300,300 speed = [2,2] scrn = p...
true
23365b4c49310dcd59ba14ce61c713c7e180b2e7
Python
hitochan777/kata
/atcoder/abc257/E.py
UTF-8
444
2.96875
3
[]
no_license
N = int(input()) C = list(int(x) for x in input().split()) min_c = 10**18 min_i = 0 for i, c in enumerate(C, start=1): if min_c >= c: min_c = c min_i = i ans = [str(min_i)] * (N // min_c) rem = N % min_c idx = 0 while rem > 0: for i in range(8, -1, -1): if min_i < i + 1 and 0 < C[i] - min_c <= rem...
true
9cd60213944807508963c5a806b45912798af75e
Python
dsgnr/netkit_old
/tests/test_sites.py
UTF-8
1,867
2.65625
3
[]
no_license
""" Tests Netkit.Sites Class """ # Standard Library import json import unittest from os import path # Third Party import requests_mock # First Party from netkit.auth import Auth from netkit.sites import Sites def fake_api(*args, **kwargs): """ Creates the fake api result for mocking later """ basepa...
true
9f56f61eb03215800d9532bc2eed2af89b18153d
Python
tvogels01/arthur-redshift-etl
/python/etl/util/timer.py
UTF-8
1,460
4.03125
4
[ "MIT" ]
permissive
"""Timer class for when you need to measure the elapsed time in seconds.""" import datetime def utc_now() -> datetime.datetime: """ Return the current time for timezone UTC. Unlike datetime.utcnow(), this timestamp is timezone-aware. """ return datetime.datetime.now(datetime.timezone.utc) def ...
true
59dc942c63e684e844df0e5549d8c2688df15629
Python
hoonpig/python_study
/rpa_basic/1_excel/11_cell_style.py
UTF-8
1,248
3.125
3
[]
no_license
from openpyxl import load_workbook from openpyxl.styles import Font, Border, Side, PatternFill, Alignment wb = load_workbook("sample.xlsx") ws = wb.active # 번호, 영어, 수학 a1 = ws["A1"] # 번호 b1 = ws["B1"] # 영어 c1 = ws["C1"] # 수학 # A 열의 너비를 5로 설정 ws.column_dimensions["A"].width = 5 # 1 행의 높이를 50으로 설정 ws.row_dimens...
true
ae1f4a35ebee3ff5ee49fabe27170c173fc00615
Python
syurskyi/Python_Topics
/021_module_collection/namedtuple/examples/namedtuple_004_Named Tuples - DocStrings and Default Values.py
UTF-8
436
3.5625
4
[]
no_license
# Named Tuples - DocStrings and Default Values from collections import namedtuple # Adding DocStrings to Named Tuples # This is easy to do, both with the generated class, as well as it's properties. Point2D = namedtuple('Point2D', 'x y') Point2D.__doc__ = 'Represents a 2D Cartesian coordinate' # And we can even add...
true
c68c001fdfe29f6f64cae0eb3ade0f13bc8dcf9f
Python
ghodulik95/Graph-Summarization-of-RDF
/Dense_Subgraphs_Filterer.py
UTF-8
991
2.734375
3
[]
no_license
from Abstract_Node_Filterer import Abstract_Node_Filterer class Dense_Subgraphs_Filterer(Abstract_Node_Filterer): def __init__(self,graph): Abstract_Node_Filterer.__init__(self) self.g = graph #Here, a candidate is an original node id def filter_nodes(self,oid,candidate_ids): to_me...
true
3e4befadeaca5f4104484c6a6c37c8be67917304
Python
pbadani/IntroductionToAlgorithms
/chapter6/BuildHeap.py
UTF-8
855
3.796875
4
[]
no_license
from chapter6.Heapify import recursiveHeapify, maxHeap, minHeap, iterativeHeapify def buildHeapRecursively(arr, heapOrder): for i in range(len(arr) // 2, -1, -1): recursiveHeapify(arr, i, heapOrder) def buildHeapIteratively(arr, heapOrder): for i in range(len(arr) // 2, -1, -1): iterativeHea...
true
5ea80e0d2c68c0f591a040dbcefc40242b3381f1
Python
Milad-abbaszadeh/hyperopt
/vector.py
UTF-8
2,106
2.53125
3
[]
no_license
import numpy as np from sklearn.cluster import KMeans from sklearn.metrics import pairwise_distances_argmin_min import temp import pickle from sklearn.preprocessing import StandardScaler def trial_builder_kmeans(all_trials,num_clusters): X = temp.vector_builder(all_trials) # X = StandardScaler().fit_transform...
true
440f05e206e90eafdc50f4739b80990f63cf406b
Python
dzemildupljak/gen2store
/services/bill.py
UTF-8
1,465
2.765625
3
[ "MIT" ]
permissive
import datetime import uuid from sqlalchemy.sql.expression import false from helpers import convert_to_dict from database import SessionLocal import models db = SessionLocal() def add_new_bill(c_id): customer = db.query(models.Customer).filter(models.Customer.id == c_id) if customer.first(): return f...
true
5bcf0bc4b7cb9647082de7d10352d1aab75fe9d3
Python
justin0022/module-progress
/src/get_module_progress.py
UTF-8
2,906
2.65625
3
[]
no_license
""" # -*- coding: utf-8 -*- Created on Tue Aug 21 14:18:10 2018 Refactored May 2019 All Canvas LMS - REST API calls made using canvasapi python API wrapper: https://github.com/ucfopen/canvasapi @authors: markoprodanovic, alisonmyers """ import sys from canvasapi.exceptions import Unauthorized import pandas as pd impo...
true
1389d669dd684fe8a6af2c4df0fb3a2814999746
Python
AshutoshPanwar/Python_udemy_course
/complex_numbers.py
UTF-8
267
3.625
4
[]
no_license
x = 2 + 3j print(type(x)) # class"complex" print(x.real) # will display the real value 2.0 (it can be of any type) print(x.imag) # will display imagenary part 3.0 (it can only be integer or floting number)
true
4e01200b135d42cc693c4cf047a371e35f2b2172
Python
AdamZhouSE/pythonHomework
/Code/CodeRecords/2889/60761/238251.py
UTF-8
108
2.890625
3
[]
no_license
n=int(input("")) volumePercent=list(map(int,input("").split(" "))) print(format(sum(volumePercent)/n,'.6f'))
true
48365f68cf3259c5ba3ff5d938f81a63b57e6f83
Python
silky/qctokyo
/serverless/apps/qctokyo/page_updater.py
UTF-8
2,564
2.6875
3
[ "Apache-2.0" ]
permissive
import logging import os from string import Template import boto3 logger = logging.getLogger() logger.setLevel(logging.INFO) # mapping column names of DynamoDB to the html elements of zodiac COLUMN_TO_ZODIAC = { "num_of_0000": "<td>Aries</td><td>Mar 21 - Apr 19</td>", "num_of_0001": "<td>Taurus</td><td>Apr 2...
true
f8988cfe4c4ab145ed20aa62540603d2707c017a
Python
waltermoreira/tartpy
/tartpy/network.py
UTF-8
5,637
2.515625
3
[ "MIT" ]
permissive
from collections.abc import Mapping, Sequence import json import socket import socketserver import threading from urllib.parse import urlparse import uuid from logbook import Logger from .runtime import ThreadedRuntime, behavior, Actor from .tools import actor_map, dict_map logger = Logger('network') class Networ...
true
ec1ab8c5ca897e96b4303981020f48d893da35c6
Python
binque/ShooterSubPyDownloader
/Main.py
UTF-8
522
2.640625
3
[]
no_license
#!/usr/bin/env python import os import sys from folder import scan_folder if __name__ == '__main__': print("Welcome to ShooterSubPyDownloader") movie_dirs = [os.curdir] if len(sys.argv) >= 2: movie_dirs = sys.argv[1:] for movie_dir in movie_dirs: detail = scan_folder(mo...
true
474938eb9b9bfda5440ea8f91316dda0a0ef8f12
Python
yunhaolucky/hackcessible-api
/bin/json_import/import_sidewalk_elevations.py
UTF-8
699
2.78125
3
[]
no_license
import json from app import db, SidewalkElevation # Expect a list of geojsons in the file def import_sidewalk_elevations(geojson_path): with open(geojson_path) as f: geojson = json.load(f) sidewalk_elevations = [] sidewalks_list = geojson["features"] for sidewalk_segment in sidewalks_list: ...
true
181d24c6dc59cbc030a7d0742acbf5eb09408a75
Python
rk0576/operatori-python
/pr_4.py
UTF-8
108
2.609375
3
[]
no_license
n=10 cm=10*100 print(cm) n=5 ml=5*1000000 print(ml) n=14 l=n*12 s=l*7/n z=n*365 print(l,s,z)
true
2d533cfccd2b78afd680fbf0cfc1243b325b027c
Python
jldupont/gaefrx
/src_common/gaefrx/excepts.py
UTF-8
1,341
2.6875
3
[]
no_license
''' The exceptions Created on Jun 26, 2015 @author: jldupont ''' class ApiError(Exception): """ Base for the whole API """ class MaybeRecoverableError(Exception): """ Maybe be used as retry trigger """ class UnrecoverableError(Exception): """ Denotes an unrecoverable error """...
true
635fb47f7f1e329b64eea725693efd5955548c90
Python
jacarolan/BNL_QCD_ML
/ML/Data/PNDME_3pt_2pt_ML_data/read_data.py
UTF-8
1,728
3
3
[]
no_license
#!/usr/bin/env python import numpy as np from sklearn import ensemble import matplotlib.pyplot as plt # Read data data = np.load('data-axial.npy', allow_pickle=True).tolist() # data['train'/'test']['input'/'output'] # inputs are vectors with 40 elements, and outputs are single numbers print(data['train']['input'].sh...
true
66868a1f8dccd36c66c673953a30290322e3e7b9
Python
radomirbrkovic/algorithms
/hackerrank/other/electronic-shop.py
UTF-8
407
3.453125
3
[]
no_license
# https://www.hackerrank.com/challenges/electronics-shop/problem keyboards = [3, 1] drives = [5, 2, 8] def getMoneySpent(keyboards, drives, b): result = -1 for keyboard in keyboards: for drive in drives: if keyboard + drive <= b and keyboard + drive > result: result...
true
169c235f9c28286cd3f75e5925a2ea95a1d34d9a
Python
vsbrt/python-beginners-excersises
/solutions/9.member.py
UTF-8
818
3.828125
4
[]
no_license
'''def is_member(valueToCheck, listToBeChecked): for i in range(len(listToBeChecked)): if valueToCheck == listToBeChecked[i]: return True else: return False List = ['aa','bb','cc','dd','ee','ffgg','hhii','jjkkll'] #print("The list is: " +str(List)) itemToCheck = input("Enter the item to check in the p...
true
c063c314ab3877235df100e167756fd0b34729af
Python
YMikita/exadel-python-course-2021
/tasks/task07/classes/order.py
UTF-8
656
3.15625
3
[]
no_license
import uuid as UUID import datetime from tasks.task07.classes.good import Good class Order: def __init__(self, client_id: UUID, goods: list[Good]): self.__id = UUID.uuid4() self.__date = datetime.date.today() self.__client_id = client_id self.__goods = goods or [] def get_id(s...
true
d6e97ec6a4bcebf70999ec9ade8818579e46ee00
Python
HunterBarrows/UH_Summer2021_CIS2348
/Homework2/Coding Problem 2.py
UTF-8
1,113
3.453125
3
[]
no_license
# Hunter Barrows 1550107 # Coding Problem 2 import csv import datetime from datetime import date user_input = input() split = user_input.split(' ') month_list = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') Day = ('1,', '2,',...
true
bea17a193a7abde29e4ed1a77f7adfa7e059abb6
Python
dataAlgorithms/data
/scrapy/scrapyBeautifulSoup.py
UTF-8
465
3.015625
3
[]
no_license
#1. Use Scrapy with BeautifulSoup from bs4 import BeautifulSoup import scrapy class ExampleSpider(scrapy.Spider): name = "example" allowed_domains = ["example.com"] start_urls = ( 'http://www.example.com/', ) def parse(self, response): # Use lxml to get decent HTML parsing speed ...
true
dbe3b3e475c22f4dedca4fbee98aa201cb9e501d
Python
haleyshi/python_learn
/stock/stock.py
UTF-8
7,308
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- from prettytable import PrettyTable #import csv def parseFile(id): dataList = [] dataDict = {} stockFile = {} if id == '510300': stockFile['name'] = '沪深300ETF' stockFile['file'] = '510300.txt' elif id == '159915': stockFile['name'] = '创业板' ...
true
5f969f27e6e5e71369ab6062dce9cd17f21436e3
Python
dQuantic/QubitDrawing
/QubitDrawing/qbdraw.py
UTF-8
34,474
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Mar 10 14:55:47 2020 @author: Quantico """ import gdspy as gds import numpy as np from . import SuppFunctions as SuppFun def saveCell2GDS(cell, gdsName): """ This function save the given cell to GDS file with the name 'gdsName' """ layout = gds.GdsLibra...
true
ae5559ed5931e5046180697e5bd5ab52e3b8da3e
Python
smgutstein/DNN_Expts
/display_data/display_tiny_imagenet_subsets.py
UTF-8
1,569
2.5625
3
[]
no_license
import argparse from collections import defaultdict from data_display import Data_Display import importlib import os import pickle import sys file_dir = os.path.join( os.path.dirname(os.path.realpath(__file__)), '../dataset_loaders') if file_dir not in sys.path: sys.path.append(file_dir) dict_path = './datase...
true
5cf79961fd23594861017e1ee4aab0e3cb75fc96
Python
mattjp/leetcode
/practice/0528-Counting_Elements.py
UTF-8
185
2.828125
3
[]
no_license
class Solution: def countElements(self, arr: List[int]) -> int: keys: Set[int] = set(arr) res: int = 0 for a in arr: if a+1 in keys: res += 1 return res
true
d3ca349b77830fc25e74210e94c24418c4edc282
Python
konarkcher/Shop_Database_UI
/model_test.py
UTF-8
2,159
2.71875
3
[]
no_license
import model from db import exception shop = model.Shop() try: shop.create_db("data/model_test.db", model.DbType.SQLITE) except Exception as e: print(e, e.args, vars(e)) shop.open_db("data/model_test.db", model.DbType.SQLITE) products = [[1, "cookie", 42, 1, 0], [2, "milk", 15, 2,...
true
89d2f4e175bc09652176ba1a546beefb8e229552
Python
symonsajib/PracticePython_P
/Exercise15_Reverse Word Order.py
UTF-8
134
4.0625
4
[]
no_license
string = input("Give me a string & I'll reverse: ") reverse = string.split()[::-1] result = " ".join(reverse) print(result)
true
b2e7f9bb1ab74d72545dd2ee29af6900e5aabe50
Python
JianxiangWang/LeetCode
/121 Best Time to Buy and Sell Stock/solution.py
UTF-8
718
3.484375
3
[]
no_license
# encoding: utf-8 # 状态转移 # dp[i]表示到i位置, 所取得的最大利润 # dp[i] = dp[i-1], dp[i] - 1..i-1 最小者 class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if prices == []: return 0 dp = [None] * len(prices) dp[0] = 0 ...
true
78739d56b5455c8230b8f5a3eb7587a517a6887d
Python
XiaoGeNintendo/CodeforcesDataCopier
/transfer.py
UTF-8
4,445
2.9375
3
[]
no_license
try: import os import json import io import urllib.request from robobrowser import RoboBrowser import html except Exception as err: print("Error 101:Import failed {0}".format(err)) exit(101) fromusr="" tousr="" topsd="" b=RoboBrowser(parser="html.parser") def getURL...
true
6ddb19a2621d84798f40df5e2916e821c0d780e6
Python
mamikonyana/cryptotools
/cryptotools/single_char_xor_cipher.py
UTF-8
428
2.796875
3
[ "MIT" ]
permissive
from .xor import variable_length_xor def get_single_char_xor_cipher_decryptions(bstring): all_candidates = [] for i in range(256): b = bytes([i]) decrypted_bytes = variable_length_xor(bstring, b) try: decrypted_string = decrypted_bytes.decode('utf-8') except Unicode...
true
1ae2b133726d71b7ecd4e70bc403620e5216d2b9
Python
ibarchakov/Stepik---Algorithms.-Methods
/dots cover.py
UTF-8
1,109
3.53125
4
[]
no_license
"""For n given intervals find the set of points of a minimal size for which each interval contains at least on of the points. In a first line there is given a number of intervals 1≤n≤100. Each of a next n lines consists of two numbers 0≤l≤r≤10**9 defining the start and the end of the interval. Output the optimal nu...
true
212b4343e000053d7f7e9b434577e59d0ce0ded3
Python
sativa/statsintro_python
/ISP/Figures/F6_2_lognormal.py
UTF-8
1,177
3.203125
3
[ "BSD-3-Clause" ]
permissive
''' Lognormal distribution functions. ''' # Copyright(c) 2015, Thomas Haslwanter. All rights reserved, under the BSD 3-Clause License # Import standard packages import numpy as np import matplotlib.pyplot as plt from scipy import stats import seaborn as sns # additional packages # Import formatting commands if dire...
true
6318b789ef38fce0af99a28c25a968bb2faa6d63
Python
ellipsis-tech/Coders-Assembly-Materials
/9_File_Reading/Resource/q7-tester.py
UTF-8
463
3.015625
3
[]
no_license
import q3 as qn dictionary = qn.get_english_dictionary('words_alpha.txt') result = qn.check_spelling("I sturddy at Singapore Managment Univercity", dictionary) print('Test 1') print ('Expected:True') print ('Actual :' + str(isinstance(result, list))) print() result = qn.check_spelling("I sturddy at Singapore Managme...
true
390e5a675e86cc64f35ae044972ae527ca23f2d1
Python
nikita12100/Python
/market_model/citizen.py
UTF-8
2,959
3.1875
3
[]
no_license
import pandas as pd import random import product # parameters # salary citizen_salary_parameter1 = 3 citizen_salary_parameter2 = 10 # параметры для отбора продукта max_price = 10000 min_qv = 0 # класс потребителя class citizen: def __init__(self, id=0): self.id = id # стартовый капитал se...
true
c71716bfab7306b1007bb43f2c10b84a66b7b635
Python
19828373863/am205_examples
/4_optimization/iter_2d.py
UTF-8
348
3.859375
4
[]
no_license
#!/usr/bin/python3 from math import sqrt def f(x1,x2): return (x1*x1+x2*x2-1,5*x1*x1+21*x2*x2-9) (x1,x2)=(0.,0.) # Print zeroth step (f1,f2)=f(x1,x2) print(0,x1,x2,f1,f2) for i in range(1,31): # Do vector iteration (x1,x2)=(sqrt(1-x2*x2),sqrt((9.-5.*x1*x1)/21.)) # Print ith step (f1,f2)=f(x1,x...
true
76a7c41e4141396b5fced6bc30969293fd213511
Python
TheGhost8/pythonprac
/20201001_0/task_0.py
UTF-8
408
3.1875
3
[]
no_license
def DominatingPair(a, b): return (a[0] >= b[0]) and (a[1] >= b[1]) and ((a[0] > b[0]) or (a[1] > b[1])) def Pareto(l_pair): out_p = [] for p in l_pair: if out_p: add = True for k in out_p: if DominatingPair(p, k): out_p.remove(k) elif DominatingPair(k, p): add = False if add: out_p....
true
f5161e9ccbe0d943861f528d7db4320e31cc1a4f
Python
matheusmcz/Pythonaqui
/Aula08/aula08.py
UTF-8
609
3.640625
4
[]
no_license
# import bebidas # from doce import pudim #import math #ceil: arredonda pra cima #floor: arredonda para baixo #trunc: elimina um numero #pow: potencia #sqrt: calcular raiz quadrada #factorial: calculo fatorial print('-' *5, 'UTILIZANDO MODULOS', '-' *5) import math number = int(input('Insira um numero: ')) raiz = math....
true
4f1435e6ceb264ac15a43e5474f358dd170126ad
Python
JunNishimura/Competitive-Programming
/AizuOnline/python/PCK/Prelim/2014/0298.py
UTF-8
186
2.5625
3
[]
no_license
N = list(map(int, input().split())) N = [ [N[i], N[i+1]] if i % 2 == 1 for i in range(0, 2*N[0]+1) ] # M = list(map(int, input().split())) # N += list(map(int, input().split())) print(N)
true
ae85cadb6c15c21a986a722ceb5804b4bb43f927
Python
fpischedda/yaff
/yaff/contrib/mixins/gravity.py
UTF-8
490
3.328125
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
""" Mixin class that updates the object direction applying fake gravity """ class GravityMixin: def __init__(self, gravity, *args, **kwargs): self.gravity = gravity super(GravityMixin, self).__init__(*args, **kwargs) def new_direction(self, dt): return [self.direction[0], ...
true
117e608fada9055337923c28b4c43cc693bca21a
Python
galij899/candy_delivery_app
/apis/tests/test_api.py
UTF-8
13,307
2.59375
3
[]
no_license
import datetime import json from django.test import Client, TestCase class ApiInputTests(TestCase): def test_setUp(self): self.client = Client() def test_postCouriers_correct(self): data = { "data": [ { "courier_id": 1, "cou...
true
7d0e03984c3487726420d25da0e8fef5e9ec8be1
Python
naitikshukla/practice
/sample_problems/Fredo and Array Update.py
UTF-8
537
3.359375
3
[]
no_license
num='15' #input 1 array = "1 2 3 4 5 6 7 8 9 10 89 21 27 98 56 23 12 23 43 98 198 22210" #input 2 array = [int(i) for i in array.split()] #convert to list in integer num = int(num) ...
true
fcc5d4532238a90b0a3beafb020e8a7c2819fa39
Python
osmanok/Python-100-days-Challenge
/Day-02/string.py
UTF-8
266
3.421875
3
[]
no_license
string="hi world" print("uzunluk", len(string)) print("title", string.title()) print("upper", string.upper()) print("lower", string.lower()) print("isupper", string.isupper()) print("starswith", string.startswith("start")) print("endswirh", string.endswith("end"))
true
67d3bbd292b011c0ffacb5a80be01aa6cced89d8
Python
PdxCodeGuild/class_emu
/Code/Larry/python/lab06_v2_password_gen.py
UTF-8
1,781
4.75
5
[]
no_license
# lab06_v2_password_gen.py ''' Lab 6: Password Generator Let's generate a 10-character password using a while loop and random.choice, this will be a string of random characters. Hint: random.choice can be used to pick a character out of a string, as well as an element out of a list. Version 2 Allow the user to enter ...
true
ace9ad28f0bf778d8e50e715934f236bdc90f828
Python
joncard1/2048
/strategies.py
UTF-8
2,776
3.078125
3
[]
no_license
__author__ = 'cardj' import random import moves from Simulator import Simulator class Strategy(object): def registerPlayer(self, player): self.player = player class LowerRightStrategy(Strategy): def getMove(self, grid): return moves.MoveUp(self.player) class RandomStrategy(Strategy): ...
true
6f9f63482ee2f8c29d50b9103dca5d98d5fdee2f
Python
winston1214/baekjoon
/1000-2000/1977.py
UTF-8
258
2.890625
3
[]
no_license
# @Author YoungMinKim # baekjoon M=int(input()) N=int(input()) tmp=[] for i in range(M,N+1): if str(i**(1/2))[-1] == '0' : tmp.append(i) else: continue if len(tmp) == 0: print(-1) else: print(sum(tmp)) print(min(tmp))
true
2507c1041284d09652e5f1a9cd2ba0d93676735e
Python
amacharla/ReadME_Generator
/OldVersions/create.py
UTF-8
881
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/python3 from bs4 import BeautifulSoup, Comment, NavigableString from sys import argv if len(argv) != 2 or argv[1] not in "README.md": print("Need to pass in README.md with HTML SourceCode") exit() # open html file and parse through source code soup = BeautifulSoup(open(argv[1]), 'html.parser') # I...
true
55d471ec857499c16e1481fa1ce0d475b8cd9099
Python
ideaqiwang/leetcode
/String/28_Implement_strStr().py
UTF-8
1,267
4.28125
4
[]
no_license
''' 28. Implement strStr() Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will return 0 when needle is...
true