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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d76acfa55f36b6f778d11572e2ec66aa329c583e | Python | imood00/python_Progate01 | /python_study_1/page11/script.py | UTF-8 | 379 | 4 | 4 | [] | no_license | x = 10
# xが30より大きい場合に「xは30より大きいです」と出力してください
if x>30:
print("xは30より大きいです")
money = 500
apple_price = 200
# moneyの値がapple_priceの値以上の時、「りんごを買うことができます」と出力してください
if money>=apple_price:
print("りんごを買うことができます")
| true |
2a286ac7d27adddbd7ecc79e7de234d67dc77423 | Python | luisibarra06/python | /lambda1.py | UTF-8 | 73 | 2.578125 | 3 | [] | no_license | # lambda1.py lai
x = lambda a, b, c, : a + b + c
fx = x(5,6,2)
print(x)
| true |
6f3dedb9984752a1774d1dea2139e429e2c37406 | Python | ccuulinay/recommender_systems | /kaggle_events_ref/DataRewriter.py | UTF-8 | 5,763 | 2.671875 | 3 | [] | no_license | from __future__ import division
import pickle
import numpy as np
import scipy.io as sio
class DataRewriter:
def __init__(self):
# 读入数据做初始化
self.userIndex = pickle.load(open("PE_userIndex.pkl", 'rb'))
self.eventIndex = pickle.load(open("PE_eventIndex.pkl", 'rb'))
self.userEventScor... | true |
a144958ef03392c0bff7ad48e726e515a8745864 | Python | TimothyHorscroft/competitive-programming | /atcoder/agc004/b.py | UTF-8 | 571 | 2.890625 | 3 | [] | no_license | n, x = map(int, input().split())
a = list(map(int, input().split()))
# array size nxn filled with zeroes
minrange = [[0 for j in range(n)] for i in range(n)]
for r in range(n):
for l in range(r):
minrange[l][r] = min(minrange[l][r-1], a[r])
minrange[r][r] = a[r]
res = int(1e18) # 10^18 is ba... | true |
c5b8fb5da84c6e61966a176852ecd8ba75cc65cc | Python | Jishasudheer/phytoncourse | /Exception_handling/vaccine.py | UTF-8 | 125 | 3.171875 | 3 | [] | no_license | age=int(input("Enter age"))
if age<18 :
raise Exception("Not eligible for vaccine")
else :
print("vaccine available") | true |
19cfb4ac4b88b55a8c55f8f71e0a4c6ebf8d4785 | Python | gmarson/Federal-University-of-Uberlandia | /Vigenere Cipher/Project/Vigenere.py | UTF-8 | 1,095 | 3.328125 | 3 | [
"Unlicense"
] | permissive | class Vigenere:
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
key = ""
def __init__(self, key):
self.key = key
def encryptMessage(self,message) -> str:
return self.translateMessage(message, 'encrypt')
def decryptMessage(self,message) -> str:
return self.translateMessage(message, 'decrypt')
def translateMessag... | true |
954743e28c55d042b417bdf62a7cf98c001f6e29 | Python | ervitis/challenges | /leetcode/minimum_index_sum_two_lists/main.py | UTF-8 | 965 | 3.9375 | 4 | [] | no_license | """
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.
You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You co... | true |
a0b3140a599e21b9509385a5497618eb774d9394 | Python | theastrocat/redditoracle | /src/main_top.py | UTF-8 | 869 | 2.875 | 3 | [] | no_license | """
Module for scaping reddit top (front page) posts and adding them to mongo database.
Still needs a method for excluding posts that are already in the database.
"""
import time
from bs4 import BeautifulSoup
from pymongo import MongoClient
import datetime
import random
from reddit_scraping import Reddit_Scrape
clien... | true |
92e8113a295597f224815bdd4e49d11428e4f0fb | Python | Allien01/PY4E | /02-data-structure/dictionaries/04.py | UTF-8 | 450 | 3.3125 | 3 | [] | no_license | fname = input("Enter the name of the file: ")
fhandle = open(fname) # abre um arquivo para leitura
count = dict()
for line in fhandle:
line = line.rstrip()
if line.startswith("From "):
word = line.split()
key = word[1] # armazena os emails de cada lista
count[key] = count.get(key, 0) +... | true |
72d57f7cf679636bf7c4baa7906771cd13e13289 | Python | joeldiazz/m03-Aplicacions_Ofimatiques | /Extres/ejercicio-mayor_menor.py | UTF-8 | 900 | 3.859375 | 4 | [] | no_license | #Python 3.6#
"""COMPARADOR DE TRES NÚMEROS"""
#Coding: Utf-8
numero1= int(input("1.Pon un numero: "))
numero2= int(input("2.Pon un numero: "))
numero3= int(input("3.Pon un numero: "))
if(numero1 == numero2 and numero3 == numero2):
print("Los 3 numeros (",numero1,",",numero2,"y",numero3,") que has escrito son iguale... | true |
fffbf3b9832d44eccb4d781a081c5a66836c8cbf | Python | yusurov/python | /exe_objet2.py | UTF-8 | 1,968 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
class Population:
def __init__(self):
self.humains = []
self.dragons = []
self.moutons = []
def reproduire_humains(humains):
nb_beb = int(len(self.humains) / 2)
for i in range(nb_bebe):
#changer le NOM
self.humains.append(Humains(nom="toto"))
def reproduir_moutons(self):
nb... | true |
556c9a796272f09aa263449d17cf628716a569ba | Python | crj1998/Beautyleg-Downloader | /genpassword.py | UTF-8 | 2,656 | 2.90625 | 3 | [] | no_license | import random
from binascii import hexlify
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget,QPushButton,QApplication,QLabel,QLineEdit,QGridLayout
def genpw(text):
pubKey='010001'
modulus='00e0b509f6259df8'
text=text[::-1].encode()
rsa=int(hexlify(text),16)**int(pubKey,16)%int(modulus,... | true |
a6ef8e7b053c70812277e1dd82608c0fbb050c1a | Python | kantasan/zikken4 | /提出用情報工学実験IV/gizi_kyoutyo.py | UTF-8 | 4,930 | 3.0625 | 3 | [] | no_license | from matplotlib import pyplot
import numpy as np
import matplotlib.pyplot as plt
import csv
import os
"""
listsは必修科目、list2は選択科目。
それぞれ0番目からAさん,Bさん...みたいな形式を取ること!
文字を数値に置き換える.例えばos 0 コンシス 1とか
"""
#授業の数
n = 34
graphname = 'group-0 Elective'
name = 'c0-Elective.jpg'
list_in = []
kamoku_list = ['0', '1', '2', '3', '4', '5'... | true |
deed7d0030544767369dad74827106a0f444d073 | Python | dsong127/MachineLearning | /NeuralNetwork/main.py | UTF-8 | 6,963 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.metrics import confusion_matrix
import seaborn as sn
from timeit import default_timer as timer
img_size = 784
h_size = 100
m = 15000
ts_m = 10000
def main():
start = timer()
print("--------Parsing data-------------------... | true |
4b91a7a18a22f8f8e5514f44eca9507d1c2a9625 | Python | furutuki/LeetCodeSolution | /0257. Binary Tree Paths/python_dfs.py | UTF-8 | 721 | 3.5 | 4 | [
"MIT"
] | permissive | # Definition for a binary tree node.
from typing import List
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.ans = []
def dfs(self, node: TreeNode, res:str):
if not node... | true |
f5d7c6fbed7ccf3bd948569ab062d9822c22736d | Python | songkicheon/MSE_Python | /ex190.py | UTF-8 | 239 | 3.640625 | 4 | [] | no_license | apart = [ [101, 102], [201, 202], [301, 302] ]
for i in apart: #apart에서 원소 하나씩 i 에 저장한다 예) i=[101, 102]
for j in i: #i에서 원소 하나씩 j에 저장하고 j와'호'를 출력한다
print(j,'호') | true |
cb15bc96622b13e3a4ff919305288e5218722653 | Python | jkagnes/BookStore | /FlaskBookstore/FlaskBookstore/FlaskBookstore/models/book.py | UTF-8 | 530 | 2.59375 | 3 | [] | no_license | class Book(object):
def __init__(self, id, title, author, publisher, publishedDate,description, category,smallThumbnail,thumbnail, price, pageCount):
self.id = id
self.title = title
self.author = author
self.publisher = publisher
self.publishedDate = publishedDate
s... | true |
0799fe9d7f895e51fede0e30e8cc8596188e54f2 | Python | nonusDev/Algorithm | /SWEA/D1/1936.1대1가위바위보.py | UTF-8 | 163 | 2.90625 | 3 | [] | no_license | import sys
sys.stdin = open("1936.1대1가위바위보.txt", 'r')
x, y = map(int, input().split())
if x-y == 1 or x-y == -2:
print('A')
else:
print('B') | true |
723915a0d5953d052917ee908cced4a968d30c10 | Python | AlexDarkstalker/PythonCourseraWeek2 | /countOfMaxElems.py | UTF-8 | 229 | 3.453125 | 3 | [] | no_license | num = int(input())
maxNum = num
countMax = 0
if num:
countMax = 1
while num:
num = int(input())
if num > maxNum:
maxNum = num
countMax = 1
elif num == maxNum:
countMax += 1
print(countMax)
| true |
51b51ec2279dab64293fd1cc206bb76be2ac8c1e | Python | jitensinha98/Python-Practice-Programs | /ex21.py | UTF-8 | 405 | 3.34375 | 3 | [] | no_license | def add(a,b):
c=a+b
return c
def sub(a,b):
c=a-b
return c
def multiply(a,b):
c=a*b
return c
def divide(a,b):
c=a/b
return c
age=add(12,2)
height=sub(14,2)
weight=multiply(2,2)
iq=divide(2,2)
print "Age=%d"%age
print "Height=%d"%height
print "Weight=%d"%weight
print "iq=%d"%iq
p=add(ag... | true |
d0c43b0608c8b9326a48497d37f11fa434aef89d | Python | wcdawn/WilliamDawn-thesis | /ch02_neutronDiffusion/python/sketch_triangle.py | UTF-8 | 510 | 2.859375 | 3 | [
"LPPL-1.3c"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
LW = 2
FN = 'Times New Roman'
FS = 12
plt.rc('lines', lw=LW)
plt.rc('mathtext', fontset='stix') # not explicitly Times New Roman but a good clone
plt.rc('font', family=FN, size=FS)
tri = np.array([
[0.7, 0.5],
[0.2, 0.5],
[0.0, -0.1],
[0.7, 0.5]])
pl... | true |
61ecd309562f4b9e088af3d445f8bd522a2ac83b | Python | jorgemauricio/proyectoGranizo | /algoritmos_procesamiento/generar_mapa_datos_nasa_2014.py | UTF-8 | 6,717 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
#######################################
# Script que permite la interpolación de los
# datos de precipitación de la NASA
# Author: Jorge Mauricio
# Email: jorge.ernesto.mauricio@gmail.com
# Date: 2018-02-01
# Version: 1.0
#######################################
"""
#!/... | true |
748ef33cab3540f7504e2d113a867b123bd9d9d4 | Python | stardust-r/LTW-I | /AI_navigation/UKF/astroPlot.py | UTF-8 | 6,554 | 2.953125 | 3 | [] | no_license | # astroPlot
#
# File containing different functions used for visualisation in astrosim
#
# Syntax: import astroPlot
#
# Inputs:
#
# Outputs:
#
# Other files required: none
# Subfunctions: none
#
# See also:
# Author: Pelayo Penarroya
# email: pelayo.penarroya@deimos-space.com
# Creation March 24, 2020
# La... | true |
86d17d9b19d1727c36ecb0fcdf0ba824c9206f8c | Python | HanHyunsoo/Python_Programming | /University_Study/lab6_7.py | UTF-8 | 804 | 3.6875 | 4 | [] | no_license | """
챕터: day6
주제: 정규식
문제: 정규식 기호 연습
작성자: 한현수
작성일: 2018.11.15
"""
import re # regular expression 모듈을 수입
# 테스트할 각종 문자열 정의
s = "teeeest"
s2 = "tetst"
s3 = "tst"
r = re.compile('e.s') # e와 s사이에 문자가 있는 경우 찾기
print(r.search(s))
print(r.search(s2))
print(r.search(s3))
r = re.compile('e?s') # e가 0~1번 나타난 후 s가 나타나는 경우 찾기
prin... | true |
773a863eeae165b2c7beccef19ff6eafd53b480b | Python | ZongLin1105/OpenCVtest | /test12.py | UTF-8 | 776 | 2.90625 | 3 | [] | no_license | import cv2
import numpy as np
cap=cv2.VideoCapture(0) #放想處理的影像檔
while(1):
# 獲取每一帧;判斷有沒有開狀態
ret,frame=cap.read()
# 轉换到 HSV;BGR轉換HSV
hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
# 設定蓝色的侷值;設定HSV藍色的值
lower_blue=np.array([110,50,50])
upper_blue=np.array([130,255,255])
# 根据侷值构建掩模
mask=cv2.inRange(hsv,lo... | true |
0659b3f845aa80c5d731921051507d031d0b6f16 | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4160/codes/1723_2498.py | UTF-8 | 336 | 3.4375 | 3 | [] | no_license | ha = int(input("Habitantes a: "))
hb = int(input("Habitantes b: "))
pa = float(input("Percentual de crescimento populacional de a: "))
pb = float(input("Percentual de crescimento populacional de b: "))
pera = pa/100
perb = pb/100
t = 0
ano = 0
while (ha < hb):
ha = ha + (ha * pera)
hb = hb + (hb * perb)
ano = ano ... | true |
7a2992f243707e4083f144e4ead4fec0b6cf3c07 | Python | cagridz/centrosome | /tests/test_zernike.py | UTF-8 | 8,426 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | from __future__ import absolute_import
from __future__ import division
import numpy as np
import scipy.ndimage as scind
import unittest
import centrosome.zernike as z
from centrosome.cpmorphology import fill_labeled_holes, draw_line
from six.moves import range
class TestZernike(unittest.TestCase):
def make_zernike... | true |
abc38e143229409c14d24e9054228eec6e33387d | Python | hjjiang/Vending-Machine | /Money.py | UTF-8 | 1,488 | 3.796875 | 4 | [] | no_license | class Money(object):
def __init__(self, value, amount):
self.value = value
self.amount = amount
self.TotalAmount = value * amount
def getTotalAmount(self):
return self.TotalAmount
def getAmount(self):
return self.amount
def addAmount(self, amoun... | true |
4ed40bf8166429dc6d02a691819c4983b878f057 | Python | DEVESHTARASIA/json-resume-to-latex | /json_to_tex/json_to_tex/__main__.py | UTF-8 | 5,823 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import json_to_tex as jtt
import json
import os
import sys
import re
from pathlib import Path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'filepaths',
type=Path,
nargs='+',
help='Filepaths to text template and JSON files. JSON files will be merged in... | true |
0cc7217a781fdb06d4b2636e2bef864703c9f8d0 | Python | a-shchupakov/Sky_viewer | /sky.py | UTF-8 | 2,570 | 2.9375 | 3 | [] | no_license | import os
import argparse
from modules import sky_gui
from tkinter import *
def check_version():
if sys.version_info < (3, 3):
print('Use python >= 3.3', file=sys.stderr)
sys.exit()
def raise_error():
print('Usage error.\r\nTry using ./sky.py --help')
sys.exit()
def cr... | true |
f115ac96a2b419f6441658c7948e229c1e0f06dc | Python | NRdeARK/Arduino | /testvisual/Untitled-1.py | UTF-8 | 128 | 3.453125 | 3 | [] | no_license | t=input("")
text=str(t)
TEXT=text.upper
for i in text:
if (TEXT[i] in "ABCDEFGHIJKLNMOPQRSTUVWXYZ"):
print(text[i])
| true |
c0915d0a00b134ee8ef6dcfee9eeb796a690f96a | Python | tonghuikang/live-pitch-tracking | /poster/step_1.py | UTF-8 | 4,828 | 2.734375 | 3 | [] | no_license | '''
only works for piano, what if the sound is being replaced the exact same frequency?
piano because it dampens
'''
import numpy as np
import matplotlib.pyplot as plt
import sounddevice as sd
import soundfile as sf
import time
import os
start_time = time.time()
# read file
fileDir = os.path.dirname(os.path.realpath... | true |
95dc905c95377d6d1b4114fc259669ec66b0f029 | Python | braingram/comando | /pycomando/protocols/base.py | UTF-8 | 1,174 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
#import sys
import weakref
from .. import errors
from ..comando import to_bytes, stob
#if sys.version_info >= (3, 0):
# stob = lambda s: s.encode('latin1') if isinstance(s, str) else s
# btos = lambda b: b.decode('latin1') if isinstance(b, bytes) else b
#else:
# stob = str
# btos = ... | true |
01b8011c5093a8fc05e5362e65e54bafbf4c8844 | Python | ides13/claimsim | /claimsim20200705.py | UTF-8 | 4,721 | 2.984375 | 3 | [] | no_license | #===============================================================================
# 爬Google美國的美專說明書
#===============================================================================
from bs4 import BeautifulSoup
import requests
def download_patent_html (patentno):
url = 'https://patents.google.com/patent/... | true |
a19bf849071cd1bc13454ea295c41a22403944f5 | Python | VakinduPhilliam/Python_Data_Science | /Python_Data_Science_Pattern_En.py | UTF-8 | 1,712 | 3.328125 | 3 | [] | no_license | # Python Data Science and Analytics.
# Data Science is a field in computer science that is dedicated to analyzing patterns in raw data using
# techniques like Artificial Intelligence (AI), Machine Learning (ML), mathematical functions, and
# statistical algorithms.
# Pattern is a web mining module for the Python pr... | true |
7594a6f18fbce84bd00a95c2842e18e3c187a129 | Python | Bit4z/python | /python/print row collunm.py | UTF-8 | 178 | 3.25 | 3 | [] | no_license | m=int(input("enter row"))
n=int(input("enter collunm"))
k=1
for i in range(m):
for j in range(n):
print("*",end="")
k=k+1
print(end="\n")
| true |
1a4c42958087358ed8a72bc611dcc89c3aa8de69 | Python | rayhanaziai/Practice_problems | /str_reverse.py | UTF-8 | 708 | 3.984375 | 4 | [] | no_license | def reverse_list(l, first_letter, last_letter):
i = first_letter
j = last_letter
while i < j:
l[i], l[j] = l[j], l[i]
i += 1
j -= 1
return l
def reverse_s(s):
char_lst = list(s)
reverse_list(char_lst, 0, len(char_lst)-1)
i = 0
for end_letter in xrange(len(char_... | true |
36ba29adbe56a5947cb526ef37cd2354141fc3ce | Python | betancjj/UC_APOP | /FiveHoleProbe/DataProcessing/Python/FiveHoleProbe_CalibrationAndProcessing.py | UTF-8 | 9,839 | 2.59375 | 3 | [] | no_license | #from scipy.interpolate import spline
import os
import numpy as np
import matplotlib.pyplot as plt
def lin_interp(indeps,deps,spec_indep):
for ind,indep in enumerate(indeps):
if spec_indep > indep and spec_indep < indeps[ind+1]:
low_indep = indep
high_indep = indeps[ind+1]
... | true |
63a2bc86260b5b7c8323c2b986a28d7dddf35011 | Python | JasonLeeFdu/SRCNN | /VERSIONs/v1/RecordMaker.py | UTF-8 | 4,043 | 2.578125 | 3 | [] | no_license | import os
import cv2 as cv
import numpy as np
import math
import tensorflow as tf
from PIL import Image as image
def prepareTrainingData(recordName):
# PIL RGB More efficiently
# img.size[0]-- width img.size[1]-- height
# tf.record里面有一个一个的example,每一个example,每一个example都是含有若干个feature的字典
# opencv 矩阵计... | true |
7ceb90d046bf117d268124cab8ed147a31e6f211 | Python | beginnerHB1/Invoice_extraction | /unicareer.py | UTF-8 | 8,794 | 2.859375 | 3 | [] | no_license | import pdftotext
import re
def read_text(lst):
text = lst[0][:lst[0].index("A Finance charge will be imposed by")]
for i in range(1, len(lst)):
start_index = lst[i].index("AMT") + 3
# try:
# end_index = lst[i].index("TOTAL NET SALE USD")
end_index = lst[i].index("A Finance charg... | true |
0e81b2c2b5683bd55a87e31e16e634025c3cfa1f | Python | wingluck/stock-analysis | /stock_analysis.py | UTF-8 | 2,184 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import pandas as pd
import datetime
class StockData(object):
def __init__(self, fname) -> None:
self._inited = False
self.fname = fname
self.stock_id = fname.split('.')[0]
def amplitude(datadir='stock-data', interval=30, end_date=None):
"""
Ca... | true |
3f0ff6724ead56a407c4a1e58b230c8dea1aaf19 | Python | mehdirazarajani/MinutesOfMeeting | /meeting-transcript-data-text-parser/venv/ProblasticRanking.py | UTF-8 | 9,115 | 3.109375 | 3 | [] | no_license | import json
import string
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
import csv
import spacy
import operator
from jellyfish import jaro_distance
# clusters = [name of clusters]
# all_words_in_collection = set()
# collections = {word:{list:{cluster#:word_count},total_word_count:int,cluster_... | true |
9354efb4d1cdd3b0f9dc3218b4fc93c2ba645dde | Python | Urvashi-91/Urvashi_Git_Repo | /Interview/Stripe/triangle.py | UTF-8 | 1,181 | 3.984375 | 4 | [] | no_license | // https://www.codewars.com/kata/56606694ec01347ce800001b/solutions/javascript
// Implement a method that accepts 3 integer values a, b, c. The method should return true if a triangle can be built with the sides of given length and false in any other case.
// (In this case, all triangles must have surface greater tha... | true |
55affb214e0ecbf6c75510f302126be6cac2eb77 | Python | DLenthu/Face_applications | /deep_face/face_similarity.py | UTF-8 | 730 | 2.703125 | 3 | [] | no_license | from deepface import DeepFace
import cv2
import matplotlib.pyplot as plt
import logging
import os
import math
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
logging.getLogger('tensorflow').setLevel(logging.FATAL)
img1_path = "test1.j... | true |
61da1d7f7e22c7199373f590895085ce42cf6442 | Python | mrcszk/Python | /Kolokwium/liczby_zaprzyjaźnione.py | UTF-8 | 688 | 4 | 4 | [] | no_license | #program wypisujący pary liczb zaprzyjaźnionych mniejszych od n
def szukanie_dzielnikow(a):
dzielniki = []
for i in range(1,a):
if not a%i:
dzielniki.append(i)
return dzielniki
def sumowanie_dzielników(a):
dzielniki = szukanie_dzielnikow(a)
suma = 0
for i in range(len(dzielniki)):
suma += ... | true |
84d804575079f8787b1a93b3c531fcaa35993667 | Python | mdnahidmolla/URI-Online-Judge-Solutions-in-Python | /URI-Online-Judge-Solutions-in-Python/1037 - Interval.py | UTF-8 | 356 | 3.65625 | 4 | [] | no_license | n = float(input())
if (n >= 0 and n <= 25.0000):
print("Intervalo [0,25]")
elif (n >= 25.00001 and n <= 50.0000000):
print("Intervalo (25,50]")
elif (n >= 50.00000001 and n <= 75.0000000):
print("Intervalo (50,75]")
elif (n >= 75.00000001 and n <= 100.0000000):
print("Intervalo (75,100]")
else:... | true |
11f55aef051019c4e15313365ab16a66ffeacd56 | Python | AkshithBellare/year3sem5 | /daa300/lab/6lab/fractional_knapsack.py | UTF-8 | 1,641 | 3.953125 | 4 | [] | no_license | class Item:
def __init__(self, value, weight):
self.v = value
self.w = weight
self.x = 0
def __str__(self):
return f"weight={self.w} value={self.v}"
def greedy_fractional_knapsack(items, capacity):
num_items = len(items)
for i in range(num_items):
items[i].x... | true |
d47903a7b8639baaf846930bcfc6c0d68730ebb3 | Python | smallblackMIN/PytestPractice | /tesecase/test_Calc_02.py | UTF-8 | 4,512 | 3.453125 | 3 | [] | no_license | from func.Calc import Calc
import pytest
import yaml
class Test_Calc_02():
def setup(self):
self.calc = Calc()
@pytest.mark.parametrize(["a","b","c"], yaml.safe_load(open("add_normal_data.yaml")))
def calc_add_normal(self,a,b,c):
'''
针对加法中正常数值的等价类用例
:param a: 加数1
:... | true |
8385b0c2059bcb4a8f4fe2011810ed408837ddc6 | Python | nightfuryyy/deep-text-recognition-benchmark | /modules/gcn.py | UTF-8 | 4,131 | 2.6875 | 3 | [] | permissive |
import math
import torch
import torch.nn as nn
class GraphConvolution(nn.modules.module.Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, batch_size, len_sequence, in_features, out_features, bias=False, scale_factor = 0., dropout = 0.0, isnormalize =... | true |
15f92fcf1a5ced90ef592a881582eef2f580b4d7 | Python | rajendrapallala/hackerrank-python-practice | /strings/alphabet_rangoli.py | UTF-8 | 1,439 | 3.40625 | 3 | [] | no_license | def print_rangoli(size):
import string
alpha = string.ascii_lowercase
l =[]
if size == 0:
return
if size == 1:
print(alpha[0])
return
for i in range(size):
strg = alpha[i:size]
l.append('-'.join(strg[::-1]+strg[1:]).center(size+3*(size-1),'-'))
print(... | true |
59506802f17561e3061ceb6204731980c05e0a5f | Python | midas-research/calling-out-bluff | /Model2-EASE/src/nltk/nltk/stem/snowball.py | UTF-8 | 150,072 | 3.5625 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-NC-ND-3.0",
"AGPL-3.0-only",
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#
# Natural Language Toolkit: Snowball Stemmer
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Peter Michael Stahl <pemistahl@gmail.com>
# Peter Ljunglof <peter.ljunglof@heatherleaf.se> (revisions)
# Algorithms: Dr Martin Porter <martin@tartarus.org>
# URL: <http://www.nltk.org/>
# Fo... | true |
3a473f649011be04111abf61011f18f8df9ad106 | Python | aclements/thesis | /thesis/data/processors/moore.py | UTF-8 | 5,286 | 2.546875 | 3 | [] | no_license | import collections
import datetime
import json
import re
import csv
import os
import itertools
class Proc(collections.namedtuple(
'Proc', 'name date clock_mhz cores total_cores tdp_watts product_id')):
def dominates(self, other):
"""Return True if self strictly dominates other."""
# cmps =... | true |
bb401e48c400835bb31114e2a6db0c5b1a58f22d | Python | ShallyZhang/Shally | /microblock.py | UTF-8 | 1,226 | 2.8125 | 3 | [] | no_license | import datetime # 导入时间库
import hashlib # 导入哈希函数库
from Transaction import Transaction # 导入交易类
class microblock: # 交易块的类,也称作microblock 的类
def __init__(self,previoushash):
self.transactionlist = [] # 交易数据列表
self.timestamp = datetime.datetime.now() # 当前交易块时间
self.hash = No... | true |
7b4e9ede9cbe7bab84e574d1250cdd71f76c01cc | Python | Melted-Cheese96/WebinteractionBots | /very_basic_web_scraper..py | UTF-8 | 219 | 2.53125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import re
r = requests.get('https://www.jimsmowing.net')
content = r.text
soup = BeautifulSoup(content, 'html.parser')
#print(soup.find_all('p')[4].get_text()) | true |
249acf53c0392f37d40ceb10e9e82d4574fc8473 | Python | ripl/camera-scene-classifier | /src/scene_classifier | UTF-8 | 3,053 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# @Author: Andrea F. Daniele <afdaniele>
# @Date: Thursday, April 27th 2018
# @Email: afdaniele@ttic.edu
# @Last modified by: afdaniele
# @Last modified time: Thursday, April 27th 2018
import sys, os
import numpy as np
import math
import rospy
import json
from darknet_ros_msgs.msg import Bo... | true |
c0c31cbf6027550e7fed4758fb49c21d436e3d36 | Python | kaizsv/GoMoKu | /player.py | UTF-8 | 2,292 | 3.0625 | 3 | [] | no_license | import re
import numpy as np
class Player(object):
def __init__(self, player, learing, n):
self.player = player
self.color = 'Black' if player == 1 else 'White'
self.is_learning = learing
self.board_size = n
def __str__(self):
return self.__class__.__name__ + ' is ' + s... | true |
3390aa3a961f55033a15ad80520071decbfd77e1 | Python | lpatruno/airline-time-analysis | /PythonScripts/avg_delay_by_time_outgoing/heatmap.py | UTF-8 | 644 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
"""
Generate the heat map using the previously computed data for avg depart delay by time
@author Luigi Patruno
@date 29 Apr 2015
"""
file_path = '../../data/avg_delay_by_time_outgoing/part-00000'
data = []
f = open(file_path)
for line in f:
key, val = line.strip().split('\t')
(month, ... | true |
ac0ea7882e3bb6d15b6181dd1efb16854c8ae9d9 | Python | atlarge-research/opendc-autoscaling-prototype | /autoscalers/plan_autoscaler.py | UTF-8 | 5,372 | 2.65625 | 3 | [] | no_license | from collections import deque
from autoscalers.Autoscaler import Autoscaler
from core import SimCore, Constants
from core.Task import Task
class PlanAutoscaler(Autoscaler):
def __init__(self, simulator, logger):
super(PlanAutoscaler, self).__init__(simulator, 'Plan', logger)
# will contain one p... | true |
2267289dfe1db171ed8295c49eec7deb46808043 | Python | devilhtc/leetcode-solutions | /0x0024_36.Valid_Sudoku/solution.py | UTF-8 | 993 | 2.984375 | 3 | [] | no_license | class Solution:
def isValidSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: bool
"""
def validate_vals(vals):
return all(
v == 1
for _, v in collections.Counter(
[int(v) for v in vals if v != "."]
... | true |
2ff3fe7475c1799365623032e1cdc2296b5e846b | Python | 5l1v3r1/RumourSpread | /OriginalModel/graph.py | UTF-8 | 1,708 | 3.28125 | 3 | [] | no_license | import numpy as np
class Graph:
def __init__(self, n):
self.n = n
self.adj_list = [[] for i in range(n)]
def add_edge(self, u, v):
self.adj_list[u].append(v)
self.adj_list[v].append(u)
def add_node(self):
self.n += 1
self.adj_list.append([])
re... | true |
40e65b777920adf80c5d6656e5a9cdda2890c959 | Python | department-of-general-services/code_jam | /advent_of_code_2020/james/day_2/day_two.py | UTF-8 | 1,947 | 3.625 | 4 | [] | no_license | import functools
import time
from pathlib import Path
from itertools import combinations
import pandas as pd
import re
def split_input(row):
regex = r"^(\d+)-(\d+)\s(\w):\s(\w+)"
match = re.match(pattern=regex, string=row["raw_text"])
row["min_reps"] = int(match.groups()[0])
row["max_reps"] = int(matc... | true |
d32415e83f4447be4139a778226ca0f0b28ff00f | Python | dongho108/CodingTestByPython | /boostcamp/ex/dfs_bfs/1_solved.py | UTF-8 | 399 | 2.875 | 3 | [] | no_license | answer = 0
def dfs(n, sum, numbers, target):
global answer
if n == len(numbers):
if sum == target:
answer += 1
return
dfs(n+1, sum+numbers[n], numbers, target)
dfs(n+1, sum-numbers[n], numbers, target)
def solution(numbers, target):
global answer
dfs(1, numbers[0... | true |
ae67114d4b45a5bb8d07bddc9422542c16ac01df | Python | madacol/segwit-p2sh | /test-pw.py | UTF-8 | 1,889 | 2.828125 | 3 | [
"WTFPL",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
import sys
from lib.keystore import from_bip39_seed
from lib.storage import WalletStorage
from lib.wallet import Standard_Wallet
# Change this to be YOUR seed phrase:
SEED_WORDS = 'final round trust era topic march brain envelope spoon minimum bunker start'
# Change this to be the addresses the ... | true |
3c138392271675bd8caf3c8a93ce20e8bf2c0e1a | Python | Nikolov-A/SoftUni | /PythonBasics/E_Easter_eggs_battle.py | UTF-8 | 625 | 4 | 4 | [] | no_license | eggs_player_1 = int(input())
eggs_player_2 = int(input())
winner = None
while winner != "End of battle":
winner = input()
if winner == "one":
eggs_player_2 -= 1
elif winner == "two":
eggs_player_1 -= 1
if eggs_player_1 == 0:
print(f"Player one is out of eggs. Player two has {... | true |
9456097f653c47004e5f28ae43f19b9138fea4e4 | Python | ArmanHZ/CS401-GitHub_Analyzer | /DevelopersNetwork andClustring/Developers Network.py | UTF-8 | 3,524 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
# Developers simple network graph
import networkx as nx
import matplotlib.pyplot as plt
class Link:
def __init__(self, _source, _target, _value):
self.source = _source
self.target = _target
self.value = _value
links = []
with open("Partne... | true |
2e7e246281e7100f3cb3143bd5461512bc422965 | Python | gersonUrban/find_best_words_with_chi2 | /data_prep.py | UTF-8 | 1,007 | 3.359375 | 3 | [] | no_license | from nltk.corpus import stopwords
def basic_preprocess_text(text_series, language='english'):
'''
Function to make a basic data prep in text, according to sentiment analysis dataset
text_series: pandas series with texts to be treated
language: string indicating stopwords language to be used
return:... | true |
2230dcca831f061291c7f96e93c0ac47a6fc5b09 | Python | Abiyash/guvi | /code kata/prime.py | UTF-8 | 137 | 3.25 | 3 | [] | no_license | a=int(input())
if a>0:
for x in range(2,a):
if(a%x==0):
print("no")
break
else:
print("yes")
else:
print("no")
| true |
7d1f106223c7d1ab1e4620d9d36b29a15adbbb9c | Python | cyberLaVoy/algorithms-notebook | /python/bfs.py | UTF-8 | 571 | 3.53125 | 4 | [] | no_license | from queue import Queue
# graph: a list of lists (adjacency list) [ [ w0, w1, ...], ...]
# start: starting vertex as index to adjacency list
# Output: the step-wise distance to all vertices from start vertex
def bfs(graph, start):
distance = [None]*len(graph)
distance[start] = 0
queue = Queue() # F... | true |
a46d190b3af807185b10e1a961267fe6922332de | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2211/60624/278179.py | UTF-8 | 609 | 2.921875 | 3 | [] | no_license | def func10():
temp = list(map(int, input().split(" ")))
n = temp[0]
k = temp[1]
names = [input().split(" ")[0]]
for i in range(n-1):
names.append(input().split(" ")[0]+names[i])
interesting_names = []
while k > 0:
k -= 1
interesting_names.append(input())
ans = []
... | true |
ac1e7292ea135c0f00f69eb7a5b34dc87ed8de6f | Python | rrwt/daily-coding-challenge | /gfg/heaps/connect_ropes.py | UTF-8 | 670 | 3.828125 | 4 | [
"MIT"
] | permissive | """
There are n ropes of different lengths, we need to connect these
ropes into one rope. The cost to connect two ropes is equal to sum of
their lengths. We need to connect the ropes with minimum cost.
"""
import heapq
from typing import List
def connect_cost(ropes: List[int]) -> int:
length = len(ropes)
if ... | true |
fcaa4403f299b93115cc2c70aa24e3b904905308 | Python | Kurolox/AdventOfCode17 | /Python/7/part2.py | UTF-8 | 1,096 | 3.453125 | 3 | [] | no_license | disk_dict = {}
weight_dict = {}
problematic_nodes = []
def find_weight(program):
# Check if the program has a disk above itself
if len(disk_dict[program]) > 0:
weight = []
# If it does, check the weight of each one of said programs
for i, disk_program in enumerate(disk_dict[program]):... | true |
ad40731ed07afe9791d0f45db99932ce73dc9a59 | Python | andrebargas/xor-neural-net | /xor_neural_network.py | UTF-8 | 2,082 | 3.546875 | 4 | [
"MIT"
] | permissive | from numpy import exp, array, dot, random
class NeuralNetwork():
def __init__(self):
# inicializa gerador de numeros aleatorios
random.seed(1)
self.synaptic_weights_1layer = 2 * random.random((3, 2)) - 1
self.synaptic_weights_2layer = 2 * random.random((2, 1)) - 1
def sigmoid(se... | true |
04a2eb6f6a074ccc997bb897d50b5f0dd679a818 | Python | mkao006/dl_udacity | /deep_learning_nano_degree/4_recurrent_neural_networks/seq2seq/seq2seq.py | UTF-8 | 14,751 | 3.34375 | 3 | [] | no_license | # Steps for training a seq2seq model.
#
# Data processing:
# - Create dictionary to convert words in to index.
# - Append special start and end tokens.
# - Pad sequence to maximum length. (7 in this example)
# - Pad target sequence with start token
#
# Model:
# - Create embedding layer for input seq... | true |
dec404ac01d62b54c6eb62d1a30d66e8391539e6 | Python | ArtjomKotkov/Tobe | /tobe/bot/games/types.py | UTF-8 | 2,098 | 3.015625 | 3 | [] | no_license | from ..types import BaseType
from ..base.types import PhotoSize, MessageEntity, Animation, User
class Game(BaseType):
"""This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
Parameters
----------
title : String
Tit... | true |
10ae1fdde42992888ec43a47ed5909d651b50022 | Python | MarvinLiangWW/learning_python_cookbook | /第一章:数据结构与算法/learning.py | UTF-8 | 3,893 | 3.484375 | 3 | [] | no_license | # 需要掌握一些基础的包 以及内置的常用函数,加快处理
# 学习这个用来记笔记的话还是用jupyter notebook比较好一点
from collections import Counter
# most_common
from collections import deque
import heapq
nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2]
print(heapq.nlargest(3, nums)) # Prints [42, 37, 23]
print(heapq.nsmallest(3, nums)) # Prints [-4, 1, 2]
class Pri... | true |
3abd81148d21cbd5dff537453432310c3f5c383a | Python | Jimmy-INL/google-research | /tf3d/utils/voxel_utils_test.py | UTF-8 | 18,644 | 2.515625 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | true |
107443104641161132dd28b5a7adf4c52b1eec0c | Python | SnehaMishra28/Python-DeepLearning_Fall2018 | /Mod1_Lab1/Source/mod1_lab1/Part4.py | UTF-8 | 4,092 | 3.484375 | 3 | [] | no_license | # Hospital Class with name and address public data attribute
class Hospital:
def __init__(self, n, a):
self.hname = n
self.haddress = a
# Dental Procedure class with procedure name , procedure code , procedure fee detailes
class Procedure:
def __init__(self, pcode, pname, pfee):
self.pr... | true |
bb4d0af6c8cf44f223333a00f82553c5ddc61e4f | Python | RagavendranMRN/Machine-Learning-Scratch | /Linear Regression/Basic Linear Regression.py | UTF-8 | 385 | 3.125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
df = pd.read_csv('mydata.csv')
plt.xlabel('area')
plt.ylabel('prices')
plt.title("HOUSE PRICE PREDICTION")
plt.scatter(df.area,df.prices,color='red',marker='+')
area = df[['area']]
price = df.prices
price
reg = linea... | true |
6731d94cc5eee423fc2d1f7ac455645719d09788 | Python | rmorgan10/PythonProgrammingGroupStudy | /People/Juan/Week 4/Currency.py | UTF-8 | 2,333 | 3.359375 | 3 | [
"MIT"
] | permissive | from typing import List
import csv
import os
from decimal import Decimal
class Money:
"""
Class that holds currency of a particular type
"""
CURRENCIES_FILENAME = os.path.join(os.getcwd(),"currency_codes.csv")
def __init__(self, amount: Decimal, currency_code: str = "USD"):
if currency_code.upper() not in ... | true |
2e867bb74e02a0f8320aace9ff1bd0c10f8a1802 | Python | bp274/HackerRank | /Algorithms/Graphs/Breadth First Search - Shortest Reach.py | UTF-8 | 1,044 | 3.234375 | 3 | [] | no_license | #!/bin/python3
def bfs(n, m, graph, s):
distance = [-1 for _ in range(n)]
distance[s] = 0
frontier = [s]
while frontier:
next = []
for u in frontier:
for v in graph[u]:
if distance[v] == -1:
distance[v] = 6 + distance[u]
... | true |
f212e8bea367d8455149b428bf3c67506da672d6 | Python | jtlongino/lott-python | /exercises/chapter_5/section_5_5_2_problem_5.py | UTF-8 | 84 | 3 | 3 | [] | no_license | """ Exercise 5 from Section 5.5.2 """
print("Force on sail is", 15**2 * 0.004 * 61)
| true |
5d59d7090768f74771f2af62bc39a0e8db2a1900 | Python | DrDavxr/Water-Rocket-Simulator | /Simulator_H2O_rocket.py | UTF-8 | 5,665 | 2.953125 | 3 | [
"MIT"
] | permissive | """
Trajectory simulator of the H2O rocket for the Course on Rocket Motors.
"""
# Import the libraries.
import numpy as np
from Integration import Simulation
from scipy.optimize import minimize_scalar
import matplotlib.pyplot as plt
# %% SOLVE FOR THE TRAJECTORY OF THE ROCKET.
def main(x, *args):
# Definition ... | true |
bc0463aaae21fa46807494b1f6759ad426d8ff27 | Python | deepak3698/FlaskAPI-For-AudioFileType | /main.py | UTF-8 | 9,093 | 2.640625 | 3 | [] | no_license | from flask import Flask, request, jsonify
import json
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import os
# Init app
app = Flask(__name__)
# Reading Data from Json
with open('config.json', 'r') as data:
params = json.load(data)["params"]
# Database
app.config['SQLALCHEMY_... | true |
a1b5ce391f1b8feb2af28f5d0aba813924270939 | Python | FreshDee/DataMiningETHZ | /Assignment1/Problem2.py | UTF-8 | 1,393 | 2.9375 | 3 | [] | no_license | import re
import sys
import collections
def mapCount(id, lines):
emit_array = []
for line in lines:
line = line.replace("\n", " ")
line = line.replace("\t", " ")
line = re.sub(r'[^\w\s]', '', line)
line = re.sub(r'[0-9]+', '', line)
words = re.split(r'\W+', line)
... | true |
7d5077c3a7e0d8f116d27c76d46859301fbf99ef | Python | pbrowneCS/srsBznz | /srsBznz.py | UTF-8 | 2,268 | 2.75 | 3 | [] | no_license | import random
class Unit(object):
def __init_(self):
self.name = name
self.energy = 5
self.health = 100
self.strength = 5
self.intelligence = 5
self.dexterity = 5
self.defense = self.level * 1.5 + self.strength * 2
self.evade = self.level * 1.5 + self.dexterity * 2
self.will = self.level * 1.5 + self... | true |
8201e308967edc9e652ed1d0063306ca5cc70e5e | Python | dmaynard24/leetcode | /python/questions_001_100/question_015/three_sum.py | UTF-8 | 1,546 | 3.59375 | 4 | [] | no_license | # 3Sum
# Problem 15
# Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
# Note:
# The solution set must not contain duplicate triplets.
# Example:
# Given array nums = [-1, 0, 1, 2, -1, -4],
# A solutio... | true |
9f6a61f388a792ff037a8595440f70d438d263e4 | Python | Nefed-dev/Euler-project | /euler_010.py | UTF-8 | 540 | 3.9375 | 4 | [] | no_license | # Сумма простых чисел меньше 10 равна 2 + 3 + 5 + 7 = 17.
# Найдите сумму всех простых чисел меньше двух миллионов.
# Решето Эратосфена
def get_primes(n):
m = n+1
numbers = [True] * m
for i in range(2, int(n**0.5 + 1)):
if numbers[i]:
for j in range(i*i, m, i):
numbers[j] = False
primes = [... | true |
5bdee83e82999542c01ac399860b446291816646 | Python | ifredom/py-desktop-app | /tweepy/demo1.1.py | UTF-8 | 916 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# coding:utf-8
import tweepy
import json
consumer_key = 'dkYGHcJMl4enNsNIMJYE3vx0M'
consumer_secret = 'F0zCq4ietgc0zAIvDeugLGOeou8AMpyTXk7O8WirvdZe9aI1G5'
access_token = '796625332501671936-nu7pw8sL71pVTztbXjooyZnT5Q8xrfL'
access_token_secret = '1GAx8IQPtaDiIZ9BMB4SgpphIGjZdcWbrEjnDD5YaEmtf'
# 获取特朗普... | true |
8d9d40f748d8351017fe52bef8296c45a8bbea76 | Python | botaoap/python_db_proway_2021 | /aula2/class/classes.py | UTF-8 | 943 | 4.3125 | 4 | [] | no_license | """
classmethod - staticmethod - dcorators
"""
class MinhaClasse:
def __init__(self, nome, idade) -> None:
self.nome = nome
self.idade = idade
def __repr__(self) -> str:
return f"{self.nome}, {self.idade}"
def metodo_de_instancia(self):
print(f"Eu sou uma classe {s... | true |
b13f87760e333ab606977ec77e251d0d422e8c32 | Python | hhuongnt/Sorting-Deck | /test/bla.py | UTF-8 | 39 | 2.703125 | 3 | [] | no_license | for i in range(1,-2,-1):
print (i)
| true |
2b7fc7c4ecc786f3c7a7d9f72f3c12e1472d0789 | Python | rafiyajaved/ML_project_1 | /boosting.py | UTF-8 | 4,133 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 15 16:30:02 2017
@author: Rafiya
"""
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metr... | true |
5cac9717cb78fa03ae3cc9e01a8776069e0d99b0 | Python | gh102003/CipherChallenge2020 | /transposition.py | UTF-8 | 740 | 3.25 | 3 | [] | no_license | ciphertext = input("Enter ciphertext: ")
key = input("enter decryption key: ")
def clean_key(key):
out = []
for c_in in key:
try:
c_out = int(c_in)
except:
c_out = ord(c_in.upper()) - 64
out.append(c_out)
return out
column_orders = clean_key(key)
column_l... | true |
ab063c3ee1cd44b09e7c6b11b62c0222df623c80 | Python | varunhari17/-calculadora-del-sistema | /syscalculator.py | UTF-8 | 6,602 | 2.8125 | 3 | [] | no_license | import tkinter
from tkinter import *
from tkinter import messagebox
val =" "
A = 0
operator = ""
def btn_1_isclicked():
global val
val = val + "1"
data.set(val)
def btn_2_isclicked():
global val
val = val + "2"
data.set(val)
def btn_3_isclicked():
global val
val =... | true |
bd698800dc9655c7f8c0db11ee57accf60786d0d | Python | shixing/CDS | /py/corpus/word2phrase.py | UTF-8 | 4,368 | 2.859375 | 3 | [] | no_license | # 1 POS tags
# 2 Scan A + N, find top 50K phrases
# replace top 50K phrases
import sys,os
import nltk
import cPickle
from utils.config import get_config
import configparser
import logging
def pos_tagging(file_in, file_out):
fin = open(file_in)
fout = open(file_out,'w')
i = 0
for line in fin:
s... | true |
500c0b02f97523c037576a15c041405bf2908ec4 | Python | Y-Suzaki/python-alchemy | /python-alchemy/src/sqlalchemy_writer_test.py | UTF-8 | 2,018 | 2.609375 | 3 | [] | no_license | import unittest
from sqlalchemy_writer import SqlAlchemyWriter
from model.skill import Skill
from model.engineer import Engineer
from model.engineer_skill import EngineerSkill
class SqlAlchemyWriterTest(unittest.TestCase):
def test_skill_all(self):
# 外部キー張っているので、先に削除しておく
SqlAlchemyWriter... | true |
e9b84b5aa87c97f3af8cb4a79a16a1ff5793af14 | Python | priyankakushi/machine-learning | /028_11_19 OOPS.py | UTF-8 | 1,852 | 4.25 | 4 | [
"CC-BY-3.0"
] | permissive | #create a class named MyClass
'''class MyClass:
#assign the values to the MyClass attributs
number = 0
name = "abc"
def Main():
#Creating an object of the MyClass. Here, "me" is the object
me = MyClass()
#Accessing the attributes of MyClass using the dot(.)operator
me.number = 1337
me.... | true |
af0eb1af682ccbf99d43db230e3a3b64942848f5 | Python | SummerNam/Python-Study | /part03_16.py | UTF-8 | 442 | 3.59375 | 4 | [] | no_license | Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> # Nth fibonacci number
>>>
>>> def main():
n = int(input("Enter the value of n: "))
fst, snd = 1,1
for i in range(n-2):
fst, snd = fst+snd ,fst
... | true |
7597dbe0bceef93ec1bd121b62fcbd28c35b3945 | Python | hculpan/StarTradingCompany | /app.py | UTF-8 | 1,703 | 2.765625 | 3 | [
"MIT"
] | permissive | import pygame
import random
from StarTradingCompany import MainScene
class MainApp:
def main_loop(self, width, height, fps):
random.seed()
pygame.init()
pygame.font.init()
screen = pygame.display.set_mode(
(width, height), pygame.SCALED)
pygame.display.set_cap... | true |
5226b8bf4fb87ab540ffbb8e777b1371c9a740a3 | Python | jackey6/test-repo | /test.py | UTF-8 | 91 | 2.84375 | 3 | [] | no_license | a = 5;
def fun():
a = 10;
print(a)
def conflict():
print(a)
print(a)
fun()
conflict() | true |
6afedb3479a402cb83ffca1ddb78e6cdcd2b3069 | Python | jerrylee529/twelvewin | /analysis/test.py | UTF-8 | 2,704 | 2.921875 | 3 | [] | no_license | # coding=utf8
"""
测试文件
"""
__author__ = 'Administrator'
import numpy as np
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
#x1 = np.array([1, 2, 3, 1, 5, 6, 5, 5, 6, 7, 8, 9, 9])
#x2 = np.array([1, 3, 2, 2, 8, 6, 7, 6, 7, 1, 2, 1, 3])
#x = np.array(list(zip(x1, x2))).reshape(len(x1), 2)
... | true |