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 |
|---|---|---|---|---|---|---|---|---|---|---|
a55ee857ded393801e519b6d8cba553920fb005c | KishManani/CAAF | /CAAF/model.py | UTF-8 | 5,976 | 3.171875 | 3 | [] | no_license | import numpy as np
from numba import jit
from CAAF.base import Base
import matplotlib.pyplot as plt
import matplotlib.animation as animation
class Heart(Base):
"""
Heart object contains the state, structure, and history of the cellular
automaton lattice. Contains method to run a simulation.
"""
d... | true |
4f6f5e85767746c687a2ebd66f72878bf90e5dee | herumph/artcbot | /mooseleague.py | UTF-8 | 2,461 | 2.765625 | 3 | [] | no_license | import praw
from config_bot import *
# Reddit stuff
r = praw.Reddit(user_agent = "ARTCbot 1.3.0 by herumph",
client_id = ID,
client_secret = SECRET,
username = REDDIT_USERNAME,
password = REDDIT_PASS)
submission = r.submission(url='https://www.reddit.com/r/RumphyBot/comments/8gb347/moo... | true |
2342505bb4c3e8d1716d59beafb8dc9f25628712 | jolemon/defects4j-dataset | /handle_linked_buggy.py | UTF-8 | 2,240 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import os
def remove_class(from_file_path, to_file_path):
with open(from_file_path, 'r') as f:
lines = f.readlines()
with open(to_file_path, 'w') as f:
new_lines = []
for line in lines:
line = line.strip()
if len(line) == 0:
continue
... | true |
d6e4fce7595645242b76b46d4651392ab9c789f7 | ajchoi/Coursera | /JohnsHopkins/PythonForGenomicDataScience/fastaparser_running.py | UTF-8 | 2,561 | 2.640625 | 3 | [] | no_license | filename='dna1.fasta'
try:
f=open(filename)
except IOError:
print('Cannot find this file!')
seq={}
for line in f:
line=line.rstrip()
if line[0]=='>':
words=line.split()
name=words[0][1:]
seq[name]=''
else:
seq[name]=seq[name]+line
f.close()
k=list(seq.ke... | true |
9a56d163501aede1e3b721451ff21c4a98089045 | Scotty12g/cHarmony_app | /app/color_model.py | UTF-8 | 10,747 | 2.65625 | 3 | [] | no_license | def FindColor(matchtype, tomatch_path, closet_path):
# Import the packages we'll need
from sklearn.neighbors import KNeighborsClassifier
from flask import Flask, request, render_template, url_for
import pandas as pd
import os
from os.path import join
import numpy as np
import time
impo... | true |
996073683a8ac6869d40ecd13b5f47fed134a7f0 | achandru/Python | /while.py | UTF-8 | 184 | 3.40625 | 3 | [] | no_license | password =''
while password != 'python123':
password = raw_input("Enter the Password: ")
if password == 'python123':
print ("Your Password is crt")
else:
print ("Sorry") | true |
2d890d2d7bebf64d7992945ba93478d4345ca55e | Devanshi1728/Youtube_MyBlog | /P_DS/binary_search.py | UTF-8 | 619 | 3.84375 | 4 | [] | no_license | def search(lst,s):
l=0;
u=len(lst)-1;
while l<=u:
mid=(l+u)//2;
if s==lst[mid]:
return mid;
else:
if s>lst[mid]:
l=mid+1;
else:
u=mid;
return -1;
lst=[]
n=int(input("Enter total number of elements ... | true |
ead27c51959e74ee02109371d88930e8b8c8251b | Skellbags/Previous-Programs | /CS-417/Assignment01/pi_approx.py | UTF-8 | 667 | 3.09375 | 3 | [] | no_license | def pi_approx():
terms = int(input("How Many Terms of PI?"))
final = 0
count = 0
sign = -1
secterm = 1
for x in range(terms-1):
x += 1
x = 1 /((x+2)+ count)
count += 1
secterm += (x * sign)
sign *= -1
final = 4 * secterm
return print(fina... | true |
96d41e6a236f31c6be4c5fb31a409073fb118fcd | JayWu7/Code | /leetcode_567.py | UTF-8 | 1,910 | 3.765625 | 4 | [] | no_license |
class Solution:
def checkInclusion(self, s1, s2):
"""
给定两个字符串 s1 和 s2,写一个函数来判断 s2 是否包含 s1 的排列。
换句话说,第一个字符串的排列之一是第二个字符串的子串。
:type s1: str
:type s2: str
:rtype: bool
"""
length_s1 = len(s1)
length_s2 = len(s2)
if length_s2 ... | true |
515986be66fb24d8e896fcc5f669956aa563a31c | tech-vin/Practice-Python | /109.py | UTF-8 | 217 | 3.546875 | 4 | [] | no_license | # check if number is positive, negative or zero
n = int(input('Enter No: '))
if n < 0:
r = 'Negative'
elif n > 0:
r = 'Positive'
elif n == 0:
r = 'zero'
else:
r = 'invalid input'
print(r) | true |
ff7b9b492c6646d445a5e4e06fc65310b51d2c7d | krishna999/pyrofit-core | /pyrofit/examples/gp.py | UTF-8 | 2,487 | 2.75 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import pyro
import torch
import pyro.distributions as dist
from pyrofit.core import *
from pykeops.torch import LazyTensor
import random
@register
class Entropy:
def __init__(self, device = 'cpu'):
self.device = device
self.pref = 0.00001
@staticmethod
def _kNN(x, y, K):
"""Get K n... | true |
ea6ed11168c645ac4f6bff6006f110dbc3b8e75e | LinkTsang/.leetcode | /solutions/1365.有多少小于当前数字的数字.py | UTF-8 | 558 | 3 | 3 | [
"MIT"
] | permissive | #
# @lc app=leetcode.cn id=1365 lang=python3
#
# [1365] 有多少小于当前数字的数字
#
from typing import *
from collections import *
# @lc code=start
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
counter = Counter(nums)
v = sorted(counter.items(), key=lambda x: x[0])
a = [0] * len(... | true |
5044ee65ec3f12f465cfe8aff7be916309ec714b | Leahxuliu/Data-Structure-And-Algorithm | /Python/巨硬/B10.数质数.py | UTF-8 | 735 | 3.84375 | 4 | [] | no_license | '''
204. Count Primes
'''
class Solution:
def countPrimes(self, n: int) -> int:
"""count the primes numbers which is less than n
Args:
n: int
Returns:
n: int, the number of primes
"""
# corner case
if n == 0 or n == 1:
... | true |
8987e5af41984cc76e7afd09e9c7dc7cc481e898 | Tanushree28/Python | /Lists/lists.py | UTF-8 | 472 | 5.09375 | 5 | [] | no_license | #A list is a sequence
#Like a string, a list is a sequence of values. In a string, the values are characters; in a list, they can be any type. The values in list are called elements or sometimes items.
#There are several ways to create a new list; the simplest is to enclose the elements in square brackets (“[" and "]”... | true |
ac8500628c596f5c7a3df2b8c03b8b9b2382e20a | breadbread1984/Tacotron2-tf2 | /tokenizer.py | UTF-8 | 863 | 3.546875 | 4 | [] | no_license | #!/usr/bin/python3
import tensorflow as tf;
import pandas as pd;
class Tokenizer(object):
def __init__(self, vocab_file = 'vocab.pkl'):
self.vocab = pd.read_pickle('vocab.pkl');
def tokenize(self, str):
tokens = list();
for ch in str:
token = self.vocab[self.vocab['character'] == ch]['token'... | true |
b19fecf1bdb76bef0638dfff06a1751e31d3b4e4 | jeffysam6/Leetcode | /2020/June-Leetcoding-Challenge/day-23-simple-node-counting.py | UTF-8 | 704 | 3.375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def countNodes(self, root: TreeNode) -> int:
c = 0
stack = [root]
... | true |
aaa839c5c1e2ad566a4af5d595c5bd95c050dd5b | spanickroon/Python-Tasks | /session_4/task_4_6.py | UTF-8 | 624 | 4 | 4 | [] | no_license | """
Task 4.6
Implement a decorator call_once which runs a function or method once.
@call_once
def sum_of_numbers(a, b):
return a + b
print(sum_of_numbers(13, 42))
>>> 55
sum_of_numbers(13, 42)
sum_of_numbers(13, 42)
sum_of_numbers(13, 42)
"""
def call_once(func):
calls = 0
def wrapper(a, b):
nonloca... | true |
a7ede62aaadbc5ead0700a16bead3924bc842780 | YMatthew531/PersonalProjects | /a1.py | UTF-8 | 5,800 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
###################################################################
#
# CSSE1001/7030 - Assignment 1
#
# Student Username: s4448451
#
# Student Name: Matthew Wing-Heng Yau
#
###################################################################
################################################... | true |
fb38d3c65e4d24f7579acb7e150ca434ffb5f21a | yom1994nigam/Tkinter-project-form | /main_form.py | UTF-8 | 24,224 | 2.5625 | 3 | [] | no_license | import tkinter as tk
import sqlite3
from PIL import ImageTk as itk
from tkinter import *
import PIL
from PIL import Image, ImageTk
from PIL import Image, ImageTk
from captcha.image import ImageCaptcha
import matplotlib.pyplot as plt
import random
import pycountry
import unicodedata
import universities
from tkinter impo... | true |
05ff2f469eff24572dc135ce07d5eb341cbcd828 | ShiroNk/Python_100Knocks | /chapter01/ex03.py | UTF-8 | 544 | 3.9375 | 4 | [] | no_license | # 03. 円周率
# "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."という文を単語に分解し,
# 各単語の(アルファベットの)文字数を先頭から出現順に並べたリストを作成せよ.
import re
string = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
string = re.sub(r"[^a-zA-Z ]", "", strin... | true |
612ce79b74bce8435702bac29dba6eedc70a7735 | milanll/python | /py_code/py_comm/py_matplot.py | UTF-8 | 7,907 | 3.671875 | 4 | [] | no_license | '''
from matplotlib import pyplot as plt
from datetime import datetime
#根据数据绘制图形
fig=plt.figure(dpi=128,figsize=(10,6))
plt.plot(dates,highs,c='red',alpha=0.5)#实参alpha指定颜色的透明度,0表示完全透明,1(默认值)完全不透明
plt.plot(dates,lows,c='blue',alpha=0.5)
plt.fill_between(dates,highs,lows,facecolor='blue',alpha=0.1) #给图表区域填充颜色
plt.tit... | true |
39f3ca023bf37a392348aa67a7bcbcfe5cab21ea | hirajanwin/LeetCode-5 | /1300. Sum of Mutated Array Closest to Target/main.py | UTF-8 | 650 | 3.328125 | 3 | [
"MIT"
] | permissive | class Solution:
def score(self, value):
res = 0
for e in self.arr:
if e > value:
res += value
else:
res += e
return res
def findBestValue(self, arr: List[int], target: int) -> int:
self.arr = arr[:]
l, h = 1, ma... | true |
e5d6074f9222f9154c0701ab22b8dd6fa2e2efb8 | fborrasumh/seminario-python | /codigo/Scripts/1_inversa.py | UTF-8 | 345 | 3.703125 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 23 22:46:43 2015
@author: Dani
"""
#Se pide una cadena
dna = raw_input('Escriba una cadena de DNA: ')
dna = dna.upper()
for nuc in dna:
if nuc not in ['A', 'T', 'C', 'G']:
print 'No es DNA. Revise su cadena'
exit()
inversa = dna[::-1]
print 'La cadena... | true |
167ff9ab0d2d02c0ad3d6dfe70e95c0b197e83d2 | BystriakovSemyon/Dealer | /watcher/watcher/__main__.py | UTF-8 | 1,938 | 2.640625 | 3 | [] | no_license | from watcher.log_helpers import setup_logger
from itertools import permutations
from time import sleep
from watcher.parsers import EXMOParser, CEXParser
from watcher.lib import Pair
from watcher.revenue import collect_deals
PARSERS_TO_RUN = [
EXMOParser,
CEXParser
]
PAIRS = [
Pair('USD', 'BTC'),
Pa... | true |
2421994d28a7d4df0684dfcc759c7e14f098b1c5 | worldbo/Effective_Python | /chapter2/19.py | UTF-8 | 1,305 | 3.671875 | 4 | [] | no_license | # page44 第十九条
def remainder(number, divisor):
return number % divisor
assert remainder(20, 7) == 6
assert remainder(20, 7) == remainder(20, divisor=7) == remainder(number=20, divisor=7) == remainder(divisor=7,
num... | true |
af619aa262965bb79978c88b07aa25545c84f500 | Jordi-Ab/SciComp_Cpp | /Coursework2/Q3/myPlotter.py | UTF-8 | 531 | 2.875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
#plt.rc('text', usetex=True)
plt.rc('font', family='serif')
x = np.loadtxt('grid.dat')
dun = np.loadtxt('du_numerical.dat')
du = np.loadtxt('du_analytical.dat')
plt.subplot(2,1,1)
plt.plot(x,dun,'ro',label='numerical')
plt.plot(x,du,'g-',label='analytical')
plt.l... | true |
62d150587baa4c317a8d479b118debae8084bc3e | cesaralmeida93/estrutura-dados-python | /secao-1-comecando-programar-com-python/desempacotamento-de-sequencias.py | UTF-8 | 132 | 3.328125 | 3 | [] | no_license | nome = 'abc'
c1, c2, _ = nome
print(c1)
print(c2)
def func(x, y):
return x**2, y**2
r1, r2 = func(2, 3)
print(r1)
print(r2) | true |
6b41fa30b08e63ad42f8464e667601ed54510760 | rafaelperazzo/programacao-web | /moodledata/vpl_data/323/usersdata/288/89057/submittedfiles/mdc.py | UTF-8 | 165 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
n=int(input('Digite dois numeros [x,y]: '))
resto=(x%y)
while resto!=0:
a=(resto/y)
if resto==0:
break
print (a)
| true |
01918dee9a5bcc2ca2af748439ccbcae28515511 | Ruymelo10/CursoemvideoPy | /exercicios/mundo3/ex82.py | UTF-8 | 439 | 3.734375 | 4 | [] | no_license | num=[]
pares=[]
impares=[]
while True:
x = int(input('Digite um numero: '))
num.append(x)
if x%2==0:
pares.append(x)
else:
impares.append(x)
cond=' '
while cond not in 'SsNn':
cond = str(input('Deseja continuar [S/N]? '))
if cond in 'nN':
break
print(f'A lista... | true |
8b5bd2651771854f1048f1ea8b268b639e8ff8a3 | neilvyas/caltrops | /tests/test_example.py | UTF-8 | 1,840 | 3 | 3 | [] | no_license | from caltrops import Error
from generic_contracts import arbitrary_computation
from generic_contracts import Errors
class TestExampleGuardedFunction:
def _parameterized_test(self, inputs, expected_output):
if len(inputs) == 3:
string_, num_, multiplier = inputs
res = arbitrary_comp... | true |
0aa24acf3d88c9662f75aead8f6a512a4136c948 | mhhuang95/PRW_RBCD | /exp_hc_dim_k.py | UTF-8 | 4,035 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pickle
from PRW import ProjectedRobustWasserstein
from Optimization.RiemannianBCD import RiemannianBlockCoordinateDescent
from Optimization.RiemannianGAS import RiemannianGradientAscentSinkhorn
def T(x,d,dim=2):... | true |
b02eaf37afdf147aa8dd360aa4a918989b0f4fd8 | liuyuzhou/ai_pre_sourcecode | /chapter2/nd_pro_use_5.py | UTF-8 | 370 | 3.3125 | 3 | [] | no_license | import numpy as np
# 数组的 dtype 为 int64(八个字节)
int_size = np.array([1, 2, 3, 4, 5], dtype=np.int64)
print('int_size的itemsize为:{}'.format(int_size.itemsize))
# 数组的 dtype 现在为 float16(两个字节)
float_size = np.array([1, 2, 3, 4, 5], dtype=np.float16)
print('float_size的itemsize为:{}'.format(float_size.itemsize))
| true |
5433c305884d0853022e2b89de81ccde7bcee278 | bernurancel/HotelRezervation | /HOTELPROJECT/import.py | UTF-8 | 9,249 | 2.90625 | 3 | [] | no_license | import pymysql.cursors
from datetime import datetime
import time
print("""
----- Welcome to Hotel Reservation System! -----
----- Rezervasyon işlemi için giriş yapınız -----
1-KAYIT OL
2-GİRİŞ YAP
3-ADMİN GİRİŞİ YAP
""")
def kayit():
connection = pymysql.connect(host = "localhost" , user = "ro... | true |
ff730ca7c180bb86f151b68037cfdd1c7249fd81 | james28689/Chess-Project | /state_analysis.py | UTF-8 | 2,261 | 3.28125 | 3 | [] | no_license | from pieces import Piece
from moves import getPawnMoves, getRookMoves, getBishopMoves, getKnightMoves, getKingMoves, checkAllMoves
def analyseBoard(board):
whiteCheckmate = findCheckmate(board, "white")
blackCheckmate = findCheckmate(board, "black")
stalemate = findStalemate(board)
if whiteCheckmate:... | true |
61162295c4892f902377730dbb95dc354e91975c | ZhangAllen98/ideal-octopy | /python/DarkSky/pycode/map_bins.py | UTF-8 | 1,685 | 2.640625 | 3 | [] | no_license | """
Calculates and plots a 2D gridded map of the mean/median limiting magnitude
"""
from matplotlib import pyplot as plt
from mpl_toolkits import basemap
from matplotlib import colors
from matplotlib import cm
import scipy.stats as stats
import numpy as np
import getdata
csvfile = "/home/tim/virtual/Dar... | true |
76fc14a5010b90082a1e2e5681aa75bcece48064 | StephanieMalvicini/FinalProject | /handlers/fairness_definitions_calculator.py | UTF-8 | 5,239 | 2.65625 | 3 | [] | no_license | import sys
from constants.predictions_names import *
from databases import parameters
from exceptions.decision_algorithm import InvalidDecisionAlgorithmParameters
from fairness_definitions.discrimination_basics import calculate_basic_metrics, \
create_positives_negatives_tables, create_probabilities_table
from han... | true |
45829b7d858c692cc2234041a5ddcff7cf441065 | ManosAgelidis/spiking_CPG | /Models/brain_model/ijspeert_CPG_loihi.py | UTF-8 | 9,512 | 2.53125 | 3 | [] | no_license | #auke_cpg_benchmark.py
#matplotlib notebook
import nengo
import nengo_loihi
from nxsdk.graph.monitor.probes import PerformanceProbeCondition
from nxsdk.api.n2a import ProbeParameter
import matplotlib.pyplot as plt
import os
import numpy as np
import random
seed = 0
np.random.seed(seed)
random.seed(seed)
def get_neighb... | true |
6a5c20b12ddbfb33807df5b0dfd14c1a4a3958e6 | Conjugasion/python_study | /main/pyhton类/多继承/Child.py | UTF-8 | 332 | 2.8125 | 3 | [] | no_license | from Father import father
from Mather import mather
class child(father, mather):
def __init__(self, money, job, height):
father.__init__(self, money)
mather.__init__(self, job)
self.height = height
self.age = 24
Mark = child(1000, "学生", 178)
print(Mark.age)
print(Mark.money)
Mark... | true |
3f8223fd55b44baa69da08e36dcd0b4f8bf38f28 | MartinPons/BookingAnalysis | /tests/test_Booking.py | UTF-8 | 4,981 | 2.78125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from BookingData import Booking
from datetime import date, timedelta, datetime as dt
import unittest
booking_df_sample = pd.read_pickle('bookings_df_sample.pkl')
booking_df_minisample = booking_df_sample.iloc[1:100]
booking_adr = {
'booking_id': "B1",
'booking_date': dat... | true |
5512acd3d7be158a8c0aa8d0145c16666bd0965a | st122037/DSA-Sricharan-Yedu-Thirnathi- | /7_Sricharan_Yedu_Thirnathi.py | UTF-8 | 1,043 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""7-Sricharan-Yedu-Thirnathi.ipynb
"""
def integrity_of_parenthesis(string):
opening_brackets = ['(','{','[']
closing_brackets = [')','}',']']
stack = []
for char in string:
if char in opening_brackets:
stack.append(char)
elif char in closing_brack... | true |
1fc679a0c6e00afaf0fafce103069388d4a5f74a | EmileSchneider/tree | /test_for_tree.py | UTF-8 | 1,402 | 3.546875 | 4 | [] | no_license | from sys import argv
import json
path_to_json_file = argv[1]
#check if argument is path
#check if their are to many arguments
def load_json_dictionary_from_path(path):
####
# arg: get the path given as argument
# ret: return python dictionary
####
return_dictionary = {}
json_data = json.loads... | true |
4f01aed28e059b63cbe5b845adf82bd2793e115c | Alex-Fuchs/bachelorthesis | /analysis.py | UTF-8 | 34,037 | 2.90625 | 3 | [] | no_license | '''
Created on 12.05.2021
@author: Alexander Fuchs
This module has all the implementation, that was used for the analysis.
So the join, the grouping and the calculation of the performance metrics
is included in this module.
Also most of the data preparation is done in this module. The majority
filtering of the grou... | true |
40e771d44de41a9657255843605cfa3d75875172 | stonescar/tournament-planner | /play.py | UTF-8 | 12,449 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# play.py -- a simple example of how the module can be used
#
import os
import bleach
from blessings import Terminal
from tournament import (connect, deleteMatches, newTournament,
registerPlayer, assignPlayers, playerStandings,
reportMatch, swissP... | true |
f11ab1eccd4b2201c61bd3468eebbfc8ea09968b | wenguixuan/Python-DataStructur | /UnionFind/unionfind_base.py | UTF-8 | 589 | 3.328125 | 3 | [] | no_license | '''
数据结构--11--UnionFind(并查集)
'''
import abc
__author__ = 'Yan'
__date__ = '2019/3/18 16:47'
class UnionFindBase(metaclass=abc.ABCMeta):
'''
数据结构--11--UnionFind(并查集)
'''
@abc.abstractmethod
def is_connected(self, p, q):
'''
判断元素p和q是否相连
'''
pass
def ... | true |
6d2cec3b4e8dd68d6e3d60d28cc570fb0ad21f7b | xiaocui123/python_study | /com/hyjf/smoothpython/chain.py | UTF-8 | 125 | 3.140625 | 3 | [] | no_license | def chain(*iterables):
for it in iterables:
yield from it
s='ABCDEF'
t=tuple(range(10))
print(list(chain(s,t))) | true |
6497cc5b190de26379a22f1eddb2f79ed6e33a1d | awesome-archive/python-debugging-skills | /debugging/code/multiprocess_main.py | UTF-8 | 642 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
import multiprocessing as mp
import time
from pudb.remote import set_trace
def worker(worker_id):
""" Simple worker process"""
i = 0
while i < 10:
if worker_id == 1: # debug process with id 1
set_trace(term_size=(80, 24))
time.sleep(1) # represents ... | true |
4b4d3ef29a0f4b954ae07aba3c752ab69fa2d96d | sarmisthamaity/pythonLogicalquestion | /number_pattern.py | UTF-8 | 174 | 3.796875 | 4 | [] | no_license |
n=5
i=1
while i<=n:
j=1
while j<i:
print (j,end=" ")
j=j+1
b=j
while b>=1:
print(b,end=" ")
b=b-1
print ()
i=i+1
| true |
07d4d6b44b1b62a84e0d1e8b2d2df36bb9c05005 | EoJin-Kim/CodingTest | /Helper/모든 소수 출력.py | UTF-8 | 328 | 3.75 | 4 | [] | no_license | import math
n=1000 #2부터 n 까지의 모든 소수를 판별
array=[True for _ in range(n+1)] #처음은 모든 소수를 True로 초기화 0,1 은 제외
for i in range(2,int(math.sqrt(n))+1):
j=2
while i*j <=n:
array[i*j]=False
j+=1
for i in range(2,n+1):
if array[i]:
print(i,end=" ") | true |
7b2a01d252a6f3a719cc07339fa78eb768386f5b | shendi-project/shendi | /backgrounds.py | UTF-8 | 2,200 | 3.109375 | 3 | [
"MIT"
] | permissive | import json
import nethysdb
# I don't know if this is useful, but for now I am leaving it here just in case
class Background(nethysdb.NethysDB):
def __init__(self, link, sourcebook, page, name, traits, description, ability_boost1, ability_boost2, trained_skill, additional_lore, feat):
super().__init__(link... | true |
ba25c6a29aa1253f770eff44784bb0edd81b79bd | bjmarsh/insight-coding-practice | /daily_coding_problem/2020-08-20.py | UTF-8 | 755 | 3.8125 | 4 | [] | no_license | """
Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed).
For example, given the string "([])[]({})", you should return true.
Given the string "([)]" or "((()", you should return false.
"""
def solution(s: str) -> bool:
left = set(list(... | true |
10031ad41732630bab5051ee0b5453c11848dd50 | bladrome/bioinfoscripts | /splitvcfaschromosome/splitvcf.py | UTF-8 | 1,226 | 2.890625 | 3 | [] | no_license | import sys
common = list()
chromosome = dict()
def common_data(line):
global common
common.append(line)
def chromosome_data(chromosome_name, line):
global chromosome
if chromosome_name not in chromosome:
chromosome[chromosome_name] = list()
else:
chromosome[chromosome_name].appe... | true |
73141ece41d4cb19ae2b74f9759590eb62645e31 | Leikjaland/sprint-4 | /Forrit/hljod.py | UTF-8 | 960 | 3.03125 | 3 | [] | no_license | import sys
import time
import pygame
from pygame.locals import QUIT
from pygame.mixer import Sound
def main():
pygame.init()
size = 680, 680
rCBack = ( 27, 27, 27 )
screen = pygame.display.set_mode( size )
screen.fill( rCBack )
pygame.display.set_caption( "Play Sound using PyGame" )
# L... | true |
c9dacb3cfe72df9fabf125b209c610d62588354f | dbranch3/cs3280project2 | /src/main/scripts/cs3280project2.py | UTF-8 | 2,288 | 3.25 | 3 | [] | no_license | """
This Script runs a HTTP Server that will respond with the Network Address given Ip and Subnet
"""
#!/usr/bin/env python
import http.server
from utils import ip_and_subnet_are_valid, get_network_address
__author__ = 'Darrell Branch'
__version__ = 'Fall 2020'
class NetAddressServer(http.server.BaseHTTPRequestHan... | true |
d7f5bf0b8b4c608be5b580b094282f51d6f702ad | raghavbajaj03/Project_2019-20 | /weather/weather.py | UTF-8 | 10,699 | 2.84375 | 3 | [] | no_license | import os
import platform
import sqlite3
import requests,json
import PySimpleGUI as sg
from datetime import datetime
import datetime
currentDT = datetime.datetime.now()
print (currentDT.strftime("%Y-%m-%d %H:%M:%S"))
print (currentDT.strftime("%Y/%m/%d"))
print (currentDT.strftime("%H:%M:%S"))
print (currentDT.st... | true |
3eb40a9c881e1f0386ab81a3d41417b810f5cf25 | ne7ermore/playground | /python/tree/red_black_tree.py | UTF-8 | 8,349 | 3.578125 | 4 | [] | no_license | class RBNode:
def __init__(self, value, is_red, parent=None, left=None, right=None):
self.value = value
self.color = is_red # 1-red 0-black
self.parent = parent
self.left = left
self.right = right
class RBTree:
def __init__(self):
self.root = None
def lef... | true |
326f5b36aded67d4a4368a83e7e41f90def2c9fb | jl-robledo/python_DAW | /proyectos/clase/calculadora_grafica.py | UTF-8 | 3,595 | 4.0625 | 4 | [] | no_license | #Zona para variables y constantes:
#fin de la zona de variables y constantes
print ("---------- CALCULADORA ----------")
print ("----------SUMA---------" )
num1 = int( input("Introduce un numero: "))
num2 = int (input("introduce un segundo numero: "))
resultado = num1 + num2
print (f"El resultado d... | true |
434d10620aa4fc82e3b54896c3e430becb635d3f | zhenguo96/test1 | /Python基础笔记/13/代码/6.动态增加实例成员.py | UTF-8 | 509 | 3.734375 | 4 | [] | no_license | class Dog:
pass
# 给对象动态添加属性
dog = Dog()
dog.name = 'asod'
dog.age = 5
print(dog.__dict__)
# 动态增加方法
def bark(self):
print("www")
dog.bark = bark
# dog.bark(dog)
from types import MethodType
dog.bark = MethodType(bark,dog) # 把函数绑定给对象
dog.bark()
# 动态绑定是针对特定对象,不是针对所有对象
dog1 = Dog()
# print(do... | true |
d6a8e0cb4c39d92efa359f4219866d0c28d105d7 | rheehot/Self-Driving-Car-09-Programing-A-Real-Car | /ros/src/waypoint_updater/waypoint_updater.py | UTF-8 | 4,949 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from styx_msgs.msg import Lane, Waypoint
from std_msgs.msg import Int32
import math
import numpy as np
from scipy.spatial import KDTree
'''
This node will publish waypoints from the car's current position to some `x` distance ahead.
'''
LO... | true |
92d3dd78f7045ce0ca1810f6826c89d5c01888b2 | sebhauri/nglbot | /src/bots/create_event.py | UTF-8 | 7,233 | 2.734375 | 3 | [] | no_license | from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
ConversationHandler,
Filters,
CallbackContext,
Dispatcher
)
from telegram import (
ReplyKeyboardMarkup,
Update,
)
from enum import Enum
import logging
import datetime
import uuid
from pony.orm import *
from model... | true |
e36804604340b02f4bfd70a50c37afd54f504837 | dixon-che/python-pptx | /pptx/exc.py | UTF-8 | 1,116 | 2.609375 | 3 | [
"MIT",
"BSD-2-Clause"
] | permissive | # Copyright (C) 2012, 2013 Steve Canny scanny@cisco.com
#
# This module is part of python-pptx and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Exceptions used with python-pptx.
The base exception class is PythonPptxError.
"""
class PythonPptxError(Exception):
"""Ge... | true |
dd213f9a1cb49e5f073d256409b92cf939e77a35 | rstaudt2/python_cdll_example | /call_c_dll.py | UTF-8 | 414 | 3 | 3 | [] | no_license | from ctypes import cdll, c_char_p, create_string_buffer
BUFFER_SIZE = 1024
dll = cdll.LoadLibrary('C++/bin/sample_dll.dll')
class Foo(object):
def __init__(self):
self.obj = dll.Foo_new()
def bar(self, name, buf):
dll.Foo_bar(self.obj, c_char_p(name), buf, BUFFER_SIZE)
if __name__ == '__main__... | true |
766f4b341e3f6799bc5482b1c2017c4461324b17 | Luisa-T/DataRepresentation | /weatherAthenry.py | UTF-8 | 2,128 | 2.90625 | 3 | [] | no_license | # code for challenge 07/03
import requests
import json
from xlwt import *
#monthly weather for Athenry
url = "https://prodapi.metweb.ie/monthly-data/Athenry"
response = requests.get(url)
data = response.json()
totalWeather = list(data)
pageNumber = 1
for item in data:
print(item)
totalWeathe... | true |
8dc18755ef8b4e149c23c58d2c7938aa7c9023d4 | os6sense/sunra_ui_apps | /recording-ui/test/test_project_properties_model.py | UTF-8 | 5,188 | 2.84375 | 3 | [] | no_license |
# -*- coding: latin-1 -*-
import time
import unittest
import pytz
from dateutil.parser import parse
from datetime import datetime
from project_properties.ProjectPropertiesModel import ProjectPropertiesModel
def setup():
pass
def teardown():
pass
class RecordingControllerTest(unittest.TestCase):
def se... | true |
d68243c65a053e519e2a768dee0055ed8883be38 | OrganIA/FlaskMockup | /app/models.py | UTF-8 | 461 | 2.71875 | 3 | [
"MIT"
] | permissive | from app import db
from app.modelform import lbl
class Person:
first_name = db.Column(db.String, **lbl('Prénom'), nullable=False)
last_name = db.Column(
db.String, **lbl('Nom de famille'), nullable=False
)
def __str__(self):
return '{person.first_name} {person.last_name}'.format(person... | true |
919c9c3d928fa5e969d828b3ca27b27fea2c4de6 | lizhuhe0323/Python | /redisconn.py | UTF-8 | 352 | 2.671875 | 3 | [] | no_license | import redis
redis_config = {
"host": "127.0.0.1",
"port": 6379
}
# redis连接对象
redis_conn = redis.Redis(**redis_config)
redis_conn.set("name","ping")
print (redis_conn.get("name"))
# redis连接池
redis_pool = redis.ConnectionPool(**redis_config)
r = redis.Redis(connection_pool=redis_pool)
r.set('name','qiang')
pri... | true |
8dc7a75866844f2228a853806135cb328f1cad07 | ZhichengZhou-1/WAH_compression | /bitmap_indexing_and_compression.py | UTF-8 | 16,976 | 3.21875 | 3 | [] | no_license | import os.path
def create_index(input_file, output_path, sorted=True):
new_path = output_path + input_file
file1 = open(input_file, "r")
if file1.mode == "r":
# read all contents of the input file
file_content = file1.readlines()
file1.close()
# if sorted is true sort the ... | true |
bfedc23cb3120e245bd08ee47806180558ef4096 | 1060460048/pythonRelate | /addWarterMark.py | UTF-8 | 3,227 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/5/9 上午11:31
# @Author : qq1060460048
# @File : addWatermark.py
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
#解决文件太大的问题
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import sys,os
import re
class aa(object):
def __init__(... | true |
c29ebd6b5117d13fc4538540313a33f97eb01d96 | Frc2481/frc-2014 | /opr/opr.py | UTF-8 | 879 | 2.578125 | 3 | [] | no_license | import reboundrumble
from numpy import matrix
from numpy import array
import urllib
MATCH_URL = "http://www.thefirstalliance.org/api/api.json.php?action=event-matches&event-code="
TEAMLIST_URL = "http://www.thefirstalliance.org/api/api.json.php?action=event-details&event-code="
#Create Parse Object
p = reboundrumble.... | true |
a1da826ef67df649f9b477514f9d36f509060485 | trofimovamw/GInCovPipe | /scripts/simulation/output_writer.py | UTF-8 | 4,112 | 2.859375 | 3 | [] | no_license |
import pandas as pd
from pathlib import Path
from yaml import dump
import datetime
strptime = datetime.datetime.strptime
class writer:
'''
Class containing input and output information, reading and writing functions.
'''
def __init__(self, outputpath, file_prefix, init_date="2020-01-01"):
self.fasta_path = out... | true |
73d471a9c6d74d158676a0e92e7b711afbab1ecb | aerickson/fleaker | /fleaker/marshmallow/fields/mixin.py | UTF-8 | 1,045 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | """Module that provides a mixin that can help define Marshmallow fields."""
from marshmallow import fields
from fleaker.constants import MISSING
class FleakerFieldMixin(fields.Field):
def get_field_value(self, key, default=MISSING):
"""Method to fetch a value from either the fields metadata or the
... | true |
1efc90ada45e59faeac616b02b1d671092cec4f0 | huangjiaxiaoluobo/python_unittest | /test_unittest/db_fixture/mysql_db.py | UTF-8 | 1,986 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python
# coding=utf-8
# 作者 :BuYang
# 创建时间 :2019/5/17 9:27
# 文件 :mysql_db.py
# IDE :PyCharm
import configparser
import pymysql.cursors
# ========== 读取dbconfig.ini配置============
fp = configparser.ConfigParser()
fp.read('dbconfig.ini', encoding="utf-8")
# 读取指定节点的配置
host = fp.g... | true |
74cb99e16a99a4fe7d1398f00a50b33eeacdd4fe | ZeeWanderer/Python-Ray-tracer | /helpers.py | UTF-8 | 84 | 2.84375 | 3 | [] | no_license | from math import isinf
def isninf(value):
return (value < 0) and isinf(value)
| true |
168023eb9d65eec8e1851c29616f625c3548b553 | Siglud/python3test | /DesignPattern/Observer.py | UTF-8 | 1,539 | 3.703125 | 4 | [] | no_license | # coding=utf-8
__author__ = 'Siglud'
#观察者
class Observer(object):
"""观察者"""
def __init__(self, subject):
self.subject = subject
self.subject.addObserver(self)
self.integer = self.subject.integer
self.double = self.subject.double
self.string = self.subject.string
de... | true |
8e43650d85f43b83b54b8e0e68d22e80f57fe0e0 | adarsh-nl/qlearning_maze | /qlearning_maze/app.py | UTF-8 | 3,468 | 3.875 | 4 | [] | no_license | """
Reinforcement learning maze example.
This script is the main part which controls the update method of this example using q-learning algorithm.
The RL algorithm (Q-learning) is in RL_agent.py.
The environment is presented in maze_env.py.
Red rectangle: explorer.
Black rectangles: hells ... | true |
1896f81ccddcef0e1f2f925c0d84da9fc57a8aec | ismailfarooq1/web-scraper-quotes | /quotes/quotes/spiders/quotes_scrape.py | UTF-8 | 764 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy_splash import SplashRequest
class QuotesScrapeSpider(scrapy.Spider):
name = 'quotes_scrape'
allowed_domains = ['quotes.toscrape.com']
script = '''
function main(splash, args)
splash.private_mode_enabled = false
url = a... | true |
9b114ea82d6122d54422785402b75cae9e645733 | gregangrogi/pyexperiments | /pyexperiments/ds bot.py | UTF-8 | 506 | 2.6875 | 3 | [] | no_license | import discord
from discord.ext import commands
TOKEN = 'NzM1MjE2MDE1ODY0MTAzMDAy.XxdBRQ.XHoCV3ssuWtDrOThw7KjIILCMnk'
bot = commands.Bot(command_prefix='!')
@bot.command(pass_context=True) # разрешаем передавать агрументы
async def бот_ты(ctx, arg): # создаем асинхронную фунцию бота
if arg == "тыгей":... | true |
6f0b7e85aeed175f7a7851fa35c3db226699a8aa | RaymondKlass/pinchy-lobster | /runTrain.py | UTF-8 | 595 | 2.828125 | 3 | [
"MIT"
] | permissive | from aitime.data import DataPool
from aitime.train import KFoldTrainer
"""
Complete the logical process of training and evaluation
"""
# 1. Create a DataPool - an object to hold all the data I have
dp = DataPool()
# 2. Extract Sequences from raw data
dp.extract_sequences()
# 3. Extract Windows from Sequences
dp... | true |
9aff5b8194714dbe6718efb32c0cb04c34f711a3 | erylieclark/Artificial-Intelligence | /biogimmickry/biogimmickry.py | UTF-8 | 18,312 | 3.46875 | 3 | [] | no_license | # Name: Erin Rylie Clark
# Course: CSC 480
# Instructor: Daniel Kauffman
# Assignment: Biogimmickry
# Term: Summer 2021
import random
from typing import Callable, Dict, Tuple, List
class FitnessEvaluator:
def __init__(self, array: Tuple[int, ...]) -> None:
"""
An instan... | true |
ad89091a61202ffd7cee8f4a9c8f84b7e269b919 | hiropppe/strand-aligner | /strand/strand/strand.py | UTF-8 | 8,948 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
# strand.py
#
# An implementation of the STRAND HTML aligner as described in
# "The Web as a Parallel Corpus" (Resnik and Smith, 2003).
import re
import py_aligner
import py_maxent
from scipy.stats import stats
class StrandAligner:
def __init__(self, difference_threshold=0.1, confidence_min=... | true |
8f22330b54d47f553ef6bd1db4cd2097543f703a | yeeh1616/Group52 | /dashboard.py | UTF-8 | 3,107 | 2.71875 | 3 | [] | no_license | from eca import *
import json
import eca.http
import datetime
import textwrap
import pprint
import re
# This function will be called to set up the HTTP server
def add_request_handlers(httpd):
# add an event-generating request handler to fire 'order' events
# This requires the POST method because the event gene... | true |
42bed1975a07df861a153e664f7aadeef045a415 | szhu3210/LeetCode_Solutions | /LC/140.py | UTF-8 | 983 | 3.28125 | 3 | [
"MIT"
] | permissive | class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: bool
"""
## recursive solution with memory
self.record=set([]) # keep record of failed string
self.res=[]
self.r=list(set([len(x) for x... | true |
32596ce312e515991ffb93f7577b2f95eb78765e | QuantumChamploo/NeilNeat | /workSpace/playTest.py | UTF-8 | 1,698 | 3.375 | 3 | [
"BSD-3-Clause"
] | permissive | from bareSnake import snakeGame
a = snakeGame()
loop = True
while loop:
print(a.direction)
print(a.pos[0])
print(a.pos[1])
print(a.gameOver)
print(a.toString())
print("east")
print(a.propDirect([10, 0]))
print("south")
print(a.propDirect([0, 10]))
print("west")
print(a.pro... | true |
f7209e8e4c7a88689882fcdd582c627d243bcb37 | LucasBelpaire/inflationcalculator | /inflationcalculator.py | UTF-8 | 869 | 3.109375 | 3 | [
"MIT"
] | permissive | # Author: Lucas Belpaire
# API: www.statbureau.org
# little script to calculate inflation
#!/usr/bin/env
import requests
import urllib
import re
def calculate_inflation(start_date, end_date, amount):
"""
Returns the amount (in dollars) adjusted for inflation.
The amount parameter is the amount (in dollar... | true |
84d9425471365761bc8e2f6d29f33b37c09626e1 | Ikochoy/rock_paper_scissors_fun | /data_collection.py | UTF-8 | 519 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
import os
cap = cv2.VideoCapture(0)
move_id = input('Enter move_id: ')
sample_no = 0
while True:
ret, frame = cap.read()
cv2.rectangle(frame, (100, 100), (500, 500), (255, 0, 0), 2)
roi = frame[100:500, 100:500]
gray = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY)
cv2.imwrite("training_image... | true |
7b91dd0ac354115f51a0804cb0f51bdcdf6a0f85 | lingyunfuyu1/xh_pictures_crawler | /xh_image_download_tool.py | UTF-8 | 4,082 | 2.96875 | 3 | [] | no_license | # coding:utf-8
import logging
import os
import re
import requests
def download_image_from_url(image_url, image_file_path, image_file_name=""):
"""请求图片URL下载图片,保存为指定的路径下的指定文件名。
参数:
image_url:要下载的图片的url
image_file_path:下载图片存放的路径,如果不存在则自动创建
image_file_name:下载图片保存的文件名,如果为空则自动从image_url中截取设置
返回:... | true |
98b63ddb12de36a75332a2cdb12dade7bcb1b3ca | christosg88/hackerrank | /Algorithms/03-Strings/Anagram/anagram.py | UTF-8 | 603 | 3.828125 | 4 | [
"MIT"
] | permissive | testcases = int(input().strip())
for test in range(testcases):
string = input().strip()
length = len(string)
half_length = length // 2
if length % 2:
print(-1)
continue
letters1 = [0] * 26
letters2 = [0] * 26
ascii_a = ord('a')
ascii_string = [ord(c) - ascii_a for c in... | true |
081069e7d0664ca05bc268df1da38405fbd36416 | ibhm/1-ProgrammingProblems | /110. Balanced Binary Tree .py | UTF-8 | 1,331 | 3.796875 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
##goal is to find the height of each subtree, find the height of left and right subtree properly in a helper function at the very top. fi... | true |
0d301a82bb68ef75b00f0314de5bf8294cad9993 | jyoplac/COVID-PERU-CSL-UNI | /SIR Basico.py | UTF-8 | 7,318 | 2.515625 | 3 | [] | no_license | """ Librerias """
from matplotlib import pyplot as plt
import numpy as np
''' cargar datos '''
from datos import data_acumulada as dt_acu
from datos import data_diaria as dt_dia
''' formulas sir'''
import formulas as fs
''' datos '''
data_cum = np.array(dt_acu.data_acumulada)
data_dia = np.array(dt_dia.data_diaria)
... | true |
d8ada75b680ffdd269530f2816a5506926fdaaee | Stamatis-Ilias/PLAsTiCC-Astronomical-Classification | /read_test_files/second_test.py | UTF-8 | 2,379 | 2.609375 | 3 | [] | no_license | import time
import os.path
import numpy as np
import pandas as pd
import gc
COLUMN_TO_TYPE = {
'object_id': np.int32,
'mjd': np.float32,
'passband': np.int8,
'flux': np.float32,
'flux_err': np.float32,
'detected': np.int8
}
def prepare_data(directory, name, output_columns):
start_time = ti... | true |
fd198ea1be4377a0b39ac3b3cf6fa55fbe9f63f9 | pengkangzhen/Hyper_Heuristic_Framework | /Benchmark.py | UTF-8 | 978 | 2.828125 | 3 | [] | no_license | import abc
class Benchmark(abc.ABC):
@abc.abstractmethod
def goal(self, solution):
pass
@abc.abstractmethod
def mutate(self):
pass
@abc.abstractmethod
def mutates(self):
pass
@abc.abstractmethod
def apply(self, mutations):
pass
@abc.abstractmetho... | true |
b3f8d4324bd720f83cd1b3c2b2d183fe09c4eee7 | BigYellowTiger/attribute_reduction-PCA-clustering | /paint.py | UTF-8 | 3,745 | 2.578125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import math
import numpy as np
import random
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus'] = False
all_color = ['b', 'c', 'g', 'k', 'm', 'r', 'w', 'y']
def get_cycle_pos(all_center, all_radius):
all_x = [... | true |
4eff15359913fd6f12d453536a516be9c83774ff | maxi4768/Ejercicios | /UsoBasicoPrint.py | UTF-8 | 592 | 4.25 | 4 | [] | no_license | # Exponer el uso basico de la funcion print
print('ejemplo basico')
print('ejemplo basico', end=' ') #Se cambia el salto de linea por un espacio en blanco
print('ejemplo basico', end=' ')
print()
print('python', 'es','fantastico')
print('python', 'es','fantastico',sep='-')#cambiamos el separador de esp... | true |
cce86e401c99c332aae7f92822a15d2a245ae36a | csJd/oj-codes | /leetcode/85.maximal-rectangle.py | UTF-8 | 1,761 | 3.546875 | 4 | [] | no_license | #
# @lc app=leetcode id=85 lang=python3
#
# [85] Maximal Rectangle
#
# https://leetcode.com/problems/maximal-rectangle/description/
#
# algorithms
# Hard (33.16%)
# Likes: 1573
# Dislikes: 52
# Total Accepted: 128.2K
# Total Submissions: 377.4K
# Testcase Example: '[["1","0","1","0","0"],["1","0","1","1","1"],["... | true |
7f530ae3052c9357193b3895e9390f03ae018cbe | Eshliforfriends/itstep | /lesson3/glue.py | UTF-8 | 154 | 3.546875 | 4 | [] | no_license | number_1 = input('Enter number 1:\n')
number_2 = input('Enter number 2:\n')
number_3 = input('Enter number 3:\n')
print(number_1 + number_2 + number_3) | true |
89599460ceb9657372c8ee4a9383cc0356e5dc99 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_1/354.py | UTF-8 | 707 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
from sys import argv
f = open(argv[1])
N = int(f.readline())
for i in range(N):
S = int(f.readline())
search_engines = []
for se in range(S): search_engines.append(f.readline()[:-1])
Q = int(f.readline())
queries = []
for qu in range(Q): queries.append(f.readline()[:-1])
switches = 0
p... | true |
1d045fef8336d67bc9b4109f97ab3e8a7c951f26 | ausaki/data_structures_and_algorithms | /leetcode/stone-game/406499053.py | UTF-8 | 631 | 3 | 3 | [] | no_license | # title: stone-game
# detail: https://leetcode.com/submissions/detail/406499053/
# datetime: Fri Oct 9 16:26:34 2020
# runtime: 624 ms
# memory: 126.9 MB
class Solution:
def stoneGame(self, piles: List[int]) -> bool:
prefix = [0]
for p in piles:
prefix.append(prefix[-1] + p)
@l... | true |
924974e643b512ff9c4c0be28bbba329beab5404 | 0xchikku/weatherForecast | /main.py | UTF-8 | 1,003 | 3.328125 | 3 | [] | no_license |
import requests, json, os, time
from datetime import datetime
from dotenv import load_dotenv
load_dotenv() #takes environment variable from .env
api_key = "Paste you API key"
base_url = "https://api.openweathermap.org/data/2.5/weather?q="
print("Hello!")
time.sleep(0.5)
print("Here You can find weather of your and... | true |
4ea397cf9975529eaf82eaadc0f43824b3805b6b | musaprg/KyoPro | /atcoder/abc155/C/main.py | UTF-8 | 743 | 2.765625 | 3 | [] | no_license | import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
... | true |
89c4f09a4edb0d29164e4975d9f7ebad05f6ac14 | SilverBlaze109/VAMPY2017 | /Games/pong.py | UTF-8 | 3,589 | 2.96875 | 3 | [
"MIT"
] | permissive | import pygame
import time
import random
WIDTH = 680
HEIGHT = 480
SIZE = (WIDTH, HEIGHT)
BLACK = (0, 0, 0)
GREY = (128, 128, 128)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
WAITING = 1
PLAYING = 2
state_time = time.time()
state = WAITING
pygame.init()
scree... | true |
f7cb5da32c2a7c11821260e33669cec4bc40d6e3 | HappyGnom/ToP | /Lab1.py | UTF-8 | 2,166 | 3.578125 | 4 | [] | no_license | from RandomGenerator import get_random_sequence
from prettytable import PrettyTable
import matplotlib.pyplot as plt
import math
# F(x) = sqrt(x)/2
# f(x) = 1/(4sqrt(x))
def get_distribution_intervals(values, num_of_intervals):
sorted_values = sorted(values)
sequence_range = 4
interval_length = sequence_... | true |