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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c7db154a8c45b5a0d1b65a0ef5357878b1cf3aa6 | Python | Arthur-ZY/Machine-Learning-Z | /ML-3-1.py | UTF-8 | 1,914 | 2.765625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import preprocessing
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import seaborn as sns
data = pd.read_csv("data\Banking.csv",header = 0)
data = data.dropna()
data['education... | true |
dc4db61c86af292739679ffdf627b8db0728a470 | Python | markovg/slithy | /examples/techfest/p2.py | UTF-8 | 6,676 | 2.578125 | 3 | [] | no_license | from slithy.library import *
from slithy.util import *
from fonts import fonts
import math
def sheared_rectangle( b, h, shear, shift ):
if shear == 0.0 or shift == 0.0:
rectangle( 0, 0, b, h )
else:
push()
if shear < 0.0:
scale( -1, 1, b/2.0, 0 )
shea... | true |
31054d91e0c6ea097c69c72c227c2b925d588d1e | Python | dRoje/design-patterns-python | /command/macroCommand.py | UTF-8 | 411 | 2.65625 | 3 | [] | no_license | from command import Command
from typing import List
class MacroCommand(Command):
def __init__(self, commands):
# type: (List(Command)) -> None
assert isinstance(commands, list)
self.commands = commands
def execute(self):
for command in self.commands:
command.execut... | true |
b55b280d8d1699c8b8c953cd97f635746367dbf3 | Python | samirad123/lab_lec5 | /task 3 f.py | UTF-8 | 116 | 3.5 | 4 | [] | no_license | def average_list(n):
sum = 0
for i in n:
sum += i
return sum/len(n)
print(average_list([1,2,3])) | true |
1dc5fa11c8d9ba084da73527c2cc8b5d747318c8 | Python | handsome12138/ComputerSimulationGit | /Homework/hw7/hw7.py | UTF-8 | 1,731 | 3.3125 | 3 | [] | no_license | '''
由于我的animation在jupyter notebook中不能正确跑出,这里用.py文件运行
'''
from Life import Life, LifeViewer
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import thinkplot
rc('animation', html='html5')
def make_viewer(n, m, row, col, *strings):
"""Makes a Life and LifeViewer object.
n, m: rows ... | true |
26439afc3ebd376f66c9a306e78023dc0a90a84c | Python | fege/Exercises | /exercises/sudoku.py | UTF-8 | 1,901 | 2.859375 | 3 | [] | no_license | import random
import itertools
def check(a):
sud = list(a)
sudo=[]
for pos,riga in enumerate(sud):
for griglia in range(3):
if not pos % 3: sudo.append([])
sudo[griglia + pos//3*3].extend(riga[griglia*3:griglia*3+3])
for pos in range(len(sudo)):
if [x for x in [... | true |
e691205ce00710bdc57bbbfa2c4bafd47a1273db | Python | SShayashi/ABC | /abc51-100/abc085/b.py | UTF-8 | 155 | 3 | 3 | [] | no_license | N = int(input())
b = []
a = [int(input()) for i in range(N)]
cnt = 0
for i in a:
if i in b:
pass
else:
b.append(i)
print(len(b))
| true |
a51ab372587885a575f725b773d5bf932eb284af | Python | marczakkordian/python_code_me_training | /02_flow/02_for/01.py | UTF-8 | 336 | 3.765625 | 4 | [] | no_license | # Stwórz listę przedmiotów, które zabierzesz na samotną wyprawę w góry.
# Wyświetl nazwę właśnie spakowanego przedmiotu, po ostatnim przedmiocie pokaż informację: “Great, we are ready!”
item_list = ['bag', 'shoes', 'sweater', 'water', 'compas', 'phone']
for i in item_list:
print(i)
print('Great, we are ready')
| true |
cce6cb67cd269d1b06a373b4d0cee9d2f45fd06b | Python | dansackett/learning-playground | /python/python-cookbook/chapter_2/code/sanitizing_example.py | UTF-8 | 676 | 3.390625 | 3 | [] | no_license | import unicodedata
import sys
"""
Translating data
"""
s = 'pýtĥöñ\fis\tawesome\r\n'
print(s)
remap = {
ord('\t'): ' ',
ord('\f'): ' ',
ord('\r'): None
}
# Convert tabs, carriage returns, etc
a = s.translate(remap)
print(a)
# Create map for all combining unicode characters to None
cmb_chrs = dict.fromkey... | true |
bb3b4512bb8ae7e0d5761e833629a2fbc8f711cb | Python | ssernapalleja/OrderNodes | /Test/llenarAleatorio.py | UTF-8 | 2,465 | 2.78125 | 3 | [] | no_license | '''
Created on 5/11/2019
@author: Guest
'''
from Node_WorkPlace.__init__ import Node_WorkPlace
from Test.printNodes import printPDFNodes
import random
from CreateMap import loadMaps
#Create Diagrams of process
proMaps = loadMaps('nodos0')
#maximo = max([obj.endDate for obj in proMaps])
#for a in proMaps:
# a.end... | true |
9571d33c7f0e29b2408637ddde4dbad248e76b02 | Python | HyeonJun97/Python_study | /Chapter03/Chapter3_pb7.py | UTF-8 | 83 | 3.15625 | 3 | [] | no_license | #Q3.7
import time
a=int(time.time()%65)
a=65+a%26 # A=65,Z=90
print(chr(a)) | true |
5ee20e093139bc32f1428a56f0ab4da2f0e83b8d | Python | felipeochoa/thtml | /extract_svg_attrs.py | UTF-8 | 3,996 | 2.59375 | 3 | [
"MIT"
] | permissive | import attr
import os
import os.path
import re
from bs4 import BeautifulSoup
@attr.s
class Interface:
name = attr.ib()
globals = attr.ib()
specific = attr.ib()
@staticmethod
def global_name(name: str) -> str:
name = re.sub(r'\s([a-z])', lambda m: m.group(1).title(), name).replace(' ', '')... | true |
9bc86857997f7c8a3efc45c47580be6937fb2c08 | Python | anthonydb/pneumatic | /pneumatic/db.py | UTF-8 | 5,584 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import sys
import csv
import sqlite3
from colorama import init
from .utils import Utils
class Database(object):
"""
A SQLite database to store results of file upload attempts to
DocumentCloud, along with database-related utilities.
"""
def __init__(self):
... | true |
280eee265af4ad17dbb71c354ffa9fbd50c16f31 | Python | erasmuss/raman-spectra-decomp-analysis | /ramandecompy/tests/test_dataprep.py | UTF-8 | 8,450 | 2.90625 | 3 | [
"MIT"
] | permissive | """docstring"""
import os
import h5py
from ramandecompy import dataprep
def test_new_hdf5():
"""
A function that tests that there are no errors in the `new_hdf5` function from dataprep.
"""
# check to ensure that the test file does not already exist and remove if it does
if os.path.exists('functio... | true |
00d6f8de99243d187cbaef49df0efaf44ad27082 | Python | ajiexw/old-zarkpy | /web/cgi/model/oauth/OAuth2.py | UTF-8 | 3,200 | 2.546875 | 3 | [] | no_license | #coding=utf-8
from .. import Model
import datetime, hashlib
class OAuth2(Model):
table_name = ''
column_names = ['Userid', 'access_token', 'open_id', 'access_expires', 'access_token_md5_int', 'open_id_md5_int', 'share', ]
def insert(self, data):
raise 'donnot use method OAuth2.insert'
def get... | true |
70459db4e5ead29cbee516da5a1ecfcfa2961bfd | Python | bberzhou/LearningPython | /4FunctionalProgram/HighFunc.py | UTF-8 | 987 | 4.71875 | 5 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 高阶函数
# 一、变量可以指向函数
# 以python内置的函数abs()为例
print(abs(-10)) # 这里是函数调用
# <built-in function abs> 内置函数
print(abs) # abs是函数本身
# 函数本身也可以赋值给变量,即:变量可以指向函数
fun = abs
print(fun(-4))
# 输出4,函数本身也可以赋值给变量,即:变量可以指向函数。
# 函数名其实就是指向函数的变量,
# 二、函数名也是变量
# abs = 10
# abs(-10)
# 把abs指向10... | true |
0bdc769662c381ee6c13f2a468aed030c3dcdc54 | Python | signoiidx/IEEE-pdf-renamer | /ieee_pdf_renamer.py | UTF-8 | 1,700 | 2.9375 | 3 | [] | no_license | import os
import re
import requests
import bs4
# make list of the files in the current directory
dir_files = str(os.listdir(os.getcwd()))
# search list for IEEE PDF files and arXiv PDF files
pdf_files = re.findall(r'\d{8}\.pdf|\d{4}\.\d{5}.pdf', dir_files) #fetch numbered pdf
pdf_num = [pdf_files.replace(".pdf", "") f... | true |
e88365eb7e0714c20bb2429a9507b2405302ed05 | Python | benji06140/oci-prog-exos | /niveau-01/chapitre-7-conditions-avancees-operateurs-booleens/bonus--casernes-de-pompiers-validation.py | UTF-8 | 863 | 2.9375 | 3 | [] | no_license | ##################################
# fichier bonus--casernes-de-pompiers-validation.py
# nom de l'exercice : Bonus : Casernes de pompiers
# url : http://www.france-ioi.org/algo/task.php?idChapter=648&idTask=0&sTab=task&iOrder=7
# type : validation
#
# Nom du chapitre :
#
# Compétence développée :
#
# auteur :
#####... | true |
b1b6676bf5d23766c88be92cd5f72f03f99fa0d3 | Python | pddona/python_ejemplos | /PROBLEMAS resueltos/TKINTER_Indice_Masa_Corporal.py | UTF-8 | 2,540 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from tkinter import * # python 3.
except:
from Tkinter import * # python 2.7
def main():
#Crear y configurar ventana principal
window = Tk()
window.title("Entry")
#window.geometry('500x150') # ... | true |
753fd43d537e6d0a896094f7ebdd078a18a53827 | Python | ivansipiran/Data-driven-cultural-heritage | /utils/utils.py | UTF-8 | 3,939 | 2.703125 | 3 | [] | no_license | import visdom
import os
import random
import json
import numpy as np
import torch
import pickle
import matplotlib
import matplotlib.pyplot as plt
#initialize the weighs of the network for Convolutional layers and batchnorm layers
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') !... | true |
6013692547d3e60165fddffac241ddb35eae8f27 | Python | amoscookeh/WaterMePlsBot | /fun_facts_api.py | UTF-8 | 2,469 | 3.21875 | 3 | [] | no_license | import os
import praw
import random
PASSWORD = os.environ['REDDIT_PASSWORD']
reddit = praw.Reddit(client_id="8ZETxx_lxHX5b6exbgMBzw", # your client id
client_secret="88ZP0r0jT56J_jpCI5h5fc_eZr798g", # your client secret
user_agent="watermeplsbot", # user agent name
... | true |
16b825a5bb794c559803051fb9ad798877960d13 | Python | enrico-kaack/RoboticGames | /Finale_Auswertung/create_visualisation.py | UTF-8 | 3,159 | 2.53125 | 3 | [] | no_license | import sys
import os
import numpy as np
import matplotlib.pyplot as plt
import rosbag
import itertools
if len(sys.argv) != 2:
print("specify the base folder as first parameter. Exiting")
sys.exit(1)
base_path = sys.argv[1]
spawn_point=np.array([[0,0],[0,1.36],[0,1.23],[-2.1,2.1],[0,2.18]])
bag_mouse = rosbag.Bag(os... | true |
52cdb7c3d62ccb14127a5d5edb3c649b65ab8f25 | Python | samhiner/code | /python/mnist-ml/mnist_neuralnet.py | UTF-8 | 3,187 | 3.3125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from tensorflow import keras
import numpy as np
import h5py
# NEURAL NET DESIGN
class NeuralNet:
#create the neural network
#learning_rate: self-explanatory
#drop_rate: likelihood of throwing out a node with dropout regularization (this is logarithmic btw so 0.9 and 0.99 are very differen... | true |
e8c3350b3d617ca407915dcce889189336185c30 | Python | alexanderdaffara/MusicDeepLearning | /src/midiTests.py | UTF-8 | 725 | 2.71875 | 3 | [] | no_license | from music21 import *
"""
[0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 102, 0, 2560],
[0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 102, 2560, 512]
1280 == quarter note for all MIDI
"""
s1 = stream.Stream()
p = pitch.Pitch()
p.midi = 74
n = note.Note()
n.duration = duration.Duration( 2560 / 1280 )
n.pit... | true |
ce3754eb9cf0f40c473aef0573ee001c6137ba81 | Python | wespatrocinio/programming_studies | /ooo/vector.py | UTF-8 | 1,600 | 3.921875 | 4 | [] | no_license | """
Playing around with overload
"""
class Vector:
""" Represent a vector in a multidimensional space. """
def __init__(self, d):
"""
Create a d-dimensional vector of zeros.
d Dimension of th vctor space (int)
"""
self._coords = [0]*d
def __len__(self):
... | true |
dc093d8b73a889a754193f73667f4db910b008f6 | Python | bhuvannarula/code-doodle | /hitting-with-projectile/main.py | UTF-8 | 2,639 | 3.703125 | 4 | [] | no_license | from math import sin, cos, tan, atan, pi
from matplotlib import pyplot
import numpy
def Range(initialVelocity, angle, accnGrav = 9.8):
tempRange = (initialVelocity**2) * sin(2*angle) / accnGrav
return tempRange
def trajectory(startC, initialVelocity, pointtoHit, pointsAbove = [], pointsBelow = [], accnGrav = ... | true |
dcd75ae7071512047c81cda8c1fcfe23026a6a52 | Python | manasharma90/AoC-2020-Python | /Puzzle11/seatFinder2.py | UTF-8 | 5,046 | 3.828125 | 4 | [
"Apache-2.0"
] | permissive | with open('input.txt', 'r') as f:
a = f.read()
seats_draft = a.splitlines()
seats = []
#creating a list with elements as a list of rows
for row_string in seats_draft:
row_list = list(row_string)
seats.append(row_list)
# determining length of each row in the pattern.
# Each row is of equal size and each... | true |
0eab8775821bfb89a254dae4895dafce5edaab7a | Python | ashbob999/Advent-of-Code | /2015/day19.py | UTF-8 | 1,298 | 3.046875 | 3 | [] | no_license | from typing import Callable
from os.path import isfile, join as path_join
file_name = path_join('input', 'day19.txt')
def to_list(mf: Callable = int, sep='\n'): return [mf(x) for x in open(file_name).read().split(sep) if x]
def to_gen(mf: Callable = int, sep='\n'): return (mf(x) for x in open(file_name).read().spl... | true |
74ca6490030e4c28cf9f7a3187a5a5c17de6a157 | Python | tribeiro/specfit | /specfit/lib/specfit.py | UTF-8 | 21,017 | 2.53125 | 3 | [] | no_license | '''
specfit.py - Definition of class for fitting linear combination of spectra.
'''
######################################################################
import os
import numpy as np
from astropy.io import fits as pyfits
from astropysics import spec
import scipy.ndimage.filters
import scipy.interpolate
import loggi... | true |
257b4ed372545039c66cfc312783f1f45148e122 | Python | juliakarabasova/programming-2021-19fpl | /queue_/queue_stack.py | UTF-8 | 1,911 | 4 | 4 | [
"MIT"
] | permissive | """
Programming for linguists
Implementation of the data structure "Queue" based on Stack
"""
from typing import Iterable
from stack.stack import Stack
# pylint: disable=invalid-name
class QueueStack_(Stack):
"""
Queue Data Structure On Stack
"""
def __init__(self, data: Iterable = (), capacity: int... | true |
0b38443c481d7bda22e9cf28e69628206dd29445 | Python | AsherYang/AsherUpload | /resources/python/copyfile.py | UTF-8 | 574 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
from shutil import copyfile
import os
print 'copy file..'
def copy(srcPath, destPath):
copyfile(srcPath, destPath)
def main():
print 'please input src file path , and destPath'
# srcPath = raw_input('srcPath : ')
srcPath = '/Users/ouyangfan/Documents/1.txt'
... | true |
2a2fd4d90e0ece88fa3eab4629373d97a9a3c91f | Python | angelofgrace/holbertonschool-higher_level_programming | /0x05-python-exceptions/4-list_division.py | UTF-8 | 508 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python3
def list_division(my_list_1, my_list_2, list_length):
list_3 = []
x = 0
while x < list_length:
try:
c = my_list_1[x] / my_list_2[x]
except ZeroDivisionError:
c = 0
print("division by 0")
except IndexError:
c = 0
... | true |
d7ba2c85dcd6fb2fcc1d4b551b5afbd0fde11cb0 | Python | econchick/api-workshop | /full/github.py | UTF-8 | 1,552 | 2.671875 | 3 | [] | no_license | #! /usr/bin/env python
import github3
import geojson
class GithubError(Exception):
pass
def create_geojson(artists):
geo_list = []
j = 1
for artist in artists:
if artist.get('coordinates') == [0, 0]:
continue
data = {}
data["type"] = "Feature"
data["id"]... | true |
e3fe4ba6c6a62a17e3f569e14b6b2a7b459fa8f7 | Python | EduardoGiacomini/booboobee | /core/bots/bot_group.py | UTF-8 | 395 | 2.828125 | 3 | [] | no_license | from core.protocol import BotCompositeProtocol
class BotGroup(BotCompositeProtocol):
def __init__(self):
super().__init__()
def add(self, bot):
self.bots.append(bot)
def get_information(self):
bot_information = ''
for bot in self.bots:
bot_information += f'---... | true |
10dec9425338bd018ea7679832e113e4a461a35c | Python | mgraupe/SutterMP285 | /sutterMP285.py | UTF-8 | 7,461 | 3 | 3 | [
"MIT"
] | permissive | # sutterMP285 : A python class for using the Sutter MP-285 positioner
#
# SUTTERMP285 implements a class for working with a Sutter MP-285
# micro-positioner. The Sutter must be connected with a Serial
# cable.
#
# This class uses the python "serial" package which allows for
# with serial devices through... | true |
83a0f1a474bd4a88c4a54179d9c6b39d5307ae8b | Python | danieltrut/alused | /2/ylesanne 2.1.py | UTF-8 | 212 | 2.96875 | 3 | [] | no_license | #kasutaja sisend
sisestatud_temperatuur = int(input("Sisesta ohu temperatuur: "))
#arvestused
if sisestatud_temperatuur > 4:
print("Ei ole jäätumise ohtu")
else:
print("On jäätumise oht")
#valjastus | true |
e197b655ae480c4b54a49c13061fd7ecf70eeb65 | Python | AlexPushkarev/LabaPython2 | /Python2.2.py | UTF-8 | 741 | 3.09375 | 3 | [] | no_license | s = input()
print(' ФИО', end=' ')
print('О студенте'.rjust(45))
list1 = s.split('_')
s1 = ''
count = 0
for i in range(1, len(list1)):
count = 0
list2 = list1[i].split(';')
for j in list2:
count = count + 1
s1 = str(j)
if count < 4:
if count == 3... | true |
00dd4f677a2e6918ad626fad31eafe44563c19c6 | Python | RPellowski/machinevision-toolbox-python | /machinevisiontoolbox/blob.py | UTF-8 | 19,799 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
2D Blob feature class
@author: Dorian Tsai
@author: Peter Corke
"""
import numpy as np
import cv2 as cv
import spatialmath.base.argcheck as argcheck
import machinevisiontoolbox as mvt
from collections import namedtuple
import random as rng
import pdb
rng.seed(13543) # would this be called... | true |
39d5aedee790a0d86d59c15c4c17cdee4f316526 | Python | ph1-618O/cleaningApps | /describeData.py | UTF-8 | 2,037 | 2.6875 | 3 | [] | no_license | # Comment: Write file creates a module that can be imported with dependencies, %%writefile -a describeData.py appends, remove if func is changed
# Comment: This function prints stats for strings and integer value columns
import pandas as pd
import numpy as np
import requests
import os
import json
import matplotlib.pypl... | true |
bdd714580b98b85e2634912bc37ada18ea97842a | Python | nicolas-1997/Python_Profesional | /palindrome.py | UTF-8 | 625 | 4.84375 | 5 | [] | no_license | # This code is for practicing static typing
def is_palindrome(string: str):
string = string.replace(" ", "").lower() #we clean the word and save it in a variable
#we compare the word with same but other way around
if string == string[::-1]: #[::-1 serves to turn]
print("This is palindrome!!",... | true |
4ad5b16e1982f0b431cff8073654d8a344f196f8 | Python | jlin12358/leetcode | /validAnagram.py | UTF-8 | 1,479 | 3.375 | 3 | [] | no_license | class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
# O(n) time complexity
# O(n) space complexity
dictionary = {}
if len(s) != len(t):
return False
for i in range(len(s)):
... | true |
a14e480f6e62faaa96fde15be599a4a903149e15 | Python | djdubois/smart-speakers-study | /scripts/smart-speakers-testbed/scripts/extract-ttml | UTF-8 | 1,999 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
import sys
import os.path
from os import path
import xml.etree.ElementTree as ET
if len(sys.argv)<2:
print("This script extracts the subtitles from a file between [start] and [end] time in seconds.")
print()
print("If no start and end time are specified, all the subtitles will be printe... | true |
bcf193070bf661cb9fec1b39a7d891dccaf58f64 | Python | aouyang1/InsightInterviewPractice | /same_tree_guang.py | UTF-8 | 1,126 | 3.6875 | 4 | [] | no_license | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param p, a tree node
# @param q, a tree node
# @return a boolean
def isSameTree(self, p, q):
# first two levels ed... | true |
d36c4d6ff306c6c5f2d91a834cc69ed6c038f5aa | Python | agatakawalec/wdi | /klasy.py | UTF-8 | 2,785 | 3.4375 | 3 | [] | no_license | class Node:
def __init__(self, da):
self.data = da
self.next = None
self.prev = None
def __str__(self):
return str(self.data)
class BidirectionalList:
def __init__(self):
self.head = None
self.tail = None
self.size = 0
def addtail(self, data):
... | true |
15d2713622331ab6ef7d9f29362c91fcbb8e29c1 | Python | Andmontc/AirBnB_clone | /tests/test_models/test_user.py | UTF-8 | 1,877 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3
"""
Test User containing classes to test on the Place class:
* Style.
* Documentation.
* Functionality.
"""
import unittest
import pep8
from models import user
from models.user import User
class TestPep8B(unittest.TestCase):
""" Check for pep8 validation. """
def test_pep8(self... | true |
237cd74ad4cf8248e803738397db5022ca5bc708 | Python | VinitaNarayanamurthi/Python_course_assignments | /Lab_7_LinkedLists/dlList.py | UTF-8 | 4,697 | 3.875 | 4 | [] | no_license | """
dlList.py
A circular doubly linked List interface and implementation in Python
author: Steven Carnovale and Vinita Narayanamurthi
"""
from dlnode import DoublyLinkedNode
class DoublyLinkedList:
__slots__ = '__head'
def __init__( self ):
""" Create an empty list.
"""
self.__head = ... | true |
c58ecb2266da67ca71e5909da81fea89f543e568 | Python | beast3334/sudokusolver | /Solver.py | UTF-8 | 2,920 | 2.875 | 3 | [] | no_license | import pyautogui
import cv2, numpy as np
from PIL import Image
import BoardSolver
topLeftLocation = pyautogui.locateCenterOnScreen("TopLeft.png")
bottomRightLocation = pyautogui.locateCenterOnScreen("BottomRight.png")
sudokuGrid = [[0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0... | true |
24d01f3c490c16130a0912020feef2c0a373db44 | Python | zzf531/leetcode | /每日一题/面试题57 - II. 和为s的连续正数序列.py | UTF-8 | 427 | 3.109375 | 3 | [] | no_license | class Solution(object):
def findContinuousSequence(self, target):
ans = []
a = target // 2 + 1
for i in range(1,a):
res = []
while sum(res) <= target:
if sum(res) == target:
ans.append(res)
break
... | true |
1ff9831112d4f33d350b5325807f9ad5f30a871c | Python | fald/algo-trade-strat | /main.py | UTF-8 | 2,794 | 3.65625 | 4 | [] | no_license | # Description:
# This program uses the dual moving average crossover to determine
# buy and sell points of stock.
import pandas as pd
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
figsize = (12.5, 4.5)
filename = "AAPL.csv"
#filename = "kaggle_AAPL.... | true |
67e3e95c15ad4b3cdc7ce45ca085cb1988e89f50 | Python | wxkpythonwork/contest | /Tianchi_License/leak_view.py | UTF-8 | 929 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | # encoding=utf-8
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('train.chusai.csv',header=0)
df1 = pd.read_csv('train.csv',header=0)
mdf = pd.merge(df, df1, on='ds', how='left')
print mdf[mdf['ds'] == '2016-05-01'].index[0]
mdf['ratio'] = mdf['cnt_y']/mdf['cnt_x'] #fusai/chusai = 1.44... | true |
becbf0d06cd75a433827ff9e438f00e64e570a07 | Python | JASONews/leveldb | /avggf.py | UTF-8 | 1,309 | 2.5625 | 3 | [
"LicenseRef-scancode-generic-cla",
"BSD-3-Clause"
] | permissive | #i/usr/bin/python
import sys
import math
def dev(l):
t = 0
for i in l:
t += float(i)
avg = float(t) / len(l)
t = 0
for i in l:
t += (float(i) - avg)**2
return math.sqrt(t/len(l))
f = open(sys.argv[1])
header = f.readline()
t = []
for i in f:
t.append(tuple(i.split(',')))
t.sort()
avg=[]
i = 0
cu... | true |
cc286c8ab27187a6b505d6abe036a678a12b8499 | Python | dominonivictor/raw_tbs_game | /functions/map_functions.py | UTF-8 | 834 | 2.734375 | 3 | [] | no_license | import constants.colors as colors
from random import randint
#TODO TOO MUCH REPETITION
def random_map_cost_tile_gen():
r = randint(1, 12)
if r in [1, 2]:
move_cost = 2
tile_color = colors.FOREST_GREEN
elif r in [3, 4]:
move_cost = 3
tile_color = colors.MOUNTAIN_ORANGE
el... | true |
5906e3a79928dda23781b17b0dd92f48d63dfc4f | Python | BigWillieN/PoliTO-Schoolwork | /Labs/Lab05/ex01.py | UTF-8 | 268 | 3.703125 | 4 | [] | no_license | def ex01_main():
list = []
ex1 = []
while list != ".":
ex1 = input("Enter a string:")
if ex1 != ".":
list.append(ex1)
else:
break
sorted_list = sorted(list)
print(sorted_list)
ex01_main()
| true |
7d6454d988eec1a08dbe2f8129ccef610a573c3a | Python | botblox/botblox-manager-software | /botblox_config/switch/port.py | UTF-8 | 369 | 3.234375 | 3 | [
"MIT"
] | permissive | class Port:
def __init__(self, name: str, port_id: int) -> None:
"""
:param name: Name of the port. This name is used in CLI commands to refer to the port.
:param port_id: ID of the port. For internal use by the library.
"""
self.name = name
self.id = port_id
def... | true |
535d2acb6c84c63c20d1fdb93d683c74411b4f23 | Python | fabo893/holbertonschool-higher_level_programming | /0x0A-python-inheritance/2-is_same_class.py | UTF-8 | 452 | 3.984375 | 4 | [] | no_license | #!/usr/bin/python3
"""
2-is_same_class
This module is to check an instance
"""
def is_same_class(obj, a_class):
"""Check if an object is exactly an instance of the specified class
Args:
obj - object to be verified
a_class - class to check the object
Return - ... | true |
e4b4a630c6b733622fa61576e8edea24e18b6779 | Python | Jingliwh/python3- | /pyfunc.py | UTF-8 | 7,178 | 3.765625 | 4 | [] | no_license | #python 高级面向对象属性
#动态绑定属性和方法
#定义类后,再将方法和属性绑定
'''
class Ball(object):
name="ball"
def ball_add(self):
print("ball method")
from types import MethodType
#给某个类的对象绑定方法,不影响其他类的对象
pingpang=Ball()
pingpang.ball_add=MethodType(ball_add,pingpang)
pingpang.ball_add() #ball method
#volleyball=Ball()
#vo... | true |
a9d31b633418762ebae164bfa9bc6762d42f69dc | Python | anujpuri72/LeetCodeSubmissions | /MayChallenge/Week1/RansomNote..py | UTF-8 | 453 | 2.90625 | 3 | [] | no_license | class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
resa = defaultdict(lambda: -1)
for keys in ransomNote:
resa[keys] = resa.get(keys, 0) + 1
resb = defaultdict(lambda: -1)
for keys in magazine:
resb[keys] = resb.get(keys, 0) + 1
... | true |
6b20d0a875ef217883b5b414d4215c6c18c19809 | Python | ShinjiKatoA16/tkinter_sample | /tk25.pyw | UTF-8 | 258 | 3.328125 | 3 | [
"MIT"
] | permissive | # P17 tk25.pyw
import tkinter as tk
def get_text():
print(tx.get('1.5', '3.4'))
root = tk.Tk()
tx = tk.Text(width=30, height=5)
bt = tk.Button(text='get Line1-Col6 to Line3-Col4', command=get_text)
[widget.pack() for widget in (tx,bt)]
root.mainloop() | true |
f37b487a7e16338ee4c8d27e386ef90c4aa3b5e7 | Python | lyz05/Sources | /北理珠/python/python123/遍历字符串并错后显示.py | UTF-8 | 140 | 3.421875 | 3 | [] | no_license | s = input()
for ch in s:
if (ch=='z'):
exit(0)
else:
print(chr(ord(ch)+1),end='')
print(' 哈哈,成功遍历!') | true |
70aab12b938671aaa45d357a833eb7473d9a366a | Python | flameous/tiltech-medhack-bot | /models.py | UTF-8 | 4,508 | 2.84375 | 3 | [] | no_license | import requests
import json
from telebot import types
state_chatting = 'state_chatting'
state_menu = 'state_menu'
button_open_jira = 'Открыть веб-интерфейс'
button_chat = 'Чат со специалистом'
button_back_to_menu = 'Закрыть чат'
ikb = types.InlineKeyboardButton
class User:
def __init__(self, tg_id: int, state... | true |
2c7698618317468cbc2db01713ac8edc5fdfc541 | Python | Tymotheus/Ensimag-Python | /4_Listes/suffixes.py | UTF-8 | 6,803 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Generalne Description:
In the following task, I have implemented a class for a List with shared suffixes.
I have proposed several metohds for operating on it allocating and optimising memory.
The most important "suffixe" allows to concatenate one list to another, saving memory for shared suff... | true |
d16684c54366d4923047d2a50c276934123ae5c2 | Python | sukhleen-kaur/Autonomous_Systems_Practical | /sudo/brain/src/body/arduino.py | UTF-8 | 4,393 | 3 | 3 | [] | no_license |
import time
import serial
import brain
import logging
import util.nullhandler
logging_namespace = 'Borg.Brain.Util.Arduino'
logging.getLogger(logging_namespace).addHandler(util.nullhandler.NullHandler())
class Arduino(object):
"""
Used to get basic sensor information from the Arduino device.
WARNING:
... | true |
3f0ac0afd021bdf18ce0344bdfca17f6623df6cf | Python | cooperative-computing-lab/graph-benchmark | /graph_generator_matching/graph_generator/generate.py | UTF-8 | 3,563 | 3.171875 | 3 | [] | no_license | import graph
import time
import sys
import argparse
def main( args ):
# Setup arguments necessary for graph
scale_l = args.scale_l
scale_r = args.scale_r
edge_factor = args.edge_factor
weighted = args.weighted
covered = args.covered
visual = args.visual
rand_probs = args.rand_probs
if args.output is not None... | true |
258ab5aa48db7592905da441c6a45072ce32b24f | Python | christopher-roelofs/microgotchi | /hud.py | UTF-8 | 4,287 | 2.6875 | 3 | [
"MIT"
] | permissive | import board
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_imageload
from time import sleep
from util import colors
import util
class Hud:
def __init__(self,pet):
self.pet = pet
self.display = board.DISPLAY
self.font = terminalio.FONT
... | true |
c66f40def05ee13fff0ef5cf8f5e78ebd4ea3c13 | Python | PhyuCin/CP1404PRAC | /Prac_02/word_generator_ver_3.py | UTF-8 | 625 | 3.46875 | 3 | [] | no_license | import random
VOWELS = "aeiou"
CONSONANTS = "bcdfghjklmnpqrstvwxyz"
print("""For word format:
(C)onsonants and 'v' for vowels:""")
word_format = input("Enter the word format using 'c' for consonants and 'v' for vowels: ")
word_format = word_format.lower()
if word_format == "auto":
word_format = ""
word_num =... | true |
62834bc8aabd77038298f9a1bb36c4a3fece5d05 | Python | AnastaFilatova/Diploma_1_Base_Python | /diplomskrpt.py | UTF-8 | 2,580 | 2.9375 | 3 | [] | no_license | import requests
from pprint import pprint
with open('token.txt', 'r') as file_object:
token = file_object.read().strip()
class VkUser:
version = '5.130'
url = 'https://api.vk.com/method/'
def __init__(self, token, version):
self.token = token
self.version = version
self.param... | true |
6c2dc6fb9b121f0582ae600f8a1514832551617a | Python | skibold/tkinter-example | /LibraryMain.py | UTF-8 | 1,322 | 2.65625 | 3 | [] | no_license | from LibraryView import *
from LibraryDB import LibraryDB
from sys import argv
logfile = None
if(len(argv) >= 2):
logfile = argv[1]
else:
logfile = "library.log"
lib = LibraryDB(logfile)
mw = Tk()
mw.title("Library")
mw.geometry('1000x500')
# setup frames, but don't pack yet
bs = BookSearchFrame(lib, mw)
ls = Lo... | true |
7771aa0e4c25e880407f90dbfb177b5e6b8250f1 | Python | zhangwei22/machine-learning | /principle_of_algorithm/source_code/chapter04/testRecommsvd.py | UTF-8 | 896 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Filename : testRecomm01.py
from numpy import *
import numpy as np
import operator
from svdRec import *
import matplotlib.pyplot as plt
eps = 1.0e-6
# 夹角余弦,避免除0
def cosSim(inA,inB):
denom = linalg.norm(inA)*linalg.norm(inB)
return float(inA*inB.T)/(denom+eps)
# 加载修正后数据
A = mat(... | true |
9b210ffd005c997d796ab5d29140122d2c77433b | Python | NazneenV/DemoGitRepo | /basic python.py | UTF-8 | 637 | 3.8125 | 4 | [] | no_license | '''p="welcome"
print(p[4:])
print(p[4:-1])
print(ord('B'))
print(max('X,Y,A,B,D'))
s="python"
for i in s:
print(i,end="")'''
var1=10
def fn1():
var1=100 #here ,defining a local var with the same name as global var
print(var1)
fn1()
print(var1) #global variable's var1 value remains unchanged
# outp... | true |
9de5a441d3603356f4f342e2574f375923fb75c8 | Python | srf94/adventofcode | /2019/python/day13.py | UTF-8 | 2,587 | 3.203125 | 3 | [] | no_license | from copy import copy
from utils import read_data
from intcode.vm import IntcodeVM
def draw_board(tiles):
tiles = copy.copy(tiles)
for tile in tiles:
for loc in range(len(tile)):
tile[loc] = str(tile[loc]).replace("0", " ").replace("2", "B").replace("3", "_").replace("4", "O")
print("... | true |
ad8b2974739a7af15e91e23220d354a5fc6692c3 | Python | novayo/LeetCode | /0092_Reverse_Linked_List_II/try_1.py | UTF-8 | 1,174 | 3.71875 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode:
newHead = ListNode(0)
newHead.next = head
... | true |
a54b297cd0dd3b87a8b41ceedadbfa1987f2a1aa | Python | madeibao/PythonAlgorithm | /PartA/Py_一个月有多少天.py | UTF-8 | 526 | 3.828125 | 4 | [] | no_license |
# 指定年份 Y 和月份 M,请你帮忙计算出该月一共有多少天。
# 输入:Y = 1992, M = 7
# 输出:31
#================================================================
from typing import List
class Solution():
def numberOfDays(self, Y: int, M: int) -> int:
D = [0,31,28,31,30,31,30,31,31,30,31,30,31]
if Y % 400 == 0 or Y % 4 == 0 and Y ... | true |
17564971f1ad1a5b6dc616908f06daa99377b49c | Python | yun63/fast | /base/singleton.py | UTF-8 | 707 | 3.03125 | 3 | [] | no_license | # coding=UTF-8
import threading
class Singleton(type):
_instance_lock = threading.Lock()
_instance = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instance:
with Singleton._instance_lock:
if cls not in cls._instance:
cls._instance[cls]... | true |
92005905ef017c65d3e3a46d85e5b6007ef596dd | Python | ECMora/SoundLab | /sound_lab_core/ParametersMeasurement/Adapters/WaveletParametersAdapters/WaveletMeanParameterAdapter.py | UTF-8 | 861 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from sound_lab_core.ParametersMeasurement.Adapters.WaveletParametersAdapters.WaveletParameterAdapter import WaveletParameterAdapter
from sound_lab_core.ParametersMeasurement.SpectralParameters.WaveletParameters import WaveletMeanParameter
class WaveletMeanParameterAdapter(WaveletParameterAdapt... | true |
5a4adfa0924cfae8f97d6657e1435e6fb1396891 | Python | spurthihemadri/Spurthi-SridharBabu- | /simplecalculator.py | UTF-8 | 4,514 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tkinter import *
import math
exp = " "
def click(number):
global exp
exp = exp + str(number)
s.set(exp)
def clickequal():
try:
global exp
total = str(eval(exp))
s.set(total)
expression = ""
except:
... | true |
180414813eeb2e2298440dc7a4bcc8ea6f0bb092 | Python | MaximumBeings/public | /swaptionPut.py | UTF-8 | 11,914 | 2.71875 | 3 | [] | no_license | """
Author: Oluwaseyi Awoga
IDE: CS50 IDE on Cloud 9/AWS
Topic: ARRC Swaption - LIBOR-SOFR Transition
Sources: David R. Smith - Financial Analyst Journal - May/June 1991
Location: Milky-Way Galaxy
"""
from __future__ import division
import math
from scipy.optimize import fsolve
import sys
import copy
import scipy.stat... | true |
c0a08426aaa66b8b9d9191d85173272b5fba7997 | Python | alexander-kononenko/pythonGitBash | /TestCases/test01/test_01.py | UTF-8 | 1,357 | 2.859375 | 3 | [] | no_license | import requests as re
import pytest
print 'Count users which contains 5 in zipcode'
try:
response = re.get('http://jsonplaceholder.typicode.com/users', timeout=(1000, 1))
userTable = response.json()
yes = 0
no = 0
for itemUsr in userTable:
if '5' in str([itemUsr['address']['zipcode']]):
... | true |
55ca9bed2548e693e1d53a5e8ec7271fef741081 | Python | Gerry84/Python-for-everybody | /6.1.py | UTF-8 | 201 | 2.90625 | 3 | [] | no_license | #6.1
str = 'X-DSPAM-Confidence:0.8475'
stpoint = str.find(':')
stpoint = int(stpoint)
print(stpoint)
length = len(str)
print(length)
number = str[stpoint+1:length]
number = float(number)
print(number)
| true |
ce77d1533df655874df2f6e907ab124d54b8e08c | Python | diwakarjaiswal880/DDCN2019-MNNIT-Allahabad | /code/pattern1.py | UTF-8 | 130 | 3.90625 | 4 | [] | no_license | n=int(input("Enter no of rows: "))
for i in range(n,0,-1):
for j in range(n,i-1,-1):
print(j,end=' ')
print()
| true |
18e11f38b4da4c498de64301c43ff1b3633ea317 | Python | nittyan/word-counter | /word_counter.py | UTF-8 | 1,312 | 2.875 | 3 | [] | no_license | import codecs
import sys
from collections import Counter
from typing import List
from tqdm import tqdm
from janome.analyzer import Analyzer
from janome.tokenfilter import ExtractAttributeFilter, POSKeepFilter
token_filters = [
POSKeepFilter(['名詞', '動詞']),
ExtractAttributeFilter('base_form')
]
analyzer = Ana... | true |
14a90b1d372d740fb73f091a78839b466d78026f | Python | davidcGIThub/quadcopter_simulation | /exampleAnimation2.py | UTF-8 | 651 | 2.71875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
list_var_points = (1, 5, 4, 9, 8, 2, 6, 5, 2, 1, 9, 7, 10)
fig, ax = plt.subplots()
xfixdata, yfixdata = 14, 8
xdata, ydata = 5, None
ln, = plt.plot([], [], 'ro-', animated=True)
plt.plot([xfixdata], [yfixdata], 'bo', ms... | true |
da4932ba434c16b9b5bd4875a29e8ea66583c7c9 | Python | EtienneAmany/Ligue1-2019-2020-season-prediction | /dataframe_prepation.py | UTF-8 | 7,594 | 3.296875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
pd.set_option('display.max_row', 111)
pd.set_option('display.max_column', 111)
df = pd.read_csv('data/ligue1_0919.csv').drop('Unnamed: 0', axis = 1)
df.drop('Div', axis = 1, inplace = True)
#On drop les lignes avec des NaN... | true |
d04a37542cebf3d68ef2c572d844943a63cb6a8a | Python | BurakYyurt/pystras | /scripts/strain.py | UTF-8 | 340 | 2.90625 | 3 | [] | no_license | import numpy as np
def engineering_strain(gradient):
return 0.5 * (gradient + gradient.T) - np.identity(3)
def green_lagrange(gradient):
return 0.5 * (np.dot(gradient.T, gradient) - np.identity(3))
def green_lagrange_rate(gradient, gradient_rate):
mult = np.dot(gradient_rate.T, gradient)
return 0.... | true |
1d7803e872d8d9854d40650976ee1ce1c05167ca | Python | vodneva/steps | /server.py | UTF-8 | 293 | 2.53125 | 3 | [] | no_license | import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Socked created!")
s.bind(('0.0.0.0', 2222))
s.listen(10)
while True:
conn, addr = s.accept()
while True:
data = conn.recv(1024)
if not data: break
if data == 'close': break
conn.send(data)
conn.close()
| true |
765f73a25064f5c13262977a3e14d509f6b63758 | Python | sidv/Assignments | /Bhargava_Krishna/AUG_9_10/greater_4.py | UTF-8 | 375 | 4.0625 | 4 | [] | no_license | a = int(input("Enter 1st number"))
b = int(input("Enter 2nd number"))
c = int(input("Enter 3rd number"))
d = int(input("Enter 4th number"))
if (a>b and a>c and a>d):
print("The greater num is" +str(a))
elif(b>a and b>c and b>d):
print("The greater num is" +str(b))
elif(c>a and c>b and c>d):
print("The greater num i... | true |
2194ff211843889bb646cd8690503232eb4c03ae | Python | andrthu/mek4250 | /adjoint/my_bfgs/lbfgs.py | UTF-8 | 16,581 | 2.578125 | 3 | [] | no_license | import numpy as np
from linesearch.strong_wolfe import *
from scaler import PenaltyScaler
from diagonalMatrix import DiagonalMatrix
#from matplotlib.pyplot import *
from my_vector import SimpleVector, MuVector,MuVectors
from LmemoryHessian import LimMemoryHessian, MuLMIH
class LbfgsParent():
"""
Parent clas... | true |
0aa062d9a2ea67d5657a434f513d62bf232cb9da | Python | chenxu0602/LeetCode | /2309.greatest-english-letter-in-upper-and-lower-case.py | UTF-8 | 413 | 3.234375 | 3 | [] | no_license | #
# @lc app=leetcode id=2309 lang=python3
#
# [2309] Greatest English Letter in Upper and Lower Case
#
# @lc code=start
class Solution:
def greatestLetter(self, s: str) -> str:
s = set(s)
upper, lower = ord('Z'), ord('z')
for i in range(26):
if chr(upper - i) in s and chr(lower... | true |
0ad8716f210685ab8a92f60d216b2a7be6a2a7da | Python | cruizeship/competitive-programming | /USACO-Bronze:Training-python/USACO-whereami/main.py | UTF-8 | 2,047 | 3.40625 | 3 | [] | no_license | '''
ID: cruzan1
LANG: PYTHON3
TASK: whereami
'''
#Misinterpreted the problem - At first, I thought the problem wanted you to find the unique strings and find the minimum length of these strings, but then I read over the problem again, and it said to instead find the smallest value of K for a string of length K that ca... | true |
fa5b1870e499d76bee73f5929cada2a40e2f07ee | Python | leetonfreestyle/repo | /main.py | UTF-8 | 9,259 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -- coding:utf-8 --
from support import *
import math
import Queue
import threading
import time
class Segmenter(object):
kMIRA = 5
beamSize = 10
model = Model()
wq = Queue.Queue()
isAllTerminated = False
# validSequence map, used in _validSequence()
_vsMap = {
... | true |
6c6f83480f845ed856eae006cc3294af312ce4f6 | Python | kileung-at-cb/pythonlib | /cardinal_pythonlib/rnc_ui.py | UTF-8 | 3,604 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- encoding: utf8 -*-
"""Support functions for user interaction.
Author: Rudolf Cardinal (rudolf@pobox.com)
Created: 2009
Last update: 24 Sep 2015
Copyright/licensing:
Copyright (C) 2009-2015 Rudolf Cardinal (rudolf@pobox.com).
Licensed under the Apache License, Version 2.0 (the "L... | true |
01dc7a912a50aff3bc09ab2ed48965f02922a96b | Python | Noronha1612/wiki_python-brasil | /Estruturas de repetição/ex05.py | UTF-8 | 1,452 | 3.734375 | 4 | [] | no_license | from functions.validação import lerFloat, lerInt
popA = lerInt('Popoulação do país A: ', pos=True, erro='Digite uma população válida')
while True:
creA = lerFloat('Taxa de crescimento, em %, do país A: ', pos=True, erro='Digite um valor entre 0 e 100')
if 0 <= creA <= 100:
break
print('Digite um va... | true |
9733aa897340a2d16e92811d2e57ccbda69e145f | Python | sergtimosh/GrokkingAlgorithms | /src/sandbox/recursiveSumArray.py | UTF-8 | 138 | 3.15625 | 3 | [] | no_license | def recurSumArr(arr):
if len(arr) == 0:
return 0
return arr[0] + recurSumArr(arr[1:])
print(recurSumArr([109, 650, 777])) | true |
e327c1494c586bfe0437f445e47720e8554ab9a6 | Python | parthddosani/edu-search | /qna.py | UTF-8 | 3,367 | 2.875 | 3 | [] | no_license | # Using flask to make an api
# import necessary libraries and functions
from flask import Flask, jsonify, request
from youtube_transcript_api import YouTubeTranscriptApi
import json
from deeppavlov import build_model, configs
from flask_cors import CORS
final_stopWords = []
temp_file = open('stopwords.txt', 'r')
fina... | true |
d2e69220bb6ea03ba85513636b69df35f77c0a2a | Python | howardh/rl | /test/learner/test_linear_learner.py | UTF-8 | 3,422 | 2.671875 | 3 | [] | no_license | import unittest
import numpy as np
import scipy.sparse
import torch
from tqdm import tqdm
from learner.linear_learner import LinearLearner
#class TestTabularLearner(unittest.TestCase):
#
# LEARNING_RATE = 0.1
# DISCOUNT_FACTOR = 0.9
#
# def setUp(self):
# self.learner = LinearLearner(
# ... | true |
2b64804b202290ab1b634d33366fb3c07ea69255 | Python | vvoZokk/dnn | /scripts/lib/evolve_state.py | UTF-8 | 437 | 2.90625 | 3 | [
"MIT"
] | permissive |
import pickle
from os.path import join as pj
class State(object):
FNAME = "state.p"
def __init__(self, seed):
self.vals = []
self.seed = seed
def add_val(self, X, tells):
self.vals.append( (X, tells) )
def dump(self, wd):
pickle.dump(self, open(pj(wd, State.FNAME), "... | true |
b7c6c15c8d516915aef35a63be4a30bd21c2254a | Python | AnTznimalz/python_prepro | /Prepro2019/road_to_legend.py | UTF-8 | 481 | 3.84375 | 4 | [] | no_license | """0068: Road to Legend"""
def main():
"""Main Func."""
num = int(input())
count = 0
time = 0
while count <= num:
text = input()
if text == "WIN":
count += 1
else:
if count > 0:
count -= 1
time += 15
hour = time//60
minu... | true |
6f1548a99e2468d30300065ddad2c99c75b73f2d | Python | dohyun93/python_playground | /section14_(유형)_정렬문제들/14-3.실패율(카카오2019).py | UTF-8 | 2,819 | 3.40625 | 3 | [] | no_license | # 슈퍼 게임 개발자 오렐리는 큰 고민에 빠졌다. 그녀가 만든 프랜즈 오천성이 대성공을 거뒀지만, 요즘 신규 사용자의 수가 급감한 것이다. 원인은 신규 사용자와 기존 사용자 사이에 스테이지 차이가 너무 큰 것이 문제였다.
#
# 이 문제를 어떻게 할까 고민 한 그녀는 동적으로 게임 시간을 늘려서 난이도를 조절하기로 했다. 역시 슈퍼 개발자라 대부분의 로직은 쉽게 구현했지만, 실패율을 구하는 부분에서 위기에 빠지고 말았다. 오렐리를 위해 실패율을 구하는 코드를 완성하라.
#
# 실패율은 다음과 같이 정의한다.
# 스테이지에 도달했으나 아직 클리어하지 못한 플레이어의 수... | true |
26663496a22a89825c627bd85d7a2903b9ac15e0 | Python | AdminSDA/Lab212 | /main.py | UTF-8 | 878 | 3.203125 | 3 | [] | no_license | import os
import glob
from problem import Problem
if __name__ == '__main__':
# List all classes in this directory and
# import all that are derived from Problem
for module in os.listdir('.'):
if module[-3:] == '.py':
__import__(module[:-3], locals(), globals())
# For each subclass ... | true |
eff1913376e25a92dd19cbb4400026908b4e6a21 | Python | Ruban-chris/Interview-Prep-in-Python | /elements_of_programming_interviews/19/19-4.py | UTF-8 | 1,795 | 4.09375 | 4 | [] | no_license | # degrees of connectedness
# Write a program that takes as input an undirected graph, which you can assume to be connected,
# and checks if the graph is minimally connected.
# Ideas
# Use DFS with visited set and parent.
# Time complexity is the same as DFS O(|V| + |E|)
# Space complexity is O(n) where n is the numb... | true |
62a822bb54154b7048c5f10ceaba6a38c2e24f42 | Python | sajandl/FlightGrid | /UI_Code.py | UTF-8 | 14,142 | 2.59375 | 3 | [] | no_license | import os
import tkinter as tk
from tkinter import filedialog
import Drone_Grid_UI
class GridInputUI:
def __init__(self, master):
super().__init__()
self.master = master
self.output_file = None
self.master.title('Grid Parameters')
self.master.columnconfigure(2, weight=1)
... | true |