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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d0d3da78c68c0bdb702a89cfc32ad8921a762d4b | Python | JJongSue/ssafy_algorithm | /Problem/src/boj/Main2110.py | UTF-8 | 479 | 2.78125 | 3 | [] | no_license | import sys
N, C = map(int, input().split())
nums = []
for i in range(N):
nums.append(int(input()))
nums.sort()
l = 1
r = nums[N-1] - nums[0]
ans = r
while l<=r:
mid = int((l+r)/2)
now = nums[0]
cnt = 1
for i in range(1, N):
# print(i)
d = nums[i] - now
if d >= mid:
... | true |
cbf3165c7c85e8e15582da1317f75cc63992d25d | Python | huangty1208/Data-Challenge | /Customer Cliff/AB_test.py | UTF-8 | 2,662 | 2.9375 | 3 | [] | no_license | # get an estimate sample size
# Packages imports
import numpy as np
import pandas as pd
import scipy.stats as stats
import statsmodels.stats.api as sms
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from math import ceil
%matplotlib inline
# Some plot styling preferences
plt.style.us... | true |
dfe2edf746f3f9f7d0c8e8ca5d2fc13460046294 | Python | ksjpswaroop/qb | /qanta/util/build_science_mc.py | UTF-8 | 6,025 | 2.765625 | 3 | [
"MIT"
] | permissive | # Script to generate output equivalent to the AI2 Kaggle science challenge
import sqlite3
import operator
import random
from csv import DictWriter
from collections import defaultdict
from qanta import logging
from qanta.extract_features import instantiate_feature
from qanta.datasets.quiz_bowl import QuestionDatabase
... | true |
1c29793cf295c17e518cc58f1184b04bb34574d8 | Python | Mostofa-Najmus-Sakib/Applied-Algorithm | /Leetcode/Python Solutions/Design Data Structure/maxStack.py | UTF-8 | 928 | 3.859375 | 4 | [
"MIT"
] | permissive | """
LeetCode Problem: 716. Max Stack
Link: https://leetcode.com/problems/max-stack/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(N)
Space Complexity: O(N)
"""
class MaxStack:
def __init__(self):
self.stack = []
def push(self, x: int) -> None:
if not self.stack:
... | true |
edcc5c2b4dfbc85e1a44ddfb39046f75a55e7d95 | Python | Laurence-mvt/AutomateTheBoringStuff | /chapter10/notes.py | UTF-8 | 2,545 | 3.53125 | 4 | [] | no_license | # chapter 10: Organizing files notes
import shutil, os
from pathlib import Path
# copy files
p = Path.cwd()
# shutil.copy(p/'AutomateTheBoringStuff/chapter10/notes.py', p/'AutomateTheBoringStuff/chapter9') # copies notes.py file to chapter9 folder
# copy a folder (tree)
# shutil.copytree(p/'AutomateTheBoringStuff/c... | true |
1c37bd8d3513c2bb7f016a7c35a315658cedb6cc | Python | sivant1361/python | /programs/SI.py | UTF-8 | 344 | 3.625 | 4 | [] | no_license | p=int(input("Principle amount="))
r=int(input("rate of interest="))
t=int(input("Number of years="))
ch=int(input("1.Simple interest\n2.Compound interest(1 or 2):"))
if (ch==1):
si=(p*r*t)/100
print("Simple interest=",si)
elif (ch==2):
ci=(p*((1+(r/100))**t))-p
print("Compound interest=",ci)
else:
p... | true |
8c3152b19d7bb34edc569b8c9cc7679706b23ffd | Python | deepakmarathe/whirlwindtourofpython | /data_science_tools/numpy_package.py | UTF-8 | 296 | 3.59375 | 4 | [] | no_license | # Numpy : Numerical Python
import numpy as np
x = np.arange(1,10)
print x
print x ** 2
print [i ** 2 for i in range(1, 10)]
print x.reshape((3,3))
print x.reshape((3,3)).T
print np.dot(x.reshape(3,3), [5, 6, 7])
print np.linalg.eigvals(x.reshape(3,3))
M = x.reshape((3,3))
print "M : ", M
| true |
63773a9ae06e4ba916d79bfb44c55e59b2b594d1 | Python | hshrimp/test_school | /bilibili/t3.py | UTF-8 | 1,101 | 3.96875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : wushaohong
'''
题目描述:
给定一个合法的表达式字符串,其中只包含非负整数、加法、减法以及乘法符号(不会有括号),
例如7+3*4*5+2+4-3-1,请写程序计算该表达式的结果并输出
输入
输入有多行,每行是一个表达式,输入以 END 作为结束;
输出
每行表达式的计算结果;
样例输入
7+3*4*5+2+4-3-1
2-3*1
END
样例输出
69
-1
'''
def cheng(temp):
temp3 = temp.split('*')
count = 1
... | true |
5632eafac5eca7cf08a78359d8b2d90468fa9c51 | Python | samuelyusunwang/quant-econ | /quantecon/career.py | UTF-8 | 2,644 | 3.578125 | 4 | [
"BSD-3-Clause"
] | permissive | """
Filename: career.py
Authors: Thomas Sargent, John Stachurski
A collection of functions to solve the career / job choice model of Neal.
"""
import numpy as np
from scipy.special import binom, beta
def gen_probs(n, a, b):
"""
Generate and return the vector of probabilities for the Beta-binomial
(n, ... | true |
ec61526afc6ee2ff18bbaef230e1190feeef903f | Python | rogue0137/practice | /leetcode_python/medium/SOLVED-minimum-cost-to-connect-sticks.py | UTF-8 | 1,616 | 3.921875 | 4 | [] | no_license | # 1167. Minimum Cost to Connect Sticks
# https://leetcode.com/problems/minimum-cost-to-connect-sticks/
class Solution:
def connectSticks(self, sticks: List[int]) -> int:
sticks.sort()
cost = 0
stack = []
while len(sticks) + len(stack) > 1:
print('LOOP')
prin... | true |
dc598bbc0e77037fc67ea86b90bb49681373fb67 | Python | portelaraian/algo-expert | /coding-interview-questions/find-duplicate-value/solution.py | UTF-8 | 286 | 3.515625 | 4 | [
"MIT"
] | permissive | # O(n) time | O(n) space - where n is the length of the input array
def firstDuplicateValue(array):
dict_values = {}
for value in array:
try:
dict_values[value] += 1
return value
except:
dict_values[value] = 1
return -1
| true |
d892ac639b3d0138e5ef950485e96e7d544833db | Python | bagustris/lpthw | /ex22-noFailure.py | UTF-8 | 303 | 2.578125 | 3 | [] | no_license | # ini adalah ex22.py
# Apa yang sudah kamu pelajari dari lthw ini...?
print """
Apa yang sudah kamu pelajari sejauh ini?
Peringatan
Hal terpenting ketika melakukan ini adalah: "Tidak ada kegagalan, HANYA MENCOBA, Tidak ada yang baru (kecuali kamu membuat improvisasi terhadap kode yang disediakan)
"""
| true |
d750ac08a984ad23cda9016035455da4c3d68902 | Python | Guilherme-Felix/Intro-Metodos-Discretos | /Exercicio1_EulerModificado.py | UTF-8 | 977 | 3.328125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
'''
Implementacao do metodo de euler modificado, segundo a ref.
https://www.ufrgs.br/reamat/CalculoNumerico/livro-py/pdvi-metodo_de_euler_melhorado.html
'''
interval = (0,1)
h = 1./30
N1 = 30
N2 = 135
h1 = 1./N1
h2 = 1./N2
x1 = np.arang... | true |
d25f215c8cacc7a5be4c10603f3131b39b3d5c7e | Python | juan7732/Advent-Of-Code-2020 | /Day4/advent.py | UTF-8 | 2,726 | 3.21875 | 3 | [] | no_license | from functools import reduce
import re
def composite_function(*func):
def compose(f, g):
return lambda x: g(f(x))
return reduce(compose, func, lambda x: x)
def read_data():
with open('data.txt') as f:
return f.read()
def parse_data(data):
tmp = data.split('\n\n')
for i in rang... | true |
ebc4be08bc5c4c6a23bb1e4168fe85d8968eccd3 | Python | Cebuick/test | /test/test.py | UTF-8 | 787 | 3.109375 | 3 | [] | no_license | import sqlite3
#connect() permet de se connecter
connexion = sqlite3.connect('D:/workspace/python/test/test/jobs.db')
#cursor()
curseur = connexion.cursor() #creation du curseur
query="select major from recent_grads;"
#print('1 '+ str(curseur.fetchone()))
curseur.execute(query) #exécute la requête SQL situé dans la vi... | true |
f70dbfbef4499d0858fb66296dbd8967ecbd76c3 | Python | nickderobertis/data-code | /datacode/summarize/subset/outliers/detail/totex.py | UTF-8 | 4,050 | 2.75 | 3 | [
"MIT"
] | permissive | import pyexlatex.table as lt
import pandas as pd
from datacode.summarize import format_numbers_to_decimal_places
from datacode.typing import DfDict, Document
from datacode.typing import DocumentOrTables, DocumentOrTablesOrNone
def outlier_by_column_summary(bad_df_dict: DfDict, selected_orig_df_dict: DfDict,
... | true |
f5e09d4520283c58490f0421fe3fda5d6450a091 | Python | eyelivermore/pythonlianxi | /py/集合数据结构.py | UTF-8 | 1,246 | 4.8125 | 5 | [] | no_license |
'''
集合是一个无序不重复元素的集。基本功能包括关系测试和消除重复元素。
'''
basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
"""
可以用大括号({})创建集合。
注意:如果要创建一个空集合,你必须用 set() 而不是 {} ;后者创建一个空的字典,下一节我们会介绍这个数据结构
"""
a = set()
# 以下演示了两个集合的操作
a = set('abcd')
b = set('cdef')
print('a集合中的字母\n',a)
print('b集合中的字母\n',b)
print('a-b:集合a中包含,b中不包含,也... | true |
aa401e50bdcae7188904e8c3f0d492c136984e44 | Python | google/earthengine-community | /samples/python/apidocs/ee_featurecollection_getnumber.py | UTF-8 | 993 | 2.578125 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | # Copyright 2023 The Google Earth Engine Community 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | true |
5fe47b6541bc1f32c8dba67ab90923ef7f70929a | Python | HigorSenna/python-study | /guppe/manipulando_arquivos_csv_e_json/json_com_pickle.py | UTF-8 | 885 | 3.625 | 4 | [] | no_license | """
Trabalhando com JSON + Pickle
pip install jsonpickle
"""
import json
import jsonpickle
class Cachorro:
def __init__(self, nome):
self.__nome = nome
def latir(self):
print(f'{self.nome} está latindo')
@property
def nome(self):
return self.__nome
cachorro = Cachorro('Pl... | true |
2ff7a82c8c4df3ea13a7e464f4c7402f9424d7e2 | Python | angelicaba23/MisionTic2022 | /Python/area_triangulo.py | UTF-8 | 628 | 4.34375 | 4 | [] | no_license | """
------------MinTic-----------------
-------------UPB-------------------
-------Angélica Barranco-----------
"""
#Elabore un algoritmo que lea los 3 lados de un triángulo cualquiera y calcule su área, considerar: Si A, B y C son los lados, y S el semiperímetro.
import numpy as np
#Entradas
a = float(input("Digite e... | true |
010042edc151e9a39c8d92d08e1e785b04e69f9f | Python | entirelymagic/PrivatePython | /Learning/date_and_time.py | UTF-8 | 476 | 3.75 | 4 | [] | no_license | """
You have to allways point to a central reference
when you speak about the time.
"""
from datetime import datetime, timezone, timedelta
print(datetime.now(timezone.utc)) # time with no offset
today = datetime.now(timezone.utc)
tomorrow = today + timedelta(days=1)
print(today)
print(tomorrow)
print(today.strftim... | true |
f5fb5489eb2fb4e22cb21eaf7f1cf6fb94bbd911 | Python | Dhual-Yhn/setp02 | /cachipun.py | UTF-8 | 1,737 | 3.78125 | 4 | [] | no_license | # Set de problemas #2
# Problema 5.
# Lenguaje y Tecnicas de Programacion
# Profesor: Igor Caracci
# Profesor(Ayudante): Andres Caro
# Universidad de Santiago de Chile
# 07 de mayo del 2013
#
# Descripcion:
#
# Programa del juego clasico "cachipun"
def ganador_cachipun(lista):
# Verifico numero de jugadores
... | true |
456231f45a34ed8e3c4bd4cca08f87d173c7e6dd | Python | bagua0301/red_slg | /OriginalPlan/trunk/client/doc/DataConvert/toServer/data_skill_point.py | UTF-8 | 2,266 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
技能点购买配置
@author: ZhaoMing
@deprecated: 2014-07-08
'''
import os
# 导入要用到的函数
from libs.utils import load_excel, load_sheel, module_header, module_php_header, gen_erl, gen_xml, prev, get_value,gen_php
# 导入礼包数据配置.xlsx,文件统一放置在docs目录
work_book = load_excel(ur"skill")
# Erl... | true |
710b05121ea3ec9b5caa5493ab5a7005f9fb1f07 | Python | mridubhatnagar/Word-Notifier | /build_vocabulary.py | UTF-8 | 2,855 | 2.828125 | 3 | [] | no_license | import os
import requests
import json
import datetime
import smtplib
import logging
from email.mime.text import MIMEText
logging.basicConfig(level=logging.DEBUG)
def fetch_response(url=None):
"""
A GET request call is done on
wordOftheDay endpoint in
wordlink API
"""
response = requests.get... | true |
8b69df9a732b92ac447a20b361123acb83ce0e43 | Python | Tekken-New-Blood/cleanup_set_your_roles | /cleanup_roles.py | UTF-8 | 1,572 | 2.578125 | 3 | [] | no_license | import discord
client = discord.Client()
yyaen_id = 95485950833983488
shreeder_id = 161215065926795265
set_your_roles_channel_id = 492305188829265941
wrong_channel_msg = "This isn't #set_your_roles"
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def ... | true |
b7619583381bdf79ad56de57e3c5f0c353c88c44 | Python | Indhuu/git-github | /python/10pwdfor.py | UTF-8 | 330 | 3.296875 | 3 | [] | no_license | # 10 attempt password for loop
Attempt = 1
N = 0
for N in range(5):
password = input('Enter the password : ')
if password == 'charu' and Attempt == 1:
print ('correct password')
break
else:
N += 1
break
print ('5 attemps over. 5 more left')
... | true |
197adf7f6577499c43d119f127ada8613ef050ba | Python | prachi464/Python-assignment | /PYTHONTRAINNING/module5/indian_batsman.py | UTF-8 | 1,698 | 2.90625 | 3 | [] | no_license | Info={1:{'player_type':'Batsman','player_name':'virat_kohli','matches':'200','runs':'15000','average':'12','Highest_score':'200'}
,2:{'player_type':'Batsman','player_name':'Rohit_Sharma','matches':'250','runs':'20000','average':'20','Highest_score':'250'}
,3:{'player_type':'Bowler','player_name':'Jasmeet_... | true |
3c9c923f21e202ea5f9180b46361f70932f9e817 | Python | fairbank-lab-ba-tagging/cold-probe | /Arduino/arduino_gui_2.0/scripts/runExperiment_noAblation.py | UTF-8 | 1,926 | 3.203125 | 3 | [] | no_license | from pyfirmata import INPUT, OUTPUT
from time import sleep, time
def run(board):
analog_pins = board.analog_pins # Pins 0-5
digital_pins = board.digital_pins # Pins 2-13
# Stepper pins
in_1 = digital_pins[2]
in_2 = digital_pins[3]
stepper_out = digital_pins[4]
in_1.mode = OUTPUT
in... | true |
8bef1d4899d6b4485ed8f2f1888056e64475b07e | Python | lrothschildshea/RL-Clue-AI | /game.py | UTF-8 | 6,172 | 2.953125 | 3 | [] | no_license | from cards import Cards
from qLearnPlayer import Player as QPlayer
from deepQPlayer import Player as DeepQPlayer
from player import Player
import random, sys
class Game:
currentPlayer = 0
solution_guessed = False
turn = 0
rooms = ["Ballroom", "Billiard Room", "Conservatory", "Dining Room", "Hall", "K... | true |
90e27cf3514a0ac329f60d161e1aed9cb2336868 | Python | Hidenaka82/Shopping-fruits | /test.py | UTF-8 | 1,189 | 4.15625 | 4 | [] | no_license |
items = {'apple': 1, 'banana': 2, 'orange': 4}
while True:
money = int(input('Please enter your budgeds to purchase fruits: $'))
for item_name in items:
#print('--------------------------------------------------')
print('You have $' + str(money) + ' to purchase products')
print(item_... | true |
3c949cc737e3b04c28c04d243823591c8d302832 | Python | LYSuperCarrot/tracking-robot | /my_yolo_track/scripts/start_tracking.py | UTF-8 | 4,173 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
from mdl_people_tracker.msg import TrackedPersons2d
from geometry_msgs.msg import PoseArray
from geometry_msgs.msg import Twist
speed = 0.0 # global speed of turtlebot
turn = 0.0 # turning rate
name = ""
distance = -1
track_index = 0
saved_dep... | true |
2b03c7b2aa5eb25b203b5f71a3d5640ac6e6853c | Python | kamchung322/headfirstpython | /webapp/vsearch4web.py | UTF-8 | 2,712 | 2.609375 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, escape, copy_current_request_context
from vsearch import search4letters
from DBcm import UseDatabase
from threading import Thread
import time
app = Flask(__name__)
app.config['dbconfig'] = {'host': '127.0.0.1',
'user': 'vsearch',
... | true |
bccc3c5db05f7d4fa4b69988fd086173dea27234 | Python | jamesl33/210CT-Course-Work | /task6/main.py | UTF-8 | 1,031 | 3.375 | 3 | [] | no_license | #!/usr/bin/python3
import datetime
from database import Database
from student import Student
from address import Address
def main():
student1 = Student(1, "Ryan", datetime.date(1978, 1, 12), Address(104, 'Main Street'), datetime.date(2017, 2, 9), '220CT', True)
student2 = Student(2, "Devin", datetime.date(200... | true |
0c8b514dfdea1128a738e86fcf0cc23fa1664e57 | Python | sarkeur/terrarium | /database/rotate_delete_db.py | UTF-8 | 745 | 2.75 | 3 | [] | no_license | ## remove old values in database IMPORT ##
import MySQLdb
import time
from time import sleep
## FUNCTIONS ##
def clean_db():
db = MySQLdb.connect(host="localhost",user="root",passwd="nairolfuaebel", db="terrarium")
cursor = db.cursor()
try:
cursor.execute("""DELETE FROM temperature
... | true |
57f2ce8da6834596e1f27b838eb5c723da25c2e9 | Python | leh08/web-template | /server/resources/file.py | UTF-8 | 931 | 2.6875 | 3 | [] | no_license | from flask_restful import Resource
from flask_uploads import UploadNotAllowed
from flask import request
from services import uploads
from services.locales import gettext
from schemas.file import FileSchema
file_schema = FileSchema()
class Upload(Resource):
@classmethod
def post(cls, flow_name: str):
... | true |
19eb03edcca390433487b21ad4e0c4a43ee44d64 | Python | Slumber-HK/SLAEx86 | /Assignment 2 - Reverse TCP/linux_x86_reverse_tcp.py | UTF-8 | 1,498 | 2.9375 | 3 | [] | no_license | import sys;
import re;
def main():
if len(sys.argv) != 3:
print "Usage: python {0} <IP> <PORT>".format(sys.argv[0])
exit()
ip = sys.argv[1]
is_valid = re.match("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", ip)
if not is_valid:
print "Do ... | true |
9b2fd294be850c941d4e4647fdb474c68cef7afd | Python | ymli1997/deeplearning-notes | /numerical/symbol-compute/04-expressions.py | UTF-8 | 2,423 | 3.796875 | 4 | [
"Apache-2.0"
] | permissive | #coding:utf-8
'''
表达式
'''
import sympy
sympy.init_printing()
from sympy import I, pi, oo
# 创建表达式
x = sympy.Symbol("x")
y = sympy.Symbol("y")
expr = 1 + 2 * x**2 + 3 * x**3
print(expr)
print(expr.args)
# 表达式简化
expr = 2 * (x**2 - x) - x * (x + 1)
print(expr)
print('simplify:',sympy.simplify(expr))
print('simplify:',exp... | true |
a5240139c3dc314f44ce6e9d411906e764bd1e0b | Python | eventia/zbc_python | /numberdemo.py | UTF-8 | 131 | 2.84375 | 3 | [] | no_license | import sys
t1 = sys.maxsize
t2 = t1 + 1
t3 = t2**10
print(t1)
print(t2)
print(t3)
print(type(t1))
print(type(t2))
print(type(t3))
| true |
a08f55766efecdc7a97c7cbacc172356a80e56db | Python | Akif-Mufti/Machine-Learning-with-Python | /datapanda.py | UTF-8 | 842 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 30 15:11:56 2017
@author: user
"""
# Load CSV using Pandas
from pandas import read_csv
from pandas import set_option
filename = 'pima-indians-diabetes.data.csv'
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
data = read_csv(filename, nam... | true |
b0b5a65c56695f0a98a2ddb027a091212df17070 | Python | PetterMinne/bachelor-drone | /Pyscripts/client.py | UTF-8 | 666 | 2.828125 | 3 | [] | no_license | import socket
def Main():
host = '127.0.0.1'
port = 5000
mySocket = socket.socket()
mySocket.connect((host,port))
x=0
y=7
messagex = str(x) +'#'+str(y)
while x != 10:
mySocket.send(messagex.encod... | true |
894475263bc04631689090a3d14c7c4172f276d6 | Python | HalfMoonFatty/Interview-Questions | /337. House Robber III.py | UTF-8 | 3,366 | 4.03125 | 4 | [] | no_license | '''
Problem:
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root."
Besides the root, each house has one and only one parent house. The thief realized that all houses in this place forms a binary tree.
It will automatically contact the police if t... | true |
3028524bdb55c02308aa19ccd5a715d6565859ca | Python | Infinite-Loop-KJSIEIT/Project-Euler | /27.py | UTF-8 | 468 | 3.03125 | 3 | [] | no_license | import itertools
a=[0]*(10**6)
for i in range(2,len(a)):
for j in range(2*i,10**6,i):
a[j]=1
prime=set()
for i in range(2,10**6):
if a[i]==0:
prime.add(i)
def isp(n):
if n in prime:
return True
return False
def conp(ab):
a,b=ab
for i in itertools.count():
n=i*i+... | true |
c9a508e14c47940589fcbd68710f877d88637e9b | Python | MarsWilliams/PythonExercises | /LearnPythonTheHardWay/ex19.py | UTF-8 | 1,298 | 4.625 | 5 | [] | no_license | #takes two arguments and prints them back within strings
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for a party!"
print "Get a blanket. \n"
#prints a string
pri... | true |
ee3262d41433c8ceaac5c0fd30be7381d37b241c | Python | MollyInThatOJ/cmpsc465-fa20 | /assignment1/problem2/DQV5105CMPSC465HW1PT2.py | UTF-8 | 472 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 2 21:14:50 2020
@author: mama
"""
line1 = input()
line2 = [int(i) for i in input().split()]
n1 = line1[0]
n2 = line2[0]
sortedout = [None]*(n1)
i = 0
k = 0
for i in line2:
if i==min(line2):
sortedout[k] = min(line2)
print(line2... | true |
193edca118761cc9a4fd8a6a7745914f30d7885f | Python | Aasthaengg/IBMdataset | /Python_codes/p02845/s595783119.py | UTF-8 | 240 | 2.96875 | 3 | [] | no_license | n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
see = [0 for i in range(n)]
ans = 1
for i in range(n):
x = a[i]
if x == 0:
ans = ans*(3-see[x])%mod
else:
ans = ans*(see[x-1]-see[x])%mod
see[x]+=1
print(ans) | true |
7c83694aa637f64705113a567067b63900ce010a | Python | chriskopacz/python_practice | /Problems/lev3/lev3_q18.py | UTF-8 | 2,138 | 4.125 | 4 | [] | no_license | #Chris Kopacz
#Python Exercises from Github
#Level 3, question 18
#created: 26 June 2017
"""
Question 18
Level 3
Question:
A website requires users to input username and password to register. Write a program to
check the validity of passwords input by users.
Following are the criteria for checking the password:
1. At ... | true |
7884422147ec00d9578d7628ac5ac9d1f77b61a4 | Python | opasha/Python | /string_representation.py | UTF-8 | 570 | 4.3125 | 4 | [] | no_license | class Fighter:
def __init__(self, name):
self.name = name
self.health = 100
self.damage = 10
def attack(self, other_guy):
other_guy.health = other_guy.health - self.damage #other_guy is omar, self is joe
print("{} attacks {}!".format(self.name, other_guy.name))
print("{} loses {} health points!".format(... | true |
ded48a66eb46c0d750e2b9afd1040c9753258fe3 | Python | tkkhuu/SelfDrivingBehavioralCloning | /model/DataLoaderBC.py | UTF-8 | 2,358 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
from sklearn.utils import shuffle
from TKDNNUtil.DataLoader import DataLoader
class DataLoaderBC(DataLoader):
def GenerateTrainingBatch(self, samples, batch_size=32, flip_images=True, side_cameras=True):
num_samples = len(samples)
while 1: # Loop forever so the genera... | true |
c422fb5da36b914899b8998631772e675b4b0069 | Python | jamendo/jamendo-recommendation-sdk | /algorithms/averageitemadj.py | UTF-8 | 815 | 2.796875 | 3 | [] | no_license | from algorithms import AlgorithmBase as A
import numpy as N
class Algorithm(A):
itemsToRatings = {}
ratingAverage=0.0
itemadjK = 3
def train(self,rating):
self.itemsToRatings.setdefault(rating[1],[])
self.itemsToRatings[rating[1]].append(rating[2])
s... | true |
ad8f8a019896a44c29121c6dc217b466a89a694c | Python | ssh0/6-2_bifurcate | /myplot_bifurcation_animation.py | UTF-8 | 1,060 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# written by Shotaro Fujimoto, May 2014.
#
import matplotlib.pylab as plt
import matplotlib.animation as animation
import array as array
import numpy as np
fig = plt.figure()
def Plot(func, x0, ntransient, nplot, r0, rmax, dr):
def callback(n):
_Plot(... | true |
b8f61b2e586b377e1fad86a6b27dc348b2c6fcfe | Python | tschamp31/Personal | /Python/Homework/loops.py | UTF-8 | 1,383 | 3.84375 | 4 | [] | no_license | for j in range(10): #Problem 1 - Just reads each range(10) 10 times. Hence the 0,1,etc 10 times.
for i in range(10):
print (i, end = " ")
print()
print()
i = 0
for j in range(10): #Problem 1 Version 2 - Built so it reads them vertically. In reality it reads 0, 10 times and so on.
for k in range(10):
print(i, e... | true |
b4cb00d7ef3db7e63e8dcf366f757136441081d8 | Python | dhchoi/TransitionBasedParsing | /Transition.py | UTF-8 | 579 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
class Transition:
# Transition types
Shift = 0
LeftArc = 1
RightArc = 2
def __init__(self, transitionType, label):
self.transitionType = transitionType
self.label = label
def __str__(self):
return 'Transition of type %d with label %s' % (self.tra... | true |
c68c3d0177b7247e02ebce71016f622b8683e3d4 | Python | emiranda04/python-read-outlook-mails | /tkcalendar.py | UTF-8 | 4,101 | 2.671875 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
import calendar
from datetime import datetime,date
class TkCalendar(Frame):
def __init__(self, master=None,dt=None):
self.status = 'Ok'
super().__init__(master)
self.grid(row=0, column=0, sticky=N + E + S + W)
self['bg'] = 'black'
self.rowconfigure(0, weight=1)
... | true |
6dc54feb55fbcf3154da535aed2c5a68707ff4a2 | Python | meta-434/bACHup | /bachup.py | UTF-8 | 3,407 | 2.609375 | 3 | [
"MIT"
] | permissive | #created by Alex Hapgood
#Started 02/2018
import boto3
import os
import platform
import datetime
import textwrap
import string
import random
import distutils
build = 'v0.2a7(inc)'
now = datetime.datetime.now()
class payload:
def __init__(self, id, source, time):
self.source = source
self.id = id
... | true |
9b0b1354f1b9df77b78fc2c32a58a617e2e6d751 | Python | dimitrisnikolaou10/nba_shot_probability_sportvu | /animate/Event.py | UTF-8 | 9,340 | 2.921875 | 3 | [] | no_license | from Moment import Moment
from Constant import Constant
import matplotlib.pyplot as plt
from matplotlib import animation
from moviepy.editor import *
class Event:
""" A class for handling and showing events """
def __init__(self, moments, player_info, event_description, probability_to_make, shot_time, feat_i... | true |
e5db77cd9936b78bb408c4adfa7afc006708e8ad | Python | BiniyamMelaku2/alx-system_engineering-devops | /0x16-api_advanced/1-top_ten.py | UTF-8 | 784 | 3.28125 | 3 | [] | no_license | #!/usr/bin/python3
"""
queries the Reddit API and prints the titles of the
first 10 hot posts listed for a given subreddit.
https://www.reddit.com/r/programming/hot/.json&limit=10
"""
import json
import requests
def top_ten(subreddit):
"""Return Top10 subreddit hot posts"""
url = "https://www.reddit.com/r/"
... | true |
0d1cc00196f9e66304060292ae245c2b82a876c0 | Python | akauntz/jetson | /packer/rss.py | UTF-8 | 4,306 | 2.65625 | 3 | [] | no_license | import csv
import requests
import xml.etree.ElementTree as ET
import re
from datetime import datetime, timedelta
def loadRSS():
# url of rss feed
url = 'https://www.cnbc.com/id/10000664/device/rss/rss.html'
# creating HTTP response object from given url
resp = requests.get(url)
# saving the xml fil... | true |
796212d2cc6982dbbd48d42eaf4579942321d156 | Python | hscleandro/COVIDcases | /plot.py | UTF-8 | 3,496 | 3.140625 | 3 | [
"MIT"
] | permissive | # Calculate the number of cases with a decreasing R-number
# For information only. Provided "as-is" etc.
# Import our modules that we are using
import matplotlib.pyplot as plt
import numpy as np
import math
import matplotlib.dates as mdates
import datetime as dt
from matplotlib.font_manager import FontProperties
from... | true |
22c6d978cd00b7a11c310d5709b9334ba7fc11b5 | Python | garam-park/elice-algorithm1-2018 | /ch01_recursive/ex03.py | UTF-8 | 583 | 3.5 | 4 | [] | no_license | '''
올바른 괄호인지 판단하기
https://academy.elice.io/courses/339/lectures/2416/materials/5
'''
def checkParen(p):
if len(p) == 0:
return "YES"
if len(p) == 2:
if p == "()":
return "YES"
else:
return "NO"
for i in range(0,len(p)-1):
if p[i] == "(" and p[i... | true |
050b4c3261ab1c0391097d4441f142720fcbf2b4 | Python | profran/YGOCardDownloader | /DownloadMain.ydk.py | UTF-8 | 4,348 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import requests
import os
clear = lambda: os.system('cls')
def newDeckPrint():
clear()
print("Welcome to Yu-Gi-Oh PDF printable cards!\n")
dir = os.getcwd()
deckArray = []
for file in os.listdir(dir):
if (file.endswith(".ydk")):
deckArray.append(file)
print("Wich deck do you wa... | true |
9fefadd175f597f77f515d933e8e9ea09091a833 | Python | figueiredo-alef/estudo-python | /exemplos/ex006.py | UTF-8 | 206 | 3.78125 | 4 | [
"MIT"
] | permissive | print('=' * 5, 'EX_006', '=' * 5)
n1 = int(input('Digite um número: '))
d = n1 * 2
t = n1 * 3
r = n1 ** (1/2)
print('O dobro de {0} é {1}, o triplo é {2} e a raiz quadradda é {3}.'.format(n1, d, t, r))
| true |
a8a9739fafabbabeba3626b5c3ea8bae38188f24 | Python | daxingyou/test-2 | /app/business/question.py | UTF-8 | 3,560 | 2.53125 | 3 | [] | no_license | #coding:utf8
"""
Created on 2015-12-23
@Author: jiangtaoran(jiangtaoran@ice-time.cn)
@Brief : 问答随机事件逻辑
"""
from utils import logger
from utils import utils
from datalib.data_loader import data_loader
from app.data.node import NodeInfo
from app.business import hero as hero_business
from app.business import item as item... | true |
7498c8229e0295a2dfc24adf95b6eea29c1884c1 | Python | mamerisawesome/oneeighty_container | /180_1.py | UTF-8 | 3,994 | 3.28125 | 3 | [] | no_license | import time
import random as rand
final_sum = 0
def get_random_int ():
return rand.randint(0, 10 ** 6)
def generate_matrix (n):
output = []
for i in range (0, n):
ioutput = []
for j in range(0, n):
ioutput += [get_random_int()]
output += [ioutput]
return output
d... | true |
005775540241583013415c99410713b5d7c9ccce | Python | taowenyin/HelloCV | /opencv_example/S5/S5.1.py | UTF-8 | 1,422 | 3.140625 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
# 边缘检测
if __name__ == '__main__':
rows = 2
columns = 3
lena = cv2.imread('data/Lena.png')
plt.subplot(rows, columns, 1)
plt.title('Lena')
plt.imshow(cv2.cvtColor(lena.copy(), cv2.COLOR_BGR2RGB))
# 第一步:把图像转化为灰度图像
lean_gray ... | true |
56fe9d264fa3f34fd376747407d112656420bf68 | Python | huytr225/workload | /poisson/poisson.py | UTF-8 | 404 | 2.515625 | 3 | [] | no_license | import statsmodels.api as sm
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
dataset = sm.datasets.get_rdataset("discoveries")
df = dataset.data.set_index("time")
df.head(10).T
fig, ax = plt.subplots(1, 1, figsize=(16, 4))
df.plot(kind='bar', ax=ax)
model = s... | true |
daada6e38258b9d6b9f4ecf91a30794bf27cc735 | Python | alexBDG/QuidEst | /Displayers/ImagePlayer.py | UTF-8 | 3,760 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 9 11:15:47 2020
@author: Alexandre Banon
"""
import sys
from PIL.ImageQt import ImageQt
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog, QGraphicsScene
from PyQt5.QtWidgets import QToolButton, QVBoxLayout, QGraphicsView, QStatusBar
from ... | true |
d9c540f3e3c710cb31cf607f44392e02adbd0fcd | Python | tigerpk86/python_data__visual | /test.py | UTF-8 | 245 | 3.34375 | 3 | [] | no_license | #!__*__coding:utf-8__*__
import decimal
for i in range(1,10) :
for j in range(1,10) :
#print(i, "x", j, "=", i*j, end = ". ");
print("%2d x%2d =%2d" % (j, i, i * j), end=", ");
#print(i * j, end=" ");
print("");
| true |
98d0513e7f246939db810c06dd82858fa3bbe0df | Python | TeodorStefanPintea/Sentiment-mining-of-the-bioinformatics-literature | /trainedClassifier.py | UTF-8 | 1,272 | 3.015625 | 3 | [] | no_license | '''
This is a classifier which was trained on a movie review data set and applied in the bioinformatics domain.
'''
import pandas as pd
import random
from nltk import word_tokenize
from nltk.sentiment.util import mark_negation
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.pipeline import... | true |
5a8f0bbfed486bd36daab5f8e5e93d4159930c15 | Python | jmv74211/Redes_neuronales | /src/plot_result.py | UTF-8 | 1,132 | 2.53125 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
num_epocs = 30
#file='./results/multilayer_perceptron/multilayer_perceptron_' + repr(num_epocs) + 'e.txt'
file='./results/multilayer_perceptron/training/tanh/multilayer_perceptron_128n_30e_f_tanh.txt'
epocas = np.loadtxt(file, delimiter='\t', skiprows=0,usecol... | true |
0d6952fa9b97772f3b598b744ed9f2e82ee31a38 | Python | douglasrodriguess/basic-to-advanced-python-course | /13-reading-and-writing-in-files/code/VideoLesson92_filesmode.py | UTF-8 | 1,720 | 4.09375 | 4 | [] | no_license | """
Modos de abertura de arquivo
'x' -> abre para escrita somente se o arquivo não existir. Caso exista, retorna um FileExistsError
'a' -> o conteudo é adicionado sempre no final do arquivo
'+' -> abre para a atualização, seja de leitura ou escrita
'r+' ou 'w+' -> há o controle do cursor
link: https://docs.python.org... | true |
5ff98e837692803c28bb3f6b39dd6fc542c856e0 | Python | JakeOh/201908_itw_bdml11 | /lab-python/lec01/ex09.py | UTF-8 | 1,025 | 4.375 | 4 | [] | no_license | """
dict: key-value의 쌍으로 이루어진 데이터들을 저장하는
사전(dictionary)식 데이터 타입
"""
person = {'name': '오쌤', 'age': 16, 'height': 170.5}
print(person)
print(type(person))
# dict의 데이터 참조 - key를 사용
print(person['name'])
print(person['age'])
print(person.keys()) # dict의 key를 알아낼 때
print(person.values()) # dict의 value들만 ... | true |
251b8f31ba431212762be5e149888d1f88f55257 | Python | f-fathurrahman/ffr-MetodeNumerik | /matplotlib01/matplotlib/ex_plot_sin_01.py | UTF-8 | 453 | 2.984375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0.0, 1.0, 200)
Δt = 0.1
A = 1.0
λ = 0.5
f = 2.0
k = -2*np.pi/λ
ω = 2*np.pi*f
t0 = 0.0
fig, ax = plt.subplots()
# ax and fig will be reused
for i in range(20):
t = t0 + Δt*i
y = A*np.sin(k*x - ω*t)
# First plot
ax.cla()
ax.plot(x... | true |
e833e69c106f07c9af27615658d0dc0145fbc37d | Python | hatan4ik/python-3-keys-study | /solutions/person.py | UTF-8 | 255 | 3.421875 | 3 | [] | no_license | class Person:
def __init__(self, first, last):
self.first = first
self.last = last
def full_name(self):
return self.first + " " + self.last
def formal_name(self, title):
return title + " " + self.full_name()
| true |
f5fea182f379b2675d938bdf6140a6eab8e4f8f9 | Python | wunengguang/cp-cnn-mutilabel | /PT.py | UTF-8 | 4,571 | 2.515625 | 3 | [] | no_license | import numpy as np
import copy
import os
from conformpredict import MLCP
class TPMLCP(MLCP):
def __init__(self,numInstance,path,numclasses=14,count=0,anum=0):
'''
:param numInstance: number
:param numclasses:类别
'''
MLCP.__init__(self,numInstance,path,numclasses=14,count=0,anum=0... | true |
490594e7d2cace57ffeb2be2c5481990310ffa3c | Python | gregunz/TorchTools | /torch_tools/models/vision/gans/dcgan.py | UTF-8 | 2,990 | 2.703125 | 3 | [
"MIT"
] | permissive | from argparse import ArgumentParser
from torch import nn
from torch_tools.models.util import GAN, FISModel
from torch_tools.models.vision.util import DCDecoder, DCEncoder
_ld = 128 # default latent_dim
_nf = 64 # default n_filters
_np = 4 # default n_pyramid
_wi = True # default use_custom_weight_init
class DC... | true |
a704f816966b52bc4ce8a27fe9059eab5a812b40 | Python | dty999/pythonLearnCode | /挑战python/095数字序列.py | UTF-8 | 191 | 3 | 3 | [] | no_license | """数字序列定义如下:
f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) % 7.
现在给你A,B和n(1 <= A,B <= 1000, 1 <= n <= 1000000000),请你计算f(n)的值。""" | true |
528da5c372ab17f11cf43fff2df2638bbdad4069 | Python | avagut/mheshimiwa-api | /api_files/utils.py | UTF-8 | 3,874 | 2.515625 | 3 | [
"MIT"
] | permissive | """Mheshimiwa api helper functions."""
from .app import api, db, app
from .models import Constituency, County, Representative
from sqlalchemy import func
def fetch_all_constituencies():
"""Get complete list of constituencies."""
constituency_list = db.session.query(Constituency.constituency_number,
... | true |
9c3625b2674cb0996593f0081bb496d8ac8f0aa1 | Python | tsinghua-fib-lab/MAG-Customer-Value-Prediction | /EPD/run_exp.py | UTF-8 | 991 | 2.671875 | 3 | [] | no_license | import os
import time
import argparse
def run_experiments(cmd):
for command in cmd:
rty_flag = 1
retry = 0
while rty_flag != 0:
rty_flag = os.system(command)
rty_flag >>= 8
time.sleep(3)
retry += 1
if retry >= 3:
... | true |
89476f0f239892b8bbefab6381c3b65491d980ba | Python | 2heeesss/Problem_Solving | /reBOJ/9935.py | UTF-8 | 345 | 3.09375 | 3 | [] | no_license | import sys
input = sys.stdin.readline
word = input().rstrip()
bomb = input().rstrip()
lastChar = bomb[-1]
stk = []
lw, lb = len(word), len(bomb)
for i in word:
stk.append(i)
if i == lastChar and ('').join(stk[-lb:]) == bomb:
for _ in range(lb):
stk.pop()
if stk:
print(('').join(stk))
... | true |
4832bad191dc78608c42f48f9afdd23118a1f004 | Python | Aasthaengg/IBMdataset | /Python_codes/p02898/s095702683.py | UTF-8 | 92 | 2.5625 | 3 | [] | no_license | n,k=map(int,input().split());print(len([i for i in list(map(int,input().split())) if i>=k])) | true |
cd3c186bc99bf1723b3229bb69cc2d7237dab4e0 | Python | MartinsJunior/EstAcqua | /NodeABP/myfuncs.py | UTF-8 | 770 | 2.9375 | 3 | [] | no_license | /*
Funcao criada para ler a voltagem no divisor de tensao (na placa desenvolvida para o projeto - visualizar pasta Projeto)
Retorna a voltagem da bateria
*/
from machine import ADC
# myADC
# ADC 12 bits
# Conversao para mV
# Retorna o valor da tensao da bateria em mV
# Divisor de tensao: R1=680k, R2=100k
# ADC Pino ... | true |
8a2bf18cbb7fe889a73d882f485df7c79da22779 | Python | leehj8896/PS | /문제풀이/자릿수 더하기/main.py | UTF-8 | 148 | 3.25 | 3 | [] | no_license | def solution(n):
answer = 0
while True:
answer+=n%10
n=n//10
if n==0:
break
return answer | true |
fd1efd93b60f7fb74d1cd0080cb915e92f4c3444 | Python | jacksonyoudi/AlgorithmCode | /PyProject/leetcode/history/n-ary-tree-preorder-traversal.py | UTF-8 | 396 | 3.390625 | 3 | [] | no_license | from typing import List
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
class NAryTreePreorderTraversal:
def preorder(self, root: 'Node') -> List[int]:
res = []
if root:
res.append(root.val)
for i in roo... | true |
d1f7e46b3cec3c134ce391e10bd8333157ae81a8 | Python | pythonzhangfeilong/Python_WorkSpace | /8_Demo_Datas/1_Demo_Broken/Demo2/用户登陆.py | UTF-8 | 256 | 3.453125 | 3 | [] | no_license | while True:
username='zhang'
password='123'
a=input('请输入用户名')
b=input('请输入密码')
if username==a and password==b:
print('欢迎登陆')
else:
print('登陆失败,请核对账号密码后重试')
| true |
a48e96f1bba48c39d7d11e84116f399da8feca77 | Python | davidwederstrandtsr/ds-methodologies-exercises | /time_series/acquire.py | UTF-8 | 2,643 | 2.984375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import requests
from os import path
# acquires the data from a url and the end point
def acquire_data(base_url, url_end):
'''
Returns a dataframe after acquiring json data from a url
base_url: the main url of the website being accessed
url_end: the targeted ... | true |
46a610ea2349eeeeab834c75fa3650513fe77a49 | Python | stegua/dotlib | /python/rnd_matrix.py | UTF-8 | 2,640 | 3.09375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 7 15:07:22 2017
@author: gualandi
"""
import numpy as np
import networkx as nx
from time import time
from gurobipy import Model, GRB, quicksum
def SolveCuttingPlane(h1, h2, M):
m = Model()
m.setParam(GRB.Param.TimeLimit, 300)
m.setParam(GRB.Param.Method, 1... | true |
e9f9feb046fe591c2b47d06df13d9559c01c28c3 | Python | sheriline/python | /voting-app-with-testing/backend/voting_app/irv.py | UTF-8 | 1,358 | 3.328125 | 3 | [] | no_license | def check(data):
eq = {
"position": data[0]["position"],
"candidates": [],
} # Store the candidates with the same percentage but less then 50%
# determine winner
_max = max(data, key=lambda x: x["percent"])
if _max["percent"] > 50:
return _max
loser = min(data, key=lam... | true |
6a10bd4052d6e35ceec9eb4d597becd3aef2ae8b | Python | rimjhiim8/GitHub_Tutorial_111 | /Data_Types.py/while_loop.py/for.py/Function.py/arguments.py | UTF-8 | 280 | 4.125 | 4 | [] | no_license | # function with one argument (fname). When the function
# is called, we pass along a first name,
# which is used inside the function to print the full name:
def my_function(fname):
print(fname + "Hello")
my_function("Rimjhiim")
my_function("Sehgal")
my_function("Kakar") | true |
489d213263a45d296cad93b031413197b8dd2b45 | Python | stevenbell/gradescope-utils | /gradescope_utils/autograder_utils/ee200utils.py | UTF-8 | 5,471 | 2.734375 | 3 | [] | no_license | import re
import subprocess as sp
import signal
import os.path
# Small functions that get used repeatedly in creating and running tests
# on student C/C++ code.
def test_build(test, target, wdir, makefile='test_makefile', maketarget=None):
""" Try building `target` in `wdir` using a `makefile` and send
any ou... | true |
f969073787e49c3e70d5afe34eed6f0c8037be10 | Python | maughray/Telegram-Translator-Bot | /main.py | UTF-8 | 1,939 | 2.5625 | 3 | [] | no_license | from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from google_trans_new import google_translator
import logging
TELEGRAM_TOKEN = '1787783787:AAHw8Nw4aieDmt0Dub7oiEjCgCkFIvmzXvA'
TARGET_LANGUAGE_KEY = 'target_language'
translator = google_translator()
logging.basicConfig(format='%(asctime)s ... | true |
b348873950571a97ca4b956b29ea108bb68056d5 | Python | ehdgua01/Algorithms | /coding_test/programmers/stack_queue/top/solution.py | UTF-8 | 462 | 3.046875 | 3 | [] | no_license | """
프로그래머스 알고리즘 문제
https://programmers.co.kr/learn/courses/30/lessons/42588
"""
def solution(heights: list) -> list:
answer: list = []
heights.reverse()
for idx, height in enumerate(heights, start=1):
receiver = 0
for i, h in enumerate(heights[idx:]):
if h > height:
... | true |
3b2150825c381b2e21d787059d18d4e2ad07fd23 | Python | benkiel/python_workshops | /2019_3_Cooper_Type/RoboFont/convert_to_hex.py | UTF-8 | 150 | 2.65625 | 3 | [
"MIT"
] | permissive | glyph = CurrentGlyph()
# glyph.appendAnchor("top", (300,300))
print(glyph.unicodes)
for u in glyph.unicodes:
print('0x{:02x}'.format(integer)) | true |
425da8ff0e53af6a51eb897d9f8b417e67c550e6 | Python | sunqf/data-tools | /corpus/bicorpus/bing/vocab.py | UTF-8 | 685 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
import asyncio
import asyncpg
import re
from corpus.bicorpus import db
_sep = re.compile('[;,:,/ ]')
async def build():
terms = set()
db_conn = await db.connect()
async with db_conn.transaction():
records = await db_conn.fetch('SELECT ch, en ... | true |
38cdb2f62cd8523d745c822789402b6f73198782 | Python | makwanas/Deep-Co-clustering-improvisations | /ConvDeepCC/ConvDeepCC/Code/core/general/pretrain_conv_autoencoder.py | UTF-8 | 10,706 | 2.625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import math
# ---------------------------------
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
n_classes = 10
batch_size = 100
# tf Graph Input
# mnist data image of s... | true |
ef2164c57fbde17ced7e6191a507b8db0e67d8d0 | Python | bishwanathdas2502/efficient_janitor | /efficient_janitor.py | UTF-8 | 1,325 | 3.171875 | 3 | [] | no_license | import math
def janitor(trash):
# print(list(set(map(lambda x:x>=1.5,trash))))
if len(set(trash)) == 1 and trash[0] == 1.5:
return math.ceil(len(trash)/2)
elif list(set(map(lambda x:x>=1.5,trash))) == [True]:
return len(trash)
else:
trash.sort(reverse = True)
less = list(... | true |
23fc1b524c27127966dee6e030605876a29b48b3 | Python | syedmeesamali/Python | /4_Misc/1_Block-Chain/hashing.py | UTF-8 | 234 | 3.3125 | 3 | [] | no_license | from hashlib import sha256
#we know x =5 and (x*y) = ac23dc.........0 (ONE ZERO at END)
x = 7
y = 0 #we don't know value of y yet
while sha256(f'{x*y}'.encode()).hexdigest()[-1] != "0":
y += 1
print(f'The solution is y = {y}')
| true |
90933c253601fd72c737d8980c65f71750197f98 | Python | aashishpeepra/lifeform-simulation-python | /parsciro.py | UTF-8 | 3,952 | 3.09375 | 3 | [] | no_license | import random
import time
from lifeform import Lifeform
import pygame
import sys
class Parsciro():
def __init__(self,initial,red,green,blue,energy):
self.allLife =[]
self.ROUNDS = initial
self.INFO = {1:red,2:green,3:blue}
self.ENERGY = energy
pygame.init() #STARTS THE PYGAM... | true |
c7b981deb33fc7bcc4db3165feeae6a24f59e538 | Python | aujohankn/Twitter-bots | /twitter_timemaps.py | UTF-8 | 383 | 2.5625 | 3 | [] | no_license | import os
import pandas as pd
import tm_tools
def heatmap_plot(userID):
# Reads the tweet timestamps from a specific Twitter account and generates the heated time map
print("Heatmap plot")
path = os.getcwd()+"\ScrapedData\Tweets\\"
df = pd.read_csv(path+"tweet" + str(userID) + ".csv")['created_at'].va... | true |
0ac222a08252ae742a95e625bc6cfbc4218ffbf0 | Python | glennj/exercism.io | /python/bob/bob.py | UTF-8 | 412 | 3.3125 | 3 | [] | no_license | def response(phrase):
phrase = phrase.rstrip()
shouting = phrase.isupper()
asking = phrase.endswith('?')
silence = phrase == ""
if shouting and asking:
return "Calm down, I know what I'm doing!"
elif shouting:
return "Whoa, chill out!"
elif asking:
return "Sure."... | true |
730a0d5b08ff4483baef3bc4b990324c32c95fb3 | Python | josh-perry/pokemon-hm-slave-finder | /scraper/get_pokemon_img.py | UTF-8 | 1,310 | 2.921875 | 3 | [] | no_license | import requests
import os
import time
art_urls = [
"https://www.serebii.net/pokearth/sprites/rb/{}.png",
"https://www.serebii.net/pokearth/sprites/gold/{}.png",
"https://www.serebii.net/pokearth/sprites/rs/{}.png",
"https://www.serebii.net/pokearth/sprites/dp/{}.png"
]
pokemon_count = [
151,
2... | true |