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
65335e5064ba742f23dee00c2b370052002c32e1
laiqjafri/LeetCode
/problems/01051_height_checker.py
UTF-8
1,231
3.609375
4
[]
no_license
# 1051. Height Checker # Easy # # 35 # # 6 # # Add to List # # Share # A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected...
true
131222f0fac145de47a57f2752341ebf03a64735
aviral-bhardwaj/Coding-challenges-for-Interviews
/Arrays/finding_a_pair_whos_sumis_given_number.py
UTF-8
203
3.390625
3
[]
no_license
def find_pair(l,s): for i in l: se=s-i l.remove(i) if se in l: return (i,se) l.append(i) return "Pair not found!" l=[1,20,5,6,9,2,10] s=int(input("Enter the sum : ")) print(find_pair(l,s))
true
dee123976245fc551b894723e7de3189d66ad557
NareStepanyan/ASUE-P4E-Homeworks
/Homework3/problem2.py
UTF-8
337
3.625
4
[]
no_license
num = int(input("Enter positive integer: ")) def prime(number): primes = [] for i in range(2, number + 1): isPrime = True for num in range(2, i): if i % num == 0: isPrime = False if isPrime: primes.append(i) return primes print(prime(n...
true
59fb737cbbac2a96b0179a6622f9c4826e94a351
catboost/catboost
/contrib/python/Pygments/py3/pygments/lexers/csound.py
UTF-8
16,994
2.5625
3
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
""" pygments.lexers.csound ~~~~~~~~~~~~~~~~~~~~~~ Lexers for Csound languages. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, bygroups, default, include, using, words from pygments.to...
true
55f784cca8089f7296c8840bad728a498c21f363
annabechang/leetcode
/153FindMinimuminRotatedSortedArray.py
UTF-8
531
3.140625
3
[]
no_license
class Solution: def findMin(self, nums: List[int]) -> int: # log n == binary # divid the nums into half and compare and then divid again until one is less l = 0 r = len(nums)-1 res = nums[0] while l<= r: if nums[l]<nums[r]: ...
true
f9c549372036c8932dd516bca47461d73c5afb12
khaibnd/LNWG
/src/selection/selection.py
UTF-8
3,208
3.265625
3
[]
no_license
'''k-way seletion of GA''' import random from src.fitness_calculation.fitness_calculation import FitnessCalculation # pylint: disable=E0401, R0913 class ChrosKWaySelection(): '''1. k individuals are randomly selected 2. The one presenting the highest fitness is declared the winner 3. A copy of this ...
true
ba03e8dcbd0255f8feae61455898188a7d4fe1c2
scientiacoder/ALG
/ALG/343Integer Break.py
UTF-8
572
3.109375
3
[]
no_license
# -*- coding:utf-8 -*- # __author__='' class Solution(object): def integerBreak(self, n): """ :type n: int :rtype: int """ if n == 0 or n == 1: return n if n == 2 or n == 3: return n - 1 if n % 3 == 0: return 3 ** (int(n / ...
true
e325bc869cdadcf5bcb22855b31ed3602db5130a
briantoth/baja-score-calculator
/compileScores.py
UTF-8
2,579
2.9375
3
[]
no_license
import sys from accel_calc import get_accel_score from cost import get_cost_score from design import get_design_score from hill import get_hill_score from manuv import get_manuv_score from sales import get_sales_score from st import get_st_score from endurance import get_endurance_score def get_compiled_score(competit...
true
4e58fc6bfb95bf252d8da6856afe3f4d460dbe99
pythonzhangfeilong/Python_WorkSpace
/1_Demo_Python_1903/15_Python_socket编程/4_socket_tcp实战_client.py
UTF-8
429
2.90625
3
[]
no_license
import socket #创建一个socket s= socket.socket(socket.AF_INET,socket.SOCK_STREAM) #连接端口 s.connect(('127.0.0.1',9001)) print('已经建立连接……') info = '' while info != 'exit': #获得输入的信息 send_mes=input('>>>') s.send(send_mes.encode()) if send_mes =='exit': break #得到服务器输入的信息 info = s.recv(1024).decode(...
true
3628bc9aea664a53046fc74fa038d142d0498d8b
gpfvic/NewWordDector
/main/App.py
UTF-8
597
2.671875
3
[]
no_license
#coding:utf-8 import argparse def parse_args(): parser = argparse.ArgumentParser( description='New Word Detector', epilog='Use %(prog)s {command} -h to get help on individual commands' ) parser.add_argument("--data_file", dest="data_file", help="raw data files") parser.add_argument("-D", type=int, dest="D"...
true
750c3bce11a857400c26f8278f8d5f19c5dc4637
Sandy4321/simple-neural-networks
/src/network.py
UTF-8
1,964
2.890625
3
[]
no_license
import numpy as np class Network(object): def __init__(self, sizes): self.biases = [np.random.randn(y) for y in sizes[1:]] self.weights = [np.random.randn(x, y)/np.sqrt(x) for x, y in zip(sizes[:-1], sizes[1:])] def train(self, trX, trY, teX, teY, num_epochs, batch_siz...
true
928b4f2a5d66429361e3e922293beeea79a40bde
kasturinaveen/The-Gradient-Descent-Optimization
/GradientDescentOptimizer.py
UTF-8
7,107
3.625
4
[]
no_license
# -*- coding: utf-8 -*- """ @author: koushik version: 1.0 """ import numpy as np class GradientDescentOptimizer(): """ This is GradientDescentOptimizer class, providing two methods for batch and stochastic gradient descent respectively. Cost function is considered as squared error...
true
9d86063f45cdd890bfc13817cfea466374b9fe73
mindcurry/InterviewBit
/Level 2/Arrays/FInd Duplicate Array.py
UTF-8
675
3.90625
4
[]
no_license
''' Given a read only array of n + 1 integers between 1 and n, find one number that repeats in linear time using less than O(n) space and traversing the stream sequentially O(1) times. Sample Input: [3 4 1 4 1] Sample Output: 1 If there are multiple possible answers ( like in the sample case above ), output any one...
true
3900e104fc1298a4306c713e52ac06054536441c
lxw920110/luffycity
/api/tests.py
UTF-8
2,566
2.6875
3
[]
no_license
# from django.test import TestCase # # # Create your tests here. import redis # # # 字符串操作 # # # # 设置值 conn = redis.Redis(host='192.168.11.180',port =6379) import redis # # # ############### 字符串操作 # # # 设置值 # # conn.set('wupeiqi_name','于超') # # # # # 获取值 # # val = conn.get('wupeiqi_name').decode('utf-8') # # ########...
true
bf03429706c6d545bbfa45f9d8d25d904fd5977d
Awesome94/Office-Space-Allocation
/Tests/test_amity.py
UTF-8
1,440
2.859375
3
[]
no_license
import unittest from amity_functions import Amity import os class AmityTest(unittest.TestCase): def test_it_creates_office(self): amity = Amity() amity.create_room('o', 'Oculus') self.assertNotEqual(len(amity.all_rooms), 0) self.assertIn('OCULUS', Amity.office_spaces.keys()) ...
true
f94416a60609de8b9e90a9f98c2d6788f3b4ff6c
KerouacAutumn/PyCode
/day05/dictDemo.py
UTF-8
299
4.15625
4
[]
no_license
season = input("请输入季节:") dict_seasons = { "春": (1, 2, 3), "夏": (4, 5, 6), "秋": (7, 8, 9), "冬": (10, 11, 12) } if season in dict_seasons: months = dict_seasons[season] for item in months: print(str(item) + "月份") else: print("输入错误")
true
0b7f85a5e2970c0f625169b5afa6207a2baa907c
GKPSingh/Functions-Practice
/secondlar.py
UTF-8
148
3.34375
3
[]
no_license
# Python program to find second largest number in a list def larsec(a): a.sort() seclar = a[-2] print(seclar) larsec([44,233,756,34])
true
f81934ff3079ea2e02d2a106c798c7d1a8499332
NR5P/HomesteadAutomationPython
/src/device.py
UTF-8
2,456
3.40625
3
[]
no_license
import datetime class Device: """ Device the parent class that all other devices inherit from Atributes: id = unique database id of the device name = unique user defined name of a device notes = user defined notes of the device pin = gpio pin number used...
true
694043634436ff97644f0cb2bdbfa2e19e28177b
eucalypto/Python
/PyCharm/PythonLanguage/exceptions/open_file_strategies.py
UTF-8
549
3.328125
3
[]
no_license
import os def traditional_strategy(myfile): if os.access(myfile, os.R_OK): with open(myfile) as file: print(file.read()) else: print(f"File {myfile} cannot be accessed") def exceptional_strategy(myfile): try: file = open(myfile) except IOError as io: print...
true
1518c2e104c54c5c3049f90f91679c51090f4d2b
gosha22008/Web-scrapping
/main.py
UTF-8
1,028
2.78125
3
[]
no_license
import requests from bs4 import BeautifulSoup import re response = requests.get('https://habr.com/ru/all/') response.raise_for_status() url = 'https://habr.com' KEYWORDS = ['дизайн', 'фото', 'web', 'python'] text = response.text soup = BeautifulSoup(text, features='html.parser') articles = soup.find_all('article') ...
true
e67fc8e847f096bd97e17fb30623ad135bfede40
vkd8756/Python
/hacker1/leader_board.py
UTF-8
681
3.078125
3
[]
no_license
import math import os import random import re import sys def climbingLeaderboard(a, b): # Write your code here a=sorted(list(set(a)),reverse=True) print(a) b.sort(reverse=True) print(b) l=len(a) j=0 r1=[] for i in range(len(b)): while j<l and b[i]<a[j]: ...
true
5e5b9bc791b1e43c2cbc233f21b411c3811e96e9
gitrymt/python
/Calculation/function/plot_band_results.py
UTF-8
1,491
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- """ Function library for plot results of band calculation Created on Fri Feb 23 23:44:06 2018 @author: gitrymt """ import numpy as np import matplotlib.pyplot as plt # Plot 1st Brillouin zone of triangular (hexagonal) lattice def plotBrillouinZone_tri(cx=0, cy=0, L=1/np.sqrt(3), linecolor='k',...
true
6181437eaf31ba91ce19fdbfb96ce18c26ea63f6
YasunoriHirakawa/tabular_rl
/agents.py
UTF-8
4,037
3
3
[ "MIT" ]
permissive
import random class QLearning: def __init__(self, q_function, initial_observations, num_actions, epsilon=0.3, learning_rate=0.1, discount_rate=0.99): self.q_function = q_function self.prev_observations = initial_observations self.num_actions = num_actions self.epsilon = epsilon ...
true
78c691c11b674e50d258cf3e061dd1e740e0ee90
YosukeKira/main
/Python/chapter2/2-5/if-noelse.py
UTF-8
187
3.546875
4
[]
no_license
level = int( input("レベルは?") ) if level >= 5: print("レベル5以上の人への補足アドバイス") if level >= 8: print("レベル8以上の人へのアドバイス")
true
99b81fce473a3d83b3d02c40bdbc265ec78b6f01
zhaox12134/datamining_project
/name_compare.py
UTF-8
1,323
3.625
4
[]
no_license
#把名字处理的一些功能函数放到这里,供调用 import re def replace(word):#去除"_" a="" for i in range(word.__len__()): if word[i] == "_": a=a+" " else: a=a+word[i] return a def delet_dot(word):#去除 "." a="" for char in word: if(char!="."): a+=char else: ...
true
3edd9eb90e1853cf3eadfda725faf7f41829b251
rthompsonj/weather_tracker
/mongo_connection.py
UTF-8
6,672
3.0625
3
[]
no_license
import datetime from pymongo import MongoClient from passlib.hash import bcrypt DBNAME = 'weather' # name of the database in Mongo UPDATE_TIME = 10 # time in minutes to refresh a forecast on request class MongoConnection(object): """Database connection manager. Parameters ---------- ip : str, opt...
true
8afc0338f9c61fe44c3af8d196a30a79ed92a3cf
bond-anton/Schottky
/Schottky/Helpers.py
UTF-8
11,787
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- ''' Created on 04 нояб. 2014 г. @author: anton ''' from __future__ import division import sympy as sym import numpy as np import math as m import mpmath as mp from scipy.interpolate import interp1d from scipy.optimize import curve_fit from Schottky import constants from Schottky.Notation im...
true
8391b3cfcc16815d2c6acc4bf8e8cdd4e5b8dc1e
cbigler/jackrabbit-googlev3-geocoder
/src/impl/geocoder.py
UTF-8
1,786
2.921875
3
[ "MIT" ]
permissive
from Geohash import geohash import geopy from rate_limiter import RateLimiter class Geocoder(object): def __init__(self, api_key=None, client_id=None, secret_key=None, reverse_cache_geohash=9): if api_key: self._geolocator = geopy.GoogleV3(api_key=api_key) elif client_id and secret_ke...
true
cbf7cf0a80ad48a602c02dc997e0f652e3128285
Thirupathiswamythanniru/python
/75.py
UTF-8
235
3.0625
3
[]
no_license
num=input("") b=len(num) s=list(num) l=[] if b%2!=0: for i in range(b//2): l+=s[i] l+='*' j=b//2+1 else: for i in range(b//2-1): l+=s[i] l+='**' j=b//2+1 for i in range(j,b): l+=s[i] print(''.join(l),end='')
true
b31d3c92970d01c78fc97372028c8ad46dc901ed
naviatolin/minimal_dns_spoofer
/src/send_request.py
UTF-8
1,054
3.15625
3
[]
no_license
""" Construct a DNS A record request and send it. """ from dns_message import Message import argparse def main(dns_address: str = '127.0.0.1') -> bytearray: """ Construct an A record request and send it. Parameters ---------- dns_address : str string of ipv4 address, set to 127.0.0.1 if n...
true
3e27442c4eedc893c729755d2aff084d52ae1872
abhitrip/scratchpad
/LeetCode/pythonSols/medianOf2Arrays.py
UTF-8
1,013
3.078125
3
[]
no_license
class Solution(object): def findMedianUtil(self,A,B,n): if len(A)>len(B): return self.findMedianUtil(B,A,n) if len(A)==0 and len(B)==0: return None if len(A)==0: return B[n-1] if n==1: return min(A[0],B[0]) k = n/2 pa =...
true
f4f9f11f7f0893398864f34ee40bc17f3ffbd23d
shu-gong/mouse-reward-system
/sound_find_threshold.py
UTF-8
8,014
2.6875
3
[]
no_license
import socket import time import threading import math import serial # Read i bytes from array as int def int_read_from_array(array, array_index, i): var_bytes = array[array_index:array_index + i] var = hex(int.from_bytes(var_bytes, 'little')) return var, array_index + i # Read i bytes from array as i c...
true
149b037d542b8a8260c9ea841c6f11f9b496310e
AdamZhouSE/pythonHomework
/Code/CodeRecords/2905/58634/281738.py
UTF-8
58
2.890625
3
[]
no_license
n = eval(input()) binary = "".join(n) print(int(binary,2))
true
e788bac233f453cc2bd9dd37f041918694d90584
NicolasBizzozzero/Competitive-Programming
/Contests/2017-11-07 - Battle Dev 10/exo2/exo2.py
UTF-8
368
3
3
[ "Unlicense" ]
permissive
N = int(input()) P = input() produits = [] for _ in range(N): produit, prix = input().split() prix = int(prix) produits.append([produit, prix]) minprix = None for produit, prix in produits: if (produit == P) and ((minprix is None) or (minprix > prix)): minprix = prix print(minprix) def mai...
true
8cfc87a920e172fd5bcd979309417fe5868623de
amymhaddad/solve_it
/daily_coding_problem/timestamps/timestamps.py
UTF-8
1,302
3.171875
3
[]
no_license
data_entries = [ {"timestamp": 10, "count": 5, "type": "enter"}, {"timestamp": 8, "count": 2, "type": "enter"}, {"timestamp": 6, "count": 0, "type": "enter"}, {"timestamp": 6, "count": 0, "type": "exit"}, {"timestamp": 8, "count": 1, "type": "exit"}, {"timestamp": 10, "count": 0, "type": "exit"}...
true
f702faa48bb468458fec0fa0da49ac52b5579f9a
YONGJINJO/Python
/Algorithm/Algorithm Level1/find_same_number.py
UTF-8
432
3.609375
4
[]
no_license
def find_same_number(some_list): numbers = [] for i in range(len(some_list)): if some_list[i] in numbers: return some_list[i] else : numbers.append(some_list[i]) # 코드를 쓰세요 # 중복되는 수 ‘하나’만 리턴합니다. print(find_same_number([1, 4, 3, 5, 3, 2])) print(find_same_number([4, 1, ...
true
7857a6a7d55e58f94e8c4bc74504a74a45beef5d
omigirish/Academic-Coding
/Python /Semester codes/libexceptionhandling.py
UTF-8
3,052
3.859375
4
[]
no_license
lib={"Python":4,"Java":4,"C++":5} reg={"Girish":["Python","Java"],"Sushant":[]} def addbook(lib): try: name = input("Enter the name of the book you wish to add: ") no=int(input("How many book to add?")) except TypeError: print("Invalid number by default 5 books added....") no=5 ...
true
af5e083c09ecc11d8a3afe0d9365835fa7c71e6a
abhih/ds-algo
/string_permutation.py
UTF-8
151
3.171875
3
[]
no_license
temp=0 def str_permute(val): if (val)==0: return "DOne" print(val) print(str_permute(val-1)) return val print(str_permute(2))
true
59219cf24651f49f4c4dc5e77309a030d5f6f2d2
SidneyKim/python-learning-examples-2018
/day 1 기초/data type 3.py
UTF-8
333
3.765625
4
[]
no_license
a = [0,1,1,2,3,4,5] print(a) print(type(a)) print(a[0:4:2]) a[0] = 100 print(a) a.append(999) print(a) a.insert(1,1000) a.remove(999) #a.pop(3) #index remove print(a) print(a.count(1)) print(len(a)) myList = [10,"abc",(1,2,3),False,3.14] print(myList) print(type(myList)) print(type(myList[2])) print(my...
true
ca8907d1374a08366ebeba63428e7ddbb0ffe64e
inteljack/EL6183-Digital-Signal-Processing-Lab-2015-Fall
/project/Examples/Examples/PP2E/System/App/Kinds/redirect.py
UTF-8
3,352
2.8125
3
[]
no_license
################################################################################ # App subclasses for redirecting standard streams to files ################################################################################ import sys from PP2E.System.App.Bases.app import App ############################################...
true
364f1f1822517dde920750fe64a537fb13b36d11
munichong/DomainClassification2017
/classification/__init__.py
UTF-8
1,618
2.546875
3
[]
no_license
import tensorflow as tf import numpy as np t = tf.constant([[0.6,0.2,0.3], [0.5,0.4,0.7]]) y = tf.placeholder(dtype=tf.int32, shape=[1, None]) # one_hot_mask = tf.one_hot(y, t.shape[1], on_value = True, off_value = False, dtype = tf.bool) # # a = tf.boolean_mask(t, one_hot_mask) ranked = tf.nn.top_k(t, k=3).indices...
true
67c0b70079250e122818885c74e22729971f59eb
imhardikj/git_test
/16_lists_remove().py
UTF-8
230
2.921875
3
[]
no_license
phones = [ 'apple', "samsung", 'moto', 'spice', 'lenovo' ] print (phones) phone = 'apple' phones.remove('apple') print (phones) message = "\nAn " + phone.title() + " phone is too expensive for me." print (message)
true
7d2079d72cdedc7cc369a755809d96628764b891
KJanos/pong
/teknos.py
UTF-8
2,914
3.359375
3
[]
no_license
import turtle #Ablak ablak = turtle.Screen() ablak.setup(width=800, height=600) ablak.bgcolor("black") ablak.title("PONG") ablak.tracer(0) #Bal oldali ütő bal_uto = turtle.Turtle() bal_uto.speed(0) bal_uto.shape("square") bal_uto.shapesize(stretch_wid=5, stretch_len=1) bal_uto.color("blue") bal_uto.penup() bal_uto....
true
ef7e5c4255e143566191d625e34f600a7738cb90
tommycarstensen/tc9
/plot/ibd_max.py
UTF-8
833
2.625
3
[]
no_license
import matplotlib.pyplot as plt from numpy.random import normal import gzip import sys import os path = sys.argv[-1] with gzip.open(path, 'rt') as f: for line in f: break d_max = {} for line in f: l = line.split() ID1 = l[0] ID2 = l[2] IBD = float(l[9]) try:...
true
9452bc2c47a1746c64d3f55fbcd50eb9044e6f0a
pankajan05/Python-Programming-Series
/Basics/Decision Making/File.py
UTF-8
498
3.875
4
[ "Unlicense" ]
permissive
if (500 == 500): print("Yes") if (500 == 500): print("Yes") else: print("No") if (400 == 500): print("Yes") else: print("No") var1 = 100 if (var1 == 500): print("Var1 is equal to 500") elif (var1 == 400): print("Var1 is equal to 400") elif (var1 == 300): print("Var1 is e...
true
97b4435043c637b4d8686f65a2f7feb1e973c383
simoncblyth/np
/tests/NPspawn_itemTest.py
UTF-8
590
2.5625
3
[]
no_license
#!/usr/bin/env python """ FOLD=/tmp/NPspawn_itemTest ipython -i NPspawn_itemTest.py """ import os, numpy as np if __name__ == '__main__': FOLD = os.environ["FOLD"] names = list(sorted(filter(lambda name:name.endswith(".npy"), os.listdir(FOLD)))) for idx in range(len(names)): name = names[idx] ...
true
e3106d16ca6713c6ed08a6134558b58af917f5d5
aver1001/github-practice
/programmers/Level 2/스킬 트리/solve.py
UTF-8
393
2.8125
3
[]
no_license
def solution(skill, skill_trees): cnt = 0 for i in skill_trees: pt = 0 for j in range (len(i)): if i[j] in skill: if i[j] == skill[pt]: pt += 1 else: break if j == len(i)-1: cnt += 1 ...
true
27a2d4dcf002845c74b92039027a782830441244
zx403413599/bitfinex_data
/Bitfinex_api1.py
UTF-8
18,097
2.765625
3
[ "MIT" ]
permissive
# 单线程Bitfinex历史价格数据爬虫(稳定但速度较慢) # 爬取全部的价格数据大概需要4-5小时 # 已连接数据库(MongoDB)自动储存 # 更新全部价格数据大概需要30分钟 import requests import json import time import pymongo import datetime class Bitfinex_api(object): def __init__(self, client_url='localhost'): self.__base_headers = { 'referer': 'https:...
true
31d8fb5441c6c0c3f15e7445c997828dea858c5b
HernanArango/image_processing
/tools/kernel.py
UTF-8
11,619
3
3
[]
no_license
from tools.convolucion import * import matplotlib.pyplot as plt import math import numpy as np #OTSU def otsu(img): hist = histogram(img) #trabajamos solo con los valores de Y (frecuencias) hist = hist[1] total_pixel = len(hist) total_value = 0 print("total_pixel",total_pixel) q1 = 0 q2 = 0 u1 = 0 u2 = 0...
true
d199291c9df91fa4511a7c652dd7d8f7d3436e0c
Aasthaengg/IBMdataset
/Python_codes/p02621/s140172497.py
UTF-8
49
3.3125
3
[]
no_license
a = int(input()) out = a + a**2 + a**3 print(out)
true
5e94ce6d11aa80894fec33ed50b4c2b641404250
IsseW/Python-Problem-Losning
/Uppgifter/1/1.7.py
UTF-8
491
4.15625
4
[]
no_license
""" Övning 1.7 - Hur många timmar, minuter och sekunder? Skriv ett program som ser ut så här när det kör. Kursiv stil innebär att användaren matar in. How many seconds? 4000 4000 seconds are 1 hours, 6 minutes and 40 seconds """ s = int(input("How many seconds? ")) m = s // 60 sec = s - m * 60 hours = m // 60 min =...
true
ed606a5f94c8a4707c330bcee602032eb0339a72
aishwaryalonarkar/Greed-game
/multiplayer_greed_game.py
UTF-8
4,877
3.21875
3
[]
no_license
import random #import tabulate global yn global val global for_i j=0 temp=0 val=0 score=[] def players(): global playerns,score playerns={} pln=int(input("Enter the number of players..")) for i in range (pln) : print 'Enter the name of player. ',i+1 name=raw_input("..") ...
true
25f3ccfa3fb4d2e2fd7bdfce4cad5e80bee56fe7
rafaelperazzo/programacao-web
/moodledata/vpl_data/40/usersdata/132/19540/submittedfiles/main.py
UTF-8
161
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import division import funcoes a=input('digite o a:') b=input('digite o b:') c=funcoes.soma(a,b) print(c) #COMECE AQUI
true
2fb77b92afcba02194386f0eda2ff525e23fd9d9
gongtian1234/easy_leetcode
/easyleetcode/leetcodes/Leetcode_024_Swap_Nodes_in_Pairs.py
UTF-8
1,235
3.78125
4
[ "Apache-2.0" ]
permissive
class ListNode: def __init__(self, x): self.val = x self.next = None def make_list(arr): head_node = None p_node = None for a in arr: new_node = ListNode(a) if head_node is None: head_node = new_node p_node = new_node else: p_...
true
e5ec1efeee9c08ac2268d30dde5f09b184cb8d3d
fwenzel/github-simple-backup
/github-simple-backup.py
UTF-8
1,711
3.015625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python import json import os import re import sys import urllib from subprocess import call # API URL to grab repository list REPO_LIST_API = 'https://api.github.com/users/%(username)s/repos?per_page=100' # github clone URL CLONE_URL = 'git://github.com/%(username)s/%(repo_name)s.git' # "Next" link reg...
true
fbaabd0b43df36db1ada357e8588c00609b7e5de
ShujiTamada/stochastic_process
/poisson_process/src/poisson_process.py
UTF-8
6,637
2.578125
3
[]
no_license
#poisson process class import sys sys.path.append("../src") sys.path.append("../data") sys.path.append("../fig") sys.path.append("../../main_folder/src/")#road a file import SDE_class as sde #road SDE_class file import importlib #funciton for doing reload import numpy as np from matplotlib import pyplot as plt i...
true
00e4f67ac0cac374023d20ca14692555ac003c0a
carl-phillips/PythonModule8
/venv/more_fun_with_collections/half_birthday.py
UTF-8
415
3.890625
4
[]
no_license
"""Carl Phillips, this program tells you your half birthday""" from datetime import datetime, timedelta def half_birthday(birthday): """ :param birthday: your birthday :return: your half birthday """ half_date = birthday + timedelta(6*365/12) print("Your birthday: " + str(birthday) + "\nYour ha...
true
a34e009a03d9258c3525a7dcd029b547940aa431
forkcodeaiyc/skulpt_parser
/run-tests/t534.py
UTF-8
381
2.9375
3
[ "MIT" ]
permissive
class U(object): def __repr__(self): return "<U>" def __pos__(self): return "pos" def __neg__(self): return "neg" def __invert__(self): return "invert" print(U()) print(-(U())) print(+(U())) print(~(U())) class E(object): def __repr__(self): return "<U>...
true
be99f37d9fc5bedbd34f91083f6a31968c2fb380
WookiePL/linear-dim-reduction
/reduction/results_metrics.py
UTF-8
3,515
2.859375
3
[]
no_license
import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix, f1_score, accuracy_score, cohen_kappa_score, classification_report, \ r2_score, mean_absolute_error, precision_score, recall_score from sklearn.pipeline import Pipeline from sklearn.prep...
true
355e9d64273ad4846a74bf8ba281e17bbaf5bcd2
owen6314/databass-public
/databass/compiler.py
UTF-8
5,364
3.21875
3
[]
no_license
from contextlib import contextmanager from collections import * from udfs import * class Indent(object): pass class Unindent(object): pass class Compiler(object): """ Defines helper functions to construct code blocks """ def __init__(self): self.var_ids = defaultdict(lambda: 0) self.lines = [] ...
true
01cd8893db5e21e8a5ffd8404697d4cab625a999
ramyasutraye/pythonprogrming
/play3.py
UTF-8
120
3.328125
3
[]
no_license
number = int(raw_input()) rev=0 while number>0: rem=number%10 rev=rev*10+rem number=number/10 print rev
true
e4e1d10af690d840b26c4380fae10451a177eeae
AqVScipio/Sudoku
/Entities/Window.py
UTF-8
381
3.265625
3
[]
no_license
import pygame class Window: def __init__(self, width, height): self.__width = width self.__height = height self.__window = pygame.display.set_mode((self.getWidth(), self.getHeight())) def getWidth(self): return self.__width def getHeight(self): return self.__he...
true
8f4f67808f4d1299f41fdbf1a8811e5a961e73e3
huguesvinzant/CMC
/Project3/Webots/controllers/pythonController/solvers.py
UTF-8
574
3.421875
3
[]
no_license
"""ODE solvers using fixed step integration""" def euler(ode, timestep, time, state, *parameters): """ODE solver with euler method""" return timestep*ode(time, state, *parameters) def rk4(ode, timestep, time, state, *parameters): """ODE solver with Runge-Kutta method""" k_1 = timestep*ode(time, stat...
true
1807066871f16e3dec0d12519c4db417aea91a59
theatamna/PFE
/models/GIN_model.py
UTF-8
6,995
2.859375
3
[]
no_license
import sys sys.path.append("models/") import torch import torch.nn as nn import torch.nn.functional as F from layers import * # Setting up the default data type use_cuda = torch.cuda.is_available() FloatTensor = torch.cuda.FloatTensor if use_cuda else torch.FloatTensor device = torch.device('cuda') if use_cuda else t...
true
ea533ddafcdd043741477733c808c5b98c5454fe
paulproteus/django-assets
/django_assets/merge.py
UTF-8
16,394
2.78125
3
[ "BSD-2-Clause" ]
permissive
"""Contains the core functionality that manages merging of assets. """ import os import cStringIO as StringIO import urlparse from django.utils.datastructures import SortedDict from django_assets.conf import settings from django_assets.updater import get_updater from django_assets.bundle import Bundle, Bu...
true
e16856571d49be933f0760c48ddb0bb01c7df6d4
victorfengming/python_projects
/history_pro/python_January/python05/象棋demo.py
UTF-8
2,518
3.140625
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # coding by xiaoming ''' 定义两个数组,一个用户一个,列表一个16个元素,二维列表,每个元素存储位置信息,如果被吃掉,位置越界,走子规则在判断验证模块单独验证,输入数之前要加格式验证模块,循环进入win校验模块判断输赢 ''' zili = ''' 0 1 2 3 4 5 6 7 8 0车 马 相 士 将 士 相 马 车 1 2 炮 炮 3兵 兵 兵 兵 兵 4 5 6卒 卒 卒 卒 卒 7 炮 ...
true
09b48b7975d1661ab90241750cd4c6c4477d06e4
nargo0o/python
/hw1.1.py
UTF-8
623
4.15625
4
[]
no_license
# Поработайте с переменными, создайте несколько, выведите на экран, запросите у пользователя несколько чисел и строк и сохраните в переменные, выведите на экран. name = input('Ваше имя?: ') print(type(name)) mobile_number = int(input('Номер телефона: ')) print(type(mobile_number)) weight = float(input('Ваш вес?: '))...
true
ea091b65db6c614ed7dfbfec27d08e004dd65699
afq984/pyardrone
/pyardrone/utils/__init__.py
UTF-8
1,344
3.453125
3
[ "MIT" ]
permissive
''' Utility functions ================= ''' import struct import time def repack_to_int(value): ''' Converts the passed in float *value* to interger as ieee754 specification. Same as *\*(int\*)&value* in C, or *reinterpret_cast<int>value* in C++. ''' return struct.unpack('i', struct.pack('f', v...
true
6638276a67709c7a8734908306d5ff93ef345149
sleeva321/reddy4
/vow4.py
UTF-8
210
3.34375
3
[]
no_license
ch=str(raw_input()) if ch in ['a','e','i','o','u']: print"Vowel" elif ch in ['b','c','d','f','g','h','j','k','l','m','n','p','q','s','t','v','w','x','y','z']: print"Consonant" else: print"invalid"
true
2940a42a0c79decfd8e959a407229597d2ab4c44
webclinic017/connect
/server/api/tests/test_portfolios.py
UTF-8
1,336
2.59375
3
[]
no_license
""" To run the tests in a Docker container: ``` $ container_id=$(docker-compose ps -q server) $ docker exec -it $container_id python manage.py test api.tests ``` To run a single test: ``` $ docker exec -it $container_id python manage.py test \ api.tests.test_portfolios.PortfolioTestCase.test_fetch_portfolio ``` ...
true
e04b2b2b87934693f4c4a92fa68340b40d5517f3
yeonnex/mypyproject
/mypyproject/examples/run.py
UTF-8
426
2.765625
3
[]
no_license
from mypyproject.paths import TEXT_PATH def main(): with open(TEXT_PATH, 'r',encoding='UTF-8') as fh: text = fh.read() print(text) # 이렇게 하면, 굳이 경로를 또 입력하지 않아도 # 미리 코딩되어있는 경로를 찾아와서 파일을 읽기 때문에 # 매우 편리하다! # '안녕!' 이라는 텍스트가 잘 출력되는 것을 볼 수 있다. if __name__ == '__main__': main()
true
c18b417cddff48e2e4b6fafb82f10e267ea9d75d
rickarter/snake
/main.py
UTF-8
599
3.078125
3
[]
no_license
import pygame from control import Control from snake import Snake from fruits import Fruits pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption('Snake') control = Control() snake = Snake() fruits = Fruits() while control.flag_games: if not control.flag_pause: control.contr...
true
095d7e2e39df124a1f1e626e151793dbd9a8a9a8
sheoranjs24/grad-school
/CSC586C-data-science/sentiment-analysis-tweets/happiest_state.py
UTF-8
4,954
2.546875
3
[]
no_license
#!/usr/local/bin import sys import string import json def main(): sent_file = open(sys.argv[1]) tweet_file = open(sys.argv[2]) states_dict = {'AL':0, 'AK':0, 'AZ':0, 'AR':0, 'CA':0, 'CO':0, 'CT':0, 'DE':0, 'FL':0, 'GA':0, 'HI':0, 'ID':0, 'IL':0, 'IN':0, 'IA':0, 'KS':0, 'KY':0, 'LA':0, 'ME':0, 'MD':0, 'MA...
true
b8f0802a4da2fe5fb545c017abebc10eba5c6305
sekhar0146/Python-for-ML
/Eval_metrics_using_sklearn.py
UTF-8
2,523
3.203125
3
[]
no_license
import numpy as np import pandas as pd # heart_disease = pd.read_csv('C:/Users/Desktop/ML/input/heart-disease.csv') #===================================================================== # Different evaluation metrics using scikit learn # Classification evaluation metrics #================================...
true
a6c969e4e05a935ce81629700c9a2faf646d701a
ZhaoHuiXin/MachineLearningFolder
/Part 2 - Regression/Section 6 - Polynomial Regression/polynomial_regression_mine.py
UTF-8
3,351
3.78125
4
[]
no_license
## Polynomial Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') # 这里等级对应的就是不同的职位,两者是等价的;所以并不需要把职位包含在自变量里面 # X must be a matrix X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].value...
true
ab8c86624dce66f54bbb719fb221541315894e07
call-cc/junkfooder
/plugins/wttr.py
UTF-8
2,710
3.046875
3
[]
no_license
import re import requests import plugin def wttr(irc, user, target, msg): nick = user.partition('!')[0] items = msg.split(' ') if len(items) <= 1: city = "Budapest" else: city = "+".join(items[1:]) reply = Wttr().get_wttr(city, nick) irc.msg(target, reply) plugin.add_plugi...
true
f160a2a7c5cef3e792945a605faf4f8c5bb13c06
zhuligs/physics
/calculate_tetragonal_from_rs.py
UTF-8
674
3.484375
3
[]
no_license
#!/usr/bin/env python # backlib.py import math def main(): # constants a0 = 5.291772108E-09 # Bohr radius in cm pi = math.pi # inputs Rs = input('For what value of Rs would you like the box? ') N = input('How many particles are there in your box? ') ratio = input('What is the c/a ratio? ...
true
b287860ec622260e3f9a761d2b719df4515e1b21
huachao2017/goodsdl
/goods2/convert_goods.py
UTF-8
22,985
2.515625
3
[ "Apache-2.0" ]
permissive
r"""and converts Step1 data to TFRecords of TF-Example protos. This module reads the files that make up the goods data and creates two TFRecord datasets: one for train and one for test. Each TFRecord dataset is comprised of a set of TF-Example protocol buffers, each of which contain a single image and label. The scri...
true
5b0dee1815cee7eeadc8b2260153698222f0299f
Lushi100999/Lab02
/sumas.py
UTF-8
35
3
3
[]
no_license
a = 6 b = 2 suma = a+b print(suma)
true
9217cac63e011b68e39594a1354ce5fd992906bd
AlexHamburg/Webscrapping_Python
/GIS_py/GIS.py
UTF-8
2,176
3.046875
3
[]
no_license
import folium import pandas as pd import json # Create map with light background map = folium.Map(location=[53.551086, 9.993682], zoom_start=11, tiles="Mapbox Bright") # Get a csv with prices prices = pd.read_csv("Hamburg_prices.csv", encoding="latin1") # Max price in the city - as param for color max_price_hamburg ...
true
d56f82fabdf8fbef45208951cd1013a02b457495
minhpvwh/pytorch-learn
/VOC - SSD300/test.py
UTF-8
322
2.734375
3
[]
no_license
import torch # X = torch.rand([3, 4]) # Y = torch.rand([3, 4]) # w, h = X.shape # print(w, h) # # # dim_0 = torch.cat([X, Y], dim=0) # print(dim_0) # dim_1 = torch.cat([X, Y], dim=1) # print(dim_1) Y = torch.tensor([[0.8000, 0.5587, 0.0972], [0.8000, 0.3000, 0.6500]]) print(torch.clamp(Y, min=0.5))...
true
62b001032dcc8bcadfcad0309fecf78eef6c716f
Checking20/BO_DQN
/dqn.py
UTF-8
4,275
3.109375
3
[]
no_license
import numpy as np import keras class DQN(object): def __init__(self, n_actions, n_features, learning_rate=0.01, reward_decay=0.9, e_greedy=0.9, memory_size=1000, batch_size=32, ...
true
490952278c2b12d73398c1571e17172f40e994a7
rickyfernandez/hartnel-summer-course
/Examples/potential.py
UTF-8
1,016
3.15625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt # create charee with value q and position x, y np.random.seed(0) q = np.random.uniform(-1, 1, 10) x = np.random.uniform(0, 1, 10) y = np.random.uniform(0, 1, 10) # create grid X = np.linspace(0.0, 1.0, 100) X, Y = np.meshgrid(X,X); Y = np.flipud(Y) # go through all ...
true
d52a5c8c1b351dd558d3e31fe3f4da928e1fd99d
EoinGr3y/codeAbbey
/insertionSort/insertionSort.py
UTF-8
1,622
3.171875
3
[]
no_license
import time input = [83, 11, 196, 125, 119, 141, 160, 86, 8, 192, 54, 64, 176, 146, 131, 157, 136, 163, 49, 180, 6, 68, 164, 181, 48, 194, 173, 84, 156, 166, 92, 98, 33, 47, 183, 41, 39, 38, 104, 16, 36, 172, 120, 198, 22, 100, 4, 89, 65, 184, 137, 59, 158, 21, 187, 76, 79, 112, 114, 152, 56, 168, 178, 90, 162, 94, 52...
true
68095dd5f1c49a1bbf17434b187c417ac632b609
shibataka000/euler-python
/problems/problem004.py
UTF-8
236
3.015625
3
[]
no_license
# coding: utf-8 import itertools import math_ext def solve(): seq = itertools.combinations(range(100, 1000), 2) seq = map(lambda x: x[0] * x[1], seq) seq = filter(math_ext.is_palindromic_number, seq) return max(seq)
true
9bf1c759b5f53771666688f0f972fbd0a8dc0759
uvula6921/algorithm_prac
/baekjoon_marathon/12_4948.py
UTF-8
1,160
3.828125
4
[]
no_license
# 에라토스테네스의 체 (소수 리스트를 알아낼때 좋음) # while True: # start = int(input()) # if start == 0: # break # n = start * 2 + 1 # sieve = [True] * n # m = int(n ** 0.5) # for i in range(2, m + 2): # if sieve[i] == True: # for j in range(2*i, n, i): # sieve[j] = False # print(len(list(filter(lamb...
true
fb7839d89cce42bd09adcd928d48ed1d6bf9431d
JennieOhyoung/interview_practice
/reverse_string.py
UTF-8
1,180
4
4
[]
no_license
# 1. Write a function "rev_str" that takes string and reverse. # 1b. Takes string of words, reverse order or words string = "christmas" def reverse(string): l = list(string) temp = 0 for i in range(len(l)/2): temp = l[-1-i] l[-1-i] = l[i] l[i] = temp print l "".join(l...
true
42b7456acfccd8b7f775c99127824e859ddf7d92
dhnanj2/TS-Codes
/rot13.py
UTF-8
633
3.296875
3
[]
no_license
alphabets_list = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" def rot13_encrypt(plain_text) : encrypted_text=[] for alphabet in plain_text : if alphabets_list.find(alphabet) < 26 : encrypted_text.append(alphabets_list[(alphabets_list.find(alphabet) + 13) % 26]) else : ...
true
a800020d4f725f4d9d389a6e3d720202dd83e1a8
ios96i/Machine-Learning-Basics
/2.classification/1.logistic Regression/try.py
UTF-8
215
2.796875
3
[]
no_license
import requests from bs4 import BeautifulSoup res = requests.get('https://automatetheboringstuff.com/chapter7/') soup = BeautifulSoup(res.text, 'html.parser') print(soup.find('div', { "class" : "book" }).text)
true
b2945c4269232f88c659853d7ae49f24a36cae6c
ei1994/opencv_practices
/histograms3.py
UTF-8
1,517
2.859375
3
[]
no_license
import cv2 import numpy as np ''' 反向投影,根据颜色直方图和模板检测图像中像素值, 实现图像分割、背景与图像分离 ''' roi = cv2.imread('images/roi.jpg') hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV) target = cv2.imread('images/apple.jpg') hsvt = cv2.cvtColor(target,cv2.COLOR_BGR2HSV) # calculating object histogram roihist = cv2.calcHist([hsv],[0, 1], None, [180,...
true
3c395b20e3f07e79df36fb588d0980d3435ed632
AshTiwari/Standard-DSA-Topics-with-Python
/Array/Array_Max_Sum_of_Contiguous_Subarray.py
UTF-8
2,003
3.765625
4
[]
no_license
# Maximum sum of a contiguous subarray of any length: from time import time # step 1: remove left_negative_subarray and right_neg_subarray if any. # Array now contains left_positive mid_negative (if any) and right_positive # step 2: cal sum of left_positive_subarray and store as global maximum. # step 3: add mid_ne...
true
4b0e031de672f50d48fdaa2536db5cac54d77429
lsindoni/VAEMusings
/blocks.py
UTF-8
1,477
2.65625
3
[]
no_license
import keras.backend as K from keras.models import Model from keras.layers import Input, Dense, Lambda, concatenate # - def combined_inputs(dx, dy): """concatenate""" inputs = [Input(shape=(dx,)), Input(shape=(dy,))] return Model(inputs, concatenate(inputs)) # - pick two layers and return the two concatenated and t...
true
8602ae34c037a4dcb85923a25deec2939bdb7eb8
anubhavc9/text-editor
/text_editor.py
UTF-8
8,882
2.90625
3
[]
no_license
from tkinter import * import tkinter.filedialog as tk import tkinter.messagebox as tk2 import os from datetime import date text_size = 16 # default text size text_style = "Helvetica" # default text style class Application(Frame): def __init__(self, master): super(Application, self).__init...
true
c29c28ddc6bf12798b31a3c8b291484cd850f484
wo-shi-lao-luo/Python-Practice
/LeetCode/Partition Array Into Three Parts With Equal Sum.py
UTF-8
1,544
3.859375
4
[]
no_license
# Given an array A of integers, return true if and only if we can partition the array into three non-empty parts with equal sums. # # Formally, we can partition the array if we can find indexes i+1 < j with (A[0] + A[1] + ... + A[i] == A[i+1] + A[i+2] + ... + A[j-1] == A[j] + A[j-1] + ... + A[A.length - 1]) # # # # Exa...
true
e9e76a6593c11124366a8489ff0fd1452679e997
tommyconner96/cs-sprint-challenge-hash-tables
/hashtables/ex3/ex3.py
UTF-8
598
3.53125
4
[]
no_license
def intersection(arrays): index = {} result = [] for a in arrays: for i in a: if i not in index: index[i] = 0 else: index[i] = 1 for k, v in index.items(): if v == 1: result.append(k) else: pass ...
true
f56284965060ca334dbb7e63008be9c694d797f3
kampfer/captcha-cracker
/crack_captcha.py
UTF-8
1,852
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- from PIL import Image import numpy as np # 打开图片 img_name = 'captcha/1.jpg' img = Image.open(img_name) w, h = img.size # 二值化 # https://pillow.readthedocs.io/en/4.2.x/handbook/concepts.html#concept-modes # http://blog.csdn.net/jia20003/article/details/8074627 img = img.convert('L') imgData = li...
true
70d38f8bd31eb572a9d2a2242467771fe01e5de2
zg-mixon/PythonCrashCourse
/Chapter5if.py
UTF-8
1,655
4.53125
5
[]
no_license
# If statements chapter. Basic example below cars = ['audi', 'bmw', 'subaru', 'toyota'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title()) # When checking for truthiness you can use python's built in string manipulation to ignore case discrepancies car = 'Audi' if ...
true
1fd7ddf8129021833f97d61e95077f67cd1550e2
EruDev/Python-Practice
/菜鸟教程100例/55.py
UTF-8
80
3.125
3
[]
no_license
# 题目:学习使用按位取反~。 a = 234 b = ~a print(b) a = ~a print(a)
true
6772c15070fe13e657b5e1250c7a358cf1a445cd
wang1365/algorithm-practice
/ml/normalequation.py
UTF-8
345
3.625
4
[ "MIT" ]
permissive
import numpy as np X = [[0, 1, 3], [1, 2, 3], [4, 5, 6], [1, 4, 5]] y = [11, 14, 31, 24] def fun(x1, x2, x3): return x1 + 2 * x2 + 3 * x3 X = np.asmatrix(X) y = np.asmatrix(y).T # Normal Equation: (XT * X)**-1 * XT * y ne = (X.T.dot(X) ** -1) * X.T * y print(ne) print(fun(1, 2, 3)) print(1 * ne[0][0] + 2 * ...
true
60042199df82cb525ef49c2ea4d7edfa9ba591b1
JeysonAc/machinelearning-az
/Exercises/PreprocessingTest.py
UTF-8
1,376
3.046875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed Feb 12 21:24:14 2020 @author: Jeyson """ #1. Importar librerias import numpy as np import pandas as pd import matplotlib.pyplot as plt #2. Cargar el Dataset datasetTest = pd.read_csv("..\datasets\Part 1 - Data Preprocessing\Section 2 -------------------- Part 1 - Data Prep...
true