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 |
|---|---|---|---|---|---|---|---|---|---|---|
9b9afdf407a25a69d96809b1ff16e99531943db9 | EnricoHuber/Rubbish | /N.2.py | UTF-8 | 596 | 4.375 | 4 | [] | no_license | """ ESERCIZI DEL SITO https://www.programmareinpython.it/esercizi-python/ """
""" Esercizio n.2 """
def max_of_three_numbers(x, y, z):
""" Takes 3 numbers and outputs the biggest one"""
if x > y and x > z:
return x
elif y > x and y > z:
return y
elif z > x and z > y:
... | true |
afd6e5726731db4503d098425ab58c7ca4ef3c98 | FrancescoPenasa/UNITN-CS-2020-SignalVideoImaging-project | /2d_implementation.py | UTF-8 | 1,241 | 2.953125 | 3 | [
"MIT"
] | permissive | import numpy as np
def grow(img, seed, t):
"""
img: ndarray, ndim=3
An image volume.
seed: tuple, len=3
Region growing starts from this point.
t: int
The image neighborhood radius for the inclusion criteria.
"""
seg = np.zeros(img.shape, dtype=np.bool)
checked = n... | true |
664a5a6e44538f47c990f63023c3e084d4c96a3a | Madhu-Kumar-S/Python_Basics | /Stringprograms/frequent no-words.py | UTF-8 | 285 | 4.1875 | 4 | [] | no_license | #Python – Words Frequency in String Shorthands
from collections import Counter
st = input("enter a string:")
print("original string is: ",st)
print("method 1")
d = {key:st.count(key) for key in st.split()}
print(d)
print("method 2")
res = Counter(st.split())
print(dict(res)) | true |
199c3c8f2fc868583287101f11a57d297aff08f5 | aa-rohan/Sudoku-Solver-Python | /sudoku.py | UTF-8 | 9,370 | 2.546875 | 3 | [] | no_license | from imutils.perspective import four_point_transform
from imutils import contours
import numpy as np
import imutils
import cv2
import pickle
from sigmoid import sigmoid
from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk
imageSize = 28
imagePixels = imageSize * imageSize
weights = pick... | true |
250f8c505ad648eaa706f28c1cb129f45e47d29f | sciencepol/HBL | /h.py | UTF-8 | 518 | 3.4375 | 3 | [] | no_license | player_score=1234
def binary_search(elements, target, low, high):
mid = (low + high) // 2
if low > high:
return high + 1
elif elements[mid][1] == target:
return mid + 1
elif target < elements[mid][1]:
return binary_search(elements, target, low, mid-1)
else:
return binary_search(elements, t... | true |
380a88206894e0fdcfd6241375d35fb6f32b9538 | VINCENT101132/vincent1 | /20210724/homework/2.py | UTF-8 | 309 | 4.21875 | 4 | [] | no_license | '''
讓使用者輸入一個str,當str有在list裡面,就移除該str
沒有str就加入list, 並顯示最後的list,list初使值為
["apple", "ball" ,"car"]
'''
j=['apple','ball','car']
print(j)
while True:
c=input('請輸入單字')
if c in j:
j.remove(c)
else:
j.append(c)
print(j) | true |
418dd933d87c03420d1359528512ba9a09178431 | aknuck/Lehigh-Coursesite-Login | /LehighCoursesiteLogin.py | UTF-8 | 2,002 | 2.984375 | 3 | [
"MIT"
] | permissive | # Adam Knuckey
# August 2016
# Get Data from Lehigh's course site
import getpass,requests
s = requests.Session()
payload = {'username':raw_input('Username: '),'password':getpass.getpass('Password: ')}
r = s.get('https://coursesite.lehigh.edu/auth/saml/login.php') #Get the initial login page, which sets the MoodleSe... | true |
6eeeed2d8fd1c8481e2d0394e4b41d31b019e87e | akashsengupta1997/pytorch_segmentation | /data/dataset.py | UTF-8 | 2,138 | 2.828125 | 3 | [] | no_license | import torch
import os
from skimage import io
import cv2
from torch.utils.data import Dataset
import numpy as np
class UPS31Dataset(Dataset):
def __init__(self, image_dir, label_dir, transform=None, image_format=".png",
label_format=".png", use_surreal_labels=False):
self.transform = tran... | true |
487ea7186ae361ea145484b744d0169666282bdd | Baidaly/datacamp-samples | /8 - statistical thinking in python - part 1/thinking probabilistically/distribution of no-hitters and cycles.py | UTF-8 | 532 | 4.03125 | 4 | [
"MIT"
] | permissive | '''
Now, you'll use your sampling function to compute the waiting time to observe a no-hitter and hitting of the cycle. The mean waiting time for a no-hitter is 764 games, and the mean waiting time for hitting the cycle is 715 games.
'''
# Draw samples of waiting times: waiting_times
waiting_times = successive_poisson(... | true |
ba267f126a76f2a7ccf291c0c817f9ba46de1074 | Onapsis/pgdiff | /pgdiff/schema/PgFunction.py | UTF-8 | 4,304 | 2.921875 | 3 | [
"MIT"
] | permissive | import hashlib
from ..diff.PgDiffUtils import PgDiffUtils
from ..helpers.OrderedDict import OrderedDict
class PgFunction(object):
def __init__(self):
self.name = ''
self.arguments = []
self.body = None
self.comment = None
def __eq__(self, other):
return self._equals(ot... | true |
b694cc79c42e917823901f993660a5af7b357205 | mcps4545/python | /Hw03(0226).py | UTF-8 | 315 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 2 22:14:51 2021
@author: admin
"""
'''
由使用者輸入數值,請透過FOR將1~數值作加總,最後印出總和。
'''
a=int(input("請輸入數值:"))
total=0
for b in range(1,a+1):
total += b
print(total)
print("程式執行完畢")
| true |
94bb7e96a890e0cadfac37f533e00b57d6603463 | franlop24/FlaskWebApp | /webpersonal/models.py | UTF-8 | 1,578 | 2.546875 | 3 | [] | no_license | from webpersonal import db, login_manager
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(user_id)
class User(db.Model, UserMixin):
__tablename__ ... | true |
da3a7491712197a1325a24a38641b8df7ebeb5ec | canselcik/libvirtdma | /idabridge.py | UTF-8 | 1,659 | 2.625 | 3 | [] | no_license | import urllib2
import idautils
import idc
import idaapi
def segment_exists(segment_name):
for s in idautils.Segments():
if idc.SegName(s) == segment_name:
return True
return False
class VirtDMA(object):
def __init__(self, hostport):
self.hostport = hostport
def readhex(sel... | true |
fc285d0d4b01cb66d2bd4d117f0a4a9db720e84d | kkwook/MyCode | /MLDL_Mycode/neuron.py | UTF-8 | 1,828 | 3.609375 | 4 | [] | no_license | ''' 신경망 기초 '''
''' weight : 가중치 -> 신호 전달 역할
bias : 편향 -> '''
import numpy as np
def AND(x1, x2):
w1, w2, bias = 0.5, 0.5, 0.7
tmp = x1 * w1 + x2 * w2
if tmp <= bias:
return 0
elif tmp > bias:
return 1
AND(0, 0)
AND(0, 1)
AND(1, 0)
AND(1, 1)
def OR(x1... | true |
79a39b94405e5262fb3f769ca7f16cb7f4b36d5a | rithvikp1998/ctci | /4.5-validate-bst.py | UTF-8 | 1,081 | 3.453125 | 3 | [
"MIT"
] | permissive | class Node:
def __init__(self, value):
self.value=value
self.left=None
self.right=None
def validate(root):
if root==None:
return 1
if root.left==None and root.right==None:
return 1
elif root.right==None:
if root.left.value<=root.value:
return ... | true |
4b4240cf815cb7fef71febb06ad9d55d7f8922ee | samstronghammer/adventofcode2019 | /day14/sol.py | UTF-8 | 2,907 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python3
import sys
sys.path.append("..")
import util
import math
# I had a hard time with part 1, but part 2 was quick. I first thought of
# integer programming (it looked like a set of constraints) but quickly
# realized it was the wrong path. I then got stuck for a while trying
# to decide how to handle ... | true |
81f43006a307ea380731f87578826aa60c4a123f | RQuintin/perspective | /python/perspective/bench/stresstest/server/manager_telemetry.py | UTF-8 | 3,222 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | ################################################################################
#
# Copyright (c) 2019, the Perspective Authors.
#
# This file is part of the Perspective library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
import logging
from datetime ... | true |
01654a43ff2f14183532201934b0b8bf1159b27f | winterest/f-function | /data_loader.py | UTF-8 | 4,441 | 2.578125 | 3 | [
"MIT"
] | permissive | from torch.utils import data
import os
import torch
from torchvision import transforms as T
from scipy import interpolate
from PIL import Image
from random import shuffle
import xml.etree.ElementTree as ET
## Config
img_size = 256
## End of config
class LabeledImageFolder(data.Dataset):
def __init__(self, root,... | true |
2aebe980a26c162429ace15279f8c1584d291faf | goodlucky-Joy/Python_TicTacToe | /01_Python/39_dictionary_pop.py | UTF-8 | 174 | 2.890625 | 3 | [] | no_license | phone_num = {'Emily':'010-234-5678',
'Eric':'010-345-6789',
'Ellie':'010-456-7890'
}
phone_num.pop('Emily')
print(phone_num)
| true |
219a022ee152ed3a0711b2cc3d517737fd51764b | MJVegad/DSofWebServer | /Request.py | UTF-8 | 2,345 | 2.859375 | 3 | [] | no_license | import random
class Request:
"""contains all the parameters related to a request in the system
clientId : client which generated the request
requestState : spawned, executing, buffered, inCoreQueue
arrivalTimeDistributionLambda : lambda for Exp distribution
serviceTimeDistribution : constant, uniform, normal,... | true |
42c1a59bb6315bd515f5a428ed43cf94d110fce0 | suman-kr/tic-tac-toe | /game.py | UTF-8 | 3,203 | 3.59375 | 4 | [] | no_license | from pyfiglet import figlet_format
from termcolor import cprint
cprint(figlet_format('Tic Tac Toe',font='big'))
print ("Copyright © Suman Kumar\n")
print ("Enter the size of the board separated by space")
print ("min = {}x{} , max = {}x{}".format(3,3,10,10))
try:
r , c = [int(i) for i in input().split()]
except:
... | true |
6af763c42ad3b81592f5576c52d5ef85706805b4 | Nickhil-Sethi/Simulations | /data_structures/string/search.py | UTF-8 | 658 | 3.6875 | 4 | [] | no_license | import numpy as np
def linear_search(mylist,item):
for index, element in enumerate(mylist):
if element == item:
return index
return -1
def binary_search(mylist,item):
begin = 0.
end = float(len(mylist)-1)
mid = int(np.ceil((begin+end)/2))
keep_going = True
while keep_going:
if end -... | true |
91cede28f6baa7673bb08782d9b533a426a68bc5 | durbek-kosimov/python-course | /nestFunc.py | UTF-8 | 627 | 3.8125 | 4 | [] | no_license | def my_dist_xyz(x, y, z):
"""x, y, z are 2D coordinates contained in a tuple
output:
d - list, where
d[0] is the distance between x and y
d[1] is the distance between x and z
d[2] is the distance between y and z"""
def my_dist(x, y):
"""subfunction for my_dist_xyz
Output is t... | true |
221b8124f6906acb0932753ce247d9904d18d1d7 | javierip/parallel-processing-teaching-toolkit | /04-GPU-accelerators/04-PyOpenCL/04-matrix_add/matrix_add.py | UTF-8 | 2,528 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# Parallel Processing Teaching Toolkit
# PyOpenCL - Example 04
# Matrix Addition
# https://github.com/javierip/parallel-processing-teaching-toolkit
import pyopencl as cl
import numpy as np
import time # For measure the running times
MATRIX_SIZE = 96 # Matrix with 96*96 elements
# Create... | true |
c62391cd4f7239683f96151f8392267f83655163 | lupang7/coding_ui | /seleium/元素操作/基础操作/simple_op.py | UTF-8 | 1,012 | 2.703125 | 3 | [] | no_license | #-*- coding:utf-8 _*-
"""
@author:lupang
@file: simple_op.py
@time: 2021/03/22
"""
from time import sleep
import os
import selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
'''
'''
class TestLocate:
def setup(self):
self.driver=webdriver.Chrome(executable_path='/u... | true |
ef66557da49c4016d97b3073eaa4982eab4cc764 | pelegm/drv | /drv/rpg/systems/cortex_plus.py | UTF-8 | 703 | 3.28125 | 3 | [
"Unlicense"
] | permissive | """
.. cortex_plus.py
Cortex Plus is a roll and keep system. In full generality, a pool is any
sequence of dice-types from {4, 6, 8, 10, 12}, of length at least 2. The
result of a roll is always the sum of the two highest results. Results of 1 do
not count, but instead are 0 (and in fact cause complications). """
... | true |
c54cd80e9cede4b9e1f43202a47d8892e15be508 | kanglicheng/CodeBreakersCode | /need to be aware after 8 15/316. Remove Duplicate Letters (failed).py | UTF-8 | 819 | 3.1875 | 3 | [] | no_license | class Solution:
def removeDuplicateLetters(self, a: str) -> str:
n = len(a)
d = dict()
for i in range(n - 1, -1, -1):
if a[i] not in d:
d[a[i]] = list()
d[a[i]].append(i)
us... | true |
e768e6eed2da7548a31e1c7618a06c9d3070d6c0 | korobool/copus_proc | /morpho_in_templates/morpho_template.py | UTF-8 | 634 | 2.5625 | 3 | [] | no_license | import sys
import os
import re
folder = sys.argv[1]
def list_template_files(f):
for file in os.listdir(f):
if file.endswith(')'):
yield file
def get_setnence_metainfo(sentence):
words = filter(lambda w: len(w) > 0, re.split(' \\\n'))
meta = []
for word in words:
yield ge... | true |
a19a25dc98ba53d6f72fedd6141191e48dd56706 | exploring-curiosity/DesignAndAnalysisOfAlgorithms | /Assignment2/q1_1power_Rec.py | UTF-8 | 206 | 3.984375 | 4 | [] | no_license | def power(a,n):
if n==1:
return a
else:
return a*power(a,n-1)
a=int(input("Enter the value of x : "))
n=int(input("Enter the value of power : "))
print("The result is ",power(a,n)) | true |
4c80957e6fc6dc6ce37b820770e629c5ef6bab21 | ernara/AutomatedVoting | /tek.py | UTF-8 | 162 | 2.53125 | 3 | [] | no_license | import math
from screeninfo import get_monitors
for m in get_monitors():
print(str(m))
print(m.width)
print(m.height)
print(math.ceil(math.sqrt(8))) | true |
bea37552c0df91de2b1933cb45f4d54cc9a4d60a | Teamforalgorithm/study_codes | /kjh/parametric/2110.py | UTF-8 | 562 | 2.953125 | 3 | [] | no_license | import sys
N, C = map(int, sys.stdin.readline())
arr = []
points = []
for i in range(N):
arr.append(int(sys.stdin.readline()))
arr.sort()
def binarySearch(start, end, distance){
mid = (start + end) / 2
val = end
for i, j in zip(arr, arr[1:] + [0]):
if j > mid:
val = min(abs(j - ... | true |
c9a561d50ec563dad50397611dd273700ffe229d | itspratham/Python-tutorial | /Python_Contents/Dictionaries/DefineDictionary.py | UTF-8 | 1,066 | 4.25 | 4 | [] | no_license | """
Dictionary : Collection key and value pair
dictionary_name {
Key : Value
Key : Value
Key : Value
Key : Value
}
"""
# Define a dictionay
d = {}
dt = dict()
print(type(d))
print(type(dt))
print(d)
# Define the values
d = {"a": "apple", 'a': "ssd", "b": "bear", "c": "cat", "d": "dog"}
print(d)
pri... | true |
06d2e5fb5bca8691b138345b6e484b6ecf7a6ce7 | Sandeep1991/Coding | /reversebits.py | UTF-8 | 278 | 3.203125 | 3 | [] | no_license | class Solution(object):
def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
return int('{:032b}'.format(n)[::-1], 2)
#Step wise alternative method
#b = '{:032b}'.format(n)
#c = b[::-1]
#return int(c,2)
| true |
649cfa9e63c845d36f68d56de121084bd3e7b033 | izlatkin/euler-project | /euler/36DoubleBasePalindromes.py | UTF-8 | 584 | 3.40625 | 3 | [] | no_license | __author__ = 'ilya'
def isPalidrome(string_n):
if len(string_n) == 1:
return True
for i in range(0, len(string_n) / 2):
return string_n[::-1] == string_n
#if (string_n[i] != string_n[::-i]):
# return False
def main():
#print isPalidrome(str(7117))
#print(bin(777)[... | true |
d9ecc0561c8d591b6595540ffbd1e817256497d7 | jredmondson/icstocsv | /icstocsv.py | UTF-8 | 1,931 | 2.8125 | 3 | [
"BSD-2-Clause"
] | permissive | import vobject
import csv
import sys
import io
import os
csv_filename = "calendar.csv"
if len(sys.argv) == 1:
print(f"icstocsv usage: icstocsv ical [csv output file]\n")
print(f" if no csv out provided, then saves at ical.csv")
quit()
if len(sys.argv) > 1:
ics_filename = sys.argv[1]
if len(sys.argv... | true |
91883fbecf550759c40cb8bee26df2458b158c35 | carysmills/whentoshop | /python/getids.py | UTF-8 | 474 | 2.546875 | 3 | [] | no_license | import config
import sys
import googlemaps
import json
gmaps = googlemaps.Client(key=config.api_key)
def getIds(location):
with open('public/locations.json') as f:
data = json.load(f)
currentlocation = data[location]
stores = gmaps.places_nearby(keyword=currentlocation['search'], type=curr... | true |
41837da54914e85b04499cc6bde5cfe96b42b95f | ayushkamat/eecs_229a_final_project | /trainers/cond_entropy_trainer.py | UTF-8 | 4,096 | 2.5625 | 3 | [] | no_license | from trainers.trainer import Trainer
from collections import defaultdict
from torch.utils.data import DataLoader
import torch
from tqdm import tqdm
import os
import pickle
torch.autograd.set_detect_anomaly(True)
class CondEntropyTrainer(Trainer):
"""
This will train Nt teachers then evaluate selecting the da... | true |
66b4422fc357649b39768308aaf20239d32349a4 | Kawamitsu7/CT_Program | /exp_program/Sinogram/list_sinogram.py | UTF-8 | 1,993 | 2.8125 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import cv2
import numpy as np
import math
import os
import matplotlib.pyplot as plt
import glob
import time
def main(src,s,f,isGray):
#画像の読み込み
folder = src
print("画像書き出しを開始するスライスを指定してください(0~画像サイズ-1)")
start = int(s)
print("画像書き出しを終了するスライスを指定してください(0~画像サイズ-1)")
fin = int(f)
print(str(start... | true |
c732a8250a6f36b5afe192ce79a45af1d7cf86c5 | dammara/computeFactorial | /computeFactorial.py | UTF-8 | 320 | 4.28125 | 4 | [] | no_license | # Markhus Dammar
# 6 October 2021
# THis program will calculate the factorial of a number
import math
def computeFactorial(myNumber):
print(f'The factorial of {myNumber} is {math.factorial(myNumber)}')
myNumber = int(input("Please input a number to find the factorial. >>> "))
computeFactorial(myNum... | true |
7bca5fb7a040f597ceec4762c69480c845064dae | mridulrb/Basic-Python-Examples-for-Beginners | /Programs/MyPythonXII/Unit1/PyChap01/formatarg.py | UTF-8 | 519 | 3.296875 | 3 | [] | no_license | # File name: ...\\MyPythonXII\Unit1\PyChap01\formatarg.py
# Printing data with format arguments
print ("The formatted data...")
print ("{0:<15} {1:^12} {2:^12} {3:^12} {4:^12} {5:^12} {6:>8}".format("Name", "English", "Physics", "Chemistry", "Mathematics", "Computer", "Total"))
print ('-' * 90)
print ("{0:<15} {1:... | true |
f59bb52f49c64f21eba208796abbf0d38780fc9f | kikugawa-shoma/Atcoder | /ABC/ABC152/ABC152D.py | UTF-8 | 1,287 | 2.84375 | 3 | [] | no_license | #N = int(input())
N = 100
str_N = str(N)
num = 0
char_set = {str(i) for i in range(1, N)}
for n1 in range(1, min(N, 100)):
for n2 in range(1, min(N, 100)):
str_n1, str_n2 = map(str, [n1, n2])
length1 = len(str_n1)
length2 = len(str_n2)
if str_n1[0] == str_n2[length2-1] and str_n1... | true |
403e28cbdebfbfb3e3cfe4adcbce6c00615cd18d | ilkinismayilov/Login_Register_System | /main.py | UTF-8 | 975 | 3.140625 | 3 | [] | no_license | from login import *
from register import *
from time import sleep
print("""Welcome teacher :)
Login -> 1
register -> 2
""")
def start():
order = int(input("Choose your number : "))
try:
if order == 1:
username = input("Username : ")
password = int(input("Password : "))
... | true |
94bbd358496b839c442a32cd68db8860c64b65ad | amrit2356/Dev-Training-Ray | /Ray_Google_Colab/01_Ray_Remote_Functions/02_ray_parallelism.py | UTF-8 | 564 | 3.609375 | 4 | [] | no_license | import ray
"""
Parallelism with Ray
"""
# Creation of Normal Python Function
def function():
return 1
# This code adds 4 values synchronously(one by one).
ray.init()
result = 0
for _ in range(4):
result += function()
assert result == 4
print(result)
# Creation of Ray Remote function
@ray.remote
def remote_fu... | true |
35ed7ab673872992facb2ff62e954b9e38d3d4ba | azikoDron/python | /task4/SRC/task4.py | UTF-8 | 1,401 | 3.25 | 3 | [] | no_license | import os
try:
input_path = input(r"path: ") # absolute path to file
base_path = os.path.normpath(input_path)
with open(base_path) as f:
reader = f.readlines()
except FileNotFoundError:
print(r'you must write absolute path like: "D:\Users\Voldemort\*.txt"')
temporary_list = [r for... | true |
6fa810d0f3b08cd1fb4c21cabfbf425e05be6b5a | habibor144369/python_program | /15th program.py | UTF-8 | 302 | 3.375 | 3 | [] | no_license | # golobal and local variable with function....
def myfnc(x):
print('inside myfnc', x)
x = 10
print('inside mufnc', x)
x = 30
myfnc(x)
print(x)
# global variable with function....
def myFunction(y):
print('inside myFunction', y)
print('inside myFunction', z)
z = 100
myFunction(z)
| true |
443d4db992ab0f5348327e76b60caa4354be6de8 | rafaelperazzo/programacao-web | /moodledata/vpl_data/97/usersdata/212/55630/submittedfiles/lecker.py | UTF-8 | 944 | 3.609375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
def lecker(lista):
i=0
cont=0
n=len(lista)
while i<n:
if i==0:
if lista[0]>lista[i+1]:
cont=cont+1
elif i==(n-1):
if lista[n-1]>lista[n-2]:
cont=cont+1
elif lista[i]>li... | true |
484f7f636654ba78b7d305b2abd72af3f709e89b | ondergetekende/python-panavatar | /panavatar/patterns.py | UTF-8 | 5,456 | 3.09375 | 3 | [
"MIT"
] | permissive | import math
SQ3 = math.sqrt(3.0)
SQ2 = math.sqrt(3.0)
INV3 = 1.0 / 3
SIN60 = SQ3 * .5
def frange(start, end, step):
"""A range implementation which can handle floats"""
if start <= end:
step = abs(step)
else:
step = -abs(step)
while start < end:
yield start
start += s... | true |
077ccbecb754487dfe9ff452a99cd674a0f460cd | jayd1903/pscsta | /PycharmProjects/untitled1/.idea/City Simulator.py | UTF-8 | 620 | 3.671875 | 4 | [] | no_license | #Define variables
population = 0
city_name = ""
generation = 0
economy_condition = 0
satisfaction = 0
game_still_on = True
#Starting loop
name_ask = raw_input("Welcome to City Simulator! Name your city! >>> ")
city_name = name_ask
print("-------------------------------\nYou are now the proud mayor of " + city_name + "!... | true |
add5f6a11b7054de5ca8501b874eaba5d34dba20 | alexdoberman/ma | /ma_py/mic_py/mic_f1_calc.py | UTF-8 | 3,507 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from interval import interval, inf, imath
def op_not_(x):
if x[0] != -inf and x[1] != inf:
return interval([-inf, x[0]], [x[1], inf])
if x[0] == -inf and x[1] != inf:
return interval([x[1], inf])
if x[0] != -inf and x[1] == inf:
return inte... | true |
42ec18880a102a0444401284ab8fa67a95a1758b | eShuttleworth/frosted | /analysis.py | UTF-8 | 1,605 | 3.0625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import digraph
from math import ceil
def byte_stain(hex_arr):
color_arr = []
for i in range(0, len(hex_arr), 2): # each entry is a nibble
if i <= len(hex_arr):
sub = int('{}{}'.format(*hex_arr[i:i + 2])... | true |
9991551508a2cf607066b1999d37e5aa3bc8e235 | petermbach/urbanbeats-legacy | /ancillary/urbanbeatspospro.py | UTF-8 | 12,774 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 13 18:51:20 2015
@author: Peter Bach
"""
#UrbanBEATS Post-processing
from osgeo import ogr
import os, numpy
#####################################################################################
## ... | true |
639b2ecee6dab1efd0d86888d2ebfa6d8fc7c3cf | Amsterdam-Internships/FewShotCrowdCounting | /models/SineNet/SineNet_functional.py | UTF-8 | 637 | 2.609375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class SineNet_functional(nn.Module):
""" Allows for a forward pass through SineNet, given only the weights. """
def __init__(self):
super(SineNet_functional, self).__init__()
def forward(self, x... | true |
01622b304aa64c8565fe01f5977ede3b99c93e86 | RAntonello/Projects-and-Classes | /Perona_SURF_2015/visipedia/classifiers/summary.py | UTF-8 | 11,108 | 2.515625 | 3 | [] | no_license | import sys, os
from jinja2 import Environment, FileSystemLoader
from matplotlib import pyplot as plt
from matplotlib.ticker import FuncFormatter
import numpy as np
from sklearn.metrics import accuracy_score, confusion_matrix
def summarize(image_data, category_data, predicted_identifiers, output_dir_path, dataset=None... | true |
c3c226201013a7cb789c2a59bb46d172b53dc29a | iamrizwan007/SeleniumEasy | /page_objects/radio_button_demo_objects.py | UTF-8 | 1,311 | 3.09375 | 3 | [] | no_license | import selenium
from selenium.webdriver.common.by import By
import pytest
class RadioButtonDemo:
male_radio = (By.XPATH, "(//label[@class='radio-inline']/input)[3]")
female_radio = (By.XPATH, "(//label[@class='radio-inline']/input)[4]")
age_0_to_5 = (By.XPATH, "(//label[@class='radio-inline']/input)[5]")
... | true |
27eda7e0a6abc54869b85040db52c83545472d69 | NeutronStar/MTGsim | /land.py | UTF-8 | 1,000 | 3.296875 | 3 | [] | no_license | from magiccard import MagicCard
from mana import Mana
class Land(MagicCard):
def __init__(self, name, type, subtype=None):
super().__init__(name, type, subtype)
def tap():
return None
class BasicLandType:
PLAINS = "Plains"
ISLAND = "Island"
SWAMP = "Swamp"
MOUNTAIN = "Mount... | true |
2454c8975246cd3401d3d93f7b61ad6faa30f743 | katieminjoo/baekjun_exercise | /[5] 1차원배열/q3_2577.py | UTF-8 | 149 | 3.3125 | 3 | [] | no_license | a = int(input())
b = int(input())
c = int(input())
d = a*b*c
d_list = list(str(d))
for i in range(10):
num = d_list.count(str(i))
print(num) | true |
1b04506b66b41d60e3d972632829bbca1ff49dc1 | nitingupta40/ArtificialInteligenceMachineMearningScripts | /neural network.py | UTF-8 | 3,146 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 18:59:14 2015
@author: nitin
"""
import math
import random
BIAS = -1
class Neuron:
def __init__(self,n_inputs):
self.n_inputs = n_inputs
self.set_weights([random.uniform(0,1) for x in range(0,n_inputs +1)])
def sum(self,inputs):
return ... | true |
d26f06c32c0c00eb620a3222c3bafe94e11f7f29 | dalzuga/holbertonschool-higher_level_programming | /basic_oop_with_python/0-alphabet.py | UTF-8 | 94 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
import string
''' Print all lowercase characters '''
print string.lowercase
| true |
d52afdf47a8918131cf48c81c66e887f19b07f34 | yongheng/dotfiles | /.bin/test-line-ending-recursively | UTF-8 | 1,495 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
from collections import defaultdict
import os
import string
table = string.maketrans('', '')
deletechars = ''.join(map(chr, range(32, 127)) + list('\n\r\t\b'))
def is_text(path):
# http://stackoverflow.com/a/1446870
with open(path, 'r') as f:
s = f.read(512)
... | true |
72e94350e14c35a1c475381f91a7e165e77fa974 | aldotele/the_python_workbook | /recursion/ex184.py | UTF-8 | 543 | 4.34375 | 4 | [] | no_license | # exercise 184: Flatten a List
def flatten(data):
# BASE CASE
if data == []:
return data
if type(data[0]) == list:
l1 = flatten(data[0])
l2 = flatten(data[1:])
return l1 + l2
else:
l1 = [data[0]]
l2 = flatten(data[1:])
return l1 + l2
if __name_... | true |
c0c359211234bc3f3f6e8a3fe2c431d5aec7d9ae | rahmanamanullah/JointFitting | /tests/test_psf.py | UTF-8 | 6,702 | 2.84375 | 3 | [] | no_license | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import numpy as np
import unittest
from astropy.modeling import models, fitting
from jfit.psf import SymmetricGaussian2D, SymmetricMoffat2D
import test_imagemodels as testimage
def guassian_convolved_with_gaussia... | true |
ac9747aa51492c6d3e2f4da54b805604be59b55f | GladkikhAnton/tasksFromCourse | /task#2/task#2.py | UTF-8 | 516 | 3.5 | 4 | [] | no_license | class Buffer:
def __init__(self):
self.list = []
def add(self, *a):
sum = 0
for item in a:
self.list.append(item)
while len(self.list) >= 5:
# print('while')
for s in range(0,5):
sum += self.list[s]
... | true |
060042273d286c86c843e1eb1d5ca4745191f0f9 | jart/cosmopolitan | /third_party/python/Lib/idlelib/idle_test/test_scrolledlist.py | UTF-8 | 496 | 2.515625 | 3 | [
"ISC",
"Python-2.0",
"GPL-1.0-or-later",
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-other-copyleft"
] | permissive | "Test scrolledlist, coverage 38%."
from idlelib.scrolledlist import ScrolledList
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk
class ScrolledListTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.root = Tk()
@classmethod
def tearDownCla... | true |
efea60541dede60303f80f1204a977c6853bc282 | cutesparrow/pythoncookbook | /Chapter1/1-17.py | UTF-8 | 203 | 2.640625 | 3 | [] | no_license | prices = {
'ACME': 45.23,
'AAPL': 612.78,
'IBM': 205.55,
'HPQ': 37.20,
'FB': 10.75
}
expensiveItems = {key:value for key,value in prices.items() if value > 200}
print(expensiveItems)
| true |
861b8121775e6c453649d9faef97b6520182b318 | MakarovI/ELIZABETH | /window.py | UTF-8 | 1,367 | 3.296875 | 3 | [] | no_license | """
class: Window(window.py) -> GUI
class Window gets 2 arguments:
1) parent -> parent window initialized in main.py
2) assistant -> Assistant class(assistant.py) object
"""
from tkinter import *
class Window:
def __init__(self, parent, assistant):
self.mainWindow = parent
... | true |
20f08c1cc8231fc910c8e36efdbc478436cce929 | vincenttuan/PythonCourse | /lesson2/Hello_Json3.py | UTF-8 | 129 | 2.875 | 3 | [] | no_license | import json
file = open('weather.json', 'r')
weather = file.read()
weather = json.loads(weather)
print(weather['main']['temp']) | true |
63451d4d5a3d35e7742cbe5b547ab830a18eb299 | hyanwong/tsinfer-benchmarking | /analysis/num_poly.py | UTF-8 | 2,191 | 2.75 | 3 | [
"MIT"
] | permissive | import multiprocessing
import argparse
import re
import sys
import tskit
import numpy as np
def run(filename):
m = re.search(r'^(.*)_ma([-e\d\.]+)_ms([-e\d\.]+)_p(\d+).trees$', filename)
if m is None:
return None
prefix = m.group(1)
ma_mut = float(m.group(2))
ms_mut = float(m.group(3))
... | true |
68f0c153360e08b5c3e0f8f1de02d49a857f3d79 | quitequinn/Robofab-tools | /Most Repeated Char.py | UTF-8 | 245 | 3.046875 | 3 | [] | no_license | #list of most repeated characters & repeated letters
mostChar = ['TH', 'HE', 'AN', 'RE', 'ER', 'IN', 'ON', 'AT', 'ND', 'ST', 'ES', 'EN', 'OF', 'TE', 'ED', 'OR', 'TI', 'HI', 'AS', 'TO', 'LL', 'EE', 'SS', 'OO', 'TT', 'FF', 'RR', 'NN', 'PP', 'CC'] | true |
05ddd25cc83ad121709ecaf182a30e88287efdaf | cliuthulu/Ex-8 | /markov.py | UTF-8 | 2,270 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import random
from random import randint
import twitter
def make_chains(corpus):
"""Takes an input text as a string and returns a dictionary of
markov chains."""
dictionary = {}
corpus = corpus.split()
#corpus is a list
i = 0
#words not in pairs
for words in corpus:
# keeps... | true |
bd1c8de66a538b22b16b985ce08bb294fdae38d7 | futeen/playboy | /usual_code/map_lambda.py | UTF-8 | 742 | 3.3125 | 3 | [] | no_license | <<<<<<< HEAD
# the way using of lambda and map
=======
# map, lambda
>>>>>>> 49e30f85260acb5bc0fbc3100a5ec8c3cce9b97a
def f(x):
return x * x
def test_map():
a = map(f, [1, 2, 3, 4, 5, 6])
for x in a:
print(x)
def test_map_lambda():
b = map(lambda x, y: x ** y, [1, 2, 3], [2, 3, 4])
for... | true |
419d8a4d68482e8734fc584d67f4c8cc4cdf2df4 | sidewalklabs/oldto | /oldtoronto/logging_configuration.py | UTF-8 | 1,083 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import datetime
import logging
import os
def configure_logging(log_file):
logger = logging.getLogger('')
# create file handler which logs even debug messages
logger.setLevel(logging.DEBUG)
timestamp = datetime.datetime.now().strftime('%Y-%m-%dT%H%M%S')
timestamped_log_file = f'{log_file}.{timest... | true |
616c64b87c14a064009e730de31d2f00afc33e33 | cmptrx/lit | /test/lit_test_framework.py | UTF-8 | 1,858 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Copyright (c) 2017 The lit developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""Test lit"""
import subprocess
import sys
import tempfile
import time
import traceback
class LitTest():
def __ini... | true |
56e733e2c72d4b51f1a60a853b9a006c889a3754 | agankur21/reviewsentimentanalysis | /Code/utils/SEMVAL_avg_senti_ML.py | UTF-8 | 6,844 | 2.546875 | 3 | [] | no_license | __author__ = "adityat"
import sys
import os
import time
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.metrics import classification_report
import xml.etree.ElementTree
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.discriminant_analy... | true |
365de0bd37a17b494bcea896e3f7abe8e96ee90b | chrispsk/dw | /back/views.py | UTF-8 | 5,070 | 2.65625 | 3 | [] | no_license | from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from .models import Vulnerability, Date
from django.db import connection, Error
from django.db.models import Count
import json
from django.core import serializers
from collections... | true |
a3cd19ee115d6775c89b7897894f8d8b08a6f78a | TrendingTechnology/autodrive | /tests/format_rng_test.py | UTF-8 | 1,411 | 2.671875 | 3 | [] | no_license | import pytest
from autodrive.range import Range
from autodrive.tab import Tab
from autodrive.interfaces import Color, TextFormat, FullRange
from autodrive.gsheet import GSheet
from autodrive.connection import SheetsConnection
class TestRangeFormatting:
@pytest.fixture(scope="session")
def test_tab(self, shee... | true |
b6f72d62481a83e0ccbd6a7d24aa539d3b1c8e04 | cfe-lab/stocky | /stocky-devel/stocky/qailib/transcryptlib/widgets.py | UTF-8 | 15,835 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | """Define controllers and widgets.
A controller is simply and base_ob with some predefined methods that is used as
a main program. The controller has predefined ways of reacting to events such as
button clocks etc.
A widget is an html element associated with a controller. It sends its events to
the contr... | true |
fe4d358a54d5718e50f6570535a8b30c986409ad | la1478963/Water | /utlis/Ansible_api/send_demo.py | UTF-8 | 379 | 2.625 | 3 | [] | no_license |
import requests
import json
ansible_api='http://ip:port/run' #这里记得把ip port 改掉
dic={
'msg':'shell',
'host':'webserver',
'module':'command',
'args':'ls /',
}
r1=requests.post(ansible_api,json=dic)
ret_dic=json.loads(r1.text)
if ret_dic['status']:
data=ret_dic['data']
for... | true |
0864f3e4f6e070086622cc8ba7583c84c6a31443 | Scassaro/MXKQuickUpdate | /QuickUpdateOptimized.py | UTF-8 | 3,546 | 2.578125 | 3 | [] | no_license | import telnetlib
import paramiko
import time
# Collect IP of MXK here and create telnet session
MXKTelnet = telnetlib.Telnet(input("Enter the IP of your device: "))
VersionNumber = input("What version do you want to upgrade to?: ")
MXKTelnet.read_until(b"login:")
MXKTelnet.write(b"admin\n")
MXKTelnet.read_until(b"pass... | true |
94739560d5f0da1545fe191076ecdc1b3ea97653 | ichan266/Code-Challenges | /Code Signal/04-21-21 Minesweeper.py | UTF-8 | 1,107 | 3.109375 | 3 | [] | no_license | # Code Signal Arcade
# Intro #24
# Solution from Ben
def minesweeper(matrix):
width = len(matrix[0])
height = len(matrix)
# add current, one before, and one after
def addRow(rowList, col):
return sum(rowList[max(0, col-1):min(col+2, width)])
def addSquare(row, col):
count = 0
... | true |
f2da39b423c2398927133c778bb4d20cc7915cc5 | cwchaney/bmstats | /src/dbPlayerStats.py | UTF-8 | 1,442 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
import psycopg2
import re
class DbPlayerStats:
def hasPlayedWith(self, buttonName):
return self.numPlaysWith(buttonName) > 0
def hasPlayedAgainst(self, buttonName):
return self.numPlaysAgainst(buttonName) > 0
def numPlaysWith(self, buttonName):
conn = self._dbConnect()
cur = conn.curso... | true |
7d2bcf9d5a4fdda4148184c3a74a422f4315fe4d | City-College-Norwich/Digi-Yr2-ExplodyGame | /test.py | UTF-8 | 385 | 2.703125 | 3 | [] | no_license | import RPi.GPIO as gpio
button_pin = 37
buzzer_pin = 12
gpio.setmode(gpio.BOARD)
gpio.setup(button_pin, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.setup(buzzer_pin, gpio.OUT)
try:
while True:
if (gpio.input(button_pin)):
gpio.output(buzzer_pin, gpio.HIGH)
else:
gpio.output(b... | true |
d6d9a7555021def3dc0e66ca32623e59a0721c5a | feiyanzhandui/tware | /experiments/alloc/run.py | UTF-8 | 554 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import os
import sys
from subprocess import call
def main():
MAX = 25
COMPILE = "g++ -std=c++11 -O3 -ffast-math -mavx alloc.cpp -o tmp"
CONST = """
#define DATA 1?
#define TILE 2?
#define TILES DATA / TILE"""
for i in range(0, 26):
fconst = open("const.h", "w")
fcons... | true |
a340bd594a24f8f8be84029ce9af4a9f098a3361 | balasundaram5396/Leetcode | /Palindrome Linked List.py | UTF-8 | 647 | 3.265625 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
if head is None:
return True
start,end=head,head
st=[]
... | true |
98e68bd08f6704a9d25cd397d10394d1dee03e54 | Hyoukjoo/study-algo | /동빈나/미래도시.py | UTF-8 | 510 | 3.34375 | 3 | [] | no_license | import collections
import heapq
import sys
n, m = 5, 7
x, k = 4, 5
exam = [[1,2], [1,3], [1,4], [2,4], [3,4], [3,5], [4,5]]
table = [[sys.maxsize] * n for _ in range(n)]
for x, y in exam:
x -= 1
y -= 1
table[x][y] = 1
table[y][x] = 1
for i in range(n):
table[i][i] = 0
for c in range(n)... | true |
0bb8bf924d5efdb5e2bea7f2184fe4af07330ced | ankitpriyarup/online-judge | /advent/2018/day19.fast.py | UTF-8 | 136 | 2.859375 | 3 | [] | no_license | # x = 1003
x = 10551403
ans = 0
d = 1
while d * d <= x:
if x % d == 0:
ans += d
ans += x // d
d += 1
print(ans)
| true |
0e844d4a92cfbebf984bbcf8b18c5820404fe710 | ikapoor/Project-Euler- | /CountingSundays.py | UTF-8 | 1,010 | 3.265625 | 3 | [] | no_license | def isLeapYear(n):
if (n%400 == 0):
return True
if (n%100 == 0):
return False
if (n%4 == 0):
return True
return False
#input Jan 1st day, and if it is a leap year
#Sunday = 0
def NumSundaysinYear(n, LY):
numSundays = 0
if (n == 0):
numSundays+... | true |
682e8b5598e08d69e252e89b509a7f36994b3dfd | anushav85/hadoop-mapreduce | /top_tags_mapper.py | UTF-8 | 1,016 | 3.3125 | 3 | [] | no_license | #!/usr/bin/python
'''
We are interested in finding out the most commonly used tags to
categorize posts on a forum. The goal is to write a map reduce program
that would process forum node data and output the top 10 tags ordered
by the number of questions they appear in.
In the mapper we simply need to get the values in... | true |
881fb31ae7c12cce018e005be3fe55fc60aa3081 | vuggesaikalyan/Hackerank-Algorithms-python | /sumWithO(con).py | UTF-8 | 85 | 3.28125 | 3 | [] | no_license | def Sum(n):
if n <= 1:
return n
return n + Sum(n-1)
n=int(input())
print(Sum(n))
| true |
152b3d16eac627cb2402c656ba30cae7c2404eab | SirRhynus/connect4 | /connect4/player.py | UTF-8 | 3,100 | 2.953125 | 3 | [
"Unlicense"
] | permissive | """
Implements a player to play connect4 with.
"""
import socket
import pickle
from blessed import Terminal
from . import c4
from time import sleep
class Player:
"""Represents a Player"""
def __init__(self, name):
"""Initializes the Player.
Arguments:
- name: the name of the player... | true |
da759d708448c26380b3e635f694063f0c114a36 | mynewzone/ddns | /record/cache.py | UTF-8 | 1,758 | 2.9375 | 3 | [] | no_license | import os
from error import Error
from shutil import rmtree
class Cache:
db_prefix = '.cache'
key_prefix = ''
key_suffix = ''
def __init__(self):
self.select(0)
def __check_path(self):
if not(os.path.exists(self.cache_path)):
os.mkdir(self.cache_path)
def __prepa... | true |
a0cf8602949b8b9c7a189562d8175f7027f67d73 | CHENGHAO-WANG/Bioinformatics_Training_Program_2018 | /week3-Python-Perl/menu.py | UTF-8 | 938 | 3.09375 | 3 | [] | no_license |
# coding: utf-8
import os
#切换到目录
os.chdir('/Users/wangchenghao/Desktop/weekly_tasks/original_dirs')
##思路:利用os.walk遍历文件,将得到的文件夹名修改,再与文件夹所在的绝对路径相连,利用得到的新路径进行重命名
##出现问题:只能对最短的路径下的文件夹重命名,剩下的文件夹因为在遍历过程中路径发生改变而无法完成遍历
##改进思路:根据绝对路径的长短,将os.walk得到的生成器的顺序颠倒;从而先修改最长路径下的文件夹名,这样就不会妨碍剩余的遍历过程
u=sorted([x for x in os.walk('/Users... | true |
95286255946d623536936722292faf8dae3c9627 | nabeen/AtCoder | /abc/abc039/a.py | UTF-8 | 239 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc039/tasks/abc039_a
def main() -> None:
A, B, C = map(int, input().split())
print(2 * (A * B + B * C + C * A))
if __name__ == '__main__':
main()
| true |
ab1d6117cf499f615e07c2b67e43a7c4d9a18c8c | Statistic666/Discussion | /fangzj/01-字符串归一化.py | UTF-8 | 457 | 3.203125 | 3 | [] | no_license | #
#File Name:test.py
#Author:Kgod
#Email:17621512033@163.com
#Homepage:https://aaakgold.github.io
#Create Date:2019-11-19 17:11:50
#Last Modified:2019年11月20日 星期三 19时49分42秒
#Description:
#/
newStr = input("请输入测试字符串:") #按行输入
newStr_sort = sorted(set(newStr)) #使用set去重后排序
for ch in newStr_sort:
print(ch + str(newStr.c... | true |
50a28d3c471736f13339b991a98f6b5f124a55b0 | HarinderToor/Python | /bookcase.py | UTF-8 | 3,293 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python3
class Bookcase:
"""
Implements an ADT to store various media items on virtual shelves.
A bookcase has r rows (shelves) and c columns, numbered from zero.
A valid position is given by a row from 0 to r-1 and a column from 0 to c-1.
"""
def __init__(self, rows, column... | true |
7263bfb32fb0d22121dea9b7267964f538e19903 | tgkei/Algorithm_study | /by_python/codeforces/552division3/b.py | UTF-8 | 359 | 3.1875 | 3 | [] | no_license | input()
nums = list(sorted(set(map(int,input().split()))))
if len(nums) > 3:
print("-1")
elif len(nums) ==3:
if nums[0]+nums[-1] != nums[1]*2:
print("-1")
else:
print(nums[1]-nums[0])
elif len(nums)==1:
print("0")
else:
if (nums[0] + nums[1])%2:
print(nums[1]-nums[0])
el... | true |
c56b3cb17ad909b4d1e96a7ef3309b650636ac12 | Grishma-Modi/Disease-prediction | /diabetes.py | UTF-8 | 3,906 | 2.84375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
#from sklearn.externals import joblib
import joblib
from joblib import dump, load
import pickle
# DATA FOR PRED
data=pd.read_csv("diabetes.csv")
print(data.head())
# Renaming DiabetesPedigreeFunction as DPF
data = data.rename... | true |
506ef11dc6182e2f906ef63d37caa2826b58373f | anfer86/teaching-datascience-lessons | /aula04a/.ipynb_checkpoints/helper-checkpoint.py | UTF-8 | 3,731 | 3.484375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import nltk
from nltk import tokenize
from nltk.stem.snowball import SnowballStemmer
from nltk.corpus import stopwords
from string import punctuation
from collections import Counter
def tokenizar(sentenca):
"""Esta função aplica tokenização em uma sentença
Para... | true |
ce906048ff0967530a6b602df14005ec59ad6437 | WindowsCrashed/UniversityProjects | /Scripts/LinearRegressionCalculatorPTBR.py | UTF-8 | 9,088 | 3.859375 | 4 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
from time import sleep
from os import system, name
# --------------------- Classes -------------------------
# ------------ Erros ---------------
# Para tratar erros relacionados à incompatibilidade de arrays
class LengthError(Exception):
pass
# Para tratar erros relacionados ... | true |
aa5d14294e8fcceaa2088ff99efc044539d69b11 | Kevin3099/PRACTICAL-PI | /kevinPython/escapequotes.py | UTF-8 | 492 | 2.6875 | 3 | [] | no_license | Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "copyright", "credits" or "license()" for more information.
>>> print("Did you know that 'word' is a word?")
Did you know that 'word' is a word?
>>>
print('Did you know that "word" is a word?')
Did you know that "word" is a word?
>>> pri... | true |
637cea6dbc95981a57e262f6c24afe83096fbd5d | renjieliu/leetcode | /0001_0599/53.py | UTF-8 | 563 | 3.046875 | 3 | [] | no_license | class Solution:
def maxSubArray(self, nums: 'List[int]') -> int:
local = 0
maxx = -float('inf')
for i in range(len(nums)): #Kadane's algo
local = max(local+nums[i], nums[i])
maxx = max(local, maxx)
return maxx
# previous approach
# class Solutio... | true |