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 |
|---|---|---|---|---|---|---|---|---|---|---|
85db5e2de2a1c8e8c842f81043f8b8b7b70adfe0 | Kryvtsov15/Tests-db2 | /handle_numbers.py | UTF-8 | 168 | 3.25 | 3 | [] | no_license | def handle_numbers(number1, number2, number3):
count = 0
for i in range(number1, number2+1):
if i % number3 == 0:
count+=1
return count
| true |
359ba376abc2fb7fbc2b3be09c6b548bcb864253 | imdad000/Data-Scrapping | /z.py | UTF-8 | 591 | 2.859375 | 3 | [] | no_license | import bs4 as bs
import urllib.request
source = urllib.request.urlopen('https://pythonprogramming.net/parsememcparseface/').read()
soup = bs.BeautifulSoup(source,'lxml')
print(soup.title)
for para in soup.find_all('p'):
print(para.text)
print(soup.get_text())
for url in soup.find_all('a'):
print(url.get(... | true |
eae483024867e27e450344e2014fd0ad595384e7 | febin97/Hello-World | /HackerRank_Birthday_Chocolate.py | UTF-8 | 822 | 2.859375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the solve function below.
def solve(n, s, d, m):
sum1 = 0
count = 0
for i in range(m):
sum1 = sum1+s[i]
if n==m:
if sum1 == d:
return 1
for i in range(n-m+1):
pr... | true |
7161af3bfcfdfc69fb6b08cf667220eccbfb7798 | zicbrain/g-coin | /gcoin/proof.py | UTF-8 | 802 | 2.859375 | 3 | [] | no_license | import hashlib
import gcoin.config as cfg
def valid_proof(block, proof=None):
""" Validates proof
last digits of hash(previous_block.header, proof)
== config.PROOF_DIGITS
Args:
block (obj):
proof (int): proof to validate
Returns:
bool:
"""
proof = proof if p... | true |
928b249284604ef6a6fd7736715a548917373939 | Gemma-Analytics/ewah | /ewah/utils/log_cleanup_dag.py | UTF-8 | 4,402 | 2.578125 | 3 | [
"MIT"
] | permissive | # Adapted from https://github.com/teamclairvoyant/airflow-maintenance-dags
from airflow.models import DAG, Variable
from airflow.operators.bash import BashOperator
from airflow.configuration import conf
from datetime import datetime, timedelta
import os
# from c_utils.various_constants import AirflowConstants
# acs = ... | true |
2d072c8e8551d7ee8b820d17ffe1573f57c7e290 | alexandraback/datacollection | /solutions_5731331665297408_0/Python/ChevalierMalFet/bruteSalesman.py | UTF-8 | 1,841 | 3.0625 | 3 | [] | no_license | import itertools
inputFile = open('C-small-attempt0.in', 'r')
outputFile = open('C-small-attempt0.out', 'w')
numTests = int(inputFile.readline())
def checkPossible(perm, connectivity, debug = False):
# Check if it's a valid city ordering
isPossible = True
visited = [perm[0]]
for i in range... | true |
17e619f940bae192b712eeccde96b3c431268c27 | Aasthaengg/IBMdataset | /Python_codes/p02873/s494889245.py | UTF-8 | 538 | 3.34375 | 3 | [] | no_license | def main():
S = input()
smaller_cnt = [0] # <
seq_cnt = 0
for c in S:
if c != '<':
seq_cnt = 0
else:
seq_cnt += 1
smaller_cnt.append(seq_cnt)
larger_cnt = [0] # >
for c in S[::-1]:
if c != '>':
seq_cnt = 0
else:
... | true |
6c3b68f16babf11a1abfd8d480241a1f7a8e788c | TheGarvitGupta/Face-Identification | /face detect and track/Azure/train_faces_add_person_2.py | UTF-8 | 1,527 | 2.765625 | 3 | [] | no_license | # 2) Add people to the group
########### Python 2.7 #############
import httplib, urllib, base64, json
from keys import SubscriptionKey
import os
import time
# The absolute path to the folder that contains a folder for each person
folderPath = "C:/Users/garvit/Desktop/Extract Images/Mountain View - 520"
peo... | true |
839cbfcf889629a9e7baa470a0accc256a7c3d9b | dnyaneshm36/helping | /algorithms/pbdfs/pbdfs.py | UTF-8 | 10,452 | 3.046875 | 3 | [] | no_license | # STRUCTURE OF TREE
#
# tree = {
# 'ABC': {
# 'happiness': 23,
# 'categories': ['adventure', 'parks'],
# 'feasible_routes': [
# {
# 'route': ['B', 'A', 'C'],
# 'ending_poi': 'C',
# 'starting_time_of_ending_poi': 10
# },
... | true |
169c916dfc3de2146c524ab90595cc82689bb56d | johnmyrda/neopixel-simulator | /src/pipereader.py | UTF-8 | 1,950 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import errno
import fcntl
import sys
import struct
import argparse
class RGBW:
def __init__(self, green, red, blue, white=None):
self.red = red
self.green = green
self.blue = blue
self.white = white
def rgb_tuple(self):
return (self.re... | true |
3715f8ffc01711ef9bbd6b093799bc8f10780f5d | ifenghao/myDeepLearning | /demo/MLPraw.py | UTF-8 | 2,025 | 2.59375 | 3 | [] | no_license | # coding:utf-8
__author__ = 'zfh'
import time
import matplotlib.pyplot as plt
import numpy as np
import theano.tensor as T
from theano import function, shared
from load import mnist
from utils import basicUtils, gradient, initial, preprocess
# 模型构建,返回给定样本判定为某类别的概率
def model(X, w1, b1, w2, b2):
h = T.nnet.sigmo... | true |
3a8844a1931b772295d8c8472664be9b2f6163dc | syibrahima31/active-learning | /binary_classification/experiment_1.py | UTF-8 | 8,011 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 21 13:47:43 2019
@author: root
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sklearn
from keras.models import Model
from keras.regularizers import l2
from keras.layers import Dense, Input
import keras.backend as ... | true |
50db928daef1b567142b7c4f6a52c660c00dfb31 | renjieliu/leetcode | /1500_1999/1774.py | UTF-8 | 940 | 2.9375 | 3 | [] | no_license | class Solution:
def closestCost(self, baseCosts: 'List[int]', toppingCosts: 'List[int]', target: int) -> int:
dp = [[t * _ for _ in range(3)] for t in toppingCosts ] #take 0, take 1 and take 2
def add(arr_1, arr_2):
output = []
for a in arr_1:
for b in arr_2:
... | true |
35c7f1128b4f6570e8916befa453e3bfbdca4662 | pujaredij17/Python | /Hangman.py | UTF-8 | 1,769 | 3.703125 | 4 | [] | no_license | import random
words = []
with open('dict.txt', 'r') as f:
line = f.readline().strip()
words.append(line)
while line:
line = f.readline().strip()
words.append(line)
rand_num = random.randint(0, len(words))
#print(words[rand_num])
text = words[rand_num]
#text =... | true |
4a43cd016c6b9bf0ba7bfbc5f138d71c34416883 | davidhayes3/Learning-Signal-Feature-Representation-Using-GANs | /Python/data_funcs.py | UTF-8 | 1,799 | 3.09375 | 3 | [] | no_license | import numpy as np
from keras.datasets import mnist, fashion_mnist, cifar10, cifar100
# Function to rescale images
def rescale_image(image, image_range=(0,1)):
if image_range is (0,1):
image *= 255
elif image_range is (-1,1):
image = 127.5 * image + 127.5
return image
# Function to pre-... | true |
41b57fc9890e251a3d6845d691d6611849d6da26 | maliaditya/Python-code-snippets | /Inheritance/Single_inhertance.py | UTF-8 | 783 | 3.28125 | 3 | [] | no_license | class College:
def __init__(self,cname,c_address,university,principal):
self.cname = cname
self.c_address = c_address
self.university = university
self.principal = principal
def principalname(self):
print("The principal of {} {} is {}".format(self.cname,self.c_address,s... | true |
a67d5e18cc05ee37ec4628d905076e4db00f1586 | jraulcr/curso-python | /inicio-basico/strings.py | UTF-8 | 677 | 3.109375 | 3 | [] | no_license | miString = "Hola mundo"
# print(dir(miString))
# print(miString.upper())
# print(miString.lower())
# print(miString.swapcase())
# print(miString.capitalize())
# print(miString.replace('Hola', 'Adios').upper())
# print(miString.count('m'))
# print(miString.startswith('Ho'))
# print(miString.endswith('mundo'))
# print(... | true |
4ff427504fced2a078b57ad8a013984ca696e076 | gk-group-ebj/GestiBank | /manager.py | UTF-8 | 2,628 | 2.625 | 3 | [] | no_license | from user import User
from connection import connect, cnx
import mysql.connector
from mysql.connector import Error
class Manager(User):
def __init__(self, id, name, surname, address,
email, password, pro_id, date_beginning_contract,
date_end_contract, phone=None, user_type=None):
... | true |
c0333f58281a854809eded183c6df82d4c3033a9 | mendysmile/pyAi | /sample12.py | UTF-8 | 627 | 3.03125 | 3 | [] | no_license | import cv2 as cv
import numpy as np
def equalHist_demo(image):
gray = cv.cvtColor(image,cv.COLOR_BGR2GRAY)
dst = cv.equalizeHist(gray)
cv.imshow("equalHist_demo",dst)
def clahe_demo(image):
gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
clahe = cv.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
d... | true |
7a1a99f2df973b9b85d1f785261e7e9dfdc3058b | sszllx/pyreport | /async.py | UTF-8 | 731 | 2.71875 | 3 | [] | no_license | import curio
import curio_http
async def fetch_one(url):
async with curio_http.ClientSession() as session:
response = await session.get(url)
content = await response.json()
return response, content
async def main(url_list):
tasks = []
for url in url_list:
task = await cur... | true |
640dbb606af340983c3e39281e673549d1889218 | Deepti3006/InterviewPractise | /removeDuplicateStrings.py | UTF-8 | 875 | 3.828125 | 4 | [] | no_license | def removeDuplicateString():
a = input("Enter the string")
for char in a:
if a.count(char) > 1:
print("I am in")
b= a.replace(char,'')
print(b)
#removeDuplicateString()
def setsort():
arr ={'G4','G3','R1','R4','G2','G5','R2','G1','R3','R5'}
sorted_arr = sorted(arr)... | true |
a0e2bc476e9950a2c0e7163b022cda4050ef99d7 | softpaper95/algorithm | /part2. 주요 알고리즘 이론과 실전문제/chapter3. 그리디/3-1. 거스름돈.py | UTF-8 | 192 | 3.375 | 3 | [] | no_license | count = 0
n = int(input())
change = [500, 100, 50, 10]
while n > 0:
for i in change:
if i <= n:
l = n//i
n = n - (i*l)
count += l
print(count)
| true |
ea309b67f3553e7a0d9a6b29872d0f785d2ffb27 | rebekcunning/dsp | /python/q5_datetime.py | UTF-8 | 871 | 3.890625 | 4 | [] | no_license | # Hint: use Google to find python function
from datetime import datetime
def days_between(d1, d2):
d1 = datetime.strptime(d1, "%m-%d-%Y")
d2 = datetime.strptime(d2, "%m-%d-%Y")
return abs((d2 - d1).days)
def days_between1(d1, d2):
d1 = datetime.strptime(d1, "%m%d%Y")
d2 = datetime.strptime(d2, "%... | true |
f20b36246d4b982c00bdf541d6f9313a43ae336e | Gaonuk/IIC2233-Gaonuk | /Tareas/T01/pilotos.py | UTF-8 | 1,313 | 2.890625 | 3 | [] | no_license | from abstracts import Persona
class Piloto(Persona):
def __init__(self, nombre, dinero,
personalidad, contextura, equilibrio,
experiencia, equipo):
super().__init__(nombre, personalidad,
contextura, equilibrio, experiencia, equipo)
self._dinero = dinero
... | true |
648297591cc22a984d7af2d0b15f01e70dd5662d | PCzarny/python101 | /3_DB/sqlraw.py | UTF-8 | 1,540 | 3.0625 | 3 | [] | no_license | import sqlite3
connection = sqlite3.connect("test.db")
# connection = sqlite3.connect(':memory') # to store data in memory
# To enable using column names not only indexes
connection.row_factory = sqlite3.Row
cursor = connection.cursor()
cursor.execute("DROP TABLE IF EXISTS projects;")
cursor.execute("""
CREATE... | true |
b4c5ee6105ccd23ab1f76f9eff589d3359ec996b | dydwnsekd/coding_test | /baekjoon/python/1789.py | UTF-8 | 152 | 2.984375 | 3 | [] | no_license | import sys
hap = 0
count = 1
S = int(sys.stdin.readline())
while True:
hap += count
if hap > S:
break
count += 1
print (count-1) | true |
d9973ec39b77ed573858664b60fc9fff258df841 | Zheng-Shaozhuo/Multiple-Single-Script-Code- | /DbClient-pymysql.py | UTF-8 | 8,289 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pymysql
class DbClient(object):
"""
数据库操作类
"""
# db实例集
instances = {}
def __new__(cls, *args, **kwargs):
"""
实例化方法
:arg args
:arg kwargs
:return db实例
"""
_key = "_".join([str(s) for s ... | true |
87fdbb31200cbd9cb0af6144a03bd585629e01c6 | Lane/alberta-pipeline-data | /scripts/create_releases_geojson.py | UTF-8 | 3,565 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import csv
import json
import sys
import argparse
import datetime
import pytz
# epoch is the beginning of time in the UTC timestamp world
epoch = datetime.datetime(1970,1,1,0,0,0,tzinfo=pytz.UTC)
parser = argparse.ArgumentParser(description='Merges json data into GeoJSON features')
parser.add_a... | true |
02f66a70734197e7e351768278d9817bbf3e6c6e | johannvk/TMA4180_optimization | /main.py | UTF-8 | 3,189 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
from robust_newton_solver import robust_minimizer
from project_functions import *
import visualization
def problem_1():
print("problem 1")
n = 3
theta_1 = np.ones(n) * (1.0 / 2)
l1 = np.array([3, 2, 2])
p1 = (3, 2)
... | true |
e9eeb10d1ffd914f9cbe09a5108f14cadc264783 | ShreyasJothish/Sprint-Challenge--Data-Structures-Python | /names/binary_search_tree.py | UTF-8 | 1,662 | 3.765625 | 4 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert(self, value):
node = Node(value)
... | true |
6ab25a44e05013c32a0e31fb01b7371dff20e67f | shankar7791/MI-10-DevOps | /Personel/Harshalm/Solutions/8MarchSolution/Prog4Solution.py | UTF-8 | 484 | 3.625 | 4 | [] | no_license | #pascal triangle
num = int(input('Enter the rows : '))
def RecPascal(y, x=1, prev=[]):
if x > y+1:
return []
elif x == 1:
return RecPascal(y, x+1 , [1])
else:
return [prev] + RecPascal(y, x+1, calculate(prev))
def calculate(prev):
res = [0]*(len(prev)+1)
res[0], res[-1] =... | true |
66d86b5e6cc4f80673d22070f80875b5038362ac | chrislove/amatino-python | /amatino/entity.py | UTF-8 | 9,577 | 2.890625 | 3 | [
"MIT"
] | permissive | """
Amatino API Python Bindings
Entity Module
Author: hugh@amatino.io
"""
from amatino import Session
from amatino.region import Region
from amatino.user import User
from amatino.permissions_graph import PermissionsGraph
from amatino.internal.api_request import ApiRequest
from amatino.internal.data_package import DataP... | true |
d7cc9e84c3316eb111ad79924c397a5104e5e7f6 | MoltenDivineCore/yande_pider | /tags.py | UTF-8 | 4,647 | 2.984375 | 3 | [] | no_license | '''
基于单页面多线程
'''
import os # 引入文件模块
import re # 正则表达式
import urllib.request
import threading
import time
# 连接网页并返回源码
def open_url(url):
try:
req = urllib.request.Request(url)
req.add_header("User-Agent",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/... | true |
6e9724da74a56d08e5bd323b7834435a84af23ed | olivia-ea/daily-coding-challenge | /has_cycle.py | UTF-8 | 290 | 3.0625 | 3 | [] | no_license | def has_cycle(head):
"""
Check if a linked list has a cycle.
"""
slow, fast = head
while slow.next is not None:
slow = slow.next
fast = fast.next.next
if current.data == tracker.data:
return True
return False | true |
381e871b8535505dfa46cbe257ffffd8ddde3a85 | SpacialCircumstances/WikiDateScraper | /src/wikidate.py | UTF-8 | 871 | 3.296875 | 3 | [
"MIT"
] | permissive | class WikiDate:
def __init__(self):
self.days = 0
self.month = 0
self.year = 0
def test_values(self):
return self.days <= 31 and self.days >= 0 and self.month <= 12 and self.month >= 0
def get_date_string(self):
days = ""
if self.days < 10:
days... | true |
78df7446ceeb59f5dd1a8f85e57912f1857b68bf | mohitsh/python_work | /graph/graph7.py | UTF-8 | 2,382 | 3.5625 | 4 | [] | no_license |
class Graph:
class Vertex:
def __init__(self,x):
self._element = x;
def element(self):
return self._element
def __str__(self):
return str(self._element)
class Edge:
def __init__(self,u,v,x):
self._origin = u
self._destination = v
self._element = x
def endpoints(self):
return (s... | true |
e387de69d6cd94de65544ead9084b47637fcfc45 | rocketfart/p365 | /codeforinterview/dropbox/photoid.py | UTF-8 | 2,467 | 3.328125 | 3 | [] | no_license | import heapq
class heapnode():
def __init__(self,name,data):
self.name=name
self.data = data
def __cmp__(self, other):
return cmp(self.data,other.data)
class solution:
#heap hashtable
def __init__(self):
self.dict={}
self.heap=[]
self.n=0
self... | true |
e08f22133565a95ee3a79f3a3e2c08ec48da8de9 | aFarchi/Optimal-Transport | /OT/OTObjects2D/plotting/plotAnalyse/definePlotSubplots.py | UTF-8 | 3,685 | 2.59375 | 3 | [] | no_license | #==================================================
#__________________________________________________
# Copyrigth 2016 A. Farchi and M. Bocquet
# CEREA, joint laboratory Ecole des Ponts ParisTech and EDF R&D
# Code for the paper: Using the Wasserstein distance to compare fields of pollutants:
# Application to the r... | true |
fb7a3da8b50e010c0f250e41768501e08bcb723e | TarunNarahari/PythonPrograms | /CountingVowels.py | UTF-8 | 258 | 4.125 | 4 | [] | no_license | word = input("Please enter a word")
vowels = ["a","e","i","o","u"]
def count(x):
amount = 0
for letter in x:
if(letter.lower() in vowels):
amount = amount + 1
return amount
print ("The number of vowels are %d" % (count(word))) | true |
44348c0dec26e41f66b43eb69f4c33133ec25a86 | abernatskiy/pyreindent | /bin/pyreindent.py | UTF-8 | 4,648 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import pylineblocks
import shutil
def reindentFile(filePath, inTabSymbol, outTabSymbol, cleanTrailingTabsAndSpaces=False, backupPostfix=None, outputOverride=None):
newBlocks = []
with open(filePath, 'r') as pyfile:
try:
for block in pylineblocks.splitIntoBlocks(pyfile, cleanTrailingTabsA... | true |
a73bc3dc0810fd61d04d4daf7657fddff4661774 | daniel-reich/ubiquitous-fiesta | /md4AF8HwJrhrhA5zm_8.py | UTF-8 | 546 | 2.765625 | 3 | [] | no_license |
def colour_harmony(anchor, ctype):
colours = ["red", "red-orange", "orange", "yellow-orange", "yellow", "yellow-green", "green", "blue-green", "blue", "blue-violet", "violet", "red-violet"]
anchor_idx = colours.index(anchor)
ctypes = {'complementary':[6],
'triadic':[4,8],
'split_compleme... | true |
2f4b5d72638fa8f8afbc35af3447b830607f60a2 | crazytan/seclogin | /test.py | UTF-8 | 274 | 2.796875 | 3 | [] | no_license | import random
f = open('test.in', 'w')
pwd = 'password'
random.seed()
for i in xrange(100):
f.write(pwd)
f.write('\n')
tmp = []
for j in xrange(20):
tmp.append(str(random.randrange(-5,15)))
f.write(','.join(tmp))
f.write('\n')
f.close()
| true |
894f0d5224921551c1f9428dc31c91aefcd0af90 | vogtdale/python | /learnpython/collections/binary/binaryTree.py | UTF-8 | 3,185 | 4.65625 | 5 | [] | no_license | '''
A Binary Tree is a non-linear data structure
that is used for searching and data organization.
A binary tree is comprised of nodes.
Each node being a data component,
one a left child and the other the right child.
'''
class Node:
def __init__(self, dataval = None):
self.dataval = dataval
se... | true |
c8627c5f05d358c25f6d52563e1b5a95d590aef8 | xxlaila/backup-monitoring | /weather/city_info.py | UTF-8 | 3,960 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/4/5 13:41
# @Author : xxlaila
# @Site :
# @File : city_info.py
# @Software: PyCharm
import requests, json
from lib import config
import pypinyin
header = {"Content-Type":"application/json"}
def province_view():
"""
获取一级城市,keywords 为空,获取... | true |
f473afc268a832b217d8e588633c0ea36d237866 | mcbishop/intro_class | /calculator.py | UTF-8 | 2,472 | 4.71875 | 5 | [] | no_license | # Math Calculator
# Create a file called calculator.py inside of ~/intro_class. Write all the code for these exercises inside of the calculator.py file.
# Write a function add that has two parameters num1 and num2. add should return the num1 and num2 added together.
def add(num1,num2):
return num1 + num2
#Use print ... | true |
9e4da941ea7976a88b636d4df45dedb706646dec | NicolasBizzozzero/Online-Judges | /Project Euler/pe41.py | UTF-8 | 416 | 3.171875 | 3 | [
"Unlicense"
] | permissive | def is_pandigital(n):
if not (0 < n < 1000000000):
return False
n = str(n)
digits = [str(i) for i in range(1, len(n)+1)]
for digit in digits:
if digit in n:
n = n.replace(digit, "")
else:
return False
# Maybe a n containing the digit 0 can cause issues... | true |
746f996dc6e54bc46dd6e78c832b7ac851123e43 | jasongorman/codecraft_nov_2020 | /source/mars_rover_inside_out_python - finished/test/mars_rover_test.py | UTF-8 | 1,676 | 3.078125 | 3 | [] | no_license | import unittest
from parameterized import parameterized
from mars_rover import Rover
class MarsRoverTest(unittest.TestCase):
@parameterized.expand([
('N', 'E'),
('E', 'S'),
('S', 'W'),
('W', 'N')
])
def test_turns_right_clockwise(self, starts_facing, ends_facing):
... | true |
8a1b386b3b013479b2a650e941cdd609b2ccb768 | Palamariuk/TheSnakeGame | /game.py | UTF-8 | 4,912 | 3.359375 | 3 | [] | no_license | from snake import *
from field import *
import pygame
import time
pygame.init()
class Game(Snake, Field):
def __init__(self, width, height, bl_size):
Snake.__init__(self, width // 2, height // 2)
Field.__init__(self, width, height)
self.bl_size = bl_size
self.current_score = 0
... | true |
cc85c10535e5a4fb9fe073d67ff05484b5c410c4 | Amaka202/my-guess-game | /guess_game.py | UTF-8 | 266 | 3.53125 | 4 | [] | no_license | secret_number = 10
guess_limit = 3
guess_count = 0
while guess_count < guess_limit:
guess_count += 1
guess = int(input("Guess my secret number: "))
if guess == secret_number:
print("You won!")
break
else:
print("Sorry, You Failed!")
| true |
5ec6cfb766a87d75866e57a4fd2be9ddb6e61841 | zhangyage/Python-oldboy | /python-auto/Curl/web_status.py | UTF-8 | 2,725 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#python -m pip install pycurl
import os
import sys
import time
import pycurl
from pycurl import CONNECTTIMEOUT, NOPROGRESS, FORBID_REUSE, MAXREDIRS,\
DNS_CACHE_TIMEOUT, WRITEHEADER, WRITEDATA, PRETRANSFER_TIME,\
STARTTRANSFER_TIME, TOTAL_TIME, HTTP_CODE, SIZE_DOWN... | true |
4ca927fd953d23d84b099ee793e577835a42a134 | wonjohnchoi/competitions | /google-code-jam/Google Code Jam 2010 - Round 1B/B.py | UTF-8 | 1,043 | 3.671875 | 4 | [] | no_license | '''
Problem
@CONTEST Google Code Jam 2011: Round 1C
@ID A
@NAME Square Tiles
@URL http://code.google.com/
Solution
@AUTHOR Wonjohn Choi (http://capcs.wordpress.com/)
@LANG Python 3
@RESULT
'''
import re
#IO FILE NAMES
inFile = r'C:\Users\Wonjohn Choi\source_codes\Google Code Jam\Google Code Jam 2011 ... | true |
230416ac33c2f9f6f345e0e57168477f907cc269 | ernestojfcosta/IPRP_LIVRO_2013_06 | /objectos_1/programas/bio_f2_sol.py | UTF-8 | 4,447 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
bio_f2_sol.py
Created by Ernesto Costa on 2008-10-14.
Copyright (c) 2008 University of Coimbra. All rights reserved.
"""
import sys
import os
# from string import * # caso use funções e não métodos
# Exercício 2.1
def conv_k_m(kilo):
return 0.62 * kilo
# Exercí... | true |
0f73f2a870e3399e45ed85ac25044ce865a41e06 | JenniferWang/medium-questions | /TwoSumSortedArray.py | UTF-8 | 551 | 3.71875 | 4 | [] | no_license | def twoSumSortedArray(arr, target):
"""
No.14
Given a sorted array, and a target, find two ele in the arr s.t. the summation equals target
suppose there is a unique answer
For unsorted arr, we can use a dic to get O(n) complexity:
https://oj.leetcode.com/problems/two-sum/
"""
left = 0
right = len(ar... | true |
f2f680afc1a42b28b6045958807511f8be7aad4c | sharmaji27/InterviewBit-Problems | /Hashing/Anagrams.py | UTF-8 | 1,283 | 4.03125 | 4 | [] | no_license | '''
Given an array of strings, return all groups of strings that are anagrams. Represent a group by a list of integers representing the index in the original list. Look at the sample case for clarification.
Anagram : a word, phrase, or name formed by rearranging the letters of another, such as 'spar', formed from ... | true |
c1a08fba67f8d907de2a8d874e1e0f674b416f0f | ameernormie/100-days-of-python | /3. Python - Beyond the basics/2.BeyondFunctions/extendedCallSyntax.py | UTF-8 | 409 | 3.78125 | 4 | [] | no_license | def print_args(arg1, arg2, *args):
print(arg1)
print(arg2)
print(args)
arguments = (1, 2, 3, 4, 5)
# Unpack a tuple to populate arguments of print_args
print_args(*arguments)
# 1
# 2
# (3, 4, 5)
def colors(red, green, blue, **kwargs):
print("r =", red)
print("g =", green)
print("g =", blue... | true |
bbb9e3bec0bbfe51ef769cc90252b47eac6ef87d | chrisjsewell/disk-objectstore | /tests/concurrent_tests/periodic_worker.py | UTF-8 | 13,388 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""A small script that, every few seconds, adds a few objects to an object store, and then tries to read it again.
This is used to test concurrency while using the container and packing at the same time.
The script is supposed to be run in parallel with many other "locusts", possibly with a (sin... | true |
8a64aff78ea42c0fad3f7b84f89c78fadaec56bc | manniqueen/python-basics | /for_odd_even_sum.py | UTF-8 | 360 | 3.90625 | 4 | [] | no_license | odd_sum = 0
even_sum = 0
n = int(input())
for i in range (1, n + 1):
num = int (input())
if i % 2 == 0:
odd_sum += num
else:
even_sum += num
if even_sum == odd_sum:
print("Yes")
print(f'Sum = {odd_sum}')
else:
difference = abs(odd_sum - even_sum)
print(f... | true |
95f52fa8f367c3963f59fa01d3232f697d20b052 | alexandraback/datacollection | /solutions_5753053697277952_1/Python/Matthew23/a.py | UTF-8 | 1,753 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding: utf8 -*-
# Google Code Jam 2016 - 1C - Problem A - Mateusz Kurek
def empty(l):
return all([x <= 0 for x in l])
def get_maxes(l):
m1, m2 = 0, 0
for i, v in enumerate(l):
if v < 0:
continue
if v > l[m1]:
m2 = m1
m1 = i
... | true |
6fe95cad28abe7419227d37f632f9c5f4537ae5e | jwang41/Mechine_learning | /回归/LDA.py | UTF-8 | 1,585 | 3.046875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
# 机器学习(周志华)第三章习题3.5
"""
编程实现线性判别分析,并给出西瓜数据集3.0å上的结果
"""
import matplotlib.pyplot as plt # 画散点图
from numpy import *
from tool import readxls
def main():
data = readxls.excel_table_byname("/Users/JJjie/Desktop/www/Mechine_Learning/dataset/西瓜3.0.xlsx", 0, "Sheet1")
y = data[3]
x = ma... | true |
d6bbbbe09d2ef15cc4aefbe85b27dcb4cba57830 | winterbeak/sightline | /geometry.py | UTF-8 | 16,569 | 3.140625 | 3 | [] | no_license | import pygame
import math
import os
import constants
import utility
os.environ['SDL_VIDEO_CENTERED'] = '1'
pygame.init()
def mod_angle(angle):
while angle < -math.pi:
angle += math.pi * 2
while angle > math.pi:
angle -= math.pi * 2
return angle
def angle_to_slope(angle):
return m... | true |
49cbd2eff95ed0d726da9e771bbf36ee504cf225 | jtjun/PySamsungDS | /day1/codes/lab_1_1.py | UTF-8 | 276 | 3.4375 | 3 | [] | no_license | P = float(input("원금을 입력하세요: "))
r = float(input("연이율을 입력하세요 (% 단위, 숫자만 입력): "))
n = int(input("만기까지의 기간을 입력하세요 (년): "))
A = (1 + r / 100) ** n * P
print("만기 금액은 " + str(A) + "입니다.")
| true |
f2647ce1f7753cc1955039e87fdbd8cdc526860d | mvbattan/tda-tp0-2017-1q | /asignaciones/main.py | UTF-8 | 1,996 | 2.75 | 3 | [] | no_license | import sys
import math
from asignaciones.preferenceGenerator import generatePreferences, FILE_NAME
E = 1 # CANTIDAD DE ESPECIALIDADES
tentative_engagements = []
free_students = []
def tableCreator(finput, qlines):
table = []
for i in range(qlines):
s = finput.readline().split(" ")
for j in ... | true |
b5d673a6cdec941b0d4c9ef48cedd890fca3574d | gkitg/edu_tmp | /Python/0_algorithms/hw_3/10_fuzzysearch.py | UTF-8 | 3,168 | 3.203125 | 3 | [] | no_license | '''
fuzzysearch('car', 'cartwheel'); // true
fuzzysearch('cwhl', 'cartwheel'); // true
fuzzysearch('cwheel', 'cartwheel'); // true
fuzzysearch('cartwheel', 'cartwheel'); // true
fuzzysearch('cwheeel', 'cartwheel'); // false
fuzzysearch('lw', 'cartwheel'); // false
'''
# Вариант ... | true |
f731d492a1e965bf3195c893a07b7f2c22363684 | yu5shi8/AtCoder | /ABC_C/ABC153C.py | UTF-8 | 285 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# C - Fennec vs Monster
# https://atcoder.jp/contests/abc153/tasks/abc153_c
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if N <= K:
ans = 0
else:
num = N - K
ans = sum(H[:num])
print(ans)
# 21:06 - 21:13(AC)
| true |
887612453ebd1ac2579ddbbe4510a172a7d553df | victomteng1997/cryptopals | /1/6_Break_repeating-key_XOR.py | UTF-8 | 4,366 | 3 | 3 | [] | no_license | import numpy as np
from base64 import b64decode
import binascii
import os
from itertools import combinations
CHARACTER_FREQ = {
'a': 0.0651738, 'b': 0.0124248, 'c': 0.0217339, 'd': 0.0349835, 'e': 0.1041442, 'f': 0.0197881, 'g': 0.0158610,
'h': 0.0492888, 'i': 0.0558094, 'j': 0.0009033, 'k': 0.0050529, 'l': 0... | true |
7d16240f239ecb1b7f964e53db21e465a0f35790 | JoeSantamariaParedes/Trabajo-4---Modelamiento-UML- | /modelo4/app.py | UTF-8 | 322 | 2.625 | 3 | [] | no_license | import os
import biblioteca
import libro
nombre_bibli=os.sys.argv[1]
autor_lib=os.sys.argv[2]
al=libro.Libro(autor_lib,"tornado",250,"1kg","140pag")
nb=biblioteca.Biblioteca(nombre_bibli,al,20,40,10)
print("la biblioteca se llama:"+nb.getNombre())
print("el autor es:"+al.getAutor())
nb.setLibro(al)
print(nb.investigar(... | true |
01253c9b51a8ee5c43f1fd0d1721f4e0f6062662 | hemal507/CS-Algorithms | /test_decipher.py | UTF-8 | 807 | 2.859375 | 3 | [] | no_license | import decipher
def test_case1() :
assert decipher.decipher("10197115121") == "easy"
def test_case2() :
assert decipher.decipher("98") == "b"
def test_case3() :
assert decipher.decipher("122") == "z"
def test_case4() :
assert decipher.decipher("1229897") == "zba"
def test_case5() :
... | true |
756938e8142dfe25e5b1136230e318d2bb6bef24 | PacktPublishing/Learning-Python-Application-Development | /Chapter 6/B05034_ch6_SRC_V2/adapterpattern_multiple_methods.py | UTF-8 | 3,610 | 3.921875 | 4 | [
"MIT"
] | permissive | """adapterpattern_multiple_methods
Example to show a way of implementing an adapter pattern.
This source is just to aid the discussion under the heading
"Dealing with multiple adapter methods" in the chapter on Design Patterns of
the book Learning Python Application Development" (Packt publishing)
The example shows ... | true |
ce7b752569f8731c16d6912049c84b7e459587e7 | mahongkai0/python | /平叠/day20/code/with.py | UTF-8 | 523 | 2.859375 | 3 | [] | no_license |
try:
fr = open('c:/Users/Administrator/Desktop/test/平叠/day20/code/test.txt','r',encoding = 'UTF-8')
try:
for line in fr:
print(line)
finally:
fr.close()
except OSError:
print("失败了")
#将由下面的with改写
try:
with open('c:/Users/Administrator/Desktop/test/平叠/day20/code/test.t... | true |
c9996b402462e3315ac8fc927663f2afc6cf9791 | Grinch101/data_structure | /algorithms/sorting_algorithms/binary_search.py | UTF-8 | 809 | 4.0625 | 4 | [] | no_license | ########## Binary search ############
# Recursively find an item in an sorted array
## devide the array into half until the len of array is 1 and the item is found.
## worst omplexity O(n)
## general complexity O(h) - h is the height of the tree
def binary_search(arr, item, upper_ind = None, lower_ind = None):
i... | true |
b71cd297ca3d8b4078b2dabd7212d111bc7efbaa | ChangxingJiang/LeetCode | /LCCI_程序员面试金典/面试17.04/面试17.04_Python_1.py | UTF-8 | 433 | 3.265625 | 3 | [] | no_license | from typing import List
class Solution:
def missingNumber(self, nums: List[int]) -> int:
expect = 0
actual = 0
for i in range(len(nums)):
expect ^= i
actual ^= nums[i]
expect ^= len(nums)
return expect ^ actual
if __name__ == "__main__":
print... | true |
a37fd697ba38600d03ed466a7e8e1864aaec8014 | DFNOsorio/Force_Platform | /code/plot_functions.py | UTF-8 | 4,196 | 2.59375 | 3 | [] | no_license | import seaborn
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from code.segmentator import Segment
from code.processing_functions import normalize
import numpy as np
def raw_dump_grid(segment_name):
f = plt.figure()
plt.figtext(0.08, 0.95, segment_name, fontsize=20)
gs1 = GridSp... | true |
2fdfc7326c64aa03eaf665a56f24ad18b67ef4d5 | GourBera/ProjectPython3 | /ProjectPython3/OOPS/test.py | UTF-8 | 4,135 | 3.671875 | 4 | [] | no_license | '''
Created on Mar 6, 2018
@author: berag
'''
from pip._vendor.requests.packages.urllib3.connectionpool import xrange
from ctypes.test.test_pickling import name
'''
import os
print(dir(os))
'print til 9'
for i in range(0,10):
print(i)
print('Second Progran')
i = 0
while i<10:
print(i)
... | true |
efe5d3a1b241116c4119eb801fa78981d8203892 | musl0074/TV2BreakTimeML | /BreakTimeAwareness_1_1.py | UTF-8 | 11,281 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[192]:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mat
from pymongo import MongoClient
import seaborn as sns; sns.set()
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential
from tensorflow.keras.laye... | true |
4ee02696395b63815ea353a3096bca71fbade847 | dekool/quantum_information | /MPS.py | UTF-8 | 2,911 | 3.359375 | 3 | [] | no_license | import numpy as np
from numpy import tensordot
def sum_left_side_with_next_A(left_side, A):
"""
join both A matrices and than contract them with the left side of the state
:return: new tensor representing the left side of the computation
"""
# all the tensors hold real values so conjugate is unnece... | true |
f8e5b49bcb368194cee824a3bc4949e94dd44419 | ikijaem/IlijaMarinaDataBase | /CollaborativeFIltering.py | UTF-8 | 2,285 | 3.15625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
class CollaborativeFiltering:
def __init__(self, ratings, movies):
self.ratings = ratings
self.movies=movies
n_users = ratings.user_id.unique().shape[0]
n_movies = ratings.movie_id.uniqu... | true |
d48a6efb7d36d5b1bed6562f12886573d628a2a4 | naotokimura1817/PAST-Practice | /py/B-Bingo_ABC157.py | UTF-8 | 1,170 | 3.46875 | 3 | [] | no_license | card = [] # Bingo card
rcard = [] # Bingo result card
nums = [] # Bingo numbers
# ビンゴカードの作成
for _ in range(0, 3):
# 一行ずつ読み取る
row = list(map(int, input().split()))
# card配列に足していく
card.append(row)
# ビンゴ数字の入力
n = int(input()) # Number of bingo numbers
for _ in range(0, n):
num = int(input())
... | true |
3ff31872cae98fc64a0715493614191639656651 | iorodeo/nano_ssr_software | /pulse/python_pulse_ssr/pulse_ssr/pulse_ssr.py | UTF-8 | 4,326 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | """
Provides a serial interface to Arduinos running the pulse_ssr_firmware
for pulsing solid state relays.
Author: Will Dickson, IO Rodeo Inc.
Copyright 2010 IO Rodeo Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain... | true |
987ba033d54a30ff21d64887a0d5ee3d3f662994 | MiguelBim/Python_40_c | /Challenge_18.py | UTF-8 | 1,467 | 4.09375 | 4 | [] | no_license | # CHALLENGE NUMBER 18
# TOPIC: Conditional
# Voter Registration App
# https://www.udemy.com/course/the-art-of-doing/learn/lecture/17060802#overview
def voter_registration(name):
political_parties_list = ["Republican", "Democratic", "Independent", "Libertarian", "Green"]
print("\nHere is a list of political p... | true |
7be99448cfbede1b65e67ac03ac60e355e5aa9a5 | jyotiranjanjally/edx-ml-course | /hw3_clustering/hw3_clustering.py | UTF-8 | 3,674 | 2.828125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import scipy as sp
import sys
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
N_clusters = 5
N_iterations = 15
def normPDF(x, mean, var):
denom = (2*np.pi*np.linalg.det(var))**.5
num = np.exp(-0.5*(x-me... | true |
04b24fedc273f8218f1cf77224fd8c48c3a54240 | aalicav/Exercicios_Python | /ex077.py | UTF-8 | 213 | 3.125 | 3 | [] | no_license | palavras = ('XICARA','NABO','PADRE','COROINHA','MISSA')
for e in palavras:
print(f'\n {e} possui as seguintes vogais:',end='')
for vogal in e:
if vogal in 'AEIOU':
print(vogal,end=',')
| true |
81b026a1a367ef41cd7acbc468ea859986f79ffb | burdenp/AI_Class | /Final/ai/GridSquare.py | UTF-8 | 6,249 | 2.71875 | 3 | [] | no_license | #Gridsystem
import sys
import os
import time
import random
import string
import Npc
import Util
import Player
import Item
global ITEMS
ITEMS = [Item.sword(), Item.staff(), Item.axe(), Item.potion(), Item.scroll(), Item.knife(),
Item.dagger(), Item.rock(), Item.poison(), Item.arrow(), Item.hammer(), Item.claw(... | true |
f646c6df02413ba64c3908a06dbca15e040b274c | mhaythornthwaite/Python-Zero-to-Mastery-Course | /Contents.py | UTF-8 | 2,580 | 3.40625 | 3 | [
"MIT"
] | permissive | '''
Contents
Section 3 Python Basics
* learning different class types and methods on those classes to structure our data appropriately as well as some basic functions.
Section 4 Python Basics 2
* if statements and for loops as well as some new functions such as ennumerate
* paremeters (name) and arguments (matt)
... | true |
5444e2809b4c0c1503ad9f8fad07fef9a92a6433 | reventhtv/hemnet-scraper | /modelXG.py | UTF-8 | 5,331 | 2.765625 | 3 | [
"MIT"
] | permissive | import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import json
import os,re
import statsmodels.api as sm
from statsmodels.graphics.gofplots import ProbPlot
from xgboost import XGBRegressor
from scipy import stats
from scipy.sta... | true |
94c20c7a4889d9377417ded44321958525467b77 | IhsanE/ProjectEulerSolutions | /Euler_21.py | UTF-8 | 206 | 2.96875 | 3 | [] | no_license | import math
def f(n):
ret=[]
for i in range(1,n):
if (n%i==0):
ret.append(i)
return ret
print (sum([i for i in range(1,10000) if (i==sum(f(sum(f(i)))) and i!=(sum(f(i))))]))
| true |
e71444b6a2392b9237e4b5de1e05a108f3a3ded0 | LeeSinCOOC/Pyhon3-spider | /data-storage/mysql.py | UTF-8 | 597 | 2.875 | 3 | [] | no_license | import pymysql
db = pymysql.connect(
host='localhost',
user='root',
password='chen0824',
port=3306)
cursor = db.cursor()
cursor.execute('select version()')
data = cursor.fetchone()
print(data)
cursor.execute('create database spiders default character set utf8')
db.close()
#try:
# cu... | true |
51c2ce1d9ffcb49ff4020727824124b69173f7bb | dictybase-playground/learn-github-action | /dsc/legacyinvoice.py | UTF-8 | 1,946 | 2.65625 | 3 | [] | no_license | from html.parser import HTMLParser
from dsc.params import OrderInfo
class InvoiceHTMLParser(HTMLParser):
"""Grab info from html version of legacy issue body.
There is no consumer email in legacy order.
Arguments:
HTMLParser {class}
"""
def __init__(self) -> None:
"""Initialize at... | true |
5f4e25cb58346c75b2d63733604a9261afabfc14 | maurisg/python-for-everybody | /Chapter 12/exercise_02.py | UTF-8 | 653 | 3.046875 | 3 | [] | no_license | import socket
# http://data.pr4e.org/romeo.txt
try:
url = input('Enter URL: ')
host = url.split('/')[2]
my_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
my_sock.connect((host, 80))
cmd = 'GET ' + url + 'HTTP/1.0\r\n\r\n'
cmd = cmd.encode()
my_sock.send(cmd)
received_data = ... | true |
b9ca9a8b56082fd750f30bcea1f2057503119914 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/word-count/5fc7a0f724ec40fa9439822bfc8ad174.py | UTF-8 | 910 | 3.65625 | 4 | [] | no_license | #!/usr/bin/python
import sys
def word_count(wordString):
""" Returns the number of occurrences of words in wordString as a
dictionary of the format: wordDict[word]=numberOfOccurrences """
wordList = splitString(wordString)
wordDict = {}
for word in wordList:
if wordDict.has_key(word):
... | true |
db83aa38be52b06f9f20e94ced8a07a1f997b4b6 | hisamwp/PROGJAR_05111740000026 | /tugas1/tugas1b/server.py | UTF-8 | 1,165 | 3.234375 | 3 | [] | no_license | import sys
import socket
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the port
server_address = ('127.0.0.1', 30001)
print("starting up on {}".format(server_address))
sock.bind(server_address)
# Listen for incoming connections
sock.listen(1)
#buffer
buf=1024
whi... | true |
89dd60c9938ca0658c06d1a1de709ad3ecf4f92b | hhkkxxx133/ECE544 | /Project/code/dataset.py | UTF-8 | 5,575 | 2.890625 | 3 | [] | no_license | # dataset.py
# Created by dwang49
# This files implements the dataset class similar to the tf.MNIST
# dataset class, where the samples are preloaded into the memory.
# Shuffled and randomly sampled to provide minibatch at runtime.
from multiprocessing import Pool
import numpy as np
import os
from scipy.io i... | true |
52a0b0f24efa4a6c8002d0cc7a919f550010d496 | wucng/Tensorflow-learning | /tf_models/slim/datasets/Slim Dataset read tfr.py | UTF-8 | 758 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
'''
https://github.com/tensorflow/models/tree/master/research/slim
您可以轻松地定义一个Slim Dataset,它存储指向数据文件的指针,
以及各种其他元数据,如类标签, train/test拆分以及如何解析TFExample protos。
'''
import tensorflow as tf
from datasets import flowers
slim = tf.contrib.slim
# Selects the 'validation' datas... | true |
cba810c9427796b9a2d16e50a50c902c13b7152a | fadmaennaji/8-puzzle | /GUI/Tk.py | UTF-8 | 5,244 | 2.53125 | 3 | [] | no_license | from Tkinter import *
from PIL import ImageTk, Image
import Tkinter, Tkconstants, tkFileDialog
import testimg
import keras
from keras.models import load_model
from os.path import join
from glob import glob
import numpy as np
import cv2
import numpy as np
import cv2
def make_squared(image):
proc_img = np.array(i... | true |
1e89c591f6d7857f9e8ae073ab3e13bcffbaf2b6 | filipov73/python_fundamentals_september_2019 | /05.Basic Syntax, Conditional Statements and Loops - More Exercises/05. How Much Coffee Do You Need.py | UTF-8 | 354 | 3.703125 | 4 | [] | no_license | data = input()
coffees_cup = 0
target_list = ["coding", "dog", "cat", "movie"]
while data != "END":
if data.lower() in target_list:
if data.isupper():
coffees_cup += 2
elif data.islower():
coffees_cup += 1
data = input()
if coffees_cup > 5:
print(f"You need extra sle... | true |
77fc1fd53db5811575fc50490c9869b4b34cf7eb | dlwlsrnjs/webday | /project/bookreview/12/tringa.py | UTF-8 | 378 | 3.1875 | 3 | [] | no_license | a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if(a==b==c):
print("정삼각형")
elif(a==b or b==c or a==c):
if not(a<b+c and b<c+a and c<a+b):
print("삼각형아님")
else:
print("이등변삼각형")
elif((a*a)+(b*b)==c*c):
print("직각삼각형")
elif(a<b+c and b<c+a and c<a+b):
print("삼각형")
else:
print("삼각형아님"... | true |
b1fd1ae873a81dea5a5d3bc5b64030bdf6f2b5d2 | galid1/Algorithm | /python/baekjoon/2.algorithm/simulation/kiwi_juice_easy.py | UTF-8 | 629 | 3.296875 | 3 | [] | no_license | # top coder KiwiJuiceEasy srm 478
class KiwiJuiceEasy:
def thePouring(self, capacities, bottles, fromId, toId):
new_bottles = list(bottles)
for i in range(len(fromId)):
from_num = fromId[i]
to_num = toId[i]
move_mount = min(new_bottles[from_num], capacities[to_... | true |
201399c3ed3a49f945a449ea282245f391d97ce3 | woodyyan/oo_step_by_step_steps | /tests/oo_step_by_step/step4/test_student.py | UTF-8 | 776 | 3.140625 | 3 | [] | no_license | # coding:utf-8
import unittest
from oo_step_by_step.step4.klass import Klass
from oo_step_by_step.step4.student import Student
class TestStudent(unittest.TestCase):
def test_basic_introduce(self):
person = Student("1","Tom", 21, Klass(2))
actual = person.introduce()
self.as... | true |
1986e6d3695aa329ebf71a08a16e46edb3bb0f72 | Dainokode/email_sender | /main.py | UTF-8 | 1,282 | 3.171875 | 3 | [] | no_license | ##################### Hard Starting Project ######################
import pandas as pd
import datetime as dt
import os, random, smtplib
# get today's day and month
today = dt.datetime.today()
month = today.month
day = today.day
# get person's day and month
data = pd.read_csv("birthdays.csv")
birthday_info = pd.Data... | true |
8da13e7ab23f894128d14de487e44fe529a6ef80 | Cegard/A_star_puzzle_solver | /a_star.py | UTF-8 | 2,093 | 3.0625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from helpers import deepcopy, find_min_by_pos, check_opposites, is_in
def a_star(*args):
puzzle = args[0]
heuristics = args[1]
heuristic = args[2]
copied_puzzle = deepcopy(puzzle)
open_list = [[copied_puzzle, 0, 0, 0, None, '']] # state, F, G, H, parent, last move
closed... | true |
f143e3f94be6137d7472d9f17479bbcfaec1f4db | Su-Mo7743/SciProgCodeExamples | /ExampleCode/GettingStarted/ReadingIntandFloat.py | UTF-8 | 637 | 4.71875 | 5 | [] | no_license | """
Starter Python programm to read a float and an int, do some simple
processing and print output.
"""
# Read in a float and and int
x = float(input("Type in a floating point number between 5 and 10 : "))
ix = int(input("Type in an integer between 10 and 20 : "))
# Do a simple divide
y = x/ix
... | true |