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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
28e6098371ce1a2042048f0638ba0e07f5be51ab | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode/201-400/000214-h/TLE--000214.py | UTF-8 | 1,714 | 3.453125 | 3 | [] | no_license | class Solution(object):
def shortestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
"""
# 首先想到的idea是先把原字符串s直接补一半,补成一个回文,然后从后向前搜索,直到找到
## 最短的且包含s的第一个回文串。比如:
## "aacecaaa" 补成 "aaacecaa-aacecaaa",然后从后向前查找到答案应该是"a-aacecaaa"
# 但是这个有问题,比如"xxy... | true |
7597b11c96b12f005a357f590c972f1814b5ced8 | Python | sinelaw/knesset-votes | /highest-voted.py | UTF-8 | 883 | 2.921875 | 3 | [
"MIT"
] | permissive | import sqlite3
import codecs
# Copied from https://stackoverflow.com/questions/3300464/how-can-i-get-dict-from-sqlite-query
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
def render_highest_votes_page():
num = 200
with cod... | true |
e290f2b815b21a71a9fa72e4b1f0166ab2197df8 | Python | guogander/python100 | /lesson_32.py | UTF-8 | 216 | 4.28125 | 4 | [] | no_license | # 题目:按相反的顺序输出列表的值。
s1 = ['a','b','c','d','e']
s2 = s1[::-1] # 复制创建新的list,不改变原序列
print(s1)
print(s2)
s1.reverse() # reverse会改变原序列
print(s1) | true |
add6816a3a4103b9a6bb14193f850b87746c987d | Python | RismusDrake/HomeWork | /Classes/HomeWork - 8.py | UTF-8 | 697 | 3.28125 | 3 | [] | no_license | '''Восьмое задание. Получить список статей хабра за месяц.
https://habr.com/top/monthly/'''
import requests
from bs4 import BeautifulSoup
def get_html(url):
r = requests.get(url)
return r.text
def get_data(html):
soup = BeautifulSoup(html, 'lxml')
h1 = soup.find('body').find('div', {'class' :"layout"}).find('d... | true |
3006c4ae20fa21d907addd2a1923a16f472e0974 | Python | dugreen/LearningOfDugreen | /leetCode/Two_Sum.py | UTF-8 | 1,063 | 3.453125 | 3 | [] | no_license | #coding:utf-8
"""
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
"""
class Solution:
"""my code, O(n) = n*2"""
def twoSum(self, nums, target):... | true |
4c481390a9513c55bc26e71b36d7765b99d61e30 | Python | ASinha24/AS24 | /armstrongcheck.py | UTF-8 | 344 | 3.78125 | 4 | [] | no_license | number=int(input("enter a number").strip())
def isArmstrong(number):
temp=number
sum1=0
while number !=0:
r=int(number%10)
sum1=int(sum1+r*r*r)
number=int(number/10)
return (sum1==temp)
if isArmstrong(number):
print("Armstrong number")
else:
print("not an Ar... | true |
a41a37b8ab0b96a5d789434ae39f2c7f7fec9d8f | Python | jasiam/mesos-stress-logger | /stresslogger/stresslogger.py | UTF-8 | 972 | 2.734375 | 3 | [] | no_license | import datetime
import os
import time
import click
@click.command()
@click.argument('lines_to_add')
@click.option('--num_files','-n')
@click.option('--keyword','-k')
@click.option('--interval','-i')
def main(lines_to_add,num_files,keyword, interval):
print("Starting stresslogger")
for i in range(int(num_files... | true |
434fd2c6bbd809aad926c8e6867569e6387690d6 | Python | shawinmihail/TrainsManagment | /RailwayObjects/Way.py | UTF-8 | 1,027 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Way:
time_to_pass = None
stations = None
direct_property = None
PROPERTY_ONE_DIRECT = "one_direct"
PROPERTY_TWO_DIRECT = "two_direct"
def __init__(self, st1, st2, time_to_pass, property):
self.stations = list()
self.stations.append(st1)
se... | true |
8600085365d6cba6eddd0999eff4d260e352dc9d | Python | Erenaliaslangiray/Emotion_Recognition_Application | /Integrated_Application/soundcatcher.py | UTF-8 | 2,604 | 2.625 | 3 | [
"MIT"
] | permissive | #Author: Eren Ali Aslangiray, Mehmet Enis İşgören
import pyaudio
import math
import struct
import wave
import time
import os
import ffmpeg_normalize
Threshold = 2
SHORT_NORMALIZE = (1.0 / 32768.0)
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 22050
swidth = 2
TIMEOUT_LENGTH = 2.5
f_name_directory = './'
... | true |
a4f50d320a41a0a4594ffd3a67a36d7fc7fa6e18 | Python | Ran4/comgud | /game.py | UTF-8 | 4,488 | 2.671875 | 3 | [] | no_license | import sys, os, random, math
import pygame
from pygame.locals import *
import constants as con
from libvector3 import Vector3
V3 = Vector3
import player
from powerup import Powerup
class Game(object):
def __init__(self):
self.screensize = self.screenw, self.screenh = \
con.S... | true |
f8319b5d6909b1a0be737b7343557fa5fa4553ea | Python | BraydanNewman/JCU_Uni | /CP1401/assesment_01/a1_2_tennis.py | UTF-8 | 1,164 | 4.21875 | 4 | [] | no_license | """
CP1401 2021-1 Assignment 1
Program 2 – Tennis Results
Student Name: Braydan Newman
Date started: 21/3/2021
Date completed: 21/3/2021
Pseudocode:
set fast game point
get player 1 score
get player 2 score
total games played = player 1 score + player 2 score
if player 1 score > player 2 score
... | true |
d7d067e0906a0d0e0bf8fc853cb2a0d5773fe7cd | Python | wjsaveve/wjspytest-homework | /simple_framework/page/main_page.py | UTF-8 | 1,118 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time
from selenium.webdriver.common.by import By
from simple_framework.basics.base_page import BasePage
from simple_framework.page.adduser_page import AddUserPage
from simple_framework.page.contact_page import ContactPage
class MainPage(BasePage):
_location_button_adduser = (By.CS... | true |
eafe89de10c4187057b0cc1e0e9772f03a576b0d | Python | echang97/passwd | /passwd/__init__.py | UTF-8 | 6,086 | 3.21875 | 3 | [
"MIT"
] | permissive | __version__ = "1.2.0"
import hashlib
from collections import Counter
from re import findall
from secrets import choice
from string import ascii_letters, ascii_lowercase, ascii_uppercase
from string import digits as all_digits
from string import punctuation
import requests
def check_password(password):
"""Check ... | true |
5bc3e0a4176d27fc38be23c5a7ae3186cc154580 | Python | jasontan056/Earthquake-Watch | /modules/inputhandler.py | UTF-8 | 204 | 2.546875 | 3 | [] | no_license | # Very preliminary user input sanitizer.
# This function only replaces whitespace with plus sign.
# The plus sign is used for Google location search.
def sanitize(input):
return input.replace(' ','+') | true |
2768382555c5b1ffd23538b89ec57726f096d8c1 | Python | Yuxiang-Wang/High-Frequency-Research | /trade_volume_imb.py | UTF-8 | 7,275 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 14:22:36 2019
成交量不平衡因子按市值跟价格分类研究
@author: yuxiang
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
from time import time
import os
import gc
%matplotlib inline
fac_path = 'fac_1m/20180903/'
#fac_path = 'fac_5m/201809... | true |
089b54b532fbbf3f5b777a678e564fdc94e39425 | Python | MaeBee/discord-bot | /extensions/giphy/cmd.py | UTF-8 | 723 | 2.875 | 3 | [
"MIT"
] | permissive | import discord
from discord.ext import commands
from .services import Giphy as GiphyLib
class Giphy(commands.Cog):
""" Giphy commands """
def __init__(self, bot):
self.bot = bot
self.giphy = GiphyLib()
@commands.command(description='Give me a phrase, get a giphy')
async def giphy(self... | true |
f59da22fa46683cd6f9a8dd3011d54d52aec303f | Python | keliangli/DNA_RNA_pretreatment | /hydrogen_bond/calu_pdb_AA_hydrogen.py | UTF-8 | 4,720 | 2.578125 | 3 | [] | no_license | # 插入操作所需要的模块
import os
import os.path
import re
import sys
sys.path.append('D:\python_prj\excel')
import PDB_excel_module
AA_Type_Hydrogen_value = {'ALA': 0, 'ARG': 4, 'ASN': 2, 'ASP': 1, 'CYS': 0, 'GLN': 2, 'GLU': 1, 'GLY': 0, 'HIS': 1, 'ILE': 0,
'LEU': 0, 'LYS': 2, 'MET': 0, 'PHE': 0, 'PRO... | true |
17860e630d30c7ecbea1e9b97ff25e28c174ee12 | Python | Nikhil-Adithyan/Algorithmic-Trading-with-Williams-R-in-Python | /WilliamsR_strategy_code.py | UTF-8 | 6,309 | 2.875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import requests
import matplotlib.pyplot as plt
from math import floor
from termcolor import colored as cl
plt.rcParams['figure.figsize'] = (20,10)
plt.style.use('fivethirtyeight')
def get_historical_data(symbol, start_date):
api_key = 'YOUR API KEY'
api_url = f'https://... | true |
a815db9538043d745682cf003a05ea8d88dab09e | Python | VotrASCII/Other | /rsa.py | UTF-8 | 2,261 | 3.875 | 4 | [] | no_license | import random
import math
# generate prime numbers up to a given number so that encryption is random
# within given list of primes
def prime(value):
p = []
c = []
for i in range(2, value+1):
if i not in c:
p.append(i)
for j in range(i*i, value+1, i):
c.appe... | true |
4036141f14c2ad12fbeafb84a4084a0e81d529a8 | Python | Under0Cover/Curso_Em_Video | /Python/lista_exercicios_035.py | UTF-8 | 613 | 3.96875 | 4 | [] | no_license | # DESAFIO 035
# TRÊS RETAS
# ESCREVA UM PROGRAMA QUE LEIA O COMPRIMENTO DE TRÊS RETAS E DIGA SE ELAS PODEM FORMAR UM TRIÂNGULO
from time import sleep
lado1 = float(input('Digite a medida de um lado do Triângulo: '))
lado2 = float(input('Digite a medida de outro lado do Triângulo: '))
lado3 = float(input('Digi... | true |
26df0ac420633f561ce65e334c8daafcd4030299 | Python | zhy8689/python_structure | /py_link/single_link.py | UTF-8 | 4,677 | 3.53125 | 4 | [] | no_license | # -*-coding:utf-8 -*-
'''
Created on 2019年3月9日
@author: zhy
'''
from log import log_tool
log = log_tool.My_Log().get_logger()
class Node(object):
''' 单链表的节点描述 '''
def __init__(self, item):
self.item = item
self.next = None
def get_item(self):
''' 获取单链表的节... | true |
1efef63d791061168720a0da09942c65acff1f96 | Python | ceberous/osxSettings | /PDFExtractAllImages.py | UTF-8 | 4,099 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# pip install tqdm pdfminer.six Pillow
import io
import sys
import os
import subprocess
from pathlib import Path
from tqdm import tqdm
from pprint import pprint
from pdfminer.high_level import extract_pages
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
fro... | true |
26db2e4f779bb03eb1ba1168d9b5e06842575f65 | Python | masataka46/tripleGAN_chainer | /utility.py | UTF-8 | 2,408 | 2.609375 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
from PIL import Image
def convert_to_10class(d):
d_mod = np.zeros((len(d), 10), dtype=np.float32)
for num, contents in enumerate(d):
d_mod[num][int(contents)] = 1.0
# debug
print("d_mod[100] =", d_mod[100])
print("d_mod[200] =", d_mod[200])
return d_mod
d... | true |
d23a500dd4c13e69ddec858e7fc68663385b975b | Python | mxl94213/LungNoduleDetection | /LungNoduleCAD/models/submission.py | UTF-8 | 4,366 | 2.765625 | 3 | [] | no_license | """
A script to visualize results and writing the results into submission files
"""
import tflearn
from models.cnn_model import CNNModel
from models.performance_evaluate import Performance_evaluate
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import imread, zoom
from glob import glob
from skle... | true |
f948a4f78c18fa7a24d3fd220e337ae2e7c3fd67 | Python | rkdms0116/SWEA | /SW2805_농작물_수확하기_D3/SW2805.py | UTF-8 | 613 | 3.1875 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt')
T = int(input())
for tc in range(T):
N = int(input())
farm = []
for n in range(N):
str_int = input()
num_list = list([int(char) for char in str_int])
farm.append(num_list)
profit = 0
for i in range(N):
for j in range(N):
... | true |
6332f37172246ad64938728c7f2779b62a9e2a39 | Python | Raphaelle3687/SimplifiedKalmanFilter | /Elo.py | UTF-8 | 2,260 | 2.625 | 3 | [] | no_license | import numpy as np
from scipy.stats import norm
import math
class Elo:
def __init__(self, data, sigma):
self.data=data
self.sigma=sigma
if data.dim!=2:
raise Exception("This data is incompatible for the Elo algorithm")
def F(self,theta, x):
z = np.dot(theta, x) / sel... | true |
b1084f4c08c76c9f6f17014b01eb775f0193a1a8 | Python | chenmich/Quantities | /tests/test_UnitExpressVisitor.py | UTF-8 | 697 | 3.109375 | 3 | [
"MIT"
] | permissive | import pytest
from quantities import units
from ast import parse
def test_UnitExpressVisitor_visit():
visitor = units.UnitExpressVisitor()
unit_exp = 'm'
tree = parse(unit_exp)
visitor.visit(tree)
assert visitor.latex == 'm'
assert visitor.html == 'm'
visitor = units.UnitExpressVisitor()
... | true |
ff008a43485d18b2a5dc371d13f559240bbcfa5f | Python | dha-enigma/gittest | /classvariables.py | UTF-8 | 331 | 3.203125 | 3 | [] | no_license | class BestCourse:
website = "http://github.com"
def __init__(self, name):
self.name = name
python_course = BestCourse("Learn Python")
learn_command_line = BestCourse("Learn Command Line")
print(python_course.name)
print(BestCourse.website)
print("\n")
print(learn_command_line.name)
print(BestCours... | true |
d91449dfd30a65858ec8c1a07c60dc7dda3697ff | Python | developyoun/AlgorithmSolve | /solved/2309.py | UTF-8 | 218 | 2.953125 | 3 | [] | no_license | from itertools import combinations
arr = [int(input()) for _ in range(9)]
for liter in combinations(arr, 7):
value = sum(liter)
if value == 100:
print('\n'.join(map(str, sorted(liter))))
break | true |
86190f611ba59c62cf58264f336eab26fce2f6a4 | Python | Rishi-Prakash-TS/Rishi_Projects | /project.py | UTF-8 | 11,648 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 4 09:06:12 2018
@author: sivar
"""
#ATTRIBUTES USED
Item_Fat_Content
Item_Identifier
Item_MRP
Item_Outlet_Sales
Item_Type
Item_Visibility
Item_Weight
... | true |
eae744b686beefc06283399df7b1a292fb81b425 | Python | marlenaJakubowska/codewars_py | /first_non-consecutive_number.py | UTF-8 | 167 | 3.65625 | 4 | [] | no_license | def first_non_consecutive(arr):
for i in range(1, len(arr)):
if arr[i] - arr[i-1] > 1:
return arr[i]
print(first_non_consecutive([1, 3, 4]))
| true |
7dc22a1d58184418af6db4f5ebe66cc8afa49f20 | Python | yashgupta777/AllDataScienceProjects | /keepitup/graphs/fast4.py | UTF-8 | 2,955 | 2.578125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import statistics
import math
import csv
df = pd.read_csv('C:/Users/Yash/PycharmProjects/keepitup/graphs/input/ab.csv')
groupby_school_Compre = df['Compre'].groupby(df['School'])
groupby_school_Vocab = df['Vocab'].groupby(df['School'])
groupby_school_TotalTime= df['Total... | true |
aeb1d0b8fff20ffc4b5b70d6dfd5a4476cd9f815 | Python | grum261/coursera | /fpow2.py | UTF-8 | 261 | 3.4375 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
def fpow2(x, y):
if y == 0:
return 1
if y == -1:
return 1./x
p = fpow2(x, y // 2)
p *= p
if y % 2:
p *= x
return p
# In[6]:
a = float(input())
n = int(input())
print(fpow2(a, n))
| true |
ef64f6a774590e20a4f1e7b3a1e273805b54f683 | Python | kovaleski100/AI_Racer | /controller1/controller.py | UTF-8 | 5,467 | 3.46875 | 3 | [] | no_license | import controller_template as controller_template
import matplotlib.pyplot as plt
import numpy as np
class Controller(controller_template.Controller):
NUM_FEATURES = 3
NUM_THETAS = (1 + NUM_FEATURES) * 5 # numero de parametros pra aprender
NUM_SAMPLES = 100 # o número de amostras
def __init__(sel... | true |
91ad87a57116672f9113ae1b723e449f82d12dd7 | Python | SlinZhang/han_tensorflow1.x | /attention.py | UTF-8 | 1,483 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
import config
def attention_layer(input, attention_size, level="word"):
if level == "word":
hidden_size = input.shape[-1].value # BI-LSTM output size
print(hidden_size)
w = tf.Variable(tf.random_normal((hidden_size, attention_size)))
b = tf.Variable(tf.rand... | true |
7bdf4bc059cca407bd131efb22dc21aa30207bef | Python | jackyzha0/BentoML | /bentoml/utils/tempdir.py | UTF-8 | 2,166 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2019 Atalaya Tech, Inc.
# 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 law or agreed to in writing, ... | true |
65523a20490edf7ec284735c67d4a4cb62dd217b | Python | xiaolongjia/techTrees | /Python/98_授课/05_data structures/quiz1.py | UTF-8 | 449 | 3.296875 | 3 | [] | no_license | #!C:\Python\Python
a = ['a', 'b', 'c']
a.extend(['d', 'e'])
print(a)
#exit()
a = ['a', 'b', 'c']
a += 'de'
print(a)
#exit()
a = ['a', 'b', 'c']
a[-1:] = ['d', 'e']
print(a)
#exit()
a = ['a', 'b', 'c']
a.append(['d', 'e'])
print(a)
#exit()
a = ['a', 'b', 'c']
a[len(a):] = ['d', 'e']
print(a)
#exit()
a = ['a', 'b',... | true |
a8ae90bfd5ff8ed9df8e3cc49bf9b1cb20821219 | Python | ucsd-ccbb/Oncolist | /src/server/TCGA/ClusterReplacer.py | UTF-8 | 1,594 | 2.578125 | 3 | [
"MIT"
] | permissive | __author__ = 'guorongxu'
import sys
import re
import math
import logging
def parse_correlation(correlation_file):
correlation_list = {}
with open(correlation_file) as fp:
lines = fp.readlines()
for line in lines:
fields = re.split(r'\t+', line)
correlation_list.update({... | true |
0379d3b27406a58562d2f1e27ed0eebbf5316c9c | Python | brpratt/aoc2020 | /src/day12.py | UTF-8 | 2,782 | 3.578125 | 4 | [] | no_license | from collections import namedtuple
Action = namedtuple("Action", ["kind", "amount"])
def parse_action(s):
return Action(s[0], int(s[1:]))
class Ship1:
x = 0
y = 0
dirx = 1
diry = 0
def _move_n(self, amount):
self.y += amount
def _move_s(self, amount):
self.y -= amount
... | true |
3ce217c2cf85c8e6b29a9ed734e42b7e9d6f6b69 | Python | pvlbsk98/task1 | /tests.py | UTF-8 | 1,607 | 2.8125 | 3 | [] | no_license | import unittest
import random
import string
import asteval
from myobfuscator import ob
class TestObfuscator(unittest.TestCase):
@staticmethod
def fill_dict(count, names):
_dict = {}
for i in range(count):
name = random.choice(names)
_dict[name] = random.ran... | true |
386f8ff9ee31adcb8e9f963643bedee5ff195a43 | Python | wang3193/f0t1 | /python/base.py | UTF-8 | 3,636 | 3.75 | 4 | [] | no_license | '''
https://github.com/jackzhenguo/python-small-examples
'''
## 求绝对值
print(abs(-6))
## 列表元素都为真
print(all([1,2,3,4]))
print(all([1,3,0,-2]))
## 至少一个元素为真
print(any([1,2,0,-1]))
print(any([0,0,[]]))
## ascii展示对象
class Stu():
def __init__(self, name):
self.name = name
def __repr__(self):
return ... | true |
356da44aa35dcf07a4bec0f2cc21c9fb9ca62a37 | Python | mechkro/TestGrounds | /Formulas_Equations/totalsystemhead.py | UTF-8 | 7,693 | 3.0625 | 3 | [
"MIT"
] | permissive | #import tkinter as tk
import math
"""
Currently:
Command line use tool where multitude of function calls will be required
Future:
- GUI implemented to expedite the carry out of calculations and ease of use.
- Can add visual graphical aids to asisst in presentations to customer.
- Break down the GUI to 2 frames - ... | true |
65deacf25cb4ff48ece9d89026a40412477e5bc8 | Python | sakti/fuzfuz | /executor/httpget.py | UTF-8 | 1,277 | 3.109375 | 3 | [
"BSD-3-Clause"
] | permissive | """Executor for http get request,
set option url with * asterisk sign to give
hints"""
import urllib2
LIST_OPTIONS = ['url', 'cookie', 'user_agent']
def execute(options, payloads, logging):
url = options.get('url')
cookie = options.get('cookie')
user_agent = options.get('user_agent')
#check if ther... | true |
dd79f15b8119736dda0365c348100e2deb15d22a | Python | wanhongfei/pykelab | /frame/test/collection_util_test.py | UTF-8 | 622 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/7/15 0:05
# @Author : wanhongfei@bytedance.com
# @Comment :
# @File : collection_util_test.py
# @Software: PyCharm
from frame.utils import different_to_list
if __name__ == '__main__':
# class A(object):
# def __init__(self,id,name):
#... | true |
7fe6f8eecf75f4b042b64ce6c7dd2b5568b617b8 | Python | thuycom205/temp | /controllers/reading.py | UTF-8 | 1,620 | 3.8125 | 4 | [] | no_license | # def is_multiple_of_five(n):
# return not n % 5
#
#
# def get_multiples_of_five(n):
# return list(filter(is_multiple_of_five, range(n)))
#
# def get_multiples_of_fivex(n):
# return list(filter(lambda k: not k % 5, range(n)))
# print(get_multiples_of_five(45))
# print(map(lambda *a: a, range(3)))
# _ = list... | true |
80ccfd38a2734f37db9be7a8f7d22b3164b3da59 | Python | niceNASA/Python-Foundation-Suda | /05_leetcode/326.3的幂.py | UTF-8 | 695 | 3.921875 | 4 | [] | no_license | """
给定一个整数,写一个函数来判断它是否是 3 的幂次方。
"""
class Solution:
def isPowerOfThree(self, n: int) -> bool:
# 递归 76ms 98.96%
return self.div3(n)
def div3(self, n):
if n == 1:
return True
elif n == 0:
return False
else:
return n%3==0 and self.div3(... | true |
ba06f0065f357520949a827c5696f310c8aa026e | Python | cedadev/cci-vocabularies | /vocabularies/validate_csv.py | UTF-8 | 2,228 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | import csv
import os
from settings import CSV_DIRECTORY, ONTOLOGIES
# columns in spreadsheet
URI = 0
LABEL = 1
ALT_LABEL = 2
URIS = {}
LABELS = {}
ALT_LABELS = {}
def _vailidate_ontology(ontology_name):
global URIS, LABELS, ALT_LABELS
URIS = {}
LABELS = {}
ALT_LABELS = {}
in_file = os.path.joi... | true |
036a9d63d814abcbe01a1b8c5b2505ad58f2ea40 | Python | rajsingh7/Cracking-The-Machine-Learning-Interview | /Supervised Learning/Classification/Decision Trees/question10.py | UTF-8 | 1,072 | 3.671875 | 4 | [] | no_license | # What is pruning? Why is it important?
from sklearn.tree import DecisionTreeClassifier
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
iris = datasets.load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.ta... | true |
519284f526dcf3d964205b5de230443e814ad7f7 | Python | mnihatyavas/Python-uygulamalar | /Brian Heinold (243) ile Python/p32402.py | ISO-8859-9 | 1,045 | 3.46875 | 3 | [] | no_license | # coding:iso-8859-9 Trke
from itertools import *
L = [''.join() for in product ("abc", "12345")]
print ("('abc', '12345') dizge ikilisinin product/rnleri:", L, "\nrn says:", len (L) )
#-------------------------------------------------------------------------------------------
print ("-"*75)
print ("\n3-for... | true |
be46d59907a3eee673af9ef293f6e5246ac4f782 | Python | NithishKumar-coder/python-programming | /bitwise_not.py | UTF-8 | 71 | 2.75 | 3 | [] | no_license | N=input()
if N=='i':
print('invalid')
else:
N=int(N)
print((~N))
| true |
b97bed94a54b80efc6e6dc457353a71dbefc21ed | Python | Asteele7301994/Rock-Paper-Scissors-and-More | /GoodVersionServerRPS.py | UTF-8 | 7,889 | 3.03125 | 3 | [] | no_license | #Name:Andrew Steele
#Major:CSIT
#Class:328_Network Programming
#StartDate:11/9/17
#DueDate: 11/30/17
#Instuctor:Dr. Frye
#Using Python 2.7
import socket
import os
import sys
###########################################
#Confirms connection with 2 players
###########################################
def initiation(p1, ... | true |
2c31a2caf4f3d46ee05ff90fd88e5271dc18491a | Python | digger3d/NeuralCompression | /projects/scale_hyperprior_lightning/vimeo.py | UTF-8 | 2,820 | 2.5625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import List, Optional, Sequence, Union
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader... | true |
313e60d8f10e277decd0cf3f9e78e2fa441196a2 | Python | alvarorivasg/project-pipelines | /main.py | UTF-8 | 2,185 | 3.1875 | 3 | [] | no_license | import pandas as pd
import argparse
from src.dframe import filtro
from src.dframe import asignaTemplo
from src.dframe import columnaDivina
from src.dframe import limpiaFinal
from src.pdf import crearPDF
from src.mail import checkMail
from src.mail import sendEmail
def recibeargumentos():
parser = argparse.ArgumentP... | true |
ccd251c7f9060c57e22330375c89ecb52ed7e622 | Python | somsomdah/Algorithm | /Algorithm-python/_section7/CoinDistribution.py | UTF-8 | 1,003 | 3.15625 | 3 | [] | no_license | def dfs(L):
global res
if L==n: # 종착점 도달, 각 가지는 해당 동전을 쓸지, 안 쓸지 결정
cha=max(money)-min(money) # 가장 큰 총액-가장 작은 총액
if cha<res: # 총액의 차가 더 작은 경유가 있고
if len(set(money))==3: # 세 사람의 총액이 서로 다르다면
res=cha # 결과값은 아까 구한 cha
else:
for i in range... | true |
5a8fed02b7f48db2792a87c54075b49ed2ddf4aa | Python | nzshow/pythonGb | /4.list2.py | UTF-8 | 398 | 3.65625 | 4 | [] | no_license | list1=[1,2,3]
list2=[4,5,6]
print('list1:',list1)
print('list2:',list2)
print('list1长度为:',len(list1))
listSum=list1+list2
print('组合:',listSum) #组合
print('listSum长度为:',len(listSum))
del(listSum[3]) #删除
print('删除了listSum[3]')
print(listSum)
print('重复list1:',list1*3) #重复
print(3 in list2) #元素是否存在于列表中
for x in listSum:prin... | true |
42ee933c5904030894f92f08a4dcb2d45a745c18 | Python | jumdtw/shooting | /for_wii/menu_for_wii.py | UTF-8 | 2,740 | 3.09375 | 3 | [] | no_license | import pygame
#KEYDOWNの定義など
from pygame.locals import *
import random
import cwiid
import time
#rect
WIDTH = 1024
HEIGHT = 648
#color
BLUE = (0,0,255)
RED = (255,0,0)
BLACK = (0,0,0)
WHITE = (255,255,255)
YELLOW = (255,255,0)
#main menu choices
Choices = {
'START':0,
'OPTION':1,
'EXIT':2,
}
select = ... | true |
4f42ddf6989cdba0e89922bec79b8a8c4ce46c58 | Python | pratripat/Super-Mario | /scripts/renderer.py | UTF-8 | 2,901 | 2.640625 | 3 | [] | no_license | import pygame, math, random, json
from .funcs import *
class Renderer:
def __init__(self, game):
self.game = game
def refresh(self):
self.background_color = (0,0,0)
if self.game.world_type in ['overworld', 'underwater']:
self.background_color = (107, 139, 255)
self... | true |
e8b7f1720b8a4c0a72ebd26522563e7ad8912965 | Python | countone/exercism-python | /complex_numbers.py | UTF-8 | 1,275 | 3.390625 | 3 | [] | no_license | from math import sqrt,sin,cos,exp
class ComplexNumber(object):
def __init__(self, real, imaginary):
self.real=real
self.imaginary=imaginary
def __add__(self, other):
return ComplexNumber((self.real+other.real),(self.imaginary+other.imaginary))
def __mul__(self, other):
... | true |
00a51b3b8a3dc21c22b859d475a58edecd24ae8a | Python | dalexach/holbertonschool-machine_learning | /math/0x03-probability/poisson.py | UTF-8 | 2,074 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python3
"""
Class Poisson that represents a poisson distribution
"""
class Poisson:
"""
Representing a Poisson distribution
"""
e = 2.7182818285
def __init__(self, data=None, lambtha=1.):
"""
Class constructor
Arguments:
- data (list): is a list of ... | true |
e64a06fb712ece3ec53effe8b61d9a73eca3e71c | Python | 15086833944/multithreading_spider | /多线程Queue爬取内容.py | UTF-8 | 3,992 | 3.359375 | 3 | [] | no_license | # 两个队列,一个队列抓取,一个队列解析,都使用多线程操作
import requests
from lxml import etree
import threading
from multiprocessing import Queue
class Crawl_thread(threading.Thread): #继承于threading.Thread这个类
# 抓取线程
def __init__(self,thread_id,pageQueue):
threading.Thread.__init__(self)
self.thread_id=thread_id
... | true |
2e7ae65199e753dfce9d8c6fdac1ee93426acb03 | Python | matheusherique/desafio | /launch/tests.py | UTF-8 | 1,111 | 2.546875 | 3 | [] | no_license | from django.test import TestCase
from .models import Launch
class LaunchTestCase(TestCase):
def setUp(self):
Launch.objects.create(
flight_number = 100,
launch_year = 1984,
launch_date_utc = "2017-11-14T00:00:00",
launch_date_local = "2017-11-14T00:00:00",
... | true |
c555eb7cf71654d8529ffcf8a6b50927d2061e35 | Python | akarshkumar0101/EE-351K | /hw8p4.py | UTF-8 | 166 | 2.734375 | 3 | [] | no_license | import numpy as np
r = np.random.normal(size = 10000)
rsqr = r ** 2
rcube = r ** 3
rfour = r ** 4
print(np.average(rcube))
print(np.average(rfour))
#print(r)
| true |
2c2a3e786ebafd311025efed0dc764b582b7a45b | Python | astrozot/imks | /imks/test_units.py | UTF-8 | 7,240 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import unittest
from random import randrange
from . import units, currencies
from .units import Value as V
class UnitTestCase(unittest.TestCase):
def setUp(self):
units.reset()
currencies.reset()
for b in ['m', 'g', 's', 'A', 'K', 'mol', 'cd']:
units.ne... | true |
2e7eb59732686a2f9936e8882d4d613f2fa39c2a | Python | Aasthaengg/IBMdataset | /Python_codes/p03695/s844654976.py | UTF-8 | 448 | 2.53125 | 3 | [] | no_license | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
rate = [0]*8
cnt = 0
for x in a:
r = x//400
if r > 7:
cnt += 1
elif not rate[r]:
rate[r] = 1
s = sum(rate)
... | true |
4da107b7bd496d69c79bcf08a131dee4c7efa13a | Python | Gerrydh/Applied-DBs | /Week 9_2.py | UTF-8 | 455 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import pymysql
conn - None
def connect():
global conn
conn = pymysql.connect(host="localhost", user="root", password="root", db="school", cursorclass=pymysql.cursors.DictCursor )
def get_experience(number):
if (not conn):
connect();
query = "select * from teacher where experience < %s"
w... | true |
e08510a259904f871a6ec8004da0124aef47c991 | Python | RamDie/DAND | /P5/code/my_functions.py | UTF-8 | 1,548 | 3.15625 | 3 | [] | no_license | from __future__ import division
from sklearn.cross_validation import cross_val_score
import numpy as np
def computeFraction( poi_messages, all_messages ):
""" given a number messages to/from POI (numerator)
and number of all messages to/from a person (denominator),
return the fraction of messages ... | true |
5c86bb65007bb75300af37902ae6b25887457676 | Python | Jsyyyyy/NNDL-course | /6-1.py | UTF-8 | 692 | 2.9375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as npy
plt.rcParams['font.sans-serif'] = "SimHei" # 设置字体
x = npy.array(
[137.97, 104.50, 100.00, 124.32, 79.20, 99.00, 124.00, 114.00, 106.69, 138.05, 53.75, 46.91, 68.00, 63.02, 81.26,
86.21])
y = npy.array(
[145.00, 110.00, 93.00, 116.00, 65.32, 104.... | true |
70e581ec2e05a9d372fc986e414aafeafaf131f7 | Python | jorgechacblogspot/micropython_pico | /I2C LCD16x2 Micropython/I2C_Scan.py | UTF-8 | 1,395 | 3.296875 | 3 | [] | no_license | # ----------------------------------------------------------------------------------------------------------------
# I2C_Scan.py sketch para escanear buscando dispositivos I2C conectados en I2C cero, localizandolos e imprimiendo
# las direcciones que encuentra en hexadecimal.
# Visita https://jorgechac.blogspot.com ve... | true |
d469979e3581d0091ce8e4268297a68cf4fb4582 | Python | hulyaserminkarakas/BallBalancingSystem | /Source/Python/pid_plot.py | UTF-8 | 2,180 | 3.125 | 3 | [] | no_license | import time, random
from collections import deque
from matplotlib import pyplot as plt
start_time = time.time()
class PositionPlot:
def __init__(self, max_entries=100):
plt.rcParams["figure.figsize"] = [12, 9]
x_axes = plt.subplot2grid(shape=(2, 2), loc=(0, 0), colspan=2)
y_axes = plt.su... | true |
cb8aceb3f44f4da00cf7992340b960f6c6f47254 | Python | yjthoo/Fake-News-Classifier | /train.py | UTF-8 | 3,679 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
import sys, getopt
import pandas as pd
import numpy as np
from tqdm import tqdm
import os
# to visualise the performance of the model
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
from sklearn.model_selection import train_test_split
from BERTSeqClassifier import BERTSe... | true |
d8fd8af07dc5b6f1a6102fa8b83460c977928e10 | Python | chocowind797/Python0709 | /d02/Hello6.py | UTF-8 | 155 | 2.734375 | 3 | [] | no_license | import random
n1 = random.randint(0, 9)
n2 = random.randint(0, 9)
n3 = random.randint(0, 9)
n4 = random.randint(0, 9)
print("%d %d %d %d"%(n1,n2,n3,n4))
| true |
0af2c35564c7bbe020eaf61d69c1bedef7392970 | Python | Prateek937/himanshu | /module/adv_ops.py | UTF-8 | 561 | 3.296875 | 3 | [] | no_license | import math
def multiply(a,b):
s=0
for i in range(int(b)):
s=s+int(a)
return s
def divide(a,b):
quotient=0
remainder=0
a=int(a)
b=int(b)
if a>=b:
while a>=b:
a=a-b
quotient+=1
remainder=(a)
else:
quotient=0
remainder=(a)
return (quotient,remainder)
def isdivisible(a,b):
if... | true |
6f67f01696e4ae252cd510e92b393ab9a44ce912 | Python | zabraf/CrowPiScover | /componentsTest/digitScreen.py | UTF-8 | 1,215 | 3.125 | 3 | [] | no_license | #!/usr/bin/python3
from tkinter import *
from PIL import Image, ImageTk
from tkinter import messagebox
import time
from Adafruit_LED_Backpack import SevenSegment
segment = SevenSegment.SevenSegment(address=0x70)
from Adafruit_LED_Backpack import SevenSegment
# Initialize the display. Must be called once before using... | true |
be8ee4094fcc60e53efdfb7b26d7c9540eb83c7b | Python | liheng1015/python | /usersys.py | UTF-8 | 1,282 | 3.015625 | 3 | [] | no_license | #!/home/student/nsd1905/bin/python
'''文档字符串
模拟用户登录信息系统
'''
# import getpass
#
# usesys = {}
# def int_user():
# uname = input('username:').strip()
# if not uname:
# print('用户名不能为空')
# return
#
# #用户不存在时询问密码,并写入字典
# if uname in usesys:
# print('用户已经存在')
# else:
# upas... | true |
60df8a79aa2ceb63be5fe555de2dbb771efc6e68 | Python | mwaskom/seaborn | /examples/grouped_boxplot.py | UTF-8 | 390 | 3.21875 | 3 | [
"BSD-3-Clause"
] | permissive | """
Grouped boxplots
================
_thumb: .66, .45
"""
import seaborn as sns
sns.set_theme(style="ticks", palette="pastel")
# Load the example tips dataset
tips = sns.load_dataset("tips")
# Draw a nested boxplot to show bills by day and time
sns.boxplot(x="day", y="total_bill",
hue="smoker", palette... | true |
efbda7a44fd4c27ddcb7f58fc7be10f33471d6be | Python | xgz59421/notes-python | /base/py9_main2_package.py | UTF-8 | 431 | 2.53125 | 3 | [] | no_license | print('main2 启动模块开始运行')
# 导入包(user)下的模块
print('----------------导入包(user)下的模块---------------')
import user.login
import user.register as ur
print('login uname: ', user.login.uname)
print('register uname: ', ur.uname)
# 导入包下模块中的成员
print('----------------导入包下模块中的成员---------------')
from user.login import uname, upwd
pr... | true |
f46dd0ad9767711ad4e279c43366ed953fc62657 | Python | NateWeiler/Resources | /Python/PyAudio/PyAudio Visualiser/AudioVisualiserGUI.pyw | UTF-8 | 10,188 | 2.984375 | 3 | [
"MIT"
] | permissive | import scipy
import scipy.io.wavfile
import scipy.signal
import time
import pygame
from subprocess import call
from pathlib import Path
songs_file = '' #Directory To Search For Songs :) [the path finding is relative to this]
lame_path = 'lame.exe' #Path to lame.exe
screen_w = 1600 ... | true |
e1973708e30af53e56ce78155f60f0fb17be6e44 | Python | wanDoubleMing/dada_openapi_python | /open_api/dada_response.py | UTF-8 | 1,055 | 2.53125 | 3 | [] | no_license | # -*- encoding: utf8 -*-
import json
CALL_EXCEPT_CODE = -2
CALL_EXCEPT_MSG = "请求异常,请检查网络情况"
SUCCESS = "success"
FAIL = "fail"
__all__ = [
"DadaRpcResponse",
]
class DadaRpcResponse(object):
def __init__(self):
"""
返回的结构体
:return:
"""
self.status = None
self.c... | true |
a7b4717c6e600db4b9d32c4f65f733648a2f4c10 | Python | marta-seq/peptidereactor | /nodes/vis/sds_5_Diversity/scripts/pairwise_diversity.py | UTF-8 | 4,242 | 2.546875 | 3 | [
"MIT"
] | permissive | from sklearn.metrics import davies_bouldin_score
from glob import glob
import pandas as pd
import numpy as np
def _ravel_and_annotate(df1, df2, df1_class, cat, div, e1, e2, f1_e1, f1_e2):
df = pd.DataFrame({
"x": df1.values.ravel(),
"y": df2.values.ravel(),
"class": df1_class.values.ravel... | true |
a480c01b627e7d4c5e3eb44f0eb6fb42ae08293e | Python | anand0427/Capstone-Azureml-Nanodegree-Udacity | /.ipynb_checkpoints/train-checkpoint.py | UTF-8 | 1,721 | 2.890625 | 3 | [] | no_license | from sklearn.linear_model import LogisticRegression
import argparse
import os
import numpy as np
from sklearn.metrics import mean_squared_error
import joblib
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
import pandas as pd
from azureml.core.run import Run
from azu... | true |
629f6d9d124105eee5eeb6bb11f6ea48268443d5 | Python | lhvubtqn/Sign-Language-Recognition | /Sign-Language-Recognition/code/transform_images.py | UTF-8 | 2,906 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Takes a set of images as inputs, transforms them using multiple algorithms to
make it suitable for ingestion into ML routines, then finally outputs them
to disk.
"""
import csv
import traceback
import logging
import os
import numpy as np
import cv2
from tqdm import tqdm
from common.config import get_config
from c... | true |
ab06eb9931a1c413030d17b6a3dbad60e73a9fd3 | Python | ConnorTingley/gyroscope_bot | /src/old/train.py | UTF-8 | 878 | 2.8125 | 3 | [] | no_license | from actor_critic_tf import Agent
from utils import plotLearning
import numpy as np
if __name__ == '__main__':
agent = Agent(alpha = 1e-5, beta = 5e-5)
score_history = []
num_episodes = 2000
for i in range(num_episodes):
done = False
score = 0
observation = env.reset()
... | true |
6619d5ad4b2f7258fc64c930a9ae81c0fa9fec7a | Python | nesilin/evolution_TALL_adults | /modules/aux_functions.py | UTF-8 | 13,533 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import os
import pandas as pd
import numpy as np
from io import StringIO
import gzip
from bgreference import hg19
from aux_data_in_pyvar import CHANNELS
# COMMON PROCESSING FUNCTIONS
#
# def read_vcf(filename, comment='##', sep='\t'):
# """
# VCF has a long header starting with ##. The function reads the VCF a... | true |
2b2ffebda0310ca677be39bf1c76747d4bf632de | Python | hechenyu/book_code | /pythonnetprog/22/echoserver.py | UTF-8 | 4,026 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# Asynchronous Echo Server - Chapter 22 - echoserver.py
# Compare to echo server in Chapter 3
import socket, traceback, os, sys, select
class stateclass:
stdmask = select.POLLERR | select.POLLHUP | select.POLLNVAL
def __init__(self, mastersock):
"""Initialize the state class"""
... | true |
5dbc823b66c56ee5d15e628858e0e13db36691ea | Python | Del-virta/goit-python | /lesson2/calc.py | UTF-8 | 1,278 | 3.8125 | 4 | [] | no_license | result = None
operand = None
operator = None
wait_for_number = True
while True:
if wait_for_number == True:
operand = input(" ")
if operand == "=":
print(result)
break
try:
operand = float(operand)
wait_for_number = False
... | true |
e47d3974f34f56781c1ec940a77e6d115201c841 | Python | Uduru0522/Challange-APP | /python/friend.py | UTF-8 | 2,949 | 3.0625 | 3 | [] | no_license | import json
import os
import sys
def addfriend(name1,name2):#name1跟name2互加為好友
namelist1=[name1,name2]
namelist2=[name2,name1]
namelist=[namelist1,namelist2]
if not os.path.isfile("./json/friend.json"):#namelist
with open("./json/friend.json","w",encoding='utf-8') as f:
json.dump(n... | true |
fcc953f1610e8e1bd6de4c90f51f30911fa4f45a | Python | fiatveritas/Algorithms | /Stanford_Course/Divide_and_Conquer/Quick_Sort/quick_sort_first_pivot.py | UTF-8 | 3,867 | 3.953125 | 4 | [] | no_license | #!/usr/bin/python2.7
first_comparison = 0
last_comparison = 0
median_comparison = 0
def partition_first(array, left_end, right_end):
"""Partition around the first element of the array"""
pivot = array[left_end]
i = left_end + 1
for j in range(left_end + 1, right_end):
if array[j] < pivot:
... | true |
d51f4bac22a43a21e46ef2b65a2f5cec759fde12 | Python | angelamchoi/pokemon_collector | /main_app/views.py | UTF-8 | 4,949 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render, redirect #import render and redirect
from django.views.generic.edit import CreateView, UpdateView, DeleteView #import all views
from django.views.generic import ListView, DetailView # import listview and detailview for toy
from django.contrib.auth import login #login
from django.con... | true |
8e9deebd8e845a06566a6c3bb27570369486ccfa | Python | charusingh21/Digital-Image-Processing | /Homework 4/EE569_HW4_2773417243_CharuSingh/code/algo.py | UTF-8 | 909 | 2.59375 | 3 | [] | no_license |
import struct
import matplotlib.pyplot as plt
import numpy as np
import random
import sys
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
image_data = []
with open("result_train.txt") as f:
for line in f:
line = line.strip().split(" ")
line = [float(x) for x in line]
image_data.append... | true |
d0cf4dc4217ac10438f009101c7662e6cbfe0571 | Python | yislamovic/python_projects | /reading_files.py | UTF-8 | 154 | 3.125 | 3 | [] | no_license | txt = open("employees.txt", "a+")
txt.write("\nappended text")
txt.close()
t = open("employees.txt", "r")
for employee in t.readlines():
print employee
| true |
a586ca1a1ee8800f6aaf80a7a456ae86c73a03d3 | Python | mac3333/PracticaconTravis | /practica/practico_03/ejercicio_05.py | UTF-8 | 1,327 | 3.359375 | 3 | [] | no_license | # Implementar la funcion actualizar_persona, que actualiza un registro de una persona basado en su id.
# Devuelve un booleano en base a si encontro el registro y lo actualizo o no.
import datetime
from .ejercicio_01 import reset_tabla, check_exists, execute_query
from .ejercicio_02 import agregar_persona
from .ejerci... | true |
32640ac43500ba203a0e2b1ed65dde780cb35811 | Python | 8589/codes | /python/leetcode/list/142_Linked_List_Cycle_II.py | UTF-8 | 1,672 | 3.609375 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
'''
with O(n) time and O(1) space without modifying the list
let n is total length of list,
x is the length before entry of loop,
l is the length, w... | true |
c5b74d9bfbaf357f86de260df239001ac48d4b01 | Python | Seonghyeony/DataStructure-Algorithm | /PS_vsCode/2559. 수열.py | UTF-8 | 375 | 2.84375 | 3 | [] | no_license | N, K = map(int, input().split())
A = list(map(int, input().split()))
count = 0
temp_sum = sum(A[0:K])
result = temp_sum
if K == 1:
print(max(A))
else:
while True:
if count + K >= N:
break
temp_sum -= A[count]
temp_sum += A[count+K]
if result < temp_sum:
... | true |
a91590e3f806026e036d4c9cb4b0445345015d6a | Python | lilomar/cyberpunk-roguelike-rpg | /src/cyberpunk/engine.py | UTF-8 | 1,724 | 2.953125 | 3 | [] | no_license | import time
from pygame.locals import * # @UnusedWildImport
import scene
from constants import * # @UnusedWildImport
class Engine:
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode(SCREEN_RECT.size)
pygame.display.set_caption('Working Title')
# pygame.mous... | true |
8f875d2f4560fe311c42ffab307142eb41f15a8b | Python | mmaukii/pipeExt | /myCommand.py | UTF-8 | 815 | 2.703125 | 3 | [] | no_license | #https://www.freecadweb.org/wiki/Command
import FreeCAD,FreeCADGui
class MyCommand:
def __init__(self):# you can add things here like defining some variables that must exist at all times
print ("init")
def GetResources(self):
return {'Accel' : "Ctrl+A",
'MenuText': QtCore.QT_TRANSLATE_NOOP("My_Command", "M... | true |
08d31a5664d558ff94e76a3011970cbd8b1e3a1d | Python | loganwilliams/linear-lens-array | /python/load_images.py | UTF-8 | 855 | 3.015625 | 3 | [] | no_license | import math
from scipy.misc import imread
import numpy as np
def load_images_into_memory(image_path, image_name, format, num_images, start_image):
digits = int(math.ceil(math.log(start_image + num_images+1,10)))
a = imread(image_path + image_name + str(start_image).zfill(digits) + format)
(image_height, image_widt... | true |
c1cf867876a857c60f192c7788b832784614b624 | Python | hugonxc/Gattatico | /core.py | UTF-8 | 5,087 | 3.015625 | 3 | [] | no_license | import pyxel
import random
from pymunk import Space, Body, Circle
from sky import draw_stars
from models import Cat, Floor, Pickle, Star
SCREEN_W, SCREEN_H = 64*4, 64*3
# Special collision methods
def dead(space, arbiter, data):
pyxel.game_over = True
return False
def boost(space, arbiter, data):
for bo... | true |
52e3c3c634526735c9f4aee92a7ac0bf7e6704d5 | Python | lancerpilgrim/interesting | /three_doors.py | UTF-8 | 2,313 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# three door problem
import random
class Door(object):
"""Randomly generate three door with one prize
"""
def __init__(self):
pool = [0, 0, 1]
self.one = random.choice(pool)
pool.remove(self.one)
self.two = random.choice(pool)
pool.remove(se... | true |
f9478ff19c25f6299ac712e03e0e07e57be7c9ec | Python | debjit31/Python | /perfect_py.py | UTF-8 | 216 | 3.890625 | 4 | [] | no_license | #to check if a number is perfect or not
s=0
a=(int)(input("Enter a number = "))
for i in range(1,a):
if a%i==0:
s=s+i
if s==a:
print(a,"is a perfect number ")
else:
print(a,"is not a perfect number")
| true |
e5d9272b80262f00f386c56a87c5cc1207e1f49a | Python | sbtries/Class_Polar_Bear | /Code/Arthur/Python_Labs/Mob2.py | UTF-8 | 1,792 | 4.59375 | 5 | [] | no_license | '''Group participants name : Ken Mazur, Arthur Andama, Mark Wilson,Aaron Parker,Ryan Gaston'''
'''Using a `while` loop, allow the user to guess 10 times. If they fail to guess the number after 10 tries,
the user is told they've lost. If the user guesses the number, the user is told they've won and the game exits.
Yo... | true |