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 |
|---|---|---|---|---|---|---|---|---|---|---|
72e592ef4fb93f3d81697f2719a32c2b7a608305 | dccuchile/CC6205 | /diagrams/dynamic_programing.py | UTF-8 | 1,091 | 3.765625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 7 10:09:39 2020
@author: felipe
"""
# more info https://www.khanacademy.org/computing/computer-science/algorithms/recursive-algorithms/a/improving-efficiency-of-recursive-functions
# fac(0)=1 fac(n)=n*fac(n-1)
def recur_factorial(n):
#c... | true |
797645fb6f234a40b178b3aff912c856fd19f9c2 | SamBillmore/WLLRTrainDiagrams | /UserInterface/graph_test.py | UTF-8 | 2,130 | 2.953125 | 3 | [] | no_license | from tkinter import Frame
from tkinter import Button
from tkinter import Label
# from tkinter import PhotoImage
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import matplotlib.dates as mdates
from config import COLUMN_DATA... | true |
cec461a002f73d22968d819fd4c5c8dce3e46540 | tannerkc/codeChallenge | /backend/code/tests.py | UTF-8 | 834 | 2.6875 | 3 | [] | no_license | from input_code import solution
def get_test_cases():
return {
"SMALL_INPUT": [1, 2, 3],
"LARGE_INPUT": [1, 2, 3] * 1000 + [4],
}
def get_expected_outputs():
return {
"SMALL_INPUT": 3,
"LARGE_INPUT": 4,
}
def test_code():
test_cases = get_test_cases()
expected = get_expected_outputs()
test... | true |
2dccde2c90bff11c521f7b3d362594a36bed5c32 | mdietterle/aulas | /Mapas/enviar-martim.py | UTF-8 | 1,434 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import folium
import requests
import json
from folium.plugins import MarkerCluster
mapa = folium.Map(
location=[-16.1237611, -59.9219642],
zoom_start=4)
marcador = MarkerCluster().add_to(mapa)
csv = pd.read_csv('importar1.csv', encoding = 'latin-1', delimiter= ';')
cepsjgs = pd.read_csv(... | true |
34fcf67c199641a83c4d9e6ac8e368963a97cd65 | Chris-Perkins/CodeForces-Solutions | /Programs/157B - Trace/157b.py | UTF-8 | 292 | 3.296875 | 3 | [] | no_license | # Description of the problem can be found at http://codeforces.com/problemset/problem/157/B
import math
n = int(input())
l_s = list(map(int, input().split()))
l_s.sort(reverse = True)
t = 0
for index in range(n):
t += (-1 if index % 2 == 1 else 1) * l_s[index] ** 2
print(t * math.pi) | true |
e8ee1730bcbc60c86ad0aaf955c74e1cc692fb12 | CoderHuo/learn-python3 | /studyLib/socket/udp_server.py | UTF-8 | 833 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
import network_setting as nt
__author__ = 'Mr.Huo'
def main():
"""UDP server"""
udp_server_addr = (nt.LOCALIP, nt.UDP_PORT_S)
udp_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udp_server.bind(udp_server_addr)
print("udp soc... | true |
d3bb5438982f6cc1ccb13cb02f0d34b9f5958e18 | KKimSangHeon/pythonStudy | /pylabTest3.py | UTF-8 | 214 | 3.15625 | 3 | [] | no_license | from pylab import plot, show
from math import sin
from numpy import linspace
xpoints = []
ypoints = []
for x in linspace(0, 10, 100):
xpoints.append(x)
ypoints.append(sin(x))
plot(xpoints, ypoints)
show() | true |
459f3d6d0b60017c6c33b19b99c087dfae56db64 | DeadboltJRS/lpthw | /ex6.py | UTF-8 | 687 | 4.59375 | 5 | [] | no_license | types_of_people = 10
x = f"There are {types_of_people} types of people."
#one instance of s/s
binary = "binary"
do_not = "don't"
y = f"Those who know {binary} and those who {do_not}."
#2nd instnace of s/s
print(x)
print(y)
print(f"I said: {x}")
print(f"I also said: '{y}'")
hilarious = False
joke_evaluation = "Isn't t... | true |
8adc43c537a0f20e9c30660e692506cb4497e979 | yingted/Myro | /trunk/Scribbler/dongle-unit-tests/vl.py | UTF-8 | 648 | 2.515625 | 3 | [] | no_license | from dongle import *
s = serial.Serial("/dev/tty.scribbler", timeout=10)
print "virtual light sensors"
conf_window(s, 0, 0, 0, 84, 191, 1, 1)
conf_window(s, 1, 84, 0, 170, 191, 1, 1)
conf_window(s, 2, 172, 0, 255, 191, 1, 1)
print "left"
g = grab_window(s, 0, 0, 0, 84, 191, 1, 1)
g.show()
print "middle"
g =... | true |
26847d9b55e85ff3ac1a0fd0727c2b71a6c69673 | sindridan/Python_2018 | /tester.py | UTF-8 | 748 | 2.9375 | 3 | [
"MIT"
] | permissive | #verkefni2_12
import re
from fractions import Fraction
def scale(s, ratio):
get_numerals = re.findall(r"([0-9]?[r\/]*[0-9])", s)
calculated = []
for val in get_numerals:
val = val + '*' + ratio
val = eval(val)
calculated.append(str(Fraction(val).limit_denominator()))
#split_stri... | true |
c394dc8ac2624773b05159805bead867315288ef | paulgrimaldo/selenium-basics | /register_new_user.py | UTF-8 | 2,491 | 2.65625 | 3 | [] | no_license | import unittest
from selenium import webdriver
from pyunitreport import HTMLTestRunner
class RegisterNewUser(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path='./chromedriver.exe')
self.driver.get('http://demo-store.seleniumacademy.com/')
self.driver.maxi... | true |
25e03c70616f9da2f201412d67d723389bb26695 | LittleGoodBoy/interface-autotest-ddt | /bin/run.py | UTF-8 | 1,158 | 2.71875 | 3 | [] | no_license | import os, sys
import datetime
'''
配置项目环境变量,用于各个模块之间的调用,系统可用找到对应的模块位置
'''
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
from lib import tools
'''
主函数,自动化测试启动函数
执行测试,并发送测试报告,将相应的测试用例执行之后记录通过与否
'''
def main():
# 自动产生python文件
tools.m... | true |
e9f6c3e6f368057c2c08aaa23bba3e086f12c6de | tekiny/DeepLearning | /ImageClassCNN.py | UTF-8 | 4,531 | 2.65625 | 3 | [] | no_license | import os
os.chdir("/Users/uuuu/Dropbox/My_Image/NeuralNet/")
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten, Dropout
from keras.layers.convolutional imp... | true |
fc3954e6b7bb24fbc16c0c1df949f3755847dc34 | dnegreira/aoc | /2020/3/2.py | UTF-8 | 734 | 3.34375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
with open("input3.txt") as f_in:
ins = [_.strip() for _ in f_in.readlines()]
def custom_path(r, d):
marker = 0
trees = 0
for i in range(0,len(ins)-1,d):
if i == 0 or len(ins[i]) <= 1:
continue
marker+=r
if marker > len(ins[i])-1:
marke... | true |
668046a629598392fd6028f6348fe7be26e3a82f | DaLinYYY/PythonCookBook | /Data structures and algorithms/07保持字典有序.py | UTF-8 | 339 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
'''
@Topic: 07保持字典有序
@desc:
@contact : dalin.strive@gmail.com @author : dalin
@time: 2019/7/7 13:56
'''
from collections import OrderedDict
d = OrderedDict()
d['foo'] = 1
d['bar'] = 2
d['spam'] = 3
d['grok'] = 4
# Outputs "foo 1", "bar 2", "spam 3", "grok 4"
for key in d:
... | true |
01f819a36bfaeabf9b3bcd3cb2756336a3093cc2 | AalauraaA/Speciale | /Python_kode/test_relationship_of_n_and_k.py | UTF-8 | 5,844 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 5 11:32:32 2020
@author: Laura
This Python Script test the relationship between n (amount of sources)
and k (amount of active sources).
The tests are performed on the cases:
- k = 1, n = 5, m = 3, true k = 2 (k < n and k = k true)
- k = 5, n = 5, m = 3, true k... | true |
5ae16dd11cd1fcae0e91734f0663e6d44d520dd4 | cash2one/webb | /webbwiki/terminal-analysis/script/cal_loc/mapper_calculate.py | UTF-8 | 134 | 2.59375 | 3 | [] | no_license | import sys
for line in sys.stdin:
line = line.strip()
if not line:
continue
if len(line.split('\t')) == 4:
print line
| true |
40ceaa2bd975f2cec816509b06b0f58927fe0a9b | lph0729/Scikit-Learn-Demo | /sklearn-model-training/classification/sklearn_random_forest.py | UTF-8 | 1,059 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: payneLi
@time: 18-7-16 上午9:49
@email: lph0729@163.com
"""
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
import pandas as pd
import numpy as np
data... | true |
eda0792a0acd7d0e67597cf6e34907a76726a0f4 | tannuchoudhary/TkinterProjects | /12Tkinter_combo_boxes.py | UTF-8 | 482 | 3.453125 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
def callback(event):
print(event.widget.get())
window = Tk()
tValues = ("A", "B", "C")
# combobox will be new instance of ttk
cbx = ttk.Combobox(window, values=tValues)
# now you can change the default value
cbx.set("Name of my Combobox")
# if you... | true |
af75f91d30102f4565f1464000b0a97ea5d70e70 | m-star18/atcoder | /submissions/abc025/b.py | UTF-8 | 423 | 3.53125 | 4 | [
"Unlicense"
] | permissive | def check(x, y):
if x == 'West':
y = -y
return y
n, a, b = map(int, input().split())
ans = 0
for i in range(n):
s, d = input().split()
d = int(d)
if d < a:
ans += check(s, a)
elif a <= d <= b:
ans += check(s, d)
else:
ans += check(s, b)
if ans > 0:
pr... | true |
c732d18f8d55f1517b72eeae7c1183cc10eb3a04 | daniel-reich/turbo-robot | /xuuQfgva9CKDH6iwH_4.py | UTF-8 | 1,219 | 4.03125 | 4 | [] | no_license | """
You will be given a matrix representing a field `g` and two numbers `x`, `y`
coordinate.
There are three types of possible characters in the matrix:
* `x` representing a rock.
* `o` representing a dirt space.
* `+` representing a grassed space.
You have to simulate grass growing from the position `(x, y... | true |
4dcdb45820ae019b1c4defc97d95904ad63760d3 | Alfonsxh/FluentPython | /07-Decorator/07-01-decorator.py | UTF-8 | 2,064 | 3.71875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
@author: Alfons
@contact: alfons_xh@163.com
@file: 07-01-decorator.py
@time: 18-2-26 下午9:27
@version: v1.0
"""
# python 装饰器
# 1.能把被装饰的函数替换成其他函数。
# 2.装饰器在加载模块时立即执行。
# 3.装饰器的强大在于它能够在不修改原有业务逻辑的情况下对代码进行扩展,
# 权限校验、用户认证、日志记录、性能测试、事务处理、缓存等都是装饰器的绝佳应用场景,
# 能够最大程度地对代码进行复用。
print("... | true |
f8b2be94ae85d1b8fc553b338212cc3c1f06eb09 | JuDa-hku/ACM | /leetCode/28ImplementstrStr().py | UTF-8 | 380 | 3.515625 | 4 | [] | no_license | class Solution:
# @param {string} haystack
# @param {string} needle
# @return {integer}
def strStr(self, haystack, needle):
m, n = len(haystack), len(needle)
if n>m:
return -1
for i in range(0, m-n+1):
if haystack[i:n+i:1] == needle:
return... | true |
7130d2c9028421b68e27eec74f21c6118981855e | kinshukk100/Internshala-Python-Training | /Module4/M4 solution.py | UTF-8 | 1,986 | 3.265625 | 3 | [] | no_license | class book:
def init (self,aut, pub, p, cp=0):
self.author=aut
self.publisher=pub
self.price=p
self.copies=cp
def get_author(self):
return self._author
def set_author(self, aut):
self._author=aut
return
author=property(get_author, set_au... | true |
dfb2d1dac7db4297bada62fd1cd7b505e2382314 | olgabienkowska/learningPython | /Hacker Rank/2d arrays_solution.py | UTF-8 | 636 | 2.953125 | 3 | [] | no_license | import math
import os
import random
import re
import sys
def funkcjaliczacasume(maciesz,i,j):
mojaSuma = (arr[i][j] + arr[i][j+1] + arr[i][j+2] +
arr[i+1][j+1] +
arr[i+2][j] + arr[i+2][j+1] + arr [i+2][j+2])
return mojaSuma
if __name__ == '__main__':
arr = []
for _ in range(6):... | true |
ed8b63ada5ea6d93d48001e01797f82b4895f8b9 | Yogitha6/Mahadasu_CSCI3202_Assignment1 | /Mahadasu_Assignment1.py | UTF-8 | 2,907 | 4.1875 | 4 | [] | no_license | from queue import *
from stack import *
from binarytree import *
from graph import *
#Testing the queue
print "Testing the Queue Implementation:"
print "--------------------------------------------------------------"
#creating an instance of the class
queue = QueueImplementation()
#Initializing the queue... | true |
4b29085a6c030046c7175454241649bcd295d1a8 | yunakim2/Algorithm_Python | /프로그래머스/level2/카펫.py | UTF-8 | 409 | 3 | 3 | [] | no_license | def solution(brown, red):
for row in range(1, int(red ** 0.5) + 1):
if red % row == 0:
col = red // row
if 2 * row + 2 * col + 4 == brown:
return [col + 2, row + 2]
if __name__ == "__main__":
print(solution(10, 2))
print(solution(8, 1))
print(solution(14... | true |
33bcba2baf00fba15db9550f1d5ced759b8a07e9 | xujinxue/ShopSchedule | /src/algorithm/ot.py | UTF-8 | 4,341 | 2.578125 | 3 | [] | no_license | __doc__ = """
ORTools求解器
def OrToolsJspSat: Jsp的ORTools模型及求解
"""
import collections
from ortools.sat.python import cp_model
"""
求解状态对应的status值(源程序cp_model_pb2.py中查看): cp_model -> cp_model_pb2
UNKNOWN = 0 # 未知状态
MODEL_INVALID = 1 # 模型不正确
FEASIBLE = 2 # 可行解
INFEASIBLE = 3 # 无可行解
OPTIMAL = 4 # 最优解
"""
def OrToolsJspS... | true |
80e95fd497bbe8fb8bc68243982ee57c17ca4ecd | StRobertCHSCS/ICS4U1c-2018-19 | /Masters/OOP/angry_bird1.py | UTF-8 | 1,393 | 3.890625 | 4 | [] | no_license |
import math
wall_health = 3
wall_x_pos = 20
wall_height = 6
time_interval = 0.1
while wall_health >0:
theta_degrees = float(input("Enter launch angle: "))
bird_velocity = float(input("Enter launch velocity (m/s): "))
bird_xpos = 0 # starting x position of bird
bird_ypos = 3 # starting y position (hei... | true |
cb52cc98cbd6bd520c2f4babf6b419c29c9ca670 | judismar/cuckoo-hashing | /Codigo-Python-Hashing/Implementação de Esquemas de Hashing/phfks.py | UTF-8 | 1,496 | 3.3125 | 3 | [] | no_license | from uhprime import HashFunction
class PerfectHashTable:
def __init__(self, n, numList, p):
self.t = range(n)
for i in range(n):
self.t[i] = HashTable()
self.hf = HashFunction(n, p)
for x in numList:
self.t[self.hf.h(x)].insert(x)
for bin in self.t:
bin.go(p)
def lookup(self, x):
return self.t... | true |
f3226e83373c1a25660770d4af7a2b535b430b0d | khushboo1510/leetcode-solutions | /Medium/240. Search a 2D Matrix II.py | UTF-8 | 1,678 | 3.3125 | 3 | [] | no_license | import numpy
class Solution:
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
if not matrix or not matrix[0]:
return False
mat = numpy.array(matrix)
def binarySearch(mat)... | true |
83891715e08b9d8c761fffe4cb9ce28c13f9b213 | JohnReid/check-yourself | /tests/unit/test_input_mixl.py | UTF-8 | 1,439 | 2.890625 | 3 | [
"MIT"
] | permissive | """
Tests the InputMixl class to ensure it is constructed correctly and that
input validation works as expected.
"""
import unittest
import numpy as np
from src.models.base_model_inputs import InputMixl
class InputMixlTests(unittest.TestCase):
"""
Unit test class for storing the various tests of the InputMix... | true |
e057f1eb2888a08ef6b53387ec1c3a0dca1bf100 | wjj800712/python-11 | /zhangruijie/Week06/rev.py | UTF-8 | 319 | 3.40625 | 3 | [] | no_license | def rev(str):
lst = str.split()
n = len(lst)
ret=[]
for i in range(n):
ret.append(lst[n-i-1])
ret = " ".join(ret)
return ret
rev("let's try to see whether it works")
###########################################
sen = "let's try to see whether it works"
" ".join(sen.split()[::-1])
| true |
035685cc74e3947009e5c10e5de0e5179233b96c | vetu11/QuienVienebot | /user.py | UTF-8 | 2,598 | 3.140625 | 3 | [
"MIT"
] | permissive | """
User Class definition.
"""
from time import time
from database import database
DEFAULT_EXPIRE_TIME = 31536000 # One year in seconds
EXPIRE_TIME_REFRESH_RATE = 604800 # One week in seconds
MIN_EXPIRE_TIME = 31536000 # On year in seconds
class User:
def __init__(self, **kwargs):
self.id = int(kwa... | true |
36bfaf1dfbdcf5c4444b6534a9581659cbbd62cc | universe3306/WebStudio2019 | /2_flask_1/source/variables.py | UTF-8 | 184 | 3.453125 | 3 | [
"MIT"
] | permissive | a = 5
c = a ** 3 # c: 125
b = 'Sangkeun'
print(b[0:3:2]) # 'Sn'
print(b[1:5]) # 'angk'
print(b[:3]) # 'San'
print(b + ' Kim') # 'Sangkeun Kim'
d = 5.123
e = 987654321123456789123456
| true |
63c1756ae5bb622a2db0dabb56bf09c39b2589b6 | FleeaniCh/python | /first_step/inherit/inherit_variable.py | UTF-8 | 533 | 4.28125 | 4 | [] | no_license | """
继承——变量
"""
class Person:
def __init__(self, name):
self.name = name
"""
class Student(Person):
# 1.子类若没有构造函数,则使用父类的
pass
s01 = Student()
print(s01.name)
"""
class Student(Person):
# 2.子类若具有构造函数,则必须先调用父类的构造函数
def __init__(self, name, score):
super().__init__(name)
... | true |
26fd1f99dd17a3b8ad773d357559a62f2ae34310 | farfanoide/popo_attribute_tracker | /popo_attribute_tracker/test_attribute_tracker.py | UTF-8 | 2,306 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from unittest import TestCase
from .attribute_tracker import AttributeTrackerMixin, TrackerConfigurationError
class AttributeTrackerMixinTest(TestCase):
def setUp(self):... | true |
7279e4ed4bb04824140a0ce60440de69d64c0a85 | emmettk/EMT | /nremt_flashcards.py | UTF-8 | 2,327 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created Feb 28 2023 for paramedic exam
@author: E. Krupczak
A little quiz program for the NREMT exam - flashcards
Covers:
START triage
Abdominal organ quadrants
"""
import random
#Make input compatible with python2
try:
get_input = raw_input
except NameError:
get_input = in... | true |
83272820f497ea9d20cc06d3bc9d4b38cff7c70b | Hk4Fun/algorithm_offer | /target_offer/26_复杂链表的复制.py | UTF-8 | 9,337 | 3.65625 | 4 | [] | no_license | __author__ = 'Hk4Fun'
__date__ = '2018/2/3 22:30'
'''题目描述:
输入一个复杂链表(每个节点中有节点值,以及两个指针,
next指向下一个节点,random指向任意一个节点),
返回结果为复制后复杂链表的head。
'''
'''主要思路:
关键在于如何快速找到random结点在复制链表中的位置
思路1(时间复杂度O(n^2),空间复杂度O(1)):
第一步,复制原链表上的每一个节点,并用next连接起来;
第二步,在原链表和复制链表设置两个指针同时从头遍历,
当在原链表中找到每个结点的random结点时停下,此时
复制链表... | true |
4c977c2585641751f4d44e465445c658c1127867 | Plopi42/dev-samples | /python/generators/passwordComposer.py | UTF-8 | 3,240 | 3.34375 | 3 | [] | no_license | #! /usr/bin/env python
import sys
class passwordComposer:
def __init__(self, minLevel = 1, maxLevel = 3, wordList = [], joinChars = ['', '_', '-', ' '], allowDoubles = False):
self.__wordList = wordList
self.__joinChars = joinChars
self.__minLevel = minLevel
self.__maxL... | true |
60f2ef3aa89ef24b5c209e77bc905c795e2dde4e | HoweChen/PythonNote-CYH | /Python Basic/Error/error_code.py | UTF-8 | 203 | 3.453125 | 3 | [] | no_license | try:
one = int(input('First number: '))
two = int(input('Second number: '))
result = one / two
except ZeroDivisionError as ZDE:
print('You cannot divide by zero')
else:
print(result)
| true |
f29086212ccceaa0324a594d21359b64af7fdc33 | HollowSleepKitty/unistuff | /week 5 ex 11.py | UTF-8 | 406 | 3.578125 | 4 | [] | no_license | password = "changeme"
count=0
while True:
print("Please enter your password")
ask = str(input())
count+=1
if count > 5:
print("Access denied, please press enter to exit and contact security to reset your password.")
break
if ask == password:
count-=1
... | true |
b9249478e9753798a661d3bebd131a029fa236af | povigg/Python | /py1.py | UTF-8 | 286 | 3.671875 | 4 | [] | no_license | for i in range(0, 5, 1):
print("hello")
print("hello")
i = 0
while i < 5:
print(i)
i += 1
#and | or | not
a = 100
b = 200
c = 50
if a > b or c == 50;
print("hello Pov")
elif a==b:
print('a is equal b')
else:
print('it is all ffff)
function() | true |
d0dc87e99620450ad2efd4057a51437653936fb3 | little-dude/tgen | /client/tgenpy/utils.py | UTF-8 | 2,342 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from builtins import hex
from builtins import str
import binascii
import netaddr
def str2int(string):
if string.startswith('0x'):
return int(string, 16)
elif string.startswith('0b'):
return int(string, 2)
else... | true |
8cd4bb07f61012e06060bef1a729d5a6c36c369f | xuyue1231/FCNCAnalysis | /tensorFlow/GetMeanStddev.py | UTF-8 | 2,667 | 2.671875 | 3 | [] | no_license | #!/usr/local/bin/python3
# create_model.py
import numpy as np
import configparser
import tensorflow as tf
import sys
from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.layers import Add, Concatenate, Lambda
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.backend import in... | true |
1938647c3e9a8f96728d6470ce05957a77bac982 | sbharadwajj/Learn-Python | /exceptions.py | UTF-8 | 558 | 3.6875 | 4 | [] | no_license | try:
# x = float(input("Num1"))
# y = float(input("Num2"))
x = 2
y = 5
result = x/y
except ValueError:
print("Enter values pliss")
except ZeroDivisionError:
print("Plis dont enter y as 0")
else:
print(result)
import math
class sqrRoot(ArithmeticError):
number = 0
pass
def s... | true |
7853b03e656d45cf19e01573e6f85a55f13479ea | chris-hranj/scapyChallenges | /snifICMP.py | UTF-8 | 419 | 2.515625 | 3 | [] | no_license | ## Import Scapy
from scapy.all import *
def sendShit(incomingPacket):
resultIP = IP(src=incomingPacket.payload.dst, dst=incomingPacket.payload.src)
resultICMP = ICMP(type='echo-reply')
resultRaw = Raw(load='THIS IS A PAYLOAD')
packet = (resultIP/resultICMP/resultRaw)
return packet
while(True):
result = sniff(c... | true |
57ed7cd7f15871203d0d49ce78322a0294084dfa | UEMK-CS-2019/DSA | /Week-9/8.py | UTF-8 | 184 | 2.796875 | 3 | [] | no_license | dicc = {'x':500, 'y':5874, 'z': 560}
key_max = max(dicc.keys(), key=(lambda k: dicc[k]))
key_min = min(dicc.keys(), key=(lambda k: dicc[k]))
print(dicc[key_max])
print(dicc[key_min])
| true |
604df4ab4e4e988b062bd49659346b35ceec2d18 | Vaibhavraj-nath-chauhan/Python-Basic | /even_print_in_string.py | UTF-8 | 49 | 2.734375 | 3 | [] | no_license | user = input("Enter String:-->")
print(user[::2]) | true |
b31f5748dd32bfa11ed531566ddd78569ecd0968 | anlutfi/tsp | /solvers.py | UTF-8 | 13,515 | 2.84375 | 3 | [] | no_license | from data_structures import *
import time
class Timeout (Exception):
pass
class TSP_Result(object):
def __init__(self, solver, time_in_seconds):
self.tour = solver.min_tour
self.iter_count = solver.iter_count
self.alg = solver.class_name()
self.lower_bound = max(solver.first_lo... | true |
bad933a3041ae4dd069642477f58b6a9160023bc | kiaev/python | /Lec16/app.py | UTF-8 | 460 | 3.3125 | 3 | [] | no_license | """
Стартовая точка программы
"""
# Импортирование модулей из пакета c разделенной областью
from geometry import circle, rectangle, trianlge
# С совмещенной
from geometry.circle import perimeter
print("Circle area(10):", circle.area(10))
print("Rectangle perimeter(10,10):", rectangle.perimeter(10, 10))
print("Triang... | true |
cf5c569141e5a4f03d04404a1161c51b60118474 | TarkanAl-Kazily/Telemetry_2017 | /Ground_Control_2017/display.py | UTF-8 | 31,834 | 2.546875 | 3 | [] | no_license | import graphics as gw
import time as time_mod
import math
import threading
import utility_test as util
import colors
# Do I need this???
GraphWin = gw.GraphWin
Point = gw.Point
Line = gw.Line
Circle = gw.Circle
Oval = gw.Oval
Rectangle = gw.Rectangle
Polygon = gw.Polygon
Text = gw.Text
Entry = gw.Entr... | true |
fbd56282a9543288aabf1b3381138cc907ad2848 | wyndegoman/PyToonLib | /main.py | UTF-8 | 1,723 | 2.734375 | 3 | [] | no_license | from Character import Character
import SkillBase
# Press Shift+F10 to execute it or replace it with your code.
def test_character(name):
toon = Character(name)
toon.gen.str_pts = 5
toon.gen.dex_pts = 21
toon.gen.con_pts = 6
toon.gen.pre_pts = 3
toon.gen.spd_pts = 3
toon.skills.append(Skil... | true |
3da93128dbeee5fc984b3878cccf83b78d71995f | tzuling1210/test | /PMIS_new-final/apps/activity/models.py | UTF-8 | 1,075 | 2.65625 | 3 | [] | no_license | from django.db import models
from apps.member.models import Member
# Create your models here.
class Activity(models.Model):
activity_name = models.CharField(max_length=20, blank=True)
target_name = models.CharField(max_length=50, null=True)
activity_date = models.DateField(null=True)
target = models.In... | true |
6795e3e3fef88ed7921ec9087b6a2d73e6e1b8e3 | JustinMalvinIrawan/cp1404practical | /prac_01/shop_calculator.py | UTF-8 | 735 | 4.25 | 4 | [] | no_license | def main():
total = 0
number_of_items = int(input("Please enter the number of items"))
# Validation for the number of the item entered cannot be under 0
while number_of_items < 0:
print("Please enter the valid number of item")
number_of_items = int(input("Please enter the number of items... | true |
a4143a6fd3b221129ff6f6072e459469e2124993 | jmilcent/flask-101 | /counter.py | UTF-8 | 124 | 2.703125 | 3 | [] | no_license | class Counter:
def __init__(self):
self.id = 3
def next(self):
self.id += 1
return self.id
| true |
8336e62f9966a5a36151d55273e9950212cde6f4 | dipayandutta93/leetcode | /169_majority_element.py | UTF-8 | 362 | 3.40625 | 3 | [] | no_license | class Solution(object):
def majorityElement(self, nums):
hash = {}
for i in range(0,len(nums)):
if nums[i] not in hash.keys():
hash[nums[i]]=1
else:
hash[nums[i]]+=1
for key,values in hash.iteritems():
if values >len(nums)/2:
return key
S = Solution()
s = [4,2,2... | true |
be760ed0bc635e8b5e70007bb693b5ff7508c2b9 | sathira123/iedcPythonWORKSHOP | /dictionary.py | UTF-8 | 109 | 2.796875 | 3 | [] | no_license | students={"name":"ROHIN","age":22}
print(students)
print(students["name"])
students["age"]=30
print(students) | true |
9599e812fce666b8480689f6eb427b0e0b45b070 | dylan-pecqueux/logiciel-tournoi-echecs | /views/round_view.py | UTF-8 | 1,638 | 3.390625 | 3 | [] | no_license | from rich.console import Console
from views.components import Components
class RoundView(Components):
def __init__(self):
super().__init__()
self.console = Console()
def display_all_matchs(self, round):
print("\033c")
self.console.print(
f"Round {round.round_number... | true |
0f2e1252434f89bdae9b1b0db81339a7dfbcd041 | csfuyu/core_python | /core_python/ch04/test04.py | UTF-8 | 741 | 3.78125 | 4 | [] | no_license | # type
print type(43)
print type('a')
print type("a")
print type(1.0)
print type(True)
m_a = [1]
m_b = ()
print type(m_a)
print type(m_b)
print type(type(43))
# test bool
if None:
print "None is False"
else:
print True
if 0:
print "0 is False"
else:
print True
if (1-1):
print "(1 - 1) is Fals... | true |
696a8bc4f3e78e3e2078d1cefcfdfd2c41490843 | Joypham/Bai-test-Pham-Hong-Hanh | /Bai 3.py | UTF-8 | 816 | 3.515625 | 4 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
data_url = 'https://raw.githubusercontent.com/TechMaster/luyen-logic/master/movies.csv'
df = pd.read_csv(data_url)
# Xử lý dữ liệu: Lấy ra dữ năm sản xuất sau khi cắt đi ký tự trống
df["get_year"] = df["title"].str.strip().apply(lambda x: x[-5:-1])
# Lọc ra phim có ... | true |
c1c844d2c78ff62a2884cbee05f3542c7aa51bea | astroboi-SH-KWON/get_guide_fr_R1_barcode_fr_R2_then_check_Guide_Barcode_pairs | /Util.py | UTF-8 | 1,331 | 2.90625 | 3 | [] | no_license | import openpyxl
class Utils:
def __init__(self):
self.ext_txt = ".txt"
self.ext_dat = ".dat"
self.ext_xlsx = ".xlsx"
def csv_to_list_ignr_header(self, path, deli_str=","):
result_list = []
with open(path, "r") as f:
header = f.readline()
print(he... | true |
6019ba1022c4345cd3568d3bec642f6c774d1b60 | Schwarzam/commerce-track | /manager.py | UTF-8 | 867 | 2.546875 | 3 | [] | no_license | from tkinter import *
import tkinter as tk
from PIL import ImageTk, Image
from content import Client, StartPage
class App(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
container.pack(side="top", fill='both', expand = True)
container.grid_rowcon... | true |
dcf9630a94dbee8faa9b32fbed7b41c8ea2d3cbd | imthefrizzlefry/PythonPractice | /HackerRank/test_hourGlassSum.py | UTF-8 | 1,181 | 3.109375 | 3 | [] | no_license | import unittest
import hourGlassSum
class hourGlassSumTests(unittest.TestCase):
def test_hackerRankSampleTestCase0(self):
inputArray = [[1,1,1,0,0,0],[0,1,0,0,0,0],[1,1,1,0,0,0],[0,0,2,4,4,0],[0,0,0,2,0,0],[0,0,1,2,4,0]]
expectedMaxSum = 19
self.assertEqual(expectedMaxSum, hourGlassSum.ho... | true |
9ea1dd3dda066256076a87601dc2fd673f855492 | cheealtair/RestAPI_KStudio_Pano | /SWA_DeployedModel.py | UTF-8 | 3,319 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
""" Smartworks Analytics - Consuming REST API of a Deployed Model
Author: C.Chee
Status:
Last Updated:
Run:
1. This program can be run directly, i.e. python <filename>
"""
import os.path
import numpy as np
import pandas as pd
import requests
import json
import csv
# CONSTANTS
FIL... | true |
751f296c81c0cd3e243e5d076416449e738f8e4a | Srihitha2782/BestEnlist | /task 12.py | UTF-8 | 218 | 2.75 | 3 | [] | no_license | file 1 = open("30days 30hours operations", "w")
file 1.write("\n I have completed 10 days successfully.")
file 1.close()
file 2 = open("30 days 30hours operations", "a")
file 2.write("\n - Hanmandla Srihitha Reddy")
file2.close() | true |
7bb6fe7ff4c62d8104fa876dc8d2d8d904294543 | PeterZhouSZ/FieldConv | /nn/twin_eval.py | UTF-8 | 852 | 2.5625 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class TwinEval(nn.Module):
def __init__(self, mu=5, ratio=0.5):
super(TwinEval, self).__init__()
self.mu = mu # Matching threshold value
self.ratio = ratio;
def forward(self, xS, xT, p_, n_):
... | true |
6c3afd6aa717f10a1c329dd31c99a3673d4e9b84 | karpur-shukla/project_euler-py | /Shukla - Project Euler 05.py | UTF-8 | 1,549 | 4.0625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
'''Problem 5: 520 is the smallest number that can be divided by
each of the numbers from 1 to 10 without any remainder. What
is the smallest positive number that is evenly divisible by
all of the numbers from 1 to 20?'''
'''Note: This corresponds to the the product of all the p... | true |
10bebaab67a2eea3612fe0195b63d1622a87d4c4 | EngandDeveloper/filtrack_py | /main_filter/filter_logic/DfsSong.py | UTF-8 | 651 | 2.96875 | 3 | [] | no_license | class DfsSong:
def __init__(self):
self.stack = []
self.song_list = []
self.pathlist = []
def processPath(self):
for x in self.song_list:
self.pathlist.append(x.getName())
return self.pathlist
def dfs(self, start, end):
start.marked = True
... | true |
83459a8d70aa8b3301b906e3b97c3be7ecb12a44 | joneubank/project-euler | /problems/p14.py | UTF-8 | 1,780 | 4.34375 | 4 | [] | no_license | '''
Problem 14
The following iterative sequence is defined for the set of positive integers:
n -> n/2 (n is even)
n -> 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
It can be seen that this sequence (starting at 13... | true |
8df1ad28ee240ac2e6d0cfca7248372015148102 | cmarshall108/chess | /main.py | UTF-8 | 10,670 | 2.65625 | 3 | [
"MIT"
] | permissive | import os
import random
import time
import pygame
import pytmx
import pytmx.util_pygame
pygame.init()
DISPLAY_WIDTH = 800
DISPLAY_HEIGHT = 600
DISPLAY_COLOR = pygame.Color(0, 0, 0)
DISPLAY_TICK_DELAY = 60
GAME_BOARD_X = DISPLAY_WIDTH / 1.5
GAME_BOARD_Y = DISPLAY_HEIGHT / 2
GAME_BOARD_TILE_WIDTH = 32
GAME_BOARD_TILE_... | true |
2b9c5e8fb463a795be13e29bf6c459416dd1535e | jianjunyue/python-learn-ml | /机器学习python实践/04Python和Scipy速成/function.py | UTF-8 | 131 | 3.515625 | 4 | [] | no_license | # 定义函数
def mysum(x, y):
"这是自定义函数"
return x + y
# 测试函数
result = mysum(x=1, y=2)
print(result) | true |
af523c3050457481dcfc63f790109c70236ac1f1 | Aasthaengg/IBMdataset | /Python_codes/p02404/s407575986.py | UTF-8 | 160 | 2.921875 | 3 | [] | no_license | while True:
h,w=map(int,raw_input().split())
if h==w==0: break
for i in xrange(h):
if i==0 or i==h-1: print '#'*w
else: print '#'+'.'*(w-2)+'#'
print "" | true |
3142ab06744c00c5b7d3dea8a6a91293b147039c | AlexRobson/OpenAI | /projects/utils/modelrunner.py | UTF-8 | 2,685 | 2.9375 | 3 | [] | no_license | import numpy as np
import time
import pdb
def iterate_minibatches(inputs, targets, batchsize, shuffle=False):
assert len(inputs) == len(targets)
if shuffle:
indices = np.arange(len(inputs))
np.random.shuffle(indices)
for start_idx in range(0, len(inputs) - batchsize + 1, batchsize):
if shuffle:
excerpt = ... | true |
64940e670d39eedc7792502eeb97d4a2bb1bd530 | tobiasgbg/code | /Day8Part1.py | UTF-8 | 2,999 | 3.59375 | 4 | [] | no_license | import copy
def turn_on_rect(list_in, rect):
rect_list = rect.split('x')
row_size = int(rect_list[0])
col_size = int(rect_list[1])
list_out = copy.deepcopy(list_in)
for row in range(0, row_size):
for col in range(0, col_size):
list_out[col][row] = 1
re... | true |
64d458eb4e633be27cb49e7cfce2d8609a0c3172 | sarthak815/Hackerrank_Python | /Easy/collections.Counter().py | UTF-8 | 307 | 3.0625 | 3 | [] | no_license |
from collections import Counter
n = int(input())
size = list(map(int,input().split()))
size = size[0:n+1]
n2 = int(input())
money = []
for i in range(n2):
cost = list(map(int,input().split()))
if size.count(cost[0])!= 0:
money.append(cost[1])
size.remove(cost[0])
print(sum(money))
| true |
d1316cc2c2054a4448781b2b910ebf4644bf053e | Piyushi-jain/Cervical-Cancer-Classification- | /CervicalCancer.py | UTF-8 | 11,653 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scikitplot as skplt
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.preprocessing import Imputer
from pandas.plotting import scatter_matrix
... | true |
87a89fadd7b5c912cb98a6a3ef61f760a65a82b9 | jonathanjmak/data-augmentation | /vggnet/plot.py | UTF-8 | 4,133 | 2.53125 | 3 | [
"MIT"
] | permissive | import shutil
import os
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
def main():
if not os.path.exists("output"):
os.makedirs("output")
train_loss_df = pd.DataFrame(list(range(300)), columns=["epoch"])
train_acc_df = pd.DataFrame(list(r... | true |
d73523d967291aab1c2d8bf0e3ea92d0eedbe47a | lucaswiman/stuff | /python/kanren-sudoku.py | UTF-8 | 2,230 | 2.703125 | 3 | [] | no_license | from logpy.tests.test_sudoku import *
example_board = (
0, 0, 8, 0, 0, 6, 0, 0, 0,
0, 0, 4, 3, 7, 9, 8, 0, 0,
5, 7, 0, 0, 1, 0, 3, 2, 0,
0, 5, 2, 0, 0, 7, 0, 0, 0,
0, 6, 0, 5, 9, 8, 0, 4, 0,
0, 0, 0, 4, 0, 0, 5, 7, 0,
0, 2, 1, 0, 4, 0, 0, 9, 8,
0, 0, 9, 6, 2, 3, 1, 0, 0,
0, 0, 0, 9, ... | true |
776b304152bb20d8770fe81c14d704e032726144 | zharmedia386/FreeCodeCamp-Stuff | /Scientific Computing with Python/Python for Everybody/Strings and Lists.py | UTF-8 | 151 | 3.046875 | 3 | [
"MIT"
] | permissive | words = 'His e-mail is q-lar@freecodecamp.org'
# Dipecah -> Split
pieces = words.split()
print(pieces)
parts = pieces[3].split('-')
print(parts)
n = parts[1]
print(n) | true |
631ae3db85eadf910d9309e01be538a3192848b4 | kavya64102/python-projects | /chess/TrackerMovement.py | UTF-8 | 18,770 | 2.75 | 3 | [] | no_license | import ChessPices
Tracker = [[],[],[],[],[],[],[],[]]
active = True
Waiting_For_Pice_Movement = False
selected = None
def start_Tracker():
for x in range(8):
y = 0
while y < 8:
value = {
"Value": None,
"State": not(active)
}
... | true |
491fd22c162942ced92d3c62111153fd57b55d1b | patrickphat/Gaussian-Mixture-Model | /GMM.py | UTF-8 | 7,324 | 3.09375 | 3 | [] | no_license | class GaussianMixtureModel:
# Notation
# dim: dimension of the data
# cov: covariance matrix
# n_clusters: number of clusters
# N: normal distribution
# m: number of data points
# k: k-th cluster
# i: i-th sample
def __init__(self,n_clusters=5):
# Number of... | true |
9309b8254918562a41b4113a63b95e0ab26daf7e | nyc1893/Python-Learning | /LICENSE.md/classification/weeksupervise/rpy_set/test.py | UTF-8 | 550 | 2.8125 | 3 | [] | no_license | from rpy2.robjects.packages import importr
# import R's "base" package
base = importr('base')
# import R's "utils" package
utils = importr('utils')
import rpy2.robjects as robjects
res = robjects.StrVector(['abc', 'def'])
print(res.r_repr())
res = robjects.IntVector([1, 2, 3])
print(res.r_repr())
res = robjects.Floa... | true |
112475ec5fa04408f10530cfaa7b3b050f6a2f30 | iCodeIN/algorithms-9 | /solutions/Binary search/Matrix Median.py | UTF-8 | 288 | 2.859375 | 3 | [] | no_license | ## Website:: Self
## Link::
## Topic:: Binary Search
## Sub-topic:: Array
## Difficulty:: Hard
## Approach:: ...
## Time complexity:: O(log(M+N))
## Space complexity:: O(1)
## Notes:: bisect_left returns the left-most position which is greater than or equal to target
## Bookmarked: Yes
| true |
02fd18151b51920889de22f4f4f1faf907d8aa54 | 369geofreeman/MITx_6.00.1x | /codewars/speedCode2-Array-Madness.py | UTF-8 | 545 | 4.65625 | 5 | [] | no_license | # Speed Code#2 Array Madness
# Objective
# Given two integer arrays a, b, both of length >= 1, create a program that returns true if the sum of the squares of each element in a is strictly greater than the sum of the cubes of each element in b.
#
# E.g.
#
# array_madness([4, 5, 6], [1, 2, 3]) => True #because 4 ** ... | true |
25e84f6717d30d586d312b77c31c3599b843d6dd | kienle371999/tezos-document | /backend/contract/tezos-contract.py | UTF-8 | 560 | 2.703125 | 3 | [] | no_license | import smartpy as sp
class PhraseKeeper(sp.Contract):
def __init__(self, initialPhrase):
self.init(phrase = initialPhrase)
# We evaluate a contract with parameters.
contract = PhraseKeeper({ "Name": "John",
"Identity": "17021234",
"Diploma Type": "Computer Science",
"Credential Number": "UET1234",
"Signa... | true |
56599a87dcada99202b521d814133b255389cdd3 | hennadialani/average_length_of_lectures | /lecture_length.py | UTF-8 | 3,581 | 2.796875 | 3 | [] | no_license | import json
import time
import csv
from pprint import pprint
majors = {}
data = json.load(open('Winter2018.json'))
def get_length(from_time, to_time):
if (len(from_time)==1):
from_time.append('00'+from_time[0][-2:])
from_time[0]=from_time[0][:-2]
if (len(to_time)==1):
to_time.append(... | true |
c06ae216c3ef0efe06befe6ea8736cb7e5dd8a05 | aleixlopezpascual/aleixlopezpascual.github.io | /Projects/Parameter Estimation and Bayesian Statistics/_1_Exercise_1.py | UTF-8 | 1,658 | 3.375 | 3 | [
"MIT"
] | permissive | import numpy as np
from math import sqrt
# we define the values of the statement
observations = np.array([1.017,2.221,1.416,0.641,0.124,1.728])
# our parameter to estimate is the mean
# we use the arithmetic mean
mean_obs=np.mean(observations)
# we compute the standard deviation of the arithmetic mean
sta... | true |
477be75413ca0f1a638ea1308b5e6c9cd798ba64 | Opteamal-GHome/Rest-Server | /save_fichier.py | UTF-8 | 2,129 | 3.203125 | 3 | [] | no_license | import pickle
import constantes
import os
class SaveFichier():
def __init__(self, ensembleRules):
'''
Initialisation d'un fichier. Ouverture en mode 'w'
'''
self.ensRules = ensembleRules
# Ouverture du fichier en mode ajout
self.file = open(constantes.n... | true |
f52c620c4960fe4e55c955db0ae589c6642ce0a5 | PatanSanaulla/AutonomousRobotControl | /detectObjectAndGrasp.py | UTF-8 | 2,868 | 2.890625 | 3 | [] | no_license | import cv2
import os
import numpy as np
import imutils
from picamera.array import PiRGBArray
from picamera import PiCamera
import RPi.GPIO as GPIO
import time
# Define pin alloc
trig = 16
echo = 18
def distance():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(trig, GPIO.OUT)
GPIO.setup(echo, GPIO.IN... | true |
fe5edcafebe53e69983eeb3e7d9b030e2d1c424e | hanajhg/pylesson | /pybasic/pybasic_13_loop.py | UTF-8 | 1,262 | 4.625 | 5 | [] | no_license | '''
循环输出数字,并判断大小:
实例
# !/usr/bin/python3
'''
count = 0
while count < 5:
print(count, " 小于 5")
count = count + 1
else:
print(count, " 大于或等于 5")
'''
for
'''
sites = ["Baidu", "Google","Runoob","Taobao"]
for site in sites:
if site == "Runoob":
print("菜鸟教程!")
break
print("循环数据 " + site)... | true |
ec6406dc44b244696f636c9f6efa1f54d1d6256a | swetank01/100daysofcode | /day-4/challenge-4.1.py | UTF-8 | 133 | 3.546875 | 4 | [] | no_license | # Head or Tails
import random
random_integer = random.randint(0,10)
if random_integer < 5:
print("HEAD")
else:
print("TAIL") | true |
3938fb75aa883cb7cb2404a596e7d825ffe60bfc | paras062/HackerRankSolution | /Python/FindLeapYear.py | UTF-8 | 724 | 3.828125 | 4 | [] | no_license | # Write a Python program to generate the next 15 leap years starting from a given year.
# Populate the leap years into a list and display the list.
# lex_auth_012693797166096384149
def find_leap_years(given_year):
# Write your logic here
count = 0
list_of_leap_years = []
# given_year = given_year + ... | true |
277b553c247f6e3bf2f849f7c9c19e6374b495a4 | srajsonu/100DaysOfCode | /Searching/Searching I/8. Minimum Difference.py | UTF-8 | 1,063 | 3.375 | 3 | [] | no_license | class Solution:
def findUpper(self, A, B):
n = len(A)
l = 0
h = n-1
while l <= h:
mid = (l + h) // 2
if A[mid] < B:
l = mid + 1
else:
h = mid - 1
return l - 1
def findLower(self, A, B):
n = len... | true |
a08431f3ddeb29a45efeaa99c78f583cfa5c0d2d | jsungmin6/Algorithm | /백준/Python/카테고리/그리디/11000.py | UTF-8 | 501 | 3.328125 | 3 | [] | no_license | # 강의실 배정
'''
끝나는 시간이 다음 시작시간보다 크다면 강의실을 추가해야한다.
'''
import sys
import heapq
input = sys.stdin.readline
N = int(input())
times = [list(map(int,input().split())) for _ in range(N)]
times.sort(key=lambda x: (x[0],x[1]))
start,end,count = 0,0,1
ends=[0]
for time in times:
s,e = time
min_ends = ends[0]
if s... | true |
7cbf7860bac2da6f9191f0b685a0c6b8ec7fdca6 | tanhm12/HMEM_py | /Graph.py | UTF-8 | 1,154 | 2.734375 | 3 | [] | no_license |
import Cal as cal
class Graph :
def __init__ (self ,trans_energy_matrix , ect , ecr , efs , emp , Adjacent_matrix) :
self.ect = ect
self.ecr = ecr
self.efs = efs
self.emp = emp
self.trans_energy_matrix = trans_energy_matrix
self.weighted_matrix = Adjacent_matrix #2d... | true |
5d8734d6dad0deb1f6fbdd2728b81a66324533ec | tazman555/python-examples | /builtin-functions.py | UTF-8 | 375 | 3.296875 | 3 | [] | no_license | #!/bin/python
# More Biul-in fuctions
farm_animals = {'horse', 'chicken', 'cow', 'fish'}
generic_container = farm_animals
print(all(generic_container))
print(any(generic_container))
print('horse' in generic_container)
print('horse' not in generic_container)
print(len(generic_container))
print(max(generic_container)... | true |
cafad1fa1ac7f0dbb761fc72fcc81c55b1e569b5 | mrzhang638993/python-basis | /serial-satisfy.py | UTF-8 | 7,854 | 3.796875 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
# 定制容器,实现定制容器需要相关的协议操作的
# 迭代操作和逻辑实现
# 需要相关的代码的实践操作和指导实践操作
"""
1.python基于序列的3个容器是:列表、元组、字符串
"""
"""
2定制不可变容器:只需要重写len,以及getitem方法即可的
class StringLike:
def __init__(self, value):
self.value = value
def __len__(self):
return len(self.value)
def __getitem__(self, item):
... | true |
a4da99de6e6feb26458c9403c03799580b19539e | FloweringKnight/spider | /place_out.py | UTF-8 | 1,715 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
###说明###
#1.使用sqlite数据库
#2.place_out('新密')输出 河南省郑州市新密市
#3.province_out_only('新密')输出 河南省
#4.数据库参见2016年9月公式的区划代码
#5.采用模糊查询,仅输出第一个结果,如果对精准度有需求,请增加关键字
###
import sqlite3
def sql_query(str1):
conn = sqlite3.connect('place.DB')
c = conn.cursor()
if isinstance(str1, str)... | true |
50590a4357d60ae289a550e97e26c1e97f0fefa1 | bitlabstudio/django-online-docs | /online_docs/templatetags/online_docs_tags.py | UTF-8 | 2,544 | 2.734375 | 3 | [
"MIT"
] | permissive | """Templatetags for the ``online_docs`` app."""
from django import template
from django.template.base import TemplateSyntaxError
from django.template.defaulttags import URLNode
register = template.Library()
class URLCrossReferenceNode(URLNode):
def __init__(self, filename, link_text, asvar):
self.filena... | true |