blob_id 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 |
|---|---|---|---|---|---|---|---|---|---|---|
660f60d08f64880250180ad9a0562aa0454bb95f | ahao214/RookieForPython | /twelve/12.14.py | UTF-8 | 229 | 2.65625 | 3 | [] | no_license | import calendar
import locale
cal = calendar.month(2019, 1)
print(cal)
locale.setlocale(locale.LC_ALL, 'zh_CN.UTF-8')
cal = calendar.month(2019, 1)
print(cal)
locale.setlocale(locale.LC_ALL, '')
print(calendar.calendar(2019))
| true |
04e5b42a2cdde2a3b8d0e3dcb686459e726b99a1 | AlvisonHunterArnuero/EinstiegPythonProgrammierung- | /char_code_calculation.py | UTF-8 | 806 | 3.921875 | 4 | [
"MIT"
] | permissive | # ---------------------------------------------------------------------------------------------
# Find all ASCII code from string characters, add them, change 7 for 1, substract both amount
# and return is final result
# Made with ❤️ in Python 3 by Alvison Hunter - March 30th, 2021
# JavaScript, Python and Web Developm... | true |
dd356ab0ec0f4381edfdb7566cce1729ab5af89a | YiqunPeng/leetcode_pro | /solutions/1625_lexicographically_smallest_string_after_applying_operations.py | UTF-8 | 775 | 3.40625 | 3 | [
"MIT"
] | permissive | class Solution:
def findLexSmallestString(self, s: str, a: int, b: int) -> str:
res = s
seen = set(res)
q = deque([s])
while q:
v = q.popleft()
va = self._apply_a(v, a)
vb = self._apply_b(v, b)
if va not in seen:
seen.ad... | true |
06ac641330122d031725a86f191bad0145e923d6 | lanjar17/Python-Project | /Chapter 6/Latihan/latihan 1_No.2 starFormation.py | UTF-8 | 666 | 3.609375 | 4 | [] | no_license | #starFormation1
def starFormation1(n):
for baris in range (n):
for kolom in range (baris + 1):
print('*', end=' ')
print()
starFormation1(4)
#starFormation2
def starFormation2(n):
for baris in range (n):
for kolom in range (4 - baris):
print('*', end=' ... | true |
821eeeb5f2046ff9b0ebce83deb7edeb30d2c5d5 | wsenanan/species-distribution | /bin/animated-gif-compare.py | UTF-8 | 1,624 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
""" creates animated GIFs of each taxon distribution from old and new distribution hdf5 files, and generates an
index.html for comparison """
from multiprocessing import Pool
import os
import h5py
def process_taxon(gif_name, grids):
import matplotlib.pyplot as plt
from matplotlib imp... | true |
89ff4b3270749f2003844b0aca338859a8cb05a6 | kirthibanothu/Convex | /convex/common/utils/conversions.py | UTF-8 | 1,313 | 3.5 | 4 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import re
_size_suffixes = ('B', 'KB', 'MB', 'GB', 'TB')
def humanize_bytes(size: int, precision=2) -> str:
"""Convert data size to human-readable units.
>>> humanize_bytes(20000)
'19.53 KB'
>>> humanize_bytes(int(5E8), precision=4)
'476.8372 MB'
"""
suffix_idx = 0
while size >= 10... | true |
f818741e407f9dfeb371a45df0048c462d7af6f8 | tomzbj/diy | /2020/cw_ft8_psk31_keyer/firmware/tsync.py | UTF-8 | 1,738 | 2.625 | 3 | [] | no_license | import serial
import time
import os
import sys
import bincopy
#VIEWCFG = True
VIEWCFG = False
class Cli:
def __init__(self, ser):
self.ser = ser
def send_ascii_cmd(self, cmd):
if VIEWCFG == True:
print(cmd)
self.ser.write(cmd)
timeout = time.time() + 1.5
... | true |
0c1668dcd2971475431fb5f01caae1fed7a97e93 | vanyarock01/numerical-methods | /3/point_2.py | UTF-8 | 3,320 | 3.21875 | 3 | [] | no_license | import math
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
var = """X* = -0.5
i : 0 1 2 3 4
Xi: - 3 -1 1 3 5
Fi: 2.8198, 2.3562, 0.7854, 0.32175, 0.19740.
"""
raw_data = {
"x*": -0.5,
"n": 4,
"x": [-3.0, -1.0, 1.0, 3.0, 5.0],... | true |
866b1a6172dfb821e6793726c6494a9453e79256 | ChadiHelwe/PyArabicNLP | /pyarabicnlp/embeddings/abstract_word_embeddings.py | UTF-8 | 668 | 3.171875 | 3 | [
"MIT"
] | permissive | from abc import ABCMeta, abstractmethod
class AbstractWordEmbeddings(metaclass=ABCMeta):
"""
This is an abstract class for the word embeddings
:param metaclass: [description], defaults to ABCMeta
:type metaclass: [type], optional
"""
@abstractmethod
def __init__(self) -> None:
pa... | true |
e570a6fe5e5016fe185202e04b882a481ffe4620 | slim-sheady19/hello-world | /maze_thing.pyde | UTF-8 | 521 | 3.328125 | 3 | [] | no_license | def setup():
size(640, 480)
import random
char_width=20
def draw_slash(fwd_slash, top, left):
if fwd_slash > 0.5:
line(left+char_width, top, left, top+char_width)
else:
line(left, top, left+char_width, top+char_width)
def draw():
for j in range(height / char_width):
for i i... | true |
b636b2f5f0ab2d2fa52eedf11f8f781b544f7f20 | d6veteran/d20m-morningstar | /rules.py | UTF-8 | 25,675 | 2.828125 | 3 | [] | no_license | # ============================================================================
# Copyright (c) 2011, SuperKablamo, LLC.
# All rights reserved.
# info@superkablamo.com
#
# Rules.py defines the Methods for accessing game mechanics and rules.
#
# ============================================================================... | true |
ae89e7092b9be2b33be534ab08576ede5274dc26 | tzihiang/webscraping_sandbox | /main.py | UTF-8 | 1,467 | 3.21875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import time
html_text = requests.get(
'https://en.digimoncard.com/cardlist/?search=true&category=508004').text
# Takes in a html request from requests.get(website_url) and returns an array with all the cards in the set
def get_card_list(html_text):
soup = Beautif... | true |
059df6d4fe3f7ce5fbd514e689a454b4f543456b | harshitha-akkaraju/bookish-octo-parakeet | /day_3/index.py | UTF-8 | 1,539 | 3.4375 | 3 | [] | no_license | filename = "input.txt"
map = []
filehandle = open(filename, 'r')
while True:
line = filehandle.readline()
if not line:
break
line = line.strip()
row = list(line)
map.append(row)
def in_the_map(position):
i = position[0]
j = position[1]
return (i >= ... | true |
52445b88a2a34305d9f2900df26d80b36ebe5e69 | panna/lab | /attic/mash-selected-2.6-0.72/apps/mashapp/templatetags/springsteen.py | UTF-8 | 440 | 2.75 | 3 | [] | no_license | from django import template
register = template.Library()
def clean_url(word, length=75):
"""Return a URL for display only, without protocol://, and up to length characters.
We add ... if the URL is truncated.
"""
parts = word.split('//')
if len(parts) > 1:
word = parts[1]
if... | true |
17260c7b8e06c221c19ea4061f024b7cf3c6ab44 | zenMarcus/latheControl | /software/pythonTools/intDividers.py | UTF-8 | 127 | 3.1875 | 3 | [] | no_license | counter = 26250 # int(pow(2,32))
print(counter)
for i in range(1,255):
if (counter % (i) == 0):
print(i,counter/i) | true |
4745123589211871b8b4cf5644f9a81b3193106d | wasi-9274/DL_Directory | /DL_Projects/dummy_data_storage/test.py | UTF-8 | 986 | 3.046875 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.DataFrame({"A": ["foo", "foo", "foo", "foo", "foo", "bar", "bar", "bar", "bar"],
"B": ["one", "one", "one", "two", "two", "one", "one", "two", "two"],
"C": ["small", "large", "large", "small", "small", "large", "small", "small", "larg... | true |
4f00f2a920b39af373d5197d736e93323f067bed | maneshreyash/Viterbi-Algorithm | /Q1_b_Viterbi.py | UTF-8 | 3,711 | 3.828125 | 4 | [] | no_license | # Implement the Viterbi algorithm to compute the most likely weather sequence and probability for any given
# observation sequence.
# Example observation sequences: 331, 122313, 331123312, etc.
#
# @author: Shreyash Sanjay Mane
import sys
class Viterbi:
# Initialise the class
# @param: sequence- The seque... | true |
05c5c9486a5caaf5e58173f0ee05d74efdf9105d | gigatexal/pytest-external-files | /tests/conftest.py | UTF-8 | 257 | 2.6875 | 3 | [] | no_license | import pytest
DUMMY_DATA = "tests/data/dummy.txt"
@pytest.fixture(scope="module")
def data_from_str():
return "hello world"
@pytest.fixture(scope="module")
def data_from_file():
with open(DUMMY_DATA) as data:
return data.read().strip()
| true |
48039ed306704b53b4d0b768d8e5eb22097ae639 | jcohao/python_basic | /1_basic.py | UTF-8 | 3,576 | 3.765625 | 4 | [] | no_license | #/usr/bin/env python3
'''
告诉shell使用Python3解释器来解释代码,如果有这行代码并且给脚本通过
chmod a+x xx.py增加执行权限,则可直接使用./xx.py来执行py文件
否则只能使用python3 xx.py
'''
'''
strip()默认情况下会删除字符串首尾的空格及换行符
当使用参数时会删除字符串中的对应的首位字符
'''
str = "hello world"
# str.strip('hl')返回"ello world",原字符串不变
'''
split()默认情况下会把空白符当成分隔符,把原字符串进行切分,返回一个列表
传入参数的时候会用传入的参数对字符... | true |
8f70de682c827159bc24d7c3c3e555fc69c6fe20 | heersaak/opdrachtenPython | /Opdrachten/Les 6/6_3.py | UTF-8 | 620 | 4.3125 | 4 | [] | no_license | ##Gegeven is variabele invoer = "5-9-7-1-7-8-3-2-4-8-7-9". Schrijf een nieuw programma
##waarin je deze variabele splitst in een lijst van getallen en print de gesorteerde lijst. Bepaal en print na
##het opsplitsen de grootste waarde, kleinste waarde, aantal getallen, de som en het gemiddelde!
invoer = [1, 2, 3, 4, 5,... | true |
aaf46b4583c50bb4c2cb90571fb4c6f9c6216f2c | kickscar/deep-learning-practices | /03.linear-algebra-basics/01/ex12.py | UTF-8 | 597 | 3.96875 | 4 | [] | no_license | # coding: utf-8
# 전치행렬(transpose matrix)
"""
1. 어떤 행렬의 행과 열을 바꿔 생성한 행렬이다.
2. 축에 대한 변경이지 요소의 변경이 아니다.
"""
import numpy as np
# a = np.array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14]])
a = np.arange(15).reshape(3, 5)
print(a)
print(a.shape)
print('=====================')
a1 = a.T
print(a1)
print(a1.sha... | true |
cac48361749fa388b3769a58c1bcaafe276acfd5 | twinstae/training | /py-db/template.py | UTF-8 | 1,920 | 2.75 | 3 | [] | no_license | from unittest import TestCase
from starlette.testclient import TestClient
from app import app
from services import AioSqliteService
USER_1 = {"name": "테스트유저"}
USER_2 = {"name": "test-user-2"}
ARTICLE_1 = {"title": "제목", "body": "내용"}
ARTICLE_2 = {"title": "title", "body": "body"}
ARTICLE_1_WITH_AUTHOR = {'author': {'n... | true |
87d5f5a05710d622e71b878d37cb157c7f2a166c | jtrockel/Image_Processing_Bioinformatics | /boxDrawer_version2.py | UTF-8 | 3,488 | 3.25 | 3 | [] | no_license | import cv2 as cv
class BoxDrawer:
def __init__(self,winSize,img,color, lineWidth, minNumToAccept=0):
"""
Initializer function for box drawing class
:param winSize: distance between points to call a new cluster of points a new cluster
:param img: image being drawn on
:param ... | true |
aff45d30742bae2ddc65451b3cce0813da372158 | IgnatIvanov/Rock-Paper-Scissors_JetBrainsAcademy | /Problems/Animals/main.py | UTF-8 | 168 | 2.78125 | 3 | [] | no_license | # read animals.txt
# and write animals_new.txt
open("animals_new.txt", "w").writelines([animal.replace("\n", " ") for animal in open("animals.txt", "r").readlines()])
| true |
3c3969808e178b18e3ac11cb87b3fe8982801399 | tlanclos/Ticket-API | /tools/b64encode.py | UTF-8 | 2,152 | 3.453125 | 3 | [] | no_license | import base64
import argparse
import pyperclip
if __name__ == '__main__':
# Create our argument parser
parser = argparse.ArgumentParser(
description='Simple encoder script to base64 encode a file and either save it to a file or print to stdout',
epilog='And that\'s how you do it'
)
# ... | true |
9b6db83c2361cbca23406f0e4698eaad588b70a4 | Gaoyang0/RacingGame | /ai_logic_使用tensorflow框架/training_model.py | UTF-8 | 1,632 | 3 | 3 | [] | no_license | # 通过数据训练并保存模型
import numpy as np
import tensorflow as tf
data_source = np.loadtxt('data/data.txt', dtype='float')
res_source = np.loadtxt('data/res.txt', dtype='float')
data = np.array(data_source)
res = np.array(res_source)
print(data.shape)
def add_layer(inputs, in_size, out_size, activation_function=None):
... | true |
f7379523c02c6ea472d357ab46d5cce8acbf670b | priyankitshukla/CurdwithDjango | /core/Topic-11_Comments.py | UTF-8 | 277 | 3.28125 | 3 | [] | no_license | # https://docs.python.org/2/tutorial/introduction.html
# comment in python using #
# this is the first comment
spam = 1 # and this is the second comment
# ... and now a third!
text = "# This is not a comment because it's inside quotes."
17 / 3 # int / int -> int
| true |
a374859d0f512b84f31d3e03761c0d4c78cd2e75 | orgatBP/at-practice | /dev/python/graphics/用python完成计算一个图形中三角形数目.py | UTF-8 | 1,583 | 3.6875 | 4 | [] | no_license |
#!/usr/bin/python
"""
---------------------------------------------------------------------------------------------------
2015.07.23 Grey www.iplaypy.com
***************************************************************************************************
Counter all the triangles in a picture
-----------------------... | true |
6c7c138fe338fce27d0b8ab53b3f1f97cc6f9a32 | Praveen-Kumar-Bairagi/Python_Logical_Quetions | /Pratice_python/harshad.py | UTF-8 | 184 | 3.234375 | 3 | [] | no_license | num=int(input("enter the num"))
num2=num
add=0
while 0<num:
a=num%10
add+=a
num=num//10
if num2%add==0:
print("harshad num")
else:
print("is not harshad num")
| true |
95ed44786c485c44a13b9f19c89eaadcf2744969 | joshuawagner93/master_thesis_wagner_joshua | /code/confusion_matrices.py | UTF-8 | 9,967 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 9 15:24:08 2021
@author: Joshua
"""
# define path as is done in the har script
# load models,data and get confusion matrices
# for now take a look at the best and worst performing models per prep.
# function which reads a preprocessed data file and the corresponding mod... | true |
38203c905c50d1cf85fb9dea9627b50621728128 | RaspiKidd/RaspiJam | /Scroll_phat/test.py | UTF-8 | 2,743 | 3.296875 | 3 | [] | no_license |
import scrollphat, time, pygame # importing libraries to use
pygame.init() # Initialising pygame library
pygame.joystick.init() # Initilaising the joystick module from pygame
joycount = pygame.joystick.get_count() # Returns the number of joysticks available
print('Available Joysticks: {}'.format(joy... | true |
ee6bbf0015282ba4859c841c4de031ca8d7708d7 | MateuszZ3/wsi-project | /code/game.py | UTF-8 | 4,226 | 3.09375 | 3 | [] | no_license | from datetime import datetime
from itertools import cycle
from itertools import permutations
from multiprocessing import Pool
from typing import Sequence, Type
from game_state import GameState
from strategies import Strategy
class Game:
def __init__(self, strategies: Sequence[Type[Strategy]], size: int, max_turn... | true |
14825f38e521f03b13ba5a896f443effa2eec90f | jasonn9538/Homework-Sample-Code | /Algorithms/q1.py | UTF-8 | 226 | 2.96875 | 3 | [] | no_license | def change(n,v,r):
d = [0]*r
while (n>0):
k = r
while k>0 and v[k-1]<=n:
k -= 1
if k == r:
return "No Solution"
else:
n=n-v[k]
d[k] += 1
return d
v=[100,50,25,10,5,1]
r = len(v)
print(change(76,v,r))
| true |
322e08e2d65c6423428db544ed6545188edb8d42 | Emirates2008/Tarun_2008 | /august 18/section4.py | UTF-8 | 155 | 3.375 | 3 | [] | no_license | def groups_of_4(a,b):
g4=[]
i=0
while i<len(a):
g4.append(a[i:i+b])
i=i+b
print(g4)
groups_of_4([1,2,3,4,5,6,7,8,9,10],4)
| true |
8daf719e474bb1df942c8c9a7cbfcd9dd614f53e | aadhityasw/Competitive-Programs | /questions/q358_linked_list_to_binary_tree/code.py | UTF-8 | 2,457 | 3.890625 | 4 | [
"MIT"
] | permissive | #Function to make binary tree from linked list.
def convert(head):
root = Tree(head.data)
ptr = head.next
queue = [root]
while ptr :
tptr = queue.pop(0)
left = Tree(ptr.data)
tptr.left = left
queue.append(left)
ptr = ptr.next
if ptr :
... | true |
16cb946b5a33aa619267dfcbfa1e1d83d22ec4b1 | danhquang14/pratical | /practical 9/class3_os.py | UTF-8 | 716 | 2.765625 | 3 | [] | no_license | import os
import shutil
print(os.getcwd())
target_path = "/Users/xuanq_000/Desktop/CP1404/week9/"
os.chdir(target_path)
print(os.getcwd())
print(os.listdir("."))
for name, dirs, files in os.walk("."):
print(name)
TARGET_PATH ="/Users/xuanq_000/Desktop/CP1404/week9/"
for each in os.listdir("."):
#print("{} i... | true |
7b39e1029d3d7f7d275218ea502f3601f9a07891 | chmullig/cs3137 | /theory5/q4.py | UTF-8 | 499 | 2.8125 | 3 | [] | no_license | from unionfind import *
if __name__ == '__main__':
print "Testing..."
uf = UnionFind()
uf.insert_objects(xrange(17))
print uf
uf.union(1,2)
uf.union(3,4)
uf.union(3,5)
uf.union(1,7)
uf.union(3,6)
uf.union(8,9)
uf.union (1,8)
uf.union(3,10)
uf.union(3,11)
uf.unio... | true |
41a93fc8a803b69941eec4e8d51fd42c7af64925 | xapple/cbmcfs3_runner | /cbmcfs3_runner/core/continent.py | UTF-8 | 3,684 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair and Paul Rougieux.
JRC biomass Project.
Unit D1 Bioeconomy.
You can use this object like this:
>>> from cbmcfs3_runner.core.continent import continent
>>> print(continent)
"""
# Built-in modules #
import os
# Third party modules ... | true |
483e4ff436e26749cf2212255e32b0233c5a0ea7 | NoserQjh/CodingPractice | /JianzhiOffer/01.py | UTF-8 | 550 | 3.46875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
# array 二维列表
def Find(self, target, array):
x = len(array) - 1
y = 0
ylim = len(array[0])
while ((y < ylim) & (x >= 0)):
if array[x][y] == target:
return True
elif array[x][y] < target:
... | true |
9a9d4630374b729c915597c1fc64d92b30c2d310 | Devlee247/Algorith_Practice_Programmers | /exhaustive_search/42839.py | UTF-8 | 648 | 3.078125 | 3 | [] | no_license | from itertools import permutations
import math
def solution(numbers):
answer = 0
number = []
s = set()
for i in numbers:
number.append(int(i))
for i in range(1, len(number)+1):
print(i)
temp = list(permutations(number, i))
for j in temp:
new_str = ''
... | true |
1a2b52ff69e8c2e6efa87d116e10495d305c4e15 | andreamartire/pygreco | /test/moves/BlackKingTest.py | UTF-8 | 72,635 | 2.625 | 3 | [] | no_license | '''
Created on Mar 28, 2015
@author: Andrea Martire
'''
from model.Generator import Generator
import Constants
import unittest
from model import QuadBitBoard
import Utils
class BlackKingTest(unittest.TestCase):
def testBlackKingMoveRightUp(self):
board = QuadBitBoard.QuadBitBoard()
board.cle... | true |
51c052e0acb716e696e9493e847a4323641d3661 | anthonywritescode/aoc2020 | /day17/part1.py | UTF-8 | 1,587 | 2.875 | 3 | [] | no_license | import argparse
import collections
import os.path
from typing import Counter
from typing import Tuple
import pytest
from support import timing
INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt')
def compute(s: str) -> int:
space = {}
for y, line in enumerate(s.splitlines()):
for x, c i... | true |
d250208ebfc5010468b3a31eda29b7a3542407e7 | WeedViks/Python | /2.1. table_function.py | UTF-8 | 525 | 4.34375 | 4 | [] | no_license | def num_to_name(n_atom):
"""Определение названия элемента по атомному номеру (Z)"""
if n_atom == 3:
return 'Li (литий)'
if n_atom == 17:
return 'Cl (хлор)'
if n_atom == 25:
return 'Mn (марганец)'
if n_atom == 80:
return 'Hg (ртуть)'
return 'WTF?!'
... | true |
617e7a47799c491f8573b0b7c67919e2e32515e5 | xiejian1/stydyAnalys | /main.py | UTF-8 | 1,744 | 2.953125 | 3 | [] | no_license | # encoding: utf-8
__author__ = 'mtianyan'
__date__ = '2018/1/17 0017 19:50'
from scrapy.cmdline import execute
import sys
import os
# 将项目根目录加入系统环境变量中。
# os.path.abspath(__file__)为当前文件所在绝对路径
# os.path.dirname() 获取文件的父目录。
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
print(os.path.abspath(__file__))
# D... | true |
0b378505e7520405d63f1ee43cae68c159def771 | rodrigolazarinigil/industry_price_quote | /dw/dimension/component.py | UTF-8 | 1,195 | 2.703125 | 3 | [] | no_license | import pandas as pd
import os
from definitions import ROOT_DIR
from util.db_connection import PostgresClient
from util.df_functions import df_bool_to_int, transform_str_columns, transform_float_columns
from util.run_functions import run_to_debug
import numpy as np
class Component:
"""
Reads a csv file with compone... | true |
ac24eeb78ee62533f5f7efa4f6779944560a19f8 | gambxxxx/scripts | /practice-stuff/python-stuff/object-oriented.py | UTF-8 | 273 | 4.15625 | 4 | [] | no_license | class Dog():
def __init__(self, breed, name):
self.breed=breed
self.name=name
def bark (self):
print('Woof!, my nammeth beith {}'.format(self.name))
mydog=Dog(breed='Lab',name='Spike')
print(type(mydog))
print(mydog.breed)
mydog.bark() | true |
e9924d44e23af9178a7d91b5f6485f65c32b0b32 | nehahooda/python_zed_shaw | /practice/prac83.py | UTF-8 | 449 | 2.984375 | 3 | [] | no_license | a=[[0]*4]*3
b=[[0]*3]*5
c=[[0]*4]*5
for i in range(len(a)):
for j in range(len(a[i])):
a[i][j]= int(raw_input("A>>"))
for i in range(len(b)):
for j in range(len(b[i])):
b[i][j] = int(raw_input("B>>"))
for i in range(len(c)):
for j in range(len(c[i])):
c[i][j]=0
for k in ran... | true |
23bfaffc4a6501b6c67fccf1cd5c5e84b69393b2 | dxcv/repo_dp | /Proyectos/reporte_diario/carry.py | UTF-8 | 2,363 | 2.765625 | 3 | [] | no_license | import sys
sys.path.insert(0,'../libreria/')
sys.path.insert(0,'../portfolio_analytics/utiles')
import libreria_fdo as fs
import utiles as utiles
def get_carry(fondos, date, plazo_dias=30):
"""
Función que dada una lista de fondos, retorna la sumaproducto de sus columnas [weight]*[duration] y [weight]*[tasa] p... | true |
2bfa1fc05f61b74bd189bd982e7ecf0b39e08045 | foxfluff/chess-py | /chess/piece/king.py | UTF-8 | 280 | 2.8125 | 3 | [
"MIT"
] | permissive |
from ._piece import chess_piece
class king(chess_piece):
def avaliable_moves(self):
raise NotImplementedError
@staticmethod
def legal_moves():
return [[x, y]
for x in range(-1, 2)
for y in range(-1, 2) if x != 0 or y != 0)]
| true |
9ecc6bf2e00f9452f6fea3dc1eb116ae11bd54bc | Adi75-dev/Repogorgon | /Python/02Basics/loops.py | UTF-8 | 257 | 4.03125 | 4 | [
"MIT"
] | permissive | # For Loop
for x in "Python":
print(x)
for x in ['a', 'b', 'c']:
print(x)
for x in range(0, 10, 2): # Two is called a step
print(x)
# While Loop
guess = 0
answer = 5
while answer != guess:
guess = int(input("Guess: "))
else:
pass
| true |
d1642072cb87cfec540e7529d28f2f34e7533b84 | bdugersuren/exercises | /usacobronze/2020dec18/daisy.py | UTF-8 | 262 | 3 | 3 | [] | no_license | avgflower=int(input())
inputs=list(map(int,input().split()))
for cur in range(len(inputs)-1):
for targ in range(cur+1,len(inputs)):
targets=inputs[cur:targ+1]
if sum(targets)/len(targets) in targets:
avgflower+=1
print(avgflower) | true |
36b61ef5af37c029a2e914f0f48a0289a231476d | gzuri/anime-sorter | /anime-sorter.py | UTF-8 | 918 | 2.953125 | 3 | [
"MIT"
] | permissive | import os
import shutil
import argparse
def move_anime(file, source_folder, destination_folder):
anime_directory_name = file[15:file.rfind('-') - 1]
target_folder = os.path.join(destination_folder, anime_directory_name)
if not os.path.exists(target_folder):
os.mkdir(target_folder)
if os.path.e... | true |
39f986c73ecffef38c24ae6b25fcd14ed381f49e | ghas-results/automation-of-image-data-preprocessing | /autodp/rl_core/env/action/simple_action.py | UTF-8 | 1,538 | 2.796875 | 3 | [
"MIT"
] | permissive | from autodp.rl_core.env.action.base_action import BaseAction
from autodp import cf
@BaseAction.register
class SimpleAction(BaseAction):
"""This class implements simple actions on an image such as flip, rotate, etc."""
def apply_action(self, action, cur_state, label):
"""Main method to apply an action ... | true |
e8d3c554351ef30081036a7d5cbf9555a796dece | LooDaHu/Password_Management_with_PUF | /SRAM_PUF_generator.py | UTF-8 | 413 | 3.1875 | 3 | [] | no_license | import pandas as pd
import random
def PUF_generator() -> list:
puf = []
for y in range(256):
temp = []
for x in range(256):
cell = random.randint(0, 1)
temp.append(cell)
puf.append(temp)
return puf
def main():
puf = PUF_generator()
result = pd.Data... | true |
5fce8357c2116ca636508158f0f64e25b6d8c19c | LaiQE/easy-gqcnn | /src/easygqcnn/preprocess.py | UTF-8 | 16,062 | 2.515625 | 3 | [] | no_license | import os
import glob
import logging
import random
import numpy as np
import cv2
# import scipy.misc as sm
import scipy.ndimage.filters as sf
import scipy.ndimage.morphology as snm
import scipy.stats as ss
import skimage.draw as sd
import tensorflow as tf
class DataProcesser(object):
""" 数据预处理器类,对所有的由Dex-Net生成的数据... | true |
532cf666fb0d86d1c956e1a30e0cb2163c324d81 | sergiarmengol/Machine-Learning | /ridge_regression_gradient_descent.py | UTF-8 | 9,491 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 3 15:16:27 2017
@author: sergiarmengol
1. Convert a DataFrame into a Numpy array (if applicable)
2. Write a Numpy function to compute the derivative of the regression weights
with respect to a single feature
3. Write gradient descent function to compute the regressio... | true |
49dcb12dede51e182da8fd31621da20e3e63987f | dendevs/aquabox_scripts | /aquabox.py | UTF-8 | 1,358 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys, getopt
import RPi.GPIO as GPIO
def main(argv):
relay_number = ''
relay_state = ''
try:
opts, args = getopt.getopt(argv,"hdr:s:",["help","relay=", "state="])
except getopt.GetoptError:
help()
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
... | true |
3dd4b77bd1b6fe05b09903db5edd8b35731a4d2d | Toluwalemi/Django-Womens-Health | /api/tests/api/test_cycle_events_view.py | UTF-8 | 3,593 | 2.6875 | 3 | [] | no_license | import pytest
@pytest.mark.django_db
def test_cycle_event_with_no_date(client, add_period_data):
"""Test cycle event event with no date as pararmeter"""
add_period_data(
last_period_date="2020-06-20",
cycle_average=25,
period_average=5,
start_date="2020-07-25",
end_date... | true |
fe04f538916f581f8328c3fc6d674a02ea0d2d64 | songtao0416/CBIMPDF | /recognizePDF/judgePDF.py | UTF-8 | 6,470 | 2.9375 | 3 | [] | no_license | from config.configPDF import configPDF
from serverPDF.readFile import readFile
from recognizePDF.firstTitle import getfirstTitle
from recognizePDF.otherTitle import getotherTitle
from recognizePDF.docPDF import docPDF
import re
"""
读取pdf文档,并判断采用哪一种方式进行pdf识别
处理pdf文本,去除空白行、去除表格文本
暂不用去除表格,因为参数提取时可以排除掉
... | true |
b77a079949339a55d4bcbd93e9617ef258dffe65 | ryan-yang-2049/oldboy_python_study | /seventh_module/CRM/测试.py | UTF-8 | 699 | 2.671875 | 3 | [] | no_license |
row = option_object.get_queryset_or_tuple(self.model_class,request,*args,**kwargs)
Option('gender').get_queryset_or_tuple(self.model_class,request,*args,**kwargs)
return
SearchGroupRow(verbose_name,field_object.rel.model.objects.filter(**db_condition),self,request.GET)
class PrimeNumbers(object):
def __init__(s... | true |
50a26dd488e0d26668f05d3be95bb509ad298543 | ktamilara/5-mul | /50p.py | UTF-8 | 100 | 3.171875 | 3 | [] | no_license | a11=int(input())
f1=0
for i1 in range(2,a11):
if a11%i1==0:
f1=1
print("yes" if f1==1 else "no")
| true |
e576801e05e7e67cb4a8ed8e76ecb57862869e08 | NathSoM/YTPMVE | /YTPMVE.py | UTF-8 | 4,122 | 2.578125 | 3 | [] | no_license | import os, sys, subprocess
from os import path
isFrozen = None
isPythonPresent = None
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'): # This code checks if the script is running in a bundled EXE or from the normal interpreter
isFrozen = True
print('Running from bundle')
else:
isFrozen = Fal... | true |
ba1926555c1ee6f019904339fd406e1a1c12c353 | nachogoro/euler_project | /Problem015.py | UTF-8 | 1,955 | 3.859375 | 4 | [] | no_license | #!/usr/bin/python3
#coding:utf8
# http://projecteuler.net/problem=15
#
# PROBLEM CONTENT:
# Starting in the top left corner of a 2×2 grid, and only being able to move
# to the right and down, there are exactly 6 routes to the bottom right corner.
#
# How many such routes are there through a 20×20 grid?
#
# EXPLANATION... | true |
2559cc0ab3efceb6d59c78660f8934daf1304301 | daniel-k/aoc2020 | /day11.py | UTF-8 | 7,867 | 4.625 | 5 | [] | no_license | #!/usr/bin/env python3
"""
--- Day 11: Seating System ---
Your plane lands with plenty of time to spare. The final leg of your journey is
a ferry that goes directly to the tropical island where you can finally start
your vacation. As you reach the waiting area to board the ferry, you realize
you're so early, nobody el... | true |
b6719abeab763a1f3de6d2e4614418201ecc4827 | ksamuel/Python-1 | /test_2to3.py | UTF-8 | 2,472 | 3.296875 | 3 | [] | no_license |
# print()
########
print "Howdy, Earth!"
with open('out.log', 'w') as f:
print >>f, "This redirects to a log file"
print "Ending with a coma skips the line break",
# range() and xrange()
#######################
for x in (range(2) + [3]):
print(x)
for x in xrange(3):
print(x)
# map() and filter()
###... | true |
7da7e120767b22ebf43347cdfb900ec5c8d75331 | earthbound19/neoplasticism-generators-collection | /darwindrian/darwindrian_color_sample.py | UTF-8 | 228 | 2.53125 | 3 | [
"Unlicense"
] | permissive | from java import awt
#Color samples from Mondrian's painting
WHITE = awt.Color(0.9,0.9,0.88)
BLUE = awt.Color(0.05,0.31,0.62)
YELLOW = awt.Color(0.96,0.83,0.28)
RED = awt.Color(0.66,0.13,0.17)
BLACK = awt.Color(0.06,0.06,0.06)
| true |
a1e810734ae0542a3e6d05f8fc9b7b5ba338925b | fengqiaobeihang/Python_matplotlib | /plot_scatter.py | UTF-8 | 3,128 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#画多条折线图
import numpy as np
import matplotlib.pyplot as plt
import xlrd
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib.pylab import *
data = xlrd.open_workbook('C:/Users/sdh/Desktop/WRF_verify/year.xlsx')#open file
sheet = dat... | true |
01955049506f349723395e4c932e417b061db9c4 | tditta/Crowdedness-Map | /py/import.py | UTF-8 | 2,408 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# Copyright 2020 Crowdedness Map 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 License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable... | true |
92ded7477d2e26bd7a909b62af98f203f4077647 | vt0311/python | /mypandas/pandasTest4.py | UTF-8 | 3,806 | 3.28125 | 3 | [] | no_license | '''
Created on 2017. 11. 6.
1. 회원 데이터를 DataFrame으로 만든다.
단, '신사임당'은 목록에서 제외한다.
2. 급여가 300원 이상인 사람만 조회해 보세요.
이 데이터를 이용하여 수평 막대 그래프를 그려라.
3. 게시물 데이터를 DataFrame으로 만들어라
4. 게시물을 남긴 사람들의 이름, 성별, 제목, 내용을
DataFrame으로 만들라.
5. 성별 급여의 총합을 pie 그래프로 만들라.
@author: acorn
'''
import pandas as pd
import numpy as np
import... | true |
d1d73d6c5a21d0cf7b8c752d13607afc5fe86aa3 | yinrui0/cell_segmentation | /load_data.py | UTF-8 | 2,574 | 2.65625 | 3 | [] | no_license | from glob import glob
from tqdm import tqdm
from skimage.io import imread
import matplotlib.pyplot as plt
import numpy as np
from skimage.transform import resize
from sklearn.model_selection import train_test_split
import tensorflow as tf
import cv2
def load_train_data(path_train, is_normalize = True):
images = []... | true |
e141c2753cd626433eec7f534f5128a6162a0ecb | LuisDOH/Vision-Artificial-Jr | /Video deteccion/video_treal.py | UTF-8 | 1,648 | 2.828125 | 3 | [] | no_license | import cv2
import numpy as np
import imutils
def Contornos(fotogramas,min,max,area_minima):
# Conversion a HSV
hsv = cv2.cvtColor(fotogramas, cv2.COLOR_BGR2HSV)
# Segmentacion de la imagen
mascara = cv2.inRange(hsv,min, max)
# Detectanto contornos a partir de la segmentacion
lista... | true |
3be515fb81131e37d7ed2e10cf17642233a2da9c | wideopenspaces/gnip-python | /test/publisher_test.py | UTF-8 | 1,816 | 2.65625 | 3 | [] | no_license | import sys
sys.path.append("../")
from gnip import publisher
import unittest
class PublisherTestCase(unittest.TestCase):
def setUp(self):
self.rule_types = ['actor', 'tag']
self.publisherName = "test"
self.xml = '<publisher name="test"><supportedRuleTypes>' + \
'<type>actor</typ... | true |
f41d923601604283b3577035ebfb01120ebea063 | gabriellaec/desoft-analise-exercicios | /backup/user_266/ch177_2020_08_14_13_42_00_628433.py | UTF-8 | 121 | 3.078125 | 3 | [] | no_license | def numero_digitos(s):
digito=0
for i in s:
if i.isdigit()==True:
digito+=1
return digito | true |
b00589d11c8d6e3b0f383a5a9b818e4f49be08b9 | simonaculda/LeetCode | /Array_and_Strings/reverseString.py | UTF-8 | 600 | 4.25 | 4 | [] | no_license | """
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array, you must do this by modifying the
input array in-place with O(1) extra memory.
"""
def reverseString(s):
"""
:param s: List[strs]
:return: It... | true |
3e61ce63bfa1a7bd58ed5a01e84280544ec10da9 | luanshiyinyang/AutoEncoder | /scripts/activation_func.py | UTF-8 | 680 | 3.09375 | 3 | [] | no_license | # -*-coding:utf-8-*-
"""author: Zhou Chen
datetime: 2019/5/26 15:06
desc: 本模块放置激活函数机器倒数
"""
import numpy as np
def sigmoid(x):
"""
Sigmoid激活函数
:param x:
:return:
"""
s = 1.0 / (1.0 + np.exp(-x))
return s
def sigmoid_grad(x):
"""
sigmoid激活函数的导数
:param x:
:return:
... | true |
a9d7dc11ce2391c7287e37ec58c8ecd958388635 | TheAssassin/voctomix | /voctocore/tests/test_config_getlist.py | UTF-8 | 1,038 | 2.734375 | 3 | [
"MIT"
] | permissive | from tests.helper.voctomix_test import VoctomixTest
from lib.config import Config
# noinspection PyUnusedLocal
class AudiomixMultipleSources(VoctomixTest):
def test_empty_string_results_in_empty_list(self):
Config.given("foo", "bar", "")
self.assertEqual(Config.getlist("foo", "bar"), [])
def... | true |
c0f1c762bb64ec517044c3a1e098ae38f8bc1648 | PRABH18/python | /tikinter2.py | UTF-8 | 443 | 3.296875 | 3 | [] | no_license | from tkinter import *
root=Tk()
root.title("My_Tkinter")
def msg1():
print("Prabhakar Singh")
label=Label(root,text="Enter Your Name",font=("Ariel",25,'bold'),bg="red",fg="white")
label.pack(side=TOP)
txt=Entry(root,font=("Comic Sans Ms",20,'bold'))
txt.pack()
btn=Button(root,text="Click Me",fg="white",bg="blue"... | true |
605d47981fc122523d64d826cc2a739c0b5f5f7f | Mayur-Debu/Pyhton_Basic_Program | /fibonacci.py | UTF-8 | 236 | 4.1875 | 4 | [] | no_license | def fibonacci(n):
if n==1:
return 0
elif n==2:
return 1
else:
return fibonacci(n-1)+fibonacci(n-2)
n=int(input("ENTER THE NUMBER YOU WANT TO FIND FIBONACCI SERIES OF: "))
print(fibonacci(n)) | true |
15912c6422654ac342bf39744bf293927f520832 | brunal/python-ggp | /ggp/util.py | UTF-8 | 1,550 | 3.171875 | 3 | [
"BSD-3-Clause"
] | permissive | # Utility functions
import random
def isint(s):
""" Is the given string an integer?"""
try:
i = int(s)
except ValueError:
return False
return True
def join(lst, sep = ' '):
lst = list(lst)
if len(lst) == 0: return ''
elif len(lst) == 1: return str(lst[0])
return reduce(... | true |
a5a2e50398927b29d7fde9f125a67036a1c03c0b | jake20001/Hello | /everydays/InterviewExmas/Hard/1.py | UTF-8 | 595 | 3.375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# -------------------------------
# ProjectName : autoDemo
# Author : zhangjk
# CreateTime : 2020/4/27 14:09
# FileName : 1
# Description : 1, 如何理解yield程序,print结果上什么?
# --------------------------------
# =========== Yield BEGIN ===============
def add(n, i):
return n+i
def test():
for i... | true |
24b8ef5426f853d6be94cd054a2f03b5c55178d0 | albarol/programming-challenges | /python-challenges/04.py | UTF-8 | 501 | 3.125 | 3 | [] | no_license | def retrieve_data(url):
import urllib
return urllib.urlopen(url).read()
def retrieve_next_link(info):
import re
pattern = re.compile("[0-9]{4,5}")
return "".join(pattern.findall(info))
next_url = """
http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing={id}
"""
next_link = 0
for i in rang... | true |
2e21e7518f7b8e66a514be2ecb57832ae820632a | kaobinchou/PTConstructor | /src/iec2peg.py | UTF-8 | 2,786 | 2.703125 | 3 | [] | no_license | # IEC grammar language to pyPEG compiler
from pyPEG import parse
import re
r = re.compile
import fileinput
def comment(): return r(r"\#.*")
terminal_symbol = r(r"\$?('.*?'" + r'|".*?")')
non_terminal_symbol = r(r"[a-z_][a-z0-9_]*")
def regex(): return "<", r(r"((\\\>)|[^>])+"), ">"
def production(): return non_te... | true |
9ebba5cef4c286dad3b5e5faa976c89445ed7511 | jpmit/betman | /api/bdaq/bdaqnonapiparse.py | UTF-8 | 6,223 | 2.53125 | 3 | [] | no_license | # bdaqnonapiparse.py
# James Mithen
# jamesmithen@gmail.com
"""Functions for parsing output of BDAQ non-Api (webscraping) calls."""
import json
import re
from betman import const, Selection, betlog
from betman.all.betexception import ApiError
def ParseNonApiGetPrices(resp, mids):
"""
Return Selections from j... | true |
03d5eafbb78f81da19f6affe728e44e8e9424635 | RichardFlynn/KattisProblems | /bijele.py | UTF-8 | 146 | 2.6875 | 3 | [] | no_license | numbers=list(map(int,input().split()))
require=[1,1,2,2,2,8]
out=""
for i in range(6):
out+=str(require[i]-numbers[i])
out+=" "
print(out) | true |
e7af738268e221226aaca107c60eb7bfee8dd457 | Mrhero-web/leetcode-pp | /code/ch09/9.2.1.2.linked_list_cycle.py | UTF-8 | 483 | 3.015625 | 3 | [
"MIT"
] | permissive | class Solution:
def hasCycle(self, head:ListNode)->bool:
if head == None or head.next == None:
return False
pslow = pfast = head
while pfast != None and pfast.next != None:
pslow = pslow.next
pfast = pfast.next.next
if pfast == pslow:
... | true |
aa55e11d0dc5c82c7ed06dda35647530d89926ab | vvilq27/python | /security/Scapy.py | UTF-8 | 633 | 2.546875 | 3 | [] | no_license | from scapy.all import*
#funkcja zwrotna do przetwarzania pakietow
def packet_callback(packet):
print "lecimy tutaj"
# print packet.show()
if packet[TCP].payload:
mail_packet = str(packet[TCP].payload)
if "user" in mail_packet.lower() or "pass" in mail_packet.lower():
print "[*] serwer: ... | true |
6ff348ad61b7b5232a58ab5929883aa403718187 | Shubhamudiwal/OpenCV-Codes | /BackProjection.py | UTF-8 | 1,098 | 2.53125 | 3 | [] | no_license | #BackProjection using histogram technique
import cv2
import numpy as np
original_image =cv2.imread("C:\\Users\\DELL\\Desktop\\OpenCv\\Image-Processing-Tutorials-main\\Data\\green.jpg")
original_image = cv2.resize(original_image,(600,650))
hsv_original = cv2.cvtColor(original_image,cv2.COLOR_BGR2HSV)
#roi of... | true |
382a9346b2b7a4c99ada5b07ffb3a7c63583602b | samarthjj/BFS-1 | /courseSchedule.py | UTF-8 | 1,854 | 3.59375 | 4 | [] | no_license | # Time Complexity : O(V + E), Space Complexity : O(V + E)
# where V is the number of prereqs visited and E is the total number of courses which have the prereqs.
# Did this code successfully run on Leetcode : yes
# Any problem you faced while coding this : no
# Your code here along with comments explaining your approa... | true |
21744f0d2f55d1cb166368cc3eb5db24e2ddd7b7 | PranavAditya99/Early-Detection-of-Low-Birth-Weight | /logisticregression.py | UTF-8 | 3,544 | 3.140625 | 3 | [] | no_license | #Reference : My notes from Andrew Ng's ML course
#gives 70-90% accuracy - It's unreliable - probably cause data is not linearly seperable
#Gave 47% once and 95% once
import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import random
class Logist... | true |
244cf69ab66577f0fb1e83f1196aa2b3f7350c80 | speed676/algoritmia_2018-2019 | /Israel/Entregable3/brikerdef.py | UTF-8 | 8,082 | 3.59375 | 4 | [
"MIT"
] | permissive | from typing import *
# ---------------------------------------------------------------------------------------------------------
class Move:
Left = "L"
Right = "R"
Up = "U"
Down = "D"
# ---------------------------------------------------------------------------------------------------------
class ... | true |
290b8c86bd2bc3c2aee1be51201f01dc2c7a5d54 | OneOneFour/ICSP_Monte_Carlo | /sgc/example/custom_widget.py | UTF-8 | 3,053 | 2.71875 | 3 | [
"MIT"
] | permissive | import pygame
from pygame.locals import *
from sgc.widgets._locals import *
from sgc.widgets.base_widget import Simple
class MyBasicWidget(Simple):
_default_size = (100,100)
class MyWidget(Simple):
_default_size = (100,100)
_available_images = ("over",)
_extra_images = {"thing": ((0.3, 0), (1, -4))}
... | true |
9c15f3b843f6bd3d58b8a95d22723330be73100f | 1914866205/python | /pythontest/day26Excel背景色.py | UTF-8 | 1,651 | 3.328125 | 3 | [] | no_license | """
excel格式化写操作
"""
from datetime import datetime
import xlsxwriter
import wordcloud
import xlrd
def set_format():
# 打开工作簿
workbook_old = xlrd.open_workbook('res/班级卡片数据.xlsx')
sheet1 = workbook_old.sheets()[0]
# 获取第1列的内容
list = [[], []]
list[0] = sheet1.col_values(1)
list[1] = sheet1.col... | true |
5364973d6a01ab2ee5b6c9271b55937f6a2296f2 | jtalamini/RL | /tabular_solution_methods/1_gridworld_iterative_policy.py | UTF-8 | 1,247 | 3.390625 | 3 | [] | no_license | import numpy as np
'''
4x4 gridworld, terminal states are (0,0) and (3,3)
in each state movements are allowed in each direction
'''
D = 4
A = 4
THETA = 1e-20
'''
equiprobable random policy: all actions are equally likely
the goal is to compute the value function for each state using this policy
this helps us finding ... | true |
b4ddb465ac0c9b6172428e9399803f0b57030052 | pamtabak/LeetCode | /26_remove_duplicates_from_sorted_array.py | UTF-8 | 480 | 2.984375 | 3 | [] | no_license | class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if (len(nums) == 0):
return 0
counter = 1
index = 1
lastSeenInt = nums[0]
originalLength = len(nums)
while (counter < originalLength):
counter += 1
if (nums[index] ... | true |
528f536731b47f63101c456d2772898c4d2c81d7 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_123/531.py | UTF-8 | 701 | 3.09375 | 3 | [] | no_license | #! /usr/bin/env python
def operations_until_solvable(mote, prey_list, acc=0):
# loser mote can't eat anything
if mote == 1:
return len(prey_list)
if not prey_list:
return acc
prey = prey_list[0]
if prey < mote:
return operations_until_solvable(mote + prey, prey_list[1:], a... | true |
bfbd672a2a0c65efbcff749c4b3a7d5197aee250 | kwangje/Anon_McAdams | /scripts/voice_modification.py | UTF-8 | 5,447 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import tempfile
import copy
import librosa
import librosa as rs
from audiotsm import wsola
from audiotsm.io.wav import WavReader, WavWriter
import soundfile as sf
import scipy
from scipy import signal
from scipy.io import wavfile
from scipy.signal import resample, lfilter
# vo... | true |
c7fcc1f2880e05f337648547b18cf4d5cd2fd912 | demetriusengdados/Python-POO | /Expressão lambda.py | UTF-8 | 160 | 2.640625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | lista = [
['P1', 13],
['P2', 6],
['P3', 7],
['P4', 50],
['P5', 8],
]
lista.sort(key=lambda item: item[1])
print(lista)
| true |
9d358420fa021360b8f04ae1475e4214d68b4975 | sidharthskumar/Competitive-Programming | /Codeforces/Edu23/3.py | UTF-8 | 347 | 2.90625 | 3 | [] | no_license | def R() : return map(int,raw_input().strip().split())
def Rf() : return map(float,raw_input().strip().split())
def Sl() : return raw_input().strip().split()
[n,s] = R()
lo, hi = 1,n+1
while lo < hi:
sm = 0
mid = lo + (hi-lo)/2
p = mid
while p != 0:
sm += p%10
p /= 10
if(mid - sm >= s):
hi = mid
else:
... | true |
58e407885c38f98933ad69e39f36e5d8cdae4d84 | Wa-dot/Rubikscube | /Rubiks/initialisation_rubik.py | UTF-8 | 1,615 | 2.859375 | 3 | [] | no_license | import serial
import picamera
import time
def Visualisation():
s = serial.Serial('/dev/ttyUSB0',112500)
print(s)
i=1
for i in range(1,7):
print(i)
if i == 1:
s.write("S".encode('ascii'))
if i == 2:
s.write("1O,2R".encode('ascii'))
... | true |
b69c58ae4ae8a836f7288134185eda1cf43eed32 | MichaelCorduroy/hacoolkids | /original.py | UTF-8 | 2,326 | 3.0625 | 3 | [] | no_license | import numpy as np
import random
dataa = [[3, 4, 0], [20,17,1], [2, 5, 0], [21, 19,]]
def sigmoid(z):
return 1 / (1 + np.exp(-z))
# Random Initialization of weights
w1 = []
for i in range(len(w1)):
v = random.random() * 0.1
w1.append(v)
w2 = []
for ii in range(len(w2)):
v = random.random() * 0.1
... | true |