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 |
|---|---|---|---|---|---|---|---|---|---|---|
515c14a71465446747f3cf19904e3a119beb253c | BackupGGCode/pyopencv | /demo/capture-cam.py | UTF-8 | 2,396 | 3.171875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# OpenCV's Python demo
# -- adapted by Minh-Tri Pham to work with pyopencv
import sys
# import the necessary things for OpenCV
from pyopencv import *
#############################################################################
# so, here is the main part of the program
if __name__ == '__main_... | true |
abfc67442ae65997af8883d2c2b045a9e3830687 | mooselau/EasyMap_Project | /test_json.py | UTF-8 | 574 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json, csv
import urllib2
data_file = open('glasgow-libraries.json')
data = json.load(data_file)
print data[0]['Facillity name ']
# print "All done!"
# url = "https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA"
# f = urllib2.urlopen... | true |
321475a2f460417ec243b3c949213e3875bf631f | Caius-Lu/latest | /excises/cnn_mnist.py | UTF-8 | 4,267 | 3.0625 | 3 | [] | no_license | # _*_ coding: UTF-8 -*-
import numpy as np
import tensorflow as tf
# 下载 并载入MNIST手写数据库(55000*28*28)
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('mnist_data',one_hot=True)
# one_hot 独热码的编码 (encoding) 形式
# 0,1,2,3,4,5,6,8,9,10
# 0:10000000000
# 1:01000000... | true |
faab7ef24eb55cd5fccc42b1759cdb75c300ad66 | shanekang/Baekjoon_Algorithm_study_01 | /별 찍기-10.py | UTF-8 | 1,000 | 3.59375 | 4 | [] | no_license | N = int(input()) #N은 3의 거듭 제곱만 input으로 받는다(3, 9, 27, ...)
star = []
for _ in range(N):
star.append(["*" for _ in range(N)])#별을 N개만큼 N번 star 리스트에 넣는다 예) 3일시 ['*','*','*'],['*','*','*'],['*','*','*']
divide = N
cnt = 0
while divide != 1:
divide /= 3 #3의 거듭 제곱임으로 3으로 나누어 지지 않을 때까지 즉 1이 될 때까지 cnt를 센다
cnt += ... | true |
21434b4d5dcf1c841da63ce8791e302450f0b9ec | brentyi/fannypack | /tests/utils/test_math.py | UTF-8 | 7,216 | 2.6875 | 3 | [
"MIT"
] | permissive | import fannypack.utils
import numpy as np
import torch
def test_cholesky_inverse():
"""Checks that our Cholesky inverse matches `torch.cholesky_inverse()`."""
torch.autograd.set_detect_anomaly(True)
batch_dims = (5,)
matrix_dim = 3
L = fannypack.utils.tril_from_vector(
torch.randn(
... | true |
c31637333033855c6cce77f09b92e70ae7733e9a | urbanisaziya/Python | /week3/76.py | UTF-8 | 157 | 3.078125 | 3 | [] | no_license | n = int(input())
x = float(input())
k = 0
i = 1
while i < n + 1:
a = float(input())
k = (k + a) * x
i += 1
a = float(input())
f = k + a
print(f)
| true |
2d7ebad96b861ef8caf7e3e45eb8a33fa4a098ad | OrchidRock/projecteuler | /18-MaxiumPathSum/MaxiumPathSum.py | UTF-8 | 1,262 | 2.578125 | 3 | [] | no_license | triangle = [75,
95,64,
17,47,82,
18,35,87,10,
20,4,82,47,65,
19,1,23,75,3,34,
88,2,77,73,7,63,67,
99,65,4,28,6,16,70,92,
41,41,26,56,83,40,80,70,33,
41,48,72,33,47,32,37,16,94,29,
53,71,44,65,25,43,91,52,97,51,14,
70,11,33,28,77,73,17,78,39,68,17,57,
91,71,52,38,17,14,91,43,58,50,27,29,48,
63,66,4,68,89,53,67,30,73,16,... | true |
cf5ee14245ed8d8c80a80a8f9e45f7aa55aa63d9 | zstarling131227/1905 | /month05/code/datascience/day07/demo06_filter.py | UTF-8 | 2,186 | 3.046875 | 3 | [] | no_license | """
demo06_filter 傅里叶频域滤波
"""
import numpy as np
import numpy.fft as nf
import matplotlib.pyplot as mp
import scipy.io.wavfile as wf
# 读文件 采样率(每秒采样个数) 每个采样位移值
sample_rate, sigs = wf.read('../da_data/noised.wav')
sigs = sigs / (2 ** 15)
# sigs /= 2 ** 15
# print(sample_rate) # 一秒钟采样44100个点
# print(sigs, sigs.shape) #... | true |
3bf1ffb063c4e0a1a664855803a5662ddb682fe2 | wantie/ctr | /deep_fm.py | UTF-8 | 4,107 | 2.578125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow import keras
import pandas as pd
from sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV, StratifiedKFold
from callbacks import RocCallback
import numpy as np
import sys
# field_info : [ field_i_len, ]
class FmCrossLayer(keras.layers.Layer):
def __... | true |
363dd8cd9ffeaa328c456fa89731cee3b5d9896c | Sirpent360/Birthday_Palindrome | /time.py | UTF-8 | 1,070 | 4.03125 | 4 | [] | no_license | import datetime
from capot import number_to_list
birth = datetime.date(1977, 5, 30)
def lived_days(birth):
today = datetime.date.today()
lived = (abs(today - birth))
return lived.days
def dummy_palindrome(lived_days):
result = number_to_list(lived_days)
return result
# today = datetime.date.t... | true |
d4dab283badc84ee71b5c8596ee4de7c1c2243a9 | Ben-Oren/Tourney-Madness | /data_cleaning.py | UTF-8 | 9,145 | 3.09375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import json
#get data
with open('test.json') as data_file:
data = json.load(data_file)
df = pd.DataFrame(data)
#remove N/A rows that were buffers in original data
#what do those rows look like?
# 'game number' serves as index per team per season, look at game number variable
... | true |
bfa5cd751dca102c97812cfdf6301da230709433 | lauflabs/PubMedPortable | /plots/bar_chart/create_bar_chart.py | UTF-8 | 3,687 | 3.125 | 3 | [
"ISC"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright (c) 2015, Kersten Doering <kersten.doering@gmail.com>
This script generates a bar chart with three columns showing the timelines from the files provided by the script get_years.py (default). The script get_years.py sends a query to the PubMedPortable ... | true |
240a863ffc667cee64ba268573c3195a3ece93e2 | osamadel/Python-Online-Courses | /MITx6001/Midterm/problem5.py | UTF-8 | 368 | 3.90625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 14 09:56:08 2016
@author: Osama
"""
def dotProduct(listA, listB):
'''
listA: a list of numbers
listB: a list of numbers of the same length as listA
'''
result = 0
for i in range(len(listA)):
result += listA[i] * listB[i]
return result
... | true |
8e6cb311d756e03b92e1562dde24952a3c88c1c1 | Yosh666/PythonMaison | /devinettes.py | UTF-8 | 343 | 3.875 | 4 | [] | no_license | import random
nombre=random.randint(1,20)
deviner= int(input("Je pense un nombre entre 1 et 20. Lequel est ce? "))
while deviner!=nombre:
if deviner<nombre:
print ("ton nombre est trop bas")
else:
print("ton nombre est trop haut")
deviner= int(input("Essaie à nouveau"))
print ("Félicitatio... | true |
9af5373b9ba1169951212ff6d5ea7b0a4e447599 | thbkrkr/iot-push-examples | /Python/python-client-http.py | UTF-8 | 1,650 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | ###########################################################
# OpenTSDB REST API session in a HTTPS connection example #
###########################################################
import json
import urllib2
import urllib
import base64
# Place your token id here
token_id = 'w3eaaaqaa7pff'
# Place your token here
toke... | true |
7a43569c27b4ac6978323ee45b28ff8af2c9a797 | CuriosityLabTAU/social-aware-sensor-package | /scripts/curious_microphone.py | UTF-8 | 1,029 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from subprocess import Popen, PIPE
from std_msgs.msg import Int32
sudo_password = '1234567'
command = 'python microphone_tuning.py'.split()
def read_microphone():
p = Popen(['sudo', '-S'] + command, stdin=PIPE, stderr=PIPE, universal_newlines=True, stdout=PIPE)
(output, err... | true |
8c8b094564acfc5ffa4da9e2b4b130e8c697705d | Ori-Roza/WeatherPredictor | /dataset_generator.py | UTF-8 | 460 | 2.796875 | 3 | [
"MIT"
] | permissive | from data_collector import DataCollector
def create_datasets():
dataset = [["date", "min_temp", "max_temp", "avg_temp", "season_association"]]
collector = DataCollector()
collector.fetch_data_to_db()
for temp in collector.db.collection.find().sort("date"):
dataset.append([temp["date"], float(t... | true |
073647a280351485c87124a3b1907d124e572617 | dbunina/py_15_3.6 | /src/temps.py | UTF-8 | 632 | 3.09375 | 3 | [] | no_license | from zeep import Client
from file_utils import parse_records
TEMP_SERVICE_URL = 'https://www.w3schools.com/xml/tempconvert.asmx?WSDL'
def get_avg_temp(source_file):
source_temps = [int(row[0]) for row in parse_records(source_file)]
average_temperature = sum(source_temps) / len(source_temps)
return '{0:.... | true |
2701d6c5d752065e7ed6c0cb2b1a6bfb17911187 | MicroKnight11/Genetic-Algorithm | /source.py | UTF-8 | 5,087 | 3.078125 | 3 | [] | no_license | # Genetic Algorithm
# import math
from random import choices, randint, uniform
from typing import List
import numpy as np
import pandas as pd
from math import sqrt
# typing
Nilai_saham = List[int]
Kromosom = List[int]
Populasi = List[Kromosom]
# global variabel
max_pop = 100
max_generation = 1000
def generate_kro... | true |
2876e9dabeabcecd0f22ced8080c2e96de647054 | RAbraham/mercylog | /mercylog/abcdatalog/ast/greater_than_predicate.py | UTF-8 | 719 | 3 | 3 | [] | no_license | from mercylog.abcdatalog.ast.term import Term
from mercylog.abcdatalog.ast.premise import Premise
from typing import *
class GreaterThanPredicate(Premise):
def __init__(self, left: Term, right: Term):
self.left = left
self.right = right
super(GreaterThanPredicate, self).__init__()
def... | true |
2dc12c3ce22c54c8eea67b615b420de166e97d30 | obertino/DS18B20_CalibAnalysis | /calib.py | UTF-8 | 1,864 | 2.53125 | 3 | [] | no_license | #plot and fit calibration data with an exponential function
import ROOT as r
from ROOT import kBlack, kBlue, kRed
import math
from array import array
import sys
import commands
nsensors=int(sys.argv[1])
r.gROOT.Reset()
r.gROOT.SetStyle("Plain")
c=r.TCanvas("c","c",600,400)
t=r.TLatex()
for i in range( nsensors ):
... | true |
53495a33ad36a6adf2418f50109de8c28298afdb | ChesleyTan/Advent-of-Code | /2015/24c.py | UTF-8 | 1,350 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
import operator
from itertools import combinations
data = open(__file__[:-3]+ '.txt', 'r').read().split('\n')[:-1]
packages = []
for line in data:
packages.append(int(line))
#packages = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11]
print packages
balance_weight = sum(packages) / 4
min_passenger_packages = None... | true |
9ecc48bd2d4259d0ec4bcf0c93ade0e65473b4ee | amasend/SIR-simulation-IBM-ESI | /simulation/container.py | UTF-8 | 7,909 | 3.25 | 3 | [
"MIT"
] | permissive | __all__ = [
'Container',
]
from simulation import container_interface as con_int
import random
import itertools
class Container(con_int.ContainerInterface):
"""
Container class is wrapper for simulation and play ground from
representation SIR model based classes.
Parameters
----------
s... | true |
84f59ccb2229c21f9ef52bdab63b8e465cacc2a0 | LxKxC/xuanhun-python | /1.3/test.py | UTF-8 | 351 | 4.125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
print("作业:")
#创建list
print("创建list.......")
list1=["a","b","c","d"]
print(list1)
print(list1[::-1])
list1=[1,2,3,4,5]
print(list1)
list1.sort(reverse=True)
print(list1)
s1="Hello Xuanhun!"
print("s1=\"Hello Xuanhun!\"")
print(s1)
print("print(s1.replace(\"Xuanhun\",\"KC\")):")
print(s1.repla... | true |
5d728c84f36c94a9675c5442805ea8109a51f5c2 | DW-Neumann/Python_Project | /main.py | UTF-8 | 1,242 | 3.59375 | 4 | [] | no_license | """
Python WebScraping Project
Written by: Wil Neumann, Charlie Walker, and Keevin Lane
12/15/19
A Program designed to scrape the web for esport player data for the games League of Legends,
Destiny2, DotA2, and Rainbow 6 Siege in order to apply a weighted scoring system to player
performances for use in fantasy... | true |
891a60c373259ca75a9fce90cb44d37712a1c03a | dpkp/kafka-python | /kafka/metrics/metric_name.py | UTF-8 | 3,419 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import absolute_import
import copy
class MetricName(object):
"""
This class encapsulates a metric's name, logical group and its
related attributes (tags).
group, tags parameters can be used to create unique metric names.
e.g. domainName:type=group,key1=val1,key2=val2
Usage l... | true |
fe5e29932cc87ac25de94c60a6ea48b038713938 | JingkaiTang/github-play | /first_case_and_group/thing/last_life_or_number/group/able_person_and_old_part.py | UTF-8 | 266 | 2.875 | 3 | [] | no_license |
#! /usr/bin/env python
def good_number_or_little_person(str_arg):
case_and_eye(str_arg)
print('ask_high_time_to_place')
def case_and_eye(str_arg):
print(str_arg)
if __name__ == '__main__':
good_number_or_little_person('different_place_or_point')
| true |
f68c393c7333402f133b6aa942e0f74673ec054a | mashinakatherina/Strange_stuffs_made_out_of_boredom | /img_cropp.py | UTF-8 | 308 | 3.140625 | 3 | [] | no_license | from PIL import Image
left = int(input("From left: "))
right = int(input("From right: "))
up = int(input("From up: "))
down = int(input("From down: "))
img_path = str(input("Your path: "))
open_img = Image.open(img_path)
cropped_img= open_img.crop((left,up,right,down))
cropped_img.save('r1')
| true |
6bc2c5507db0ba53a9814eb81ba7215689c48be4 | dscarbro21/csm-physics-pythonHelp | /chapters/chapter1-2/code/chapter2/section2/printIntro.py | UTF-8 | 1,049 | 4.125 | 4 | [] | no_license | print("print function basics:")
print("Each statement prints on a new line")
print("unless I tell it not to with the end= ", end="")
print("parameter")
print("- Because by default end is set to a newline")
print()
print("an empty print still uses the default end parameter")
print()
print("I can end with spaces", end... | true |
1875378c3cea7272b9aa40ed1aa76d9cd95875e3 | noootown/NCTU_NLP | /hw1/Q1.py | UTF-8 | 1,478 | 2.875 | 3 | [] | no_license | import math
import re
import json
from collections import defaultdict
def tf(word, blob):
return sum([word == w for w in blob])
def n_containing(word, bloblist):
return [word in blob for blob in blobList]
def idf(word, bloblist):
return math.log10(len(blobList) / (1 + n_containing(word, bloblist)))
if __name_... | true |
9ce27f4ec9c241c4513e91cbbdf477f7c1d21944 | ToucanToco/peakina | /peakina/helpers.py | UTF-8 | 6,949 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | """
This module provides mainly methods to validate and detect
the type (CSV, Excel...), the encoding and the separator (for CSV) of a file.
It's also where the reference of all supported types is done.
In order to support a new type, you need to create a reader in the `readers`
package and add the MIME types and the n... | true |
1001c8a4ce99b73565e0b332d7064024be6da858 | allwak/algorithms | /Sprint12/Theme1/1b.py | UTF-8 | 2,514 | 3.421875 | 3 | [] | no_license | """ B. Любители конференций
Все языки Node JS 8.16
Ограничение времени 0.08 секунд 0.1 секунда
Ограничение памяти 39Mb 64Mb
Ввод стандартный ввод или input.txt
Вывод стандартный вывод или output.txt
На IT-конференции присутствовали студенты из разных вузов со всей страны. Список студентов представлен в таблице. В коло... | true |
fd4d7be384451b61b0aef62f0f4bef1ba17809a7 | noamfluss42/sprint2 | /image_recognition/try_cv2.py | UTF-8 | 174 | 2.671875 | 3 | [] | no_license | import numpy as np
import cv2
# Load an color image in grayscale
img = cv2.imread('a.png', 0)
print(type(img))
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows() | true |
c94c74746b626ec8858dac11069e9c2a8368362b | frankcheng1991/master | /cheat sheet file/Test.py | UTF-8 | 24,176 | 4.59375 | 5 | [] | no_license | ## Functional Programming, part 1:
# "C:\Users\Zhixiong Cheng\Desktop\complete_python_bootcamp\cheat sheet file"
def SumOfSquares(x, y):
''' Compute its sum of square of all of its arguments '''
twoTimes = x ** 2 + y ** 2
return twoTimes # Here is our first comment!!
# Example 2: when taking strings as argument:
de... | true |
f276cc929eef05f293f7c5582da4aa513be206e7 | Eliane28/fundamentosdeprogramacion | /EstructurasRepetitivas/FactorialIEjava.py | UTF-8 | 1,203 | 3.125 | 3 | [] | no_license | package EstRepetitivas;
import java.math.BigInteger;
import java.util.Scanner;
public class FactorialE{
static Scanner cs=new Scanner(System.in);
public static void calcularFactorial(int numero){
int contador=1;
long resultado=1;
if(numero>1){resultado=numero;}
while(contado... | true |
72608e28ec30b6c7bf84bf87e7f00cf0c1bb9a34 | weiyuyan/LeetCode | /LeetCode周赛/2020年3月15日周赛/5359. 最大的团队表现值.py | UTF-8 | 2,508 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:ShidongDu time:2020/3/15
'''
公司有编号为 1 到 n 的 n 个工程师,给你两个数组 speed 和 efficiency ,其中 speed[i] 和 efficiency[i] 分别代表第 i 位工程师的
速度和效率。请你返回由最多 k 个工程师组成的最大团队表现值 ,由于答案可能很大,请你返回结果对 10^9 + 7 取余后的结果。
团队表现值 的定义为:一个团队中「所有工程师速度的和」乘以他们「效率值中的最小值」。
示例 1:
输入:n = 6, speed = [2,10,3,1... | true |
e9d3d44b0e7b4c221bbae81927e8dbafbfbe9cfd | Ananyaagupta/Projects-Archive | /Machine Learning/16 Natural Language Processing/N-gram-Keyword-Generation-Using-Different-Libraries/Keyword_Extraction_Rake_nltk.py | UTF-8 | 592 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from rake_nltk import Rake
from nltk.tokenize import word_tokenize
from nltk.probability import FreqDist
rake_nltk_var = Rake()
text = """spaCy is an open-source software library for advanced natural language processing,
written in the programming languages Python and Cython. The library is published under the MIT... | true |
61890a7db647327117a5c23a5ec5366cfcd1458e | JuliaZxr/hogwarts_lg3_Yuki | /python_practice/work2_objectOriented/TongLao.py | UTF-8 | 1,199 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/2/20 11:51
# @Author : Yuki
class TongLao:
def __init__(self, hp, mp):
# hp:血量
self.hp = hp
# mp:法力
self.mp = mp
def see_people(self, name):
if name == "无崖子":
print("师弟!!!!")
elif name... | true |
083e45cc45e2fd24e9e64313d1637b32f6f09907 | PengDauan/qrlab | /pulseseq/pulseseq/ampgen.py | UTF-8 | 2,076 | 3.46875 | 3 | [] | no_license | import numpy as np
class Interpolator:
def __init__(self, xs=None, ys=None, order=2):
if xs is not None:
self.set_interpolation(xs, ys, order)
def set_interpolation(self, xs, ys, order=2):
self.params = np.polyfit(xs, ys, order)[::-1]
def __call__(self, arg):
... | true |
08a5fc6e880b744f86a03d2ed63551ff97f8ba48 | FlavioAssis/python_para_desenvolvedores | /python_para_desenvolvedores/exercicios4/test_e2.py | UTF-8 | 371 | 2.546875 | 3 | [] | no_license | '''
Created on 13/08/2012
@author: fillipecordeiro
'''
import unittest
from exercicios4.e2 import Lista
class Test(unittest.TestCase):
def test_set_listself(self):
lista = Lista([1,2,3,4,4,5,6,6])
self.assertEqual(len(lista.set_list()), 6)
if __name__ == "__main__":
#import sys;s... | true |
4781f8a8f506a8e522e53c2949c19846055b952c | parthpm/Recommender_movies | /recommender_system.py | UTF-8 | 2,502 | 3.21875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
column_names=['user_id', 'item_id', 'rating', 'timestamp']
df=pd.read_csv('u.data',sep='\t',names=column_names)
print(df.head())
movie_titles = pd.read_csv("Movie_Id_Titles")
print(movie_titles.head())
df=pd.me... | true |
af6fa5033503095c10e4c6c8e4e020afd87ac55e | nivethasathiya/nivi18 | /print.py | UTF-8 | 127 | 2.984375 | 3 | [] | no_license | N,K=map(int,input().split())
i=0
n=1
while(n!=N and n<N):
i+=1
n=K**i
if(n==N):
print("yes")
else:
print("no")
| true |
f96cc19b69bab7ff5f69a44b0652c45838e4a845 | woxane/codewars-solution | /Product of consecutive Fib numbers (5 kyu)/Product-Fib-numbers.py | UTF-8 | 454 | 2.96875 | 3 | [] | no_license | def productFib(prod):
last , previous = 1,0
'''we create variable and put 1 and zero into them'''
while last*previous<prod :
'''in here we create loop until last * pervious is less than product'''
last , previous = last+previous , last
'''until the loop s done we collect last and pe... | true |
630eec577c5143354ae11d45bc25187df59d3f69 | robrant/tracks | /archive/src/reFormatXSensor.py | UTF-8 | 5,985 | 2.9375 | 3 | [] | no_license |
import os
import datetime
import numpy as np
from scipy import integrate
#----------------------------------------------------------------#
def getFldIndex(line):
''' Gets the field index into a list '''
#----------------------------------------------------------------#
def getDictionary(line):
''' ... | true |
0f8ebcf4decb8b72c9ad2cc0b6792668049049bf | Sidhudog/dinobot | /main.py | UTF-8 | 2,185 | 2.796875 | 3 | [] | no_license | import pyautogui
from PIL import Image,ImageGrab
import time
from numpy import asarray
def hit(key):
pyautogui.keyDown(key)
def takess():
image = ImageGrab.grab().convert('L')
return image
if __name__ == "__main__":
print("Dino game about to start")
time.sleep(3)
hit('up')
cnt=0
speed... | true |
de9600281c42dc4207577fbce864cc8534ca60cf | zhanghui0228/package | /src/ding.py | UTF-8 | 1,196 | 2.765625 | 3 | [] | no_license | import json
import os
from datetime import datetime
try:
import requests
except Exception as err:
value = os.system("pip3 install requests")
if value == 0:
import requests
else:
print("错误信息:{0},返回码:{1}".format(err, value))
class Ding(object):
tag = '钉钉机器人,内容要有hui 字段'
def __ini... | true |
2f78ec2438eb698a29e496bb241194722489c43d | coolshree4u/python_learnings | /python_for_testers/first_kick_start/input_name.py | UTF-8 | 120 | 3.203125 | 3 | [] | no_license | print("Welcome to python programming for testing")
test_name= input("Enter your name")
print("your name is "+test_name) | true |
11a3b08f50bc5cd0346af40e746a541d9f81b69e | slzjw26/learn_Pthon | /D1/multithread.py | UTF-8 | 404 | 3.09375 | 3 | [
"MIT"
] | permissive | import threading
def working(name, n):
print('threading %s start to work' % name)
for i in range(n):
print('%s: #%s' % (name, i))
print('threading %s stop working' % name)
if __name__ == '__main__':
threads = []
for i in range(2):
t = threading.Thread(target=working, args=(i, 7))... | true |
c35fab0439ab4b342f167f6fe4fffc9756cde5fd | xxw1122/Leetcode | /Python/Anagrams.py | UTF-8 | 446 | 3.375 | 3 | [] | no_license | class Solution:
# @param strs, a list of strings
# @return a list of strings
def anagrams(self, strs):
d = {}
for item in strs:
ans = list(item)
ans.sort()
s = "".join(ans)
if s not in d:
d[s] = []
d[s].append(item[:... | true |
627305969fa27286cb8976b392220db114887103 | sarthakpunjabi/python-intermediate | /pong-game/main.py | UTF-8 | 1,767 | 3.1875 | 3 | [] | no_license | from turtle import Turtle , Screen
import time
from random import choice
from ball import Ball
from computer import Computer
from score import Score
#setting up screen
screen = Screen()
screen.setup(width=800,height=600)
screen.title("Ping Pong Game")
screen.bgcolor("black")
screen.tracer(0)
#making of players
comp... | true |
5b55fe0ed4d4044dc084b43205d328c8126b76e5 | garima763/valuefy | /scarp.py | UTF-8 | 4,074 | 2.640625 | 3 | [] | no_license | import requests
import json
import re
from util.Sentry import SentryLogger
from multiprocessing import Pool, Manager, Process
class get_urls:
def __init__(self):
self.url = "https://medium.com/"
self.escape_extension = ["png", "xml", "jpg", "jpeg", "css", "io", "ico"]
self.pool ... | true |
a2243dccd86caac6ede1137031ba449f0c47e22f | appukuttan-shailesh/basalunit | /basalunit/scores/score_ZScore.py | UTF-8 | 2,208 | 2.609375 | 3 | [] | permissive | import math
import sciunit.scores
import quantities
import numpy as np
#==============================================================================
class BU_ZScore(sciunit.Score):
"""
Returns Mean of Z-scores
"""
_allowed_types = (float,)
_description = ('Returns mean of valid Z-scores')
de... | true |
0144d6910fb4899f1e0d561dee386bd82439e890 | andlzanon/semantic-bot-recommender | /SemanticBot/bandit/base_bandit.py | UTF-8 | 1,569 | 3.625 | 4 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
class Bandit():
def __init__(self, arms: int):
"""
Base bandit constructor
:param amrs: probability distribution of each arm
"""
# quantity of arms
self.narms = arms
# times each arm was used
self.na... | true |
a395b02d271584eac21f70a17a8bb7e2763088f3 | johnrso/wordhunt-app | /api/board.py | UTF-8 | 4,906 | 3.171875 | 3 | [] | no_license | import numpy as np
import random
from weights import Alphabet
class Board:
points = (0, 0, 0, 300, 400, 800, 1400, 1800, 2000, 0, 0, 0, 0, 0)
width = height = 4
def __init__(self, dict = 'words_dictionary.json', alpha = None, letters = [], dimensions = None):
self.words = {}
self.letters_... | true |
2c5e756a0d25ea26c683ecc97bdc750ff6b73109 | colemai/bioinformatics_scripts | /rosalind/rosalind6.py | UTF-8 | 1,141 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python3
"""
author: Ian Coleman
purpose: Calculate Hamming Distance between two NT seqs
input: text file with two lines, a seq on each
output: single int, the Hamming distance i.e minimum point mutations between seqs
"""
from sys import argv
def intake_seqs (input_filename):
#Converts fasta file into a... | true |
51c143bc2976825785fb950216ddd1dd134cddcd | yingxingtianxia/NSDVN2010 | /exec/day12/myError.py | UTF-8 | 220 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
'''
测试自定义异常
'''
age = int(input('请输入年龄>'))
# if not 0 < age < 110:
# raise ValueError('年龄不合法')
# print(age)
assert 0 < age < 110,'年龄不合法'
print(age) | true |
1ffe360aadd32f1365d56c13d36ff0ed6378438f | chariot1498/Popularity-of-tv-shows-on-tumblr | /Homeland codes/eda4home.py | UTF-8 | 3,473 | 2.53125 | 3 | [] | no_license | import mysql.connector
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter
from textblob import TextBlob
cnx = mysql.connector.connect(user='root', password='sid',host='localhost', database='Homeland')
cursor = cnx.cursor()
l1 = []
cursor.execute("""SELECT body,timestamp FROM Text wher... | true |
0d06e3e5f495498b9e91ccf07ff7c53547114e25 | liudading/tmp | /dr/price.py | UTF-8 | 1,840 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 00:21:54 2019
@author: lihepeng
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
xp = np.arange(24)
x = np.linspace(0, 24, 144)
# Train Price
filename = '/home/lihepeng/Documents/Github/tmp/data/price/RtpData2015.csv... | true |
1ce8ef6bcc500a0572f0905e5227d0535c91ffde | jadendick/AdventOfCode2020 | /day13/code.py | UTF-8 | 993 | 3.125 | 3 | [] | no_license | file = open("input","r")
input = file.read().split("\n")[:-1]
time = int(input[0])
routes = []
split = input[1].split(",")
for x in range(len(split)):
if(split[x] != "x"):
routes.append((int(split[x]),x))
def part1():
min = -1
id = 0
for x in routes:
x = x[0]
diff = int(time /... | true |
34d89ba009f7a4ce81c11a5509f93b422983da8d | timmahrt/praatIO | /tests/utilities/test_my_math.py | UTF-8 | 2,372 | 2.828125 | 3 | [
"MIT"
] | permissive | import unittest
from praatio.utilities import my_math
from tests.praatio_test_case import PraatioTestCase
class TestMyMath(PraatioTestCase):
datasetA = [1, 10, 100, 1000]
datasetB = [1, -10, 100, -1000]
datasetC = [10.5, 47, 93.24, -5]
datasetD = [32, 24, 18, 5, 61]
def test_rms(self):
... | true |
f80d466de85b26c692e8d2b4884639cc2700ce70 | a1d4r/curses-battleship | /battleship/ui/display.py | UTF-8 | 2,974 | 3.34375 | 3 | [] | no_license | import curses
import curses.ascii
from curses import textpad
from typing import List
from battleship.logic.player import Player, Computer, BasePlayer
from battleship.field.grid import Grid
from battleship.logic.settings import DEFEAT_MESSAGE, VICTORY_MESSAGE
class DisplayManager:
"""Class representing manager fo... | true |
adc6c3975e2909716bef381c2dc0ab0be9f390b0 | r1chardj0n3s/html | /html/test_format.py | UTF-8 | 7,039 | 3.109375 | 3 | [] | no_license | # -*- encoding: utf8 -*-
import sys
import unittest
from .format import HTML, XHTML, XML
class TestCase(unittest.TestCase):
def test_empty_tag(self):
'generation of an empty HTML tag'
self.assertEquals(str(HTML().br), '<br>')
def test_empty_tag_xml(self):
'generation of an empty XHTML... | true |
fe78b89656234ddbbade21c7fc9d83ffdd48913f | esalesky/jsalt-scripts | /tsne.py | UTF-8 | 823 | 2.734375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import sys
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from mpl_toolkits.mplot3d import Axes3D
#load data
ppl = int(sys.argv[1])
A = np.load(sys.argv[2])
B = np.load(sys.argv[3])
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(A[:,0], A[:,1... | true |
4dc3f9ee61166fc3544847605f440980ee263691 | Hroque1987/Exercices_Python | /Functions_examples/key.points.argument.passing.py | UTF-8 | 41 | 2.671875 | 3 | [] | no_license | x = 3
def func(y):
print(y)
func(x)
| true |
065ec08d5227487f3c1e168810f495ac2ac6b440 | jacksteroo/oracle-feeder | /priceserver/modules/sdr/imf.py | UTF-8 | 2,095 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from typing import Dict, List
import requests
import csv
SDR_RATE_URL = "https://www.imf.org/external/np/fin/data/rms_five.aspx?tsvflag=Y"
SDR_CURRENCY_CODE_MAP = {
# major currencies
"U.S. dollar": "USD",
"U.K. pound": "GBP",
"Euro": "EUR",
"Japanese yen": "JPY",
"Korean won": "KRW",
"C... | true |
2732757c459d801d2e1ac5249d65c0f0f8a085ae | zaanwar/fasta_tools | /tests/test_writers.py | UTF-8 | 1,168 | 2.90625 | 3 | [] | no_license | import unittest
import subprocess
from unittest.mock import patch
from fasta_tools.fasta_writers import *
GOLD_PATH = 'GOLD.fasta'
GOLD_CONTENT = '>One\nATGC\n>Two\nATGTCATCG\n>Three\nATGTAT\n'
TEMP_PATH = 'temp.fasta'
LIST = GOLD_CONTENT.split('\n')
TUPLES = [tuple(['>One', 'ATGC']), tuple(
['>Two', '>ATGTCATCG... | true |
d636bee6d75ee3e60e794d330aed09c8a42f0b85 | elkorb/self-py-solutions | /834.py | UTF-8 | 299 | 3.75 | 4 | [] | no_license | def inverse_dict(my_dict):
inversed = {}
for key in my_dict:
if my_dict[key] not in inversed:
inversed[ my_dict[key]] = [key]
else:
inversed[my_dict[key]].append(key)
inversed[my_dict[key]].sort()
return inversed
| true |
d0cc9bbf32d127ccd339ba38475cf1b442248220 | vegardkoder/LightBlue | /old_code.py | UTF-8 | 1,312 | 3.234375 | 3 | [] | no_license | #
# Author: Vegard Hansen Stenberg
# Date: 11.11.2020
# Goal: Create a basic NN to learn
#
import numpy as np
import timeit
import activationFunctions
import models
# ---------- perceptron ----------
def perceptron(input, weights, bias):
outputs = activationFunctions.Sigmoid(np.dot(input, weights)) + bias
# --... | true |
017f4c8ab07826e4e2cd610a3b00b592efc6f618 | Madiwka4/sozdikscraper | /scrape.py | UTF-8 | 920 | 2.546875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import sys, getopt
import urllib.parse
def main(argv):
inputfile = ''
inputfile = urllib.parse.quote(inputfile.encode('utf8'), ':/')
numberfile = ''
try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
except getopt.Getop... | true |
2f342e87619772801f9ac3d38d61e3170098920c | phantomgoose/CodingDojo | /Python Stack/Misc/Bike/bike.py | UTF-8 | 1,055 | 3.953125 | 4 | [] | no_license | class Bike(object):
def __init__(self, price, max_speed, miles = 0):
self.price = price
self.max_speed = max_speed
self.miles = miles
def displayInfo(self):
print(self.price, self.max_speed, self.miles)
def ride(self):
print("Riding")
self.miles += 10
... | true |
535c8679d061d20807385b302f918c7fff498112 | RahmaliaSafitri/Pemetaan-Tingat-Ancaman-Tanah-Longsor | /webapp.py | UTF-8 | 1,729 | 2.734375 | 3 | [] | no_license | import numpy as np
import streamlit as st
import streamlit.components.v1 as components
import pickle
import warnings
warnings.filterwarnings('ignore')
kmeans_model = pickle.load(open('kmeans.pkl', 'rb'))
def main():
st.markdown("<h1 style='text-align: center; color: teal;'>Pemetaan Tingat Ancaman Tanah Longsor ... | true |
45199d32b347ab9f2ffe13c9a776e4490b4c4031 | maggieee/tictactoetutorial | /tictactoe.py | UTF-8 | 2,743 | 4.1875 | 4 | [] | no_license | # winning:
def win(current_game):
# find out if there's a diagonal winner:
if current_game[0][0] == current_game[1][1] == current_game[2][2] or current_game[0][2] == current_game[1][1] == current_game[2][0] and current_game[1][1] != '☐':
print(f'{current_game[1][1]} is the winner!')
return Tru... | true |
7a26e78f21fc79d5ef12f9dde788b6ba74118749 | saurabhkpatel/Programming | /python/assignments/assignment5.py | UTF-8 | 5,761 | 3.28125 | 3 | [] | no_license | # Implementation of classic arcade game Pong
# Saurabh Patel
# Contact : skpatel@syr.edu
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PA... | true |
5617945a143917762d72c763af371bbf3c817064 | xuhn1997/ECommgpu | /din_feature/generate_train_underline_data.py | UTF-8 | 2,700 | 3.171875 | 3 | [] | no_license | """
此文件是用来生成构造DIN的线下训练集
一共有只有1号到16号的数据
我们采用1号到15号的数据构建线下训练集
训练的时候不需要进行召回,直接构建
所以要将用户的行为的历史行为按照时间进行排序,,,,
"""
import sys
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
import numpy as np
import pandas as pd
import random
ITEM_COUNT = 43182... | true |
bc4076eb44b091c19bd14dac1a5d75cfb6a05e0a | shoaiburrehman/Pakistan-Car-Price-Prediction | /Flask/app.py | UTF-8 | 3,404 | 2.9375 | 3 | [] | no_license | import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
import json
from model import predic_index, price_estimate, predict_price
from data_input import data_in
from numpy import *
#file_name = "models/dtree_car_price_model.pickle"
#model = pickle.load(open(file_name, 'rb'))
#print(m... | true |
e5d01c68aa69241f229a5695622405b11be28342 | alonmelon25/SI364-Winter2018 | /DS2/challenges.py | UTF-8 | 3,882 | 3.4375 | 3 | [] | no_license | from flask import Flask, render_template, request
import requests
import json
app = Flask(__name__)
## Challenge 1
# If you go to http://localhost:5000/square, it would a display a form
# Update the view function that receives the data from the form and returns square of the number
@app.route('/square')
def squareVie... | true |
bb95b7f8eb12ab6d9cd0c5458c4987a081603c88 | yashvkirloskar/HExIt | /Test_Apprentice.py | UTF-8 | 2,081 | 2.890625 | 3 | [] | no_license | from Apprentice import *
from MCTS import *
import shutil
def testTrain():
print ("Starting testTrain")
apprentice = Apprentice("testApprentice", 5, 2)
mcts = MCTS(5, 2, 50, 3)
batch, labels = mcts.generateExpertBatch()
apprentice.train(batch, labels)
shutil.rmtree("testApprentice")
print (... | true |
8b04b7efcaa38e9b5a626cd4e1271c01b4e02e65 | theahmadzai/na-and-ai | /Numerical Analysis/Methods/Root Finding/regular_falsi.py | UTF-8 | 901 | 3.40625 | 3 | [] | no_license | import tabulate as tb
import numpy as np
import matplotlib.pyplot as plt
fx = lambda x: (x ** 3) - (3 * x) - 5
sfx = lambda a, b: (a * fx(b) - b * fx(a)) / (fx(b) - fx(a))
# plot function
X = np.linspace(-10, 10,1000)
Y = fx(X)
plt.plot(X,Y, color='orange')
a = -5.5
b = 7
ans = []
while round(fx(a), 4) != 0:
x... | true |
749c1eab7cdb8d7fed88b4c1eccfc1a21402e46c | dbalchev/kmeans | /kmeans/distances.py | UTF-8 | 1,569 | 3.015625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from itertools import chain
from math import sqrt
from .utils import count_duplicates, self_information, merge, WeightedMap
def dot_product(lh, rh):
if len(lh) > len(rh):
lh, rh = rh, lh
result = 0
for l_word, l_weight in lh.items():
result += l_weight * rh[l_word]
... | true |
8bb89bc0a26b612fcc3fee21f031f0cb954817c0 | entrymissing/ciTools | /Reporting/createReportGraphs.py | UTF-8 | 4,659 | 2.546875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams, rc
from radar_chart import radar_factory
def customaxis(ax, c_left='k', c_bottom='k', c_right='none', c_top='none',
lw=3, size=12, pad=8):
for c_spine, spine in zip([c_left, c_bottom, c_right, c_top],
... | true |
f310a4cd91e00d66cd5c63d3a69a30ec46711ff3 | mikerauer/pyb-class | /smallscript.py | UTF-8 | 167 | 3.359375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
'''
author: MikeRAuer
simple print scipt
'''
def main():
'''main func defined'''
my_note = "print this string"
print(my_note)
main()
| true |
0beafa24760e6569f8bbfe057a77659d0b8dfe97 | nkini/CMP203-HW4 | /parser.py | UTF-8 | 3,557 | 2.78125 | 3 | [] | no_license | import scanner
import screener
from pprint import pprint
outstring = ''
def E(tokens):
global outstring
if tokens[0].type == 'VAR':
outstring += 'var('+tokens[0].value+')'
return tokens[0], tokens[1:]
elif tokens[0].type == 'NUM':
outstring += 'num('+str(tokens[0].value)+')'
... | true |
2e8c9e763f9671651486857e5ce94798e1596db7 | MuhammedUlviOzkaya/calculating-pi | /main.py | UTF-8 | 782 | 2.59375 | 3 | [] | no_license | from ulvi import TicToc, FindPi
from threading import Thread
import time
import os
if __name__ == "__main__":
tt = TicToc()
tt.tic()
n = 1000
find_pis = []
"""finding_pi.throw_points(10000000)"""
threads = []
for i in range(os.cpu_count()):
find_pis.append(FindPi())
threads... | true |
b4bca8acb9811c4866d49a45959e29f32148c0b6 | code1990/bootPython | /python/91python/c_06_test.py | UTF-8 | 1,224 | 2.609375 | 3 | [] | no_license | import unittest
class c_06_test(unittest.TestCase):
def test_54(self):
#建议54:理解built-inobjects
print("")
def test_55(self):
#建议55:__init__()不是构造方法
print("")
def test_56(self):
#建议56:理解名字查找机制
print("")
def test_57(self):
#建议57:为什么需要self参数
print("")
def test_58(self):
#建议58:理解MRO与多继承
print("... | true |
9be929a744426e7248db14d742cecad8dc74af41 | nasaharvest/us-inseason-phenorm | /preprocess/prep_sar_inputs_aws.py | UTF-8 | 6,791 | 2.53125 | 3 | [] | no_license | # Hannah Kerner
# October 9, 2020
# Make growth stage normalized SAR inputs
import numpy as np
import pandas as pd
import xarray as xr
import os
from glob import glob
from subprocess import call
import sys
import rasterio
from rasterio.vrt import WarpedVRT
from affine import Affine
IMG_DIM = 3660
HLS_RES = 30
def ... | true |
4b9e2899cda4f2acdcafd9e159bea212bfcee966 | abdou-c/ExoPython | /exo9td.py | UTF-8 | 721 | 4.25 | 4 | [] | no_license | #Exercice 9 : Ecrire un algorithme qui donne la durée de vol en heure minute connaissant l'heure de départ et l'heure d'arrivée.
#a. On considère que le départ et l'arrivé ont lieu le même jour
#b. On suppose que la durée de vol est inférieure à 24 heures mais peut avoir lieu le lendemain
hd = int(input("saisir l'heur... | true |
2c1de4460b0d18ec9183b1ec10b1814297751c70 | Shaofanl/RunFaithRun | /code_parse.py | UTF-8 | 3,142 | 2.515625 | 3 | [] | no_license | import os
import numpy as np
from scipy.misc import imread
if __name__ == '__main__':
# start_time = 1520288889.2129278
# start_time = 1520289193.6855888
# start_time = 1520323553.994526
# start_time = 1520369935.8181005
start_time = 1520411037.6885858
filedir = os.path.abspath("./data/"+str(st... | true |
535523551c56a2d5a4234efc6505a87cf0d7a938 | hanson-hex/python-learn | /ccf/数位之和.py | UTF-8 | 494 | 3.640625 | 4 | [] | no_license | """
问题描述
给定一个十进制整数n,输出n的各位数字之和。
输入格式
输入一个整数n。
输出格式
输出一个整数,表示答案。
样例输入
20151220
样例输出
13
样例说明
20151220的各位数字之和为2+0+1+5+1+2+2+0=13。
评测用例规模与约定
所有评测用例满足:0 ≤ n ≤ 1000000000。
"""
if __name__ == '__main__':
exam_list = sum(list(map(int, input())))
print(exam_list) | true |
4412992b1087b18b81e6f69290d8d419424f6653 | DangerousCode/DAM-2-Definitivo | /Python/Pracica 3 Python/Ejercicio2.py | UTF-8 | 726 | 4.0625 | 4 | [] | no_license | __author__ = 'Alvaro'
#Creamos una funcion que gestionara el numero que le pasemos
def comprobar(num):
#declaracion de funciones
def sumaDosDigitos(numero):
#Se pasa a string para poder recorrerlo y se castea en el for para sumarlo
aux=str(numero)
sum=0
for i in aux:
... | true |
4718ad8581f9410bbc91a66694ead7aabb98eedc | zazaliu/leetcode-python | /binary search/300. Longest Increasing Subsequence.py | UTF-8 | 1,231 | 3.4375 | 3 | [] | no_license | class Solution:
def lengthOfLIS1(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
"""
DP算法:复杂度:O(n^2)
"""
if not nums:return 0
dp=[1 for i in range(len(nums))]
for i in range(1,len(nums)):
for j in range(i):
... | true |
b3538d15d39792b5ff3c970c01c8e9a6ad5428de | inbilla/tempex | /tempex/collector/environment.py | UTF-8 | 2,137 | 2.984375 | 3 | [] | no_license | import time
import datetime
import configparser
from .sensors.australian_bureau_of_meteorology import AustralianBureauOfMeteorology
from .sensors.dyson_pure_cool import DysonPureCool
class Environment:
type_lookup = {
'AustralianBureauOfMeteorology': AustralianBureauOfMeteorology,
'DysonPureCool':... | true |
57ecf0b8fbd9267029442c5cc7f4196144cf8f6c | Vasudev21/Algorithms | /Python/test.py | UTF-8 | 210 | 3.5 | 4 | [] | no_license | # Algorithm to find the single number in an array of pairs of numbers
def test(numbers):
temp=0;
for x in range(0,len(numbers)):
temp=temp^numbers[x]
return temp
nums=[1,1,2,2,3,5,5]
print test(nums)
| true |
d9141d8d64f79a1757e1b9de7bdc47bbb81332fd | edison0829/course_codes | /codes1-ml/knnreg.py | UTF-8 | 1,657 | 2.578125 | 3 | [] | no_license | import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
import pandas as pd
import math
import random
from sklearn import neighbors
from sklearn.neighbors import KNei... | true |
ebd3fd43c7cd1d1d1b27626aaa5ef303ad54f039 | piotrk32/WizualizacjaDanych | /pandasPDz1.py | UTF-8 | 286 | 2.859375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import xlrd
x = [2005, 2010, 2015, 2016, 2017 ]
y = [364.4, 413.3, 369.3, 382.3, 402.0]
plt.plot(x,y)
plt.title("Urodzenia żywe (w tys.) ")
plt.xlabel("rok")
plt.ylabel("tys. urodzeń")
plt.show() | true |
555521af995264ea0131e4082c3155a2aee6f37d | nsohit/tiban-antares-bigbox | /fix_keypad.py | UTF-8 | 550 | 2.6875 | 3 | [] | no_license | import time
import RPi.GPIO as GPIO
from keypad import keypad
GPIO.setwarnings(False)
import I2C_LCD_driver
mylcd= I2C_LCD_driver.lcd()
i = 0
def tampilan():
kp = keypad(columnCount = 3)
# waiting for a keypress
digit = None
while digit == None:
digit = kp.getKey()
i = 0
i+=1
mylcd.lcd... | true |
cd7efd814cd7cd51231051cd7b30c7177f6dcd72 | ArunThirunav/hackerrank | /birthdayCakeCandles.py | UTF-8 | 325 | 2.734375 | 3 | [] | no_license | from array import *
def sum(ar):
max = len(ar) - 1
print(ar[max])
print(ar.count(ar[max]))
if __name__ == "__main__":
global i
ar = input("Enter: ")
ar = list(map(int, ar.rstrip().split()))
ar.sort()
ar = array('Q', ar)
print(ar)
print(type(ar))
sum(ar)
# print(sum(... | true |
3d812c254fd8e632740eff19d30e83d3b86bf0bf | hyller/GladiatorLibrary | /python-cookbook-master/src/8/creating_cached_instances/example1.py | UTF-8 | 482 | 3.421875 | 3 | [
"Unlicense"
] | permissive | # Simple example
class Spam:
def __init__(self, name):
self.name = name
# Caching support
import weakref
_spam_cache = weakref.WeakValueDictionary()
def get_spam(name):
if name not in _spam_cache:
s = Spam(name)
_spam_cache[name] = s
else:
s = _spam_cache[name]
return ... | true |
708749fcf0513b547c3a33bd18979de638a0856c | smparekh/Intro2Unix | /Homework2/shells.py | UTF-8 | 770 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
#--------------------------------------------------
# ECE 2524 Homework 2 Problem 1 Shaishav Parekh
#
# Date: 09/11/2012
#--------------------------------------------------
# Open the file
with open('/etc/passwd', 'r') as f:
# Read each line
for line in f:
# Split the line into sections deli... | true |
ff98f8fb9d78ac2b6616f88bd52301dde0c427a8 | atulchauhan89/LearnPythonByDoing | /Functions and modules/Modules/implementation.py | UTF-8 | 340 | 3.171875 | 3 | [
"MIT"
] | permissive | from Calculator_operations import*
import math
c=addition(10,9) #calling a function of module directly by its name
print("Addition of a number",c)
d=division(10,2)
print("Division of a number",d) #calling a function of module directly by its name
content=dir(mat... | true |
c00ee41029536e1ed7ec9bcd1380dc81901fff89 | lidongdongbuaa/leetcode2.0 | /链表/链表删除/82. Remove Duplicates from Sorted List II.py | UTF-8 | 3,470 | 4.03125 | 4 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2019/11/6 8:24
# @Author : LI Dongdong
# @FileName: 82. Remove Duplicates from Sorted List II.py
''''''
'''
82. Remove Duplicates from Sorted List II.py
题目分析
1.要求:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numb... | true |