blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
ba61306dcf4c30da69f253be5aea104466257199 | Python | elbacb/rpymir | /dia4/dia4.py | UTF-8 | 977 | 4.3125 | 4 | [] | no_license | """ LISTAS """
"""
añadir:
lista.append(elemento)
lista.insert()
+
borrar:
lista.pop()
eliminar lista:
del
vacear:
lista.clear()
slice (trozo de lista):
lista=[5,12,4,6,8,1,0,-1,3,12,15,17,-3]
sublista=[3,len(lista)-1]
sublista1=[3:]
sublista2=[-3:]
sublista3=[:-3]
pr... | true |
3a101894b6977e0dd753ec972478c4c7416e8913 | Python | jmarq/advent2020 | /8/8.2.py | UTF-8 | 1,160 | 3.09375 | 3 | [] | no_license | infile = open("input.txt", 'r')
rules = infile.read().strip().split("\n")
count = len(rules)
# acc jmp nop
cur = 0
seen = set()
total = 0
done = False
swap_tries = set()
swapped_this_time = False
failed_tries = 0
total_steps = 0
while cur not in seen:
total_steps += 1
line = rules[cur]
action, num = line.... | true |
12426c5aac9c4297743285f85e1a04ceaeeee17c | Python | Polo2126/python--dev- | /plotting_plotly.py | UTF-8 | 1,563 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#!pip install plotly
#read a csv file
import pandas as pd
import numpy as np
import plotly.express as px
# In[4]:
path = 's3://686-balaj2p/Car_sales.csv'
# In[5]:
df = pd.read_csv(path)
# In[6]:
df.info()
# In[7]:
df.shape
# In[8]:
df.head()
# In[9... | true |
a1569b7f69309c42d9e3ea989a5eb05c295b5c1c | Python | mengqlTHU/DoorDetector | /detection_video.py | UTF-8 | 3,548 | 2.765625 | 3 | [] | no_license | #############################################
# Object detection - YOLO - OpenCV
# Author : Arun Ponnusamy (July 16, 2018)
# Website : http://www.arunponnusamy.com
############################################
import cv2
import argparse
import numpy as np
ap = argparse.ArgumentParser()
ap.add_argument('-v', '--vide... | true |
a496451dcc31d3586b9cb0d6640813b95cf4a445 | Python | sametz/nmrsim | /src/nmrsim/_classes.py | UTF-8 | 12,471 | 2.953125 | 3 | [
"MIT"
] | permissive | """
This module provides high-level API classes for abstract NMR concepts such as spin systems and spectra.
"""
import itertools
import numbers
import numpy as np
from nmrsim.firstorder import first_order_spin_system, multiplet
from nmrsim.math import reduce_peaks, add_lorentzians
from nmrsim.qm import qm_spinsystem
... | true |
481c9f1c56e30e4aa3a9943480db0914c7080d7b | Python | ml-imd/Sclx_research | /create_csvs/src/run.py | UTF-8 | 2,107 | 3.28125 | 3 | [] | no_license | import sys
import papers_data_creation
import qualis_by_year
import split_program
def name_the_file(filename, dataIn):
"""
Modify the name of the file passed as a param'
:param filename: the parameter received in command line
:param dataIn: the name of the file received by command line
:return: ... | true |
4233f7fca114354ef93cf39a89d2a2cba9028fc3 | Python | komalupatil/Leetcode_Solutions | /Easy/Majority Element.py | UTF-8 | 319 | 3.15625 | 3 | [] | no_license | #Leetcode 169. Majority Element
class Solution:
def majorityElement(self, nums: List[int]) -> int:
d = {}
for i in nums:
if i in d:
d[i] +=1
else:
d[i] = 1
for num in d:
if d[num] > len(nums)/2:
return num
| true |
5aa4eb1993564eccdeffe538069f4116dc500171 | Python | daniel-reich/ubiquitous-fiesta | /E9Wkppxyo763XywBe_14.py | UTF-8 | 227 | 3.0625 | 3 | [] | no_license |
def binary_clock(time):
time = [bin(int(i))[2:] for i in time if i.isdigit()]
for i,v in enumerate(time): time[i] = "{:>4}".format("0"*(int("243434"[i])-len(v))+v)
return [''.join(i[j] for i in time) for j in range(4)]
| true |
a42c0789af8f1ff5d5e8fcd27be9e4f4e6a10f96 | Python | LeeThomas13/data-structures-and-algorithms | /python/tests/test_insertion_sort.py | UTF-8 | 659 | 3.65625 | 4 | [] | no_license | from code_challenges.insertion_sort.insertion_sort import insertion_sort
import pytest
def test_empty_array():
array = []
actual = insertion_sort(array)
expected = 'empty array'
assert actual == expected
def test_single_array():
array = [5]
actual = insertion_sort(array)
expected = 'its a... | true |
e17227e5933d3df73eace05215b21957341ea732 | Python | JoungChanYoung/algorithm | /programmers/행렬테두리회전하기.py | UTF-8 | 1,154 | 2.75 | 3 | [] | no_license | #level2 2021-dev-matching
def solution(rows, columns, queries):
answer = []
li = [[0 for j in range(columns)] for i in range(rows)]
tmp = 0
for i in range(rows):
for j in range(columns):
tmp += 1
li[i][j] = tmp
for x1, y1, x2, y2 in queries:
... | true |
29230c4a6d797380ea5d2645823960b2c3b7a4c4 | Python | dragynir/qt_selectors_first | /func_utils.py | UTF-8 | 4,389 | 3.046875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy.interpolate import CloughTocher2DInterpolator, LinearNDInterpolator
import os
from tqdm import tqdm
# CONSTANT dictionary that defines extensions of files that can be read by Pandas functions
EXT = {'txt': pd.read_table, 'csv': pd.read_csv,
'xls': pd.read_excel... | true |
23a8fba3e5f63e31a837799f8780abc8c9278dd4 | Python | natsumemaya/hexlet_tasks | /5_composite_data/pairs_on_strings/tests.py | UTF-8 | 548 | 3.40625 | 3 | [] | no_license | import pairs
EMPTY = ''
def test_pair1():
pair = pairs.cons('hi', 'hexlet')
assert pairs.car(pair) == 'hi'
assert pairs.cdr(pair) == 'hexlet'
print('test_pair1 is Ok!')
def test_pair2():
pair = pairs.cons('Hello!', EMPTY)
assert pairs.car(pair) == 'Hello!'
assert pairs.cdr(pair) == EMPTY
... | true |
17c7419660e5450039adc1cdf1570a9bbd734cf4 | Python | nivransh2008/python-programme1 | /function.py | UTF-8 | 287 | 3.625 | 4 | [] | no_license | def countWords():
fileName = input("enter your file name ")
openFile = open(fileName, "r")
numberOfWords = 0
for i in openFile:
words = i.split()
numberOfWords= numberOfWords+len(words)
print(words)
print(numberOfWords)
countWords()
| true |
64d3a46e1d847fceff8bcf3f5fa416a9fa3092ba | Python | siwalan/kattis | /aaah.py | UTF-8 | 112 | 2.96875 | 3 | [] | no_license | capable = len(input())
required = len(input())
if (capable >= required):
print("go")
else:
print("no")
| true |
b40ea188fbccf46fe0b127ebe61038bd458325dc | Python | gangki/Python | /lkw/unit10.py | UTF-8 | 100 | 3.46875 | 3 | [] | no_license | #10.5 심사문제: range로 튜플 만들기
n = int(input())
a = tuple(range(-10, 10, n))
print(a) | true |
54c954daaa86b930c1d48ec8cddecc8659a1a3fa | Python | wietomasz/simple_banking | /payment_engine.py | UTF-8 | 2,397 | 2.65625 | 3 | [] | no_license | # This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
from distutils.util import strtobool
from src.accounts import User
from src.transaction import Transaction
import sys
import pandas as ... | true |
3a863b2f94d05c26adb6ab4e9712531bd0f338d2 | Python | janfelix/bioinformatic_tools | /max2lineage_multi.py | UTF-8 | 2,705 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python3
#take highest match by bitscore from blast analyses and extract the taxonomic lineage from the ncbi taxdump database
#call as: python max2lineage_multi.py infile.txt outfile.csv numcores
import pandas as pd
import re
import sys
import multiprocessing
from multiprocessing import Pool
#handle input a... | true |
956de5acc0575629cbc11fc55866b441071edb39 | Python | matheusmr13/ray | /ray-peewee/tests/test_api.py | UTF-8 | 3,767 | 2.609375 | 3 | [
"MIT"
] | permissive |
import unittest, peewee
from ray_peewee.all import PeeweeModel
import unittest
import json
from webapp2 import Request
from ray.http import Response
from ray.wsgi.wsgi import application
from ray.endpoint import endpoint
database = peewee.SqliteDatabase('example.db')
class DBModel(PeeweeModel):
class Meta:
... | true |
14b6e74914eb1cb42a1c2f41ad2c6ba418e9fb71 | Python | DirectorOfMe/directorof.me | /lib/python/core/tests/test__authorization_groups.py | UTF-8 | 9,295 | 2.546875 | 3 | [] | no_license | import pytest
import json
from directorofme.flask import JSONEncoder
from directorofme.authorization import standard_permissions
from directorofme.authorization.groups import GroupTypes, Group, Scope, root, admin, nobody, \
everybody, anybody, user, staff, base_groups, pus... | true |
47ee91013f36a34d2b726e5481a127dd8538e8b1 | Python | travesto/CS116 | /gcd.py | UTF-8 | 323 | 4.21875 | 4 | [] | no_license | """
Euclid's GCD
"""
def gcd(m,n):
if n == 0:
return m
else:
return gcd(n, m % n)
def main():
print("This program calculates the greatest common divisor (GCD) for two integers.\n")
a = int(input("Enter a number: "))
b = int(input("Enter another: "))
print("\nGCD =",gcd(a,b))
mai... | true |
4bcdd13032a2c47f33f6a93c2a8967c07a739b23 | Python | HaoLiangPao/CS50 | /CS50_Intro/Week6-Python/ProblemSet/cash.py | UTF-8 | 775 | 3.859375 | 4 | [
"MIT"
] | permissive | import re
# Get user input
change = -1.0
# Only take an input value between 1 and 8 (inclusive)
while not (0 <= change):
user_input = input("Change owed: ")
# Reject invalid inputs
if (user_input.isnumeric() or "." in user_input):
change = float(user_input)
change = int(change * 100)
# Greedy Algor... | true |
f0e6fbbb942ebfe176bc8501481fc85c55910284 | Python | walkccc/LeetCode | /solutions/1037. Valid Boomerang/1037.py | UTF-8 | 222 | 2.734375 | 3 | [
"MIT"
] | permissive | class Solution:
def isBoomerang(self, points: List[List[int]]) -> bool:
return (points[1][0] - points[0][0]) * (points[2][1] - points[1][1]) != \
(points[1][1] - points[0][1]) * (points[2][0] - points[1][0])
| true |
ec5dfa8f2dee7df913a7ca919e7562f2558bef01 | Python | Asieh-A-Mofrad/Enhanced-Equivalence-Projective-Simulation | /initialization.py | UTF-8 | 2,284 | 2.921875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Last update: Sep. 2, 2020
@author: Asieh Abolpour Mofrad
Initialization values
This code is used for simulation results reported in an article entitled:
''Enhanced Equivalence Projective Simulation:
a Framework for Modeling Formation of Stimulus Equivalence Classes"
... | true |
7358d08acb2951f6fdadc8b7ae29ead53856c864 | Python | meghanagottapu/Leetcode-Solutions | /leetcode_py/Fraction to Recurring Decimal.py | UTF-8 | 3,868 | 3.078125 | 3 | [] | no_license | from collections import defaultdict
class Solution:
# @param {integer} numerator
# @param {integer} denominator
# @return {string}
def fractionToDecimal(self, numerator, denominator):
res = ''
if numerator * denominator < 0:
res = '-'
numerator = abs(numerator)
... | true |
904cff6b54db9818448204c73197325386547754 | Python | radams15/AudioLang | /audio.py | UTF-8 | 911 | 2.875 | 3 | [] | no_license | import wave
import translator
class Audio:
def __init__(self, file):
self.file = file
self.commands = translator.audio_commands
self.framerate = 8000 # max freq (I Think)
def read(self):
out_raw = ""
with wave.open(self.file, 'rb') as w:
for i in range(w.get... | true |
e985ba4cbea6c9684eccbfc9946e09cc72f3dde3 | Python | MOON-CLJ/learning_python | /llm/exercises_1_3_31.py | UTF-8 | 1,784 | 3.546875 | 4 | [] | no_license | class DoubleNode(object):
def __init__(self, item, prev, next):
self.item = item
self.prev = prev
self.next = next
def insert_at_beginning(item, first):
old_first = first
first = DoubleNode(item, None, old_first)
if old_first:
old_first.prev = first
return first
def... | true |
e6eb730473a6293039350dd86991a1714b53a0af | Python | awsbatch02/awsbatch02_repo01 | /function.py | UTF-8 | 1,697 | 4.6875 | 5 | [] | no_license | #!usr/bin/python
# To get the first number from the user
print "Please enter first number: "
# Store first input value in a
a = int(input())
# To get second number from the user
print "Please enter second number: "
# Store second input value in b
b = int(input())
# Define a function to add two numbers
def add(var1 , va... | true |
88b0479beac6037e0e978f4f1b5aa1df1e02767c | Python | rockerBOO/landscaper | /properties.py | UTF-8 | 2,221 | 3 | 3 | [
"MIT"
] | permissive | from collections import UserList
class TextProperty:
def __init__(self, value):
self.input(value)
def input(self, value):
self.data = value
def __str__(self):
return "<%s text:%s>" % (self.__class__.__name__, self.data)
def Value(self):
return self.data
def ToJSO... | true |
16129fdfdd34e0d9b458ba2d5f381c204b6d7579 | Python | shiqi1994/ISBI2020_DR | /toolkit/meanstd.py | UTF-8 | 3,407 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 21:15:34 2020
@author: sqtang
"""
import sys
import torch
import pandas as pd
import warnings
from sklearn import model_selection
from torch.utils.data import DataLoader
warnings.filterwarnings("ignore")
import numpy as np
from os import listdir... | true |
fa3c068c2ce61a7fac193554364182849ac3d016 | Python | ksamala/k_python | /scripts/20_for.py | UTF-8 | 81 | 2.75 | 3 | [] | no_license | my_list = [1,2,3,4,5,6,7,8,9,10]
for cheetha in my_list:
print(cheetha)
| true |
a598c05b193754953b8b21a42da3191ab5bbecc5 | Python | xelda1988/schokofin-parser | /schokofin_parser.py | UTF-8 | 3,040 | 2.859375 | 3 | [] | no_license | #Program to parse a schokofin-protocol and export as CSV
#"Geld" as a function of time and with an ID as first entry
#author: Alexander Rietzler
#version: 0.1 - 17.12.2013
#contact: alexander.rietzler at gmail.com (at=@)
import os
import string
import csv
#input directory path, read directory name and save as ID-str... | true |
1c0d2b9cf4ad47353a3deb50f65d174f9d648f89 | Python | TheOneTrueGod/NetBattle | /Effects.py | UTF-8 | 13,582 | 2.65625 | 3 | [] | no_license | import pygame
from Globals import *
class Effect:
def __init__(self, pos, type, clr, time, other):
assert(False) #This should never be created. It is a superclass that I stole from
#a different program of mine.
self.pos = pos
self.type = type
self.time = time
self.clr = clr
self.other = o... | true |
9344d2e4462fc2d123e1ff70826e09072d1a9bbe | Python | mattDuque/MC-server-queue-notifier | /2b2t notifier.py | UTF-8 | 2,008 | 2.8125 | 3 | [] | no_license | from win10toast_persist import ToastNotifier
import time
import getpass
# define notifier
toaster = ToastNotifier()
#tracking the positions on server queue
current_pos = 0
last_pos = 0
#bools to control execution
has_run = False
first_notificarion = False
#get log adress
user_name = getpass.getuser()
file_adress = "C... | true |
e79da5e15a628da48bd2aa6cd47984cabca05cfb | Python | Minakshi-Verma/cs-module-project-algorithms | /single_number/single_number.py | UTF-8 | 1,260 | 4.125 | 4 | [] | no_license | '''
Input: a List of integers where every int except one shows up twice
Returns: an integer
'''
##instructor's optimized code
# def single_number(nums): # O(n)
# # keep track of number of times an item occurs in input
# counts = {}
# # loop through input list O(n)
# for num in nums:
# # if it... | true |
af828e9d3f0798ffe22a1ba961f0990704208a3f | Python | wujinzhong/tinyik | /tinyik/visualizer.py | UTF-8 | 5,348 | 2.890625 | 3 | [
"MIT"
] | permissive | import numpy as np
try:
import open3d as o3d # the extra feature
except ImportError:
pass
def translate(p):
x, y, z = p
return np.array([
[1., 0., 0., x],
[0., 1., 0., y],
[0., 0., 1., z],
[0., 0., 0., 1.]
])
def rotate(axis, angle):
x, y... | true |
0474ee7aff8c5a55d44709241b17499bb47a2e19 | Python | syurskyi/Python_Topics | /095_os_and_sys/_exercises/templates/Python 3 Most Nessesary/16.1. Open file.py | UTF-8 | 4,758 | 3.53125 | 4 | [] | no_license | # # # -*- coding: utf-8 -*-
#
# # Прежде чем работать с файлом, необходимо создать объект файла с помощью функции
# # open ( ) .
# #
# # В первом параметре указывается путь к файлу. Путь может быть абсолютным или относительным.
# # При указании абсолютного пути в Windows следует учитывать, что в Python слеш
# # являетс... | true |
5bfa808aa56db0317e373ba39a8a55f14c766d84 | Python | ventilator/neat_python | /file io/Pandas_in_chuncs.py | UTF-8 | 1,453 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 14:29:45 2019
@author: gruenewa
"""
import pandas as pd
import re
import numpy as np
import seaborn as sns
import sys
def readfile(filename):
chunksize = 200000
results = []
for c in pd.read_csv(filename, sep=":", header=None, names=["user","passw... | true |
50e72d46833eab8385d74ee3dc8069b5eb0b150e | Python | NikitaGryaznov/stepik---auto-tests-course | /lesson2-2_steep6-vol2.py | UTF-8 | 504 | 2.71875 | 3 | [] | no_license | from selenium import webdriver
import math
link = "http://SunInJuly.github.io/execute_script.html"
b = webdriver.Chrome()
b.get(link)
x = b.find_element_by_css_selector("#input_value").text
ex = str(math.log(abs(12*math.sin(int(x)))))
answer = b.find_element_by_css_selector("#answer").send_keys(ex)
b.execute_script("... | true |
6af807e27c33de8eb6a4f7f37e6d5d82c2d8a18a | Python | wagoleb/euler | /problem43.py | UTF-8 | 649 | 3.5 | 4 | [] | no_license | listOfPandigital = []
import itertools
lista = itertools.permutations('0123456789')
for item in lista:
listOfPandigital.append(''.join(item))
print(len(listOfPandigital))
"""************"""
def find(n):
dividers = [2, 3, 5, 7, 11, 13, 17]
warunki = []
for i in range(1, len(n)-2):... | true |
2f40550dfbecfa04d97c99e2461a2d33a320613d | Python | gorazdko/specter-diy | /src/gui/popups.py | UTF-8 | 6,479 | 2.5625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import lvgl as lv
from .common import *
from .decorators import *
# global popups array
# we use it in close_all_popups()
popups = []
# pop-up screens
class Popup(lv.obj):
def __init__(self, close_callback=None):
super().__init__()
self.old_screen = lv.scr_act()
self.close_callback = clos... | true |
7c0662cf33d41fc7d863113f24ff610f27aafdfb | Python | lawtech0902/py_imooc_algorithm | /array/15_3sum.py | UTF-8 | 1,395 | 3.5 | 4 | [] | no_license | # _*_ coding: utf-8 _*_
"""
__author__ = 'lawtech'
__date__ = '2018/9/20 下午8:59'
给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组。
注意:答案中不可以包含重复的三元组。
例如, 给定数组 nums = [-1, 0, 1, 2, -1, -4],
满足要求的三元组集合为:
[
[-1, 0, 1],
[-1, -1, 2]
]
"""
class Solution:
def threeSum(self, nums... | true |
467cbba1947b84586a3e71cecd20db6b6c9d6309 | Python | cjjhust/python_datastucture | /1-1-2.py | UTF-8 | 992 | 3.8125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 10 12:20:12 2018
@author: CJJ
"""
"""
方法功能:对不带头结点的单链表进行逆序
输入参数:firstRef:链表头结点
"""
def RecursiveReverse(head):
# 如果链表为空或者链表中只有一个元素
if head is None or head.next is None :
return head
else :
# 反转后面的结点
newhead=RecursiveReverse(he... | true |
e8b80509dcbe8bca205eb76389ea8fe62e26c918 | Python | AndreasLH/3-ugers-projekt-Ham-n-spam | /prototyper/KnnImplemented.py | UTF-8 | 5,843 | 3.234375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
def prepare_data(csv_file):
""" Function: Loads data and prepares data (feature transformation)
Input: cvs-file with messages and class (spam = 1 or not sp... | true |
1260515fd649434c80ba9d6fcaa334f196a053f9 | Python | danielcasadio/desafio-sti | /modulo_acesso.py | UTF-8 | 3,356 | 2.84375 | 3 | [] | no_license | import csv as csv
import random
import os
class Leitor:
def __init__(self, arquivo):
self.arquivo = arquivo
def list_names(self):
with open(self.arquivo) as f:
reader = csv.DictReader(f)
# fieldnames ['nome', 'matricula', 'telefone', 'email', 'uffmail', 'status']
... | true |
8148fe61c1c92ccdcce99e4ce12580f2af84fbea | Python | sioLabs/friends-classifier | /extractor.py | UTF-8 | 2,036 | 2.921875 | 3 | [] | no_license | import re
from bs4 import BeautifulSoup
from urllib import urlopen
def linkImporter(baseURL):
scripts=[]
html = urlopen(baseURL).read()
raw = BeautifulSoup(html)
links = raw.find_all("a")
for link in links:
s = link.string.extract()
print(s)
# print(link.find('season'))
... | true |
1953bf0470ea84407200e307bbb5a0a1291a609d | Python | Clarksj4/Tournament_Organizer- | /daoserver/src/dao.py | UTF-8 | 12,639 | 2.765625 | 3 | [] | no_license | """
Entrypoint for the DAO
This is the public API for the Tournament Organiser. The website, and apps
should talk to this for functionality wherever possible.
"""
import json
import os
import re
from flask import Flask, request, make_response, jsonify
from functools import wraps
from datetime_encoder import DateTim... | true |
c35c61f97931a2f06c6e3292d69935ff448955e8 | Python | surajthapar/Scout | /scout/index.py | UTF-8 | 8,852 | 2.9375 | 3 | [] | no_license | import json
import os
import sqlite3
from typing import List, Dict, Iterator, Tuple
from scout import term
from scout.exceptions import (
TableAlreadyExists,
)
class Index:
"""Index generator for Scout searches.
:raises TableAlreadyExists: Raised when table being created already exists.
"""
inde... | true |
482c07f66b0b8df44afd8e896db299c97b505047 | Python | JasonWherry/LeetCode | /python/35_SearchInsertPosition.py | UTF-8 | 614 | 3.296875 | 3 | [] | no_license | class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
# check for empty list
if not nums:
print('nums is Empty')
return -1
first_large = last_small = 0
# find location for target
for i in range(0, len(nums)):
... | true |
667d2f9c73ddfb8b388143b8321389fa923696c5 | Python | CaioSGoncalves/ComputerVision | /PS_01/video.py | UTF-8 | 1,741 | 3.046875 | 3 | [] | no_license | import cv2
import numpy as np
from cg_util import calculate_image_measures,esc_pressed
class Video:
file_path = None
value = None
def __init__(self, file_path):
self.file_path = file_path
def read(self):
video = cv2.VideoCapture(self.file_path)
if not video.isOpened():
... | true |
a51b0d852b58759a9473bcc24c7643f26af42a20 | Python | natthikorn/project | /test1.py | UTF-8 | 162 | 2.78125 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.title("Welcome to app")
photo = PhotoImage(file="333.png")
label = Label(root, image=photo)
label.pack()
root.mainloop() | true |
481ceb47b034b357751fa7d5b2f1aea5a4a3aa52 | Python | jinghui31/Respberry_Pi | /Botton/LEDControl.py | UTF-8 | 3,451 | 3.15625 | 3 | [] | no_license | from tkinter import *
from functools import partial
"""RGBLED just use for static (red, green, blue)"""
from gpiozero import RGBLED
from random import randint
import RPi.GPIO as gpio
led = RGBLED(red = 17, green = 27, blue = 22)
pins = (5, 6, 13, 19, 12, 16, 20, 21)
digits = {
0: (1, 1, 1, 0, 0, 1, 1, 1),
1: ... | true |
6872b4472da14ab592e3ff2e93a6f20f9b70535f | Python | sonamg111/IMDB-web-scraping-python | /eighth_task.py | UTF-8 | 1,132 | 2.828125 | 3 | [] | no_license | import os.path
from fifth_task import*
from first_task import*
from fourth_task import*
import json
def cashingMovieDetails(data,details):
moviesData = []
for index in details:
moviesUrl = index["url"]
# print (moviesUrl)
movieId=moviesUrl.split("/")
# print movieId
mov... | true |
370bca206e5f810e1bf1053c87b51cac048a1629 | Python | fafsaff/python- | /test/任务3-3.py | UTF-8 | 98 | 3.75 | 4 | [] | no_license | num = int(input("请输入一个数:"))
while num != 0:
print(num % 10)
num = num//10 | true |
16b06654347d04fed79419e8091c56d2e7a14d81 | Python | lpf471800/retrievalSystem | /code/api_controlers/base_function.py | UTF-8 | 2,206 | 3.046875 | 3 | [
"MIT"
] | permissive | """
对用户提供的图像编码和文本编码服务进行封装和测试
"""
import numpy as np
import sys
sys.path.append("..")
from models import encoder
import logging
import globalvar
# 变量初始化
logger = globalvar.get_value("logger")
def image_encoder_api(model, image_path):
"""
对用户提供的图像编码函数进行二次封装
:param model: 用户提供的模型
:param image_path: 提供... | true |
328b56606429328a856aa7181ed5f2bb9638a1ae | Python | N3mT3nta/ExerciciosPython | /Mundo 2 - Estruturas de Controle/ex052.py | UTF-8 | 337 | 4.21875 | 4 | [
"MIT"
] | permissive | tot = 0
num = int(input('Digite um número: '))
for c in range(1, num + 1):
if num % c == 0:
print('\033[32m')
tot = tot + 1
else:
print('\033[31m')
print('{} '.format(c), end=' ')
print(f'\033[mO valor {num} foi divisível {tot} vezes, portanto: ')
if tot == 2:
print('\033[32mÉ primo')
else:
print('\033[31mNã... | true |
651c39877fba3ca727f388102cf592c9bcdd5c44 | Python | hellovictorlee/cache | /dynamodb.py | UTF-8 | 4,440 | 2.5625 | 3 | [] | no_license | import logging
import boto3
import math
from botocore.exceptions import ClientError
from contextlib import closing
import time
import uuid
import json
def create_table(table='cache', region='us-west-2'):
try:
dynamodb = boto3.client('dynamodb', region_name=region)
dynamodb.create_table(AttributeDe... | true |
84de9491599c84dee019f356acd71905a61b2c5a | Python | nur3k/selenium_projects1 | /Trash/FindValueInTheCell.py | UTF-8 | 1,093 | 3.078125 | 3 | [] | no_license | import unittest
from selenium import webdriver
class SalarySearch(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def test_search_in_python_org(self):
driver = self.driver
driver.get("https://www.qtptutorial.net/automation-practice/")
self.assertIn("Auto... | true |
9d2e92dd988391b657f1ed905518ad29a9b1097e | Python | distmatters/411-ifi-aid-flows | /wbp/wb-scrape.py | UTF-8 | 2,240 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# wbp/wb-scrap.py
""" Download data from the World Bank's Project API which are not included in
the bulk project data download available on their website.
"""
__copyright__ = """
Copyright 2021 Evans Policy Analysis and Research Group (EPAR).
"""
__license__ = """
This project is licensed un... | true |
197e207c9afbbef327c0fe48ce06ff75ec43cb5c | Python | pylangstudy/201707 | /25/02/divmod.py | UTF-8 | 72 | 3.0625 | 3 | [
"CC0-1.0"
] | permissive | #divmod(a, b)
#商と剰余からなる対を返す
print(divmod(7, 3))
| true |
0748b34965f6f20a9f33541f014e7a3c2b35fa2a | Python | rady1337/FirstYandexLyceumCourse | /21. Функции/Домашняя работа/Скажи «пароль» и проходи.py | UTF-8 | 322 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def ask_password():
n = 0
while True:
a = input()
if a == 'password':
print('Пароль принят')
break
else:
n += 1
if n == 3:
print('В доступе отказано')
exit()
| true |
89e72e2c76a8ed2d6e9f9f037d2f06c4c9801140 | Python | StevenLOL/kaggleScape | /data/rscript320.py | UTF-8 | 1,434 | 2.921875 | 3 | [] | no_license | import kagglegym
import numpy as np
import pandas as pd
from sklearn import linear_model as lm
target = 'y'
# The "environment" is our interface for code competitions
env = kagglegym.make()
# We get our initial observation by calling "reset"
observation = env.reset()
# Get the train dataframe
train = observation.tr... | true |
d5b4c7c3ee13cc9780548af2af7f452a9f78f984 | Python | mistasse/modulom-panopticdeeplab | /segmentation/model/output_math/utils.py | UTF-8 | 4,425 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | from types import FunctionType
import collections
import functools
import textwrap
import inspect
def override(original):
def decorator(f):
f.__doc__ == original.__doc__
return f
return decorator
_NOVALUE = object()
_kw_kinds = (inspect.Parameter.KEYWORD_ONLY,
inspect.Parameter.... | true |
9f6b21a0b1797b5beff909aea1d62ad46ee41cab | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_62/56.py | UTF-8 | 1,056 | 2.84375 | 3 | [] | no_license | def Intersect(w1,w2):
if (w1[0] < w2[0] and w1[1] > w2[1]):
return 1
if (w1[0] > w2[0] and w1[1] < w2[1]):
return 1
return 0
if __name__ == '__main__':
#in_file = 'testA.txt'
#in_file = 'A-small-attempt0.in'
in_file = 'A-large.in'
out_file = 'res'
l... | true |
5a62dcb64d113e80da6283fd005febe804c296ef | Python | MingJerry/Guide | /alpha/logger.py | UTF-8 | 1,085 | 2.84375 | 3 | [] | permissive | import logging
import os
class Logger(object):
def __init__(self, module_name):
self.module = module_name
if os.path.isdir("/var/www/html/"):
self.log_file = "/tmp/brace_log.log"
else:
self.log_file = "./brace_log.log"
self.trace_format = '%(asc... | true |
400c0ec7e086a5c1cc5e178a651f15263032c762 | Python | oludom/DPSproject3 | /improved/util_methods.py | UTF-8 | 5,333 | 2.71875 | 3 | [] | no_license | import time
import json
import requests
from random import randint
import socket
portRange = range(5000, 6000)
def generate_node_id():
millis = int(round(time.time() * 1000))
node_id = millis + randint(800000000000, 900000000000)
return node_id
# This method is used to register the service in the servic... | true |
a47350cfeef40d81f0ac6710404dd83e3f88a631 | Python | multimodalspectroscopy/bcmd-web | /app/bayescmd/util.py | UTF-8 | 902 | 3.203125 | 3 | [
"MIT"
] | permissive | import os
import sys
def findBaseDir(basename, max_depth=5, verbose=False):
"""
Get relative path to a BASEDIR.
:param basename: Name of the basedir to path to
:type basename: str
:return: Relative path to base directory.
:rtype: StringIO
"""
MAX_DEPTH = max_depth
BASEDIR = os.pat... | true |
b38dcfa702f808c6ebd1ddcc35ba342f19ce6e37 | Python | zenithlight/advent-of-code-2017 | /2a.py | UTF-8 | 192 | 2.84375 | 3 | [] | no_license | table = None
with open('2.input', 'r') as handle:
table = [[int(number) for number in line.split()] for line in handle.readlines()]
print(sum([max(line) - min(line) for line in table]))
| true |
f248450a4091ac05cfde51b3ab20606f1ca6bae8 | Python | baccarnh/dev | /partie2.py | UTF-8 | 1,462 | 3.640625 | 4 | [] | no_license | print("ex1: True ou false?")
var1=input("entrer variable1")
var2=input("entrer variable2")
longueur_var1= len (var1)
longueur_var2= len (var2)
if longueur_var1==0 and longueur_var2==0:
print("true")
else: print("false")
print ("ex2: calculer mon ãge")
annéeactu= int(input("donner l'année actuelle"))
votreannée=int... | true |
d7c86293c1ae6b2279fa49cd3b84c6de64b6f9d0 | Python | openmv/openmv | /scripts/examples/01-Camera/07-Sensor-Control/sensor_exposure_control.py | UTF-8 | 3,161 | 3.671875 | 4 | [
"MIT"
] | permissive | # Sensor Exposure Control
#
# This example shows off how to cotnrol the camera sensor's
# exposure manually versus letting auto exposure control run.
# What's the difference between gain and exposure control?
#
# Well, by increasing the exposure time for the image you're getting more
# light on the camera. This gives ... | true |
c9095b57a301426f886f8562c5fe60b462c7aa64 | Python | torinmr/cs244-project | /lib/experiments/wpim_fig5.py | UTF-8 | 1,620 | 2.921875 | 3 | [] | no_license | from lib.client_server_input_generator import ClientServerInputGenerator
from lib.pim import PimSwitch
from lib.statistical import StatisticalSwitch
from lib.wpim import WPimSwitch
from lib.plot import draw_plot
import numpy as np
from tqdm import tqdm
loads = np.linspace(0.05, 0.95, 18)
credit = np.zeros((16, 16))
#... | true |
48fa99657eff97cddec5d3508baf3d06f4f6226a | Python | DongZhi999/PRML_Notes | /PyCharm_Project/预科-python/面向对象/inherit.py | UTF-8 | 3,562 | 4.3125 | 4 | [] | no_license | ''''''
'''
继承
'''
# class Animal():
# def __init__(self,name,food):
# self.name = name
# self.food = food
#
# def eat(self):
# print('%s爱吃%s'%(self.name,self.food))
#
# # 声明子类,继承animal
# class Dog(Animal):
# #子类自己的属性
# def __init__(self,name,food,drink):
# #加载父类构造方法
#... | true |
ef2dd59657b34ab9ad96b32319accaa64591c645 | Python | aburasali/PyhtonClass | /Lists/Exercise-1.py | UTF-8 | 379 | 4.3125 | 4 | [] | no_license | # the statement create a list containing a three different string values.
programming_language=['Python', 'C', 'Java' ]
#Print out the first item/element in this case is Pyhton
print(programming_language[0])
#Print out the second item/element in this case is C
print(programming_language[1])
#Print out the third item/e... | true |
fba5196008664a6e28760612e577fda3feeb6a51 | Python | arunraman/Code-Katas | /Leetcode - FB/p080.py | UTF-8 | 323 | 3 | 3 | [] | no_license | class p080(object):
def removeduplicatesfromsortedarrayallowedTwice(self, nums):
i = 0
for n in nums:
if i < 2 or n > nums[i - 2]:
nums[i] = n
i += 1
return i, nums[:i]
S = p080()
print S.removeduplicatesfromsortedarrayallowedTwice([1, 1, 1, 2, 2, ... | true |
d23e539cf431ab9ef8dad87cb130b8833dbc8c60 | Python | leiyu-boy/comment_nlp | /start.py | UTF-8 | 5,976 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/8/21 10:49 上午
# @Author : yu.lei
# 准备数据
import re
import jieba
import joblib
import numpy
from gensim.models import Word2Vec
from sklearn.model_selection import train_test_split
from emotion_dict.dict_analy import filter_stop_words, match_word, cal_score
from emotion_dict... | true |
0b123d1b081df66b4472e343c0be7ac1739a8762 | Python | joysjohney/Luminar_Python | /PythonPrograms/flowcontrols/looping/nested1,12,123.py | UTF-8 | 143 | 3.390625 | 3 | [] | no_license | #1
#12
#123
for i in range(1,4): #i=1 i=2 i=3
for j in range(1,i+1): #j(1,2) j(1,2,3) j(1,4)
print(j,end="") #1 12 123
print() | true |
a9b51a3c82e881655d9246fab4db7a9a0752a3d3 | Python | claytonjwong/leetcode-py | /704_binary_search.py | UTF-8 | 410 | 3.421875 | 3 | [
"MIT"
] | permissive | #
# 704. Binary Search
#
# Q: https://leetcode.com/problems/binary-search/discuss/
# A: https://leetcode.com/problems/binary-search/discuss/600517/Javascript-Python3-C%2B%2B-Lower-Bound
#
from typing import List
from bisect import bisect_left
class Solution:
def search(self, A: List[int], T: int) -> int:
... | true |
332f0f55db72efd055c978f75dc22a7739cb5c0f | Python | quarkfin/qf-lib | /qf_lib/backtesting/events/time_event/regular_time_event/calculate_and_place_orders_event.py | UTF-8 | 2,019 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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 License at
#
# http://www.apache.org/licenses/LICENSE-2... | true |
59aae73b99b410ddc0bca493146647b073fea16e | Python | c0ns0le/Pythonista | /audio/sameeas-master/audioroutines.py | UTF-8 | 6,169 | 2.828125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import math, struct, random, array
pi = math.pi
def getFIRrectFilterCoeff(fc, sampRate, filterLen=20):
'Calculate FIR lowpass filter weights using hamming window'
'y(n) = w0 * x(n) + w1 * x(n-1) + ...'
ft = float(fc) / sampRate
#print ft
m = float(filterLen - 1)
weights = []
... | true |
3c8115060ed74320c30a4b3b33b1690034128819 | Python | jimbobbennett/holiday-speech-demos | /text-to-speech.py | UTF-8 | 841 | 3.109375 | 3 | [
"MIT"
] | permissive | import os
import azure.cognitiveservices.speech as speechsdk
from dotenv import load_dotenv
load_dotenv()
speech_key = os.environ['KEY']
service_location = os.environ['LOCATION']
# Creates an instance of a speech config with specified subscription key and service region.
speech_config = speechsdk.SpeechConfig(subscri... | true |
67fb3f5c4fcfb36e19c4c5c8513fb36ed3328dab | Python | liutong1997/my-works | /files_to_deal/人格因子散点图.py | UTF-8 | 3,344 | 3.125 | 3 | [] | no_license | # coding=utf-8
from xlrd import *
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import Axes3D
import random
import numpy as np
# 随机颜色函数
def random_color():
colorArr = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
color = ""
for i in range(6):
color += colo... | true |
7bf91ba3e4b3fb4228eec4269060eaefbb648a1b | Python | sonicma7/empacgame | /enemy.py | UTF-8 | 3,804 | 2.96875 | 3 | [] | no_license | import pygame
import sys
import math
import layermanager
import player
import balloon
from pygame.locals import *
class Enemy():
def __init__(self, background, type):
self.type = type
if type == 0:
self.image = pygame.image.load('art/testenemy.png').convert_alpha()
... | true |
765e6d32c12d90bc3033145c08a29394245bff3c | Python | sysadwcai/Python-Projects | /mpl.pie.py | UTF-8 | 622 | 3.03125 | 3 | [] | no_license | from matplotlib import pyplot as plt
plt.style.use('fivethirtyeight')
#slices = [120, 80, 30, 20]
#labels = ['Sixty', 'Fourty', 'Extra1', 'Extra2']
slices = [59219, 55466, 47544, 36443, 35917]
labels = ['JavaScript', 'HTML/CSS', 'SQL', 'Python', 'Java']
explode = [0, 0, 0, 0.1, 0] # 0.1% distance away from r... | true |
9a1e2800e7d93aec3dd41c08c327dafcef446a4e | Python | txthuong/txthuong | /oneclick/AppModule/GraphicGNSS.py | UTF-8 | 3,487 | 3 | 3 | [] | no_license | '''
Graphic to display the satellites position
This program can be used to create a dynamic graphic to dislay the sat position.
It is an exemple.
Today this code is not used in autotest application
Created on 6 avr. 2012
@author: jm Seillon
'''
import wx
import math
import random
class GNSS_Graphic(wx.Window):
def... | true |
ef094238929e12c8163cae5be80ae8a63bafafb8 | Python | DerrickThai/Elliot-CC | /elliot/__main__.py | UTF-8 | 791 | 3.1875 | 3 | [] | no_license | from elliot.time_interval import TimeInterval
from scheduler import Scheduler
def main():
# Read the CSV and determine the longest block of time in which all users are free to meet
scheduler = Scheduler("../calendar.csv")
longest_interval = scheduler.longest_free_interval()
if longest_interval is Non... | true |
cd20dd37871d65e2b6226aa72fac86e4444691c1 | Python | mdrafiqulrabin/tnpa-generalizability | /NPM-IST21/results/plots/num_of_stmt.py | UTF-8 | 1,531 | 2.65625 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df_main = pd.read_csv('../data/num_of_stmt.csv')
y_tricks_map = {
'pcp5': '$\leq 5$',
'pcp10': '$6 \sim 10$',
'pcp15': '$11 \sim 15$',
'pcp20': '$16 \sim 20$',
'pcp25': '$21 \sim 25$',
'pcp50': '$26 \sim 50$',
'pcp100': ... | true |
22c20876a49d2704507f4c28745d59d41667c063 | Python | tjvick/advent-of-code | /2022_python/solutions/day20/part1.py | UTF-8 | 1,162 | 2.65625 | 3 | [] | no_license | from copy import deepcopy
from solutions import helpers
import numpy as np
np.set_printoptions(edgeitems=30, linewidth=100000)
filename = 'input'
# filename = 'test2'
ints = helpers.read_each_line_as_int(filename)
original_ordering = list(enumerate(ints))
n = len(original_ordering)
new_positions = []
modified_o... | true |
7127ecab8f19428a1f3f28609e82729e5026cfd9 | Python | lucifer1004/codeforces | /1624/b/b.py | UTF-8 | 404 | 3.171875 | 3 | [
"CC-BY-4.0"
] | permissive | from sys import stdin
input = stdin.readline
def read_int():
return int(input())
def read_ints():
return map(int, input().split())
t = read_int()
for case_num in range(t):
a, b, c = read_ints()
if (b * 2 - c > 0 and (b * 2 - c) % a == 0) or (b * 2 - a > 0 and (b * 2 - a) % c == 0) or ((a + c) % 2 ... | true |
484dc5dea74f8ff75f1fed3fba735d64d460d660 | Python | chjdev/euler | /python/problem4.py | UTF-8 | 707 | 4.40625 | 4 | [
"BSD-2-Clause"
] | permissive | # Largest palindrome product
# Problem 4
# A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is
# 9009 = 91 × 99.
#
# Find the largest palindrome made from the product of two 3-digit numbers.
LOWER = 100
UPPER = 999
def is_palindrome(num):
snum = s... | true |
ec61ef70de7a7b07512b139c5605f2871369077b | Python | 470024581/uda-ml-python3 | /tianchi_precision_medical_competition/feature.py | UTF-8 | 1,530 | 3 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
color = sns.color_palette()
sns.set_style('darkgrid')
import warnings
def ignore_warn(*args ,**kwargs):
pass
warnings.warn = ignore_warn
from scipy import stats
from scipy.stats import norm, skew
... | true |
786be7ea6b00676e927cbdbaeafed2201c1e06e7 | Python | connor-klopfer/animal_response_nets | /data_prep_scripts/import_beetle.py | UTF-8 | 1,207 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
"""
Taking the association networks from the beetle data and saving to a friendlier format type, for easier use.
Used VThorsethief's code as a template
"""
from os.path import join
import pandas as pd
import networkx as nx
def get_beetle_networks():
"""Impor... | true |
924052aa2e4b76165832de63ebf9c617de952b17 | Python | AggarwalAnshul/Dynamic-Programming | /InterviewBit/Strings/implement-strstr.py | UTF-8 | 2,061 | 3.828125 | 4 | [] | no_license | """
Please Note:
Another question which belongs to the category of questions which are intentionally stated vaguely.
Expectation is that you will ask for correct clarification or you will state your assumptions before you start coding.
Implement strStr().
strstr - locate a substring ( needle ) in a string ( haystack... | true |
738c05e5eb9628c2a21ef1aa4952fd52d3c889c9 | Python | Carretero140/caseInterview | /Pipeline.py | UTF-8 | 4,626 | 2.65625 | 3 | [] | no_license | import os
from google.cloud.bigquery import schema, table
from google.cloud.bigquery.enums import WriteDisposition
import pandas as pd
from google.cloud import bigquery
from props.import_properties import Properties
class Pipeline:
"""Function that will be used to extract data from json files"""
def __ex... | true |
76ffdb9dc9dfe54bfaaa3832a41cd393ecc9ace8 | Python | cujeu/quantocean | /backtest/data.py | UTF-8 | 18,363 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 15 10:50:35 2014
@author: colin4567
"""
import numpy as np
import pandas as pd
import datetime
import os, os.path
pd.set_option('notebook_repr_html', False)
from abc import ABCMeta, abstractmethod
from event import MarketEvent
class DataHandler(obje... | true |
cc07bcea5a49eea0b77498673e819bca6b1f22ed | Python | liraRaphael/Compressor-texto | /Compactador.py | UTF-8 | 8,800 | 3.203125 | 3 | [] | no_license | '''
Nessa classe, terá as funções para compactar os textos
'''
import os, sys, math,Arquivo, re
class Compactador:
leitura = None # conterá a classe de Arquivo para leitura
gravacao = None # conterá a classe de Arquivo para gravar
# tira os itens repetidos
def tirarRepeticao(self,quebrar):
... | true |
bc9eca9eae00a88cd65580140e0b7b55f5e6ae61 | Python | GuangyuZheng/leet_code_python | /54_Spiral_Matrix.py | UTF-8 | 3,594 | 3.484375 | 3 | [] | no_license | from typing import List
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
output = []
height = len(matrix)
if height == 0:
return output
wide = len(matrix[0])
if wide == 0:
return output
wall = [[False for i in rang... | true |
54287d2b6256576269e5d9424d470fc6a7ec9da2 | Python | rcarino/Project-Euler-Solutions | /problem34.py | UTF-8 | 255 | 3.484375 | 3 | [] | no_license | __author__ = 'rcarino'
import math
def sum_factorials():
for i in range(10, 1000000):
if i == sum([math.factorial(int(c)) for c in str(i)]):
print i, 'with factorials: ', [math.factorial(int(c)) for c in str(i)]
sum_factorials() | true |
066bc1abf620ab049ca9feae80a0c3d73c418528 | Python | Dharadharu/hi | /r.py | UTF-8 | 114 | 3.0625 | 3 | [] | no_license | p=int(input())
r,s=input().split()
r=int(r)
s=int(s)
if p in range(r+1,s):
print("yes")
else:
print("no")
| true |
c082afc303efbff0f3a6182b7e3cc3d430534dfb | Python | kollokviegenerator/mvp | /api-draft.py | UTF-8 | 6,300 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python2.7
#TODO: implement group management
#Remove print statements from the different managers?
import getopt, sys
"""
Unifi API
"""
class apidraft:
def __init__(self):
self.user_management = UserManagement()
self.tag_management = TagManagement()
self.group_manageme... | true |
9f7d3ab2719a4f0c9c712a8c51b30b0bf3a4c26d | Python | jarredbultema/ts_helpers | /src/ts_pre_processing.py | UTF-8 | 6,653 | 3.296875 | 3 | [] | no_license | import numpy as np
#####################
# Preprocessing Funcs
#####################
def dataset_reduce_memory(df):
"""
Recast numerics to lower precision
"""
for c in df.select_dtypes(include=['float64']).columns:
df[c] = df[c].astype(np.float32)
for c in df.select_dtypes(include=['int6... | true |
a23277a8b30620bb10f9e3002be838d5b7129520 | Python | iliankostadinov/thinkpython | /Chapter10/Ex10.9.py | UTF-8 | 570 | 4.21875 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""
Write a function that reads the file words.txt and builds a list with one
element per word. Write two versions of this function, one using the append
method and the other using the idiom t = t + [x] . Which one takes longer to
run? Why?
"""
def create_list(filename):
t = []
fin... | true |