blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
b303d966736c928572dc410ce2306ed42c92c208 | Python | TanishTaneja/Python-Questions | /Coding Ninjas/Conditionals & Loops/Q2_Sum_of_n_numbers.py | UTF-8 | 327 | 4.46875 | 4 | [] | no_license | # Given an integer n, find and print the sum of numbers from 1 to n.
# Note : Use while loop only.
# Input Format :
# Integer n
# Output Format :
# Sum
# Read input as specified in the question
# Print output as specified in the question
n = int(input())
i = 1
Sum = 0
while i <= n:
Sum = Sum + i
i += 1
prin... | true |
31eee1a0d7ecb4ae62e7d90edd51920005c9553c | Python | AlexKonkin92/stepic_study | /Строки/Вывод матрицы с элементами, представленными суммами соседних чисел.py | UTF-8 | 2,147 | 3.640625 | 4 | [] | no_license | #Напишите программу, на вход которой подаётся прямоугольная матрица в виде последовательности строк, заканчивающихся строкой,
# содержащей только строку "end" (без кавычек)
#Программа должна вывести матрицу того же размера, у которой каждый элемент в позиции i, j
#равен сумме элементов первой матрицы на позициях (i-1, ... | true |
4f941e79dab4748a533442bad6eddb3a0419f26e | Python | Aasthaengg/IBMdataset | /Python_codes/p02665/s170512018.py | UTF-8 | 411 | 2.78125 | 3 | [] | no_license | N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)
if N == 0:
if A[0] != 1:
print(-1)
else:
print(1)
exit()
ret = 1
children = 1 - A[0]
bottom -= A[0]
for i in range(N):
children = children * 2 - A[i+1]
if children <= -1:
ret = -1
break
bottom -= A[i+1]... | true |
ef016333db8b8085a60ec50cc51332aa7ffa98e1 | Python | gmarler/courseware-tnl | /labs/py2/decorators/greaterthanequals.py | UTF-8 | 866 | 3.0625 | 3 | [] | no_license | '''
>>> a = Angle(45)
>>> b = Angle(30)
>>> c = Angle(30)
>>> d = Angle(15)
>>> a == b
False
>>> b == c
True
>>> a > b
True
>>> b > a
False
>>> a >= b
True
>>> b >= a
False
>>> b >= b
True
>>> a >= d
True
'''
# Implement the greaterthanequals decorator here:
# Do not edit any code below this line!
@greaterthanequa... | true |
89983aaeb5020b8150db785a6d09d18c7362ed88 | Python | venkatsvpr/Problems_Solved | /LC_Largest_Substring_Between_Two_Equal_Characters.py | UTF-8 | 1,574 | 3.78125 | 4 | [] | no_license | """
1624. Largest Substring Between Two Equal Characters
Given a string s, return the length of the longest substring between two equal characters, excluding the two characters. If there is no such substring return -1.
A substring is a contiguous sequence of characters within a string.
Example 1:
Input: s = "aa"... | true |
7b1d28bbd56dbe161e2fc4a49a387acb89bdce20 | Python | jdanray/leetcode | /isSubtree.py | UTF-8 | 404 | 3.609375 | 4 | [] | no_license | # https://leetcode.com/problems/subtree-of-another-tree/
class Solution:
def isSub(self, s, t):
if not s:
return not t
if not t:
return False
if s.val != t.val:
return False
return self.isSub(s.left, t.left) and self.isSub(s.right, t.right)
def isSubtree(self, s, t):
if self.isSub(s, t):
re... | true |
54fc6f8169ffddb5d8ae3f42b8cca2cfbef8088e | Python | plougue/O_Platformer | /Sources/Characters/PC_Luc.py | UTF-8 | 3,163 | 2.953125 | 3 | [] | no_license | import pygame
from Sources.Pc import Pc
from Sources.Projectiles.PR_Stick import *
class PC_Luc(Pc):
'Base class for Luc'
def __init__(self, screen, initialPosition=[0,0]):
Pc.__init__(self,screen, "Luc", initialPosition)
# Attack related arguments
self.attackFrameDuration = 10
self.attackRemain... | true |
7798e6bc12f2157f37218711d40f52cc36b696f2 | Python | Pavitra-Shivanand-Hiremath/Machine-Learning-Projects | /Multiple_Linear_Regression/Multiple_Linear_regression_best_model.py | UTF-8 | 6,429 | 3.140625 | 3 | [] | no_license | '''
@Team 4:
Manasa Kashyap Harinath
Sravanthi Avasarala
Pavitra Shivanand Hiremath
Ankit Bisht
Overview: We are implementing 'Multiple linear regression' using least square method on a dataset with multiple predictors and single response variable. We are trying to predict the value of response variable based on a... | true |
9f90fb99e3666eeb16ffcf2a45b1ec32cd08afbc | Python | andreskask/taller-recursividad | /9. suma de digitos.py | UTF-8 | 275 | 3.734375 | 4 | [] | no_license | def inicio():
print sumaDigitos(raw_input("suma de digitos:\ningrese numero: "))
raw_input("enter para salir")
def sumaDigitos(numero):
if len(numero) < 2:
return int(numero)
else:
return int(numero[len(numero) - 1]) + sumaDigitos(numero[:-1])
inicio() | true |
1d124ad98bdea65054a4a4323706d26bc2440992 | Python | redspyder/redspyder | /agTimeout.py | UTF-8 | 1,343 | 3.140625 | 3 | [] | no_license | import subprocess, threading, os
##################################################################################################################################
# Class agTimeout
# Usage:
# agTimeout([cmd, args,], timeout).Run()
# cmd: command to be run
# args: arguments to command
# timeout: ti... | true |
31a05b7941695de7d738b70d922777ca6d297cf0 | Python | youaresoroman/pp1 | /01-TypesAndVariables/duringclass/19.py | UTF-8 | 97 | 3.765625 | 4 | [] | no_license | x = int(input("Podaj x: "))
y = int(input("Podaj y: "))
numbers = [x, y]
print(f"{sum(numbers)}") | true |
8c717b64db134649fa17388df123ef6db247bd8b | Python | hanwgyu/algorithm_problem_solving | /CTCI/1_5_OneAway.py | UTF-8 | 1,872 | 3.859375 | 4 | [] | no_license | # 1-5 One Away
import unittest
# Solution : 대문자 구분해서 52개의 배열에 갯수 입력하고, 두 벡터의 차이 벡터의 총합이 -1~1이고 제곱합이 2이하. O(n)
def function(string_a, string_b):
lower_cnt = [0 for _ in range(26)]
upper_cnt = [0 for _ in range(26)]
for alpha in string_a:
if alpha.islower():
idx = ord(alpha) - ord("a")
... | true |
e565dd59b69f72e5e7f946c154ba31e8537eb556 | Python | gsmcwhirter/simulations | /src/simulations/statsparser.py | UTF-8 | 6,615 | 2.515625 | 3 | [
"MIT"
] | permissive | """ Handle the parsing and aggregation of simulation results
Classes:
:py:class:`StatsParser`
main statistics parsing class
"""
import cPickle
import os
import sys
from simulations.base import Base
from simulations.base import withoptions
@withoptions
class StatsParser(Base):
""" Base class for par... | true |
5d7573cfb7a9828c2085dfb09400567646963bf6 | Python | jwong1MHS/Project-Euler | /Problem 20.py | UTF-8 | 132 | 3.4375 | 3 | [] | no_license | import math
fac = 100
number = math.factorial(fac)
sum_of_digits = sum(int(digit) for digit in str(number))
print(sum_of_digits)
| true |
842915753f528b99cb13e0a19e0bb420e13d5e1d | Python | swolfson/textManipulation | /wordfind.py | UTF-8 | 1,194 | 3.5625 | 4 | [] | no_license | '''
a script to find hidden words of a defined length in a sentence
Ex: "hope only traps a peasant"
---hidden 4 letter word "peon"
---hidden 3 letter word "sap", "ant", "rap", etc
'''
from sys import argv
import string
import json
script, n_letters, insentence = argv
test_sentence = "hope only traps. a peasant"
... | true |
f1c32a0458dac7d954111617bd7d20ae568ba19e | Python | EvenStrangest/PyTorch-BayesianCNN | /Image Recognition/utils/NonBayesianModels/ExperimentalCNNModel.py | UTF-8 | 1,711 | 2.546875 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
from utils.BBBlayers import FlattenLayer
class CNN1(nn.Module):
"""
Experimental self-defined CNN Model
"""
def __init__(self, outputs, inputs):
super(CNN1, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(inputs, 92, 3, stride=1),
... | true |
a9a9b2ceb10992a1628d06f2c40b03916ac5258f | Python | limgeonho/Algorithm | /inflearn/BFS/토마토.py | UTF-8 | 807 | 2.828125 | 3 | [] | no_license | from collections import deque
dx=[-1,0,1,0]
dy=[0,1,0,-1]
n, m=map(int, input().split())
board=[list(map(int, input().split())) for _ in range(m)]
Q=deque()
dis=[[0]*n for _ in range(m)]
for i in range(m):
for j in range(n):
if board[i][j]==1:
Q.append((i, j))
while Q:
tmp=Q.popleft()
... | true |
053b64b0d854cdfb10710aad336ac69ebc54644c | Python | OzTamir/Databases-Project | /ui/Views/new_category.py | UTF-8 | 1,001 | 3.203125 | 3 | [] | no_license | ####################################
#
# Databases project - UI.Views Package
#
####
#
# Written by: Oz Tamir
# Email: TheOzTamir@gmail.com
# Date: 25 - 02 - 2015
#
####
#
# Filename: new_category.py
# Description: Defines a view for creating new categories
#
####################################
from view_base imp... | true |
af768987e6c6947ddd7db24aa4602246f2b58d9c | Python | adam147g/ASD_exercises_solutions | /Obligatory tasks/Obligatory_task_01/01_exercise.py | UTF-8 | 538 | 3.78125 | 4 | [
"MIT"
] | permissive | # Proszę zaimplementować QuickSort tak, żeby używał najwyżej O(logn) dodatkowej pamięci.
from random import randint
def partition(T, p, r):
pivot = T[r]
i = p-1
for j in range(p, r):
if T[j] <= pivot:
i += 1
T[i], T[j] = T[j], T[i]
T[i+1], T[r] = T[r], T[i+1]
return... | true |
b1f79ef29c72d93b2174b8b365ea7aafc046a0b0 | Python | micahwar/Project-Euler | /26.py | UTF-8 | 691 | 2.875 | 3 | [] | no_license | def getCycleLength(d, n, r, c, f, k, j):
if (d in k):
return (r - 1) - k.index(d)
else:
k.append(d)
if not j:
if d < n:
d *= 10
if d < n:
f.append(0)
return getCycleLength(d*10, n, r+1, n, f, k, True)
else:
... | true |
8a3b6a8008bfa94db2ed4b1113689582d556b5a0 | Python | DevKokko/x509Validator | /verify-certificate.py | UTF-8 | 3,100 | 2.953125 | 3 | [] | no_license | import socket
import ssl
import datetime
import sys
help_text = """
Usage:
python verify-certificate.py <domain Name>
EXAMPLE: python verify-certificate.py www.hua.gr
OR with multiple domains: python verify-certificate www.hua.gr www.google.com
"""
try:
sys.argv[1]
except IndexError:
print help_text
ex... | true |
16721a62681abd3e8a7dc7e05b796a9d62966c90 | Python | GuiSilvaLoureiro/projeto_python_skyone | /main.py | UTF-8 | 1,834 | 3.4375 | 3 | [] | no_license | from projeto_python_skyone.Colaboradores import Colaborador
from projeto_python_skyone.Devs import Dev
from projeto_python_skyone.Squads import Squad
print('\n-==-=-=-=-=-=-=-=-=-=-=-Sky.One Solutions=-=-=-=-=-=-=-=-=-=-=-=-=-=-')
print('Bem vindo ao sistema de cadastro de squads!\n')
# Estrutura para cadastrar squa... | true |
ac9238ef3544b63fd4e152fcfcf06439de540004 | Python | back-js/Algorithm | /baekjun/1018.py | UTF-8 | 2,730 | 3.625 | 4 | [] | no_license | '''
지민이는 자신의 저택에서 MN개의 단위 정사각형으로 나누어져 있는 M*N 크기의 보드를 찾았다.
어떤 정사각형은 검은색으로 칠해져 있고, 나머지는 흰색으로 칠해져 있다. 지민이는 이 보드를 잘라서
8*8 크기의 체스판으로 만들려고 한다.
체스판은 검은색과 흰색이 번갈아서 칠해져 있어야 한다. 구체적으로, 각 칸이 검은색과 흰색 중 하나로 색칠되어 있고,
변을 공유하는 두 개의 사각형은 다른 색으로 칠해져 있어야 한다. 따라서 이 정의를 따르면 체스판을 색칠하는 경우는
두 가지뿐이다. 하나는 맨 왼쪽 위 칸이 흰색인 경우, 하나는 검은색인 경우이다.... | true |
0302123fe51a68926bda609364563eaedfc8c980 | Python | castrocp/SSC-analysis-scripts | /generatePED.py | UTF-8 | 1,796 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
from itertools import izip_longest
# Read in the SSC family ID mapping file and generate a pedigree file (.ped) for each family.
# The unaffected sibling is not being included since the GATK tools only work for trios
# function for iterating over a group in chunks of "n" size
def grouper(iterable, ... | true |
cc5b3ba64bdb6e969a86fe4d3eccd6d8bdade6e3 | Python | jbjares/websphere-automation-framework | /HelloWorld/br_gov_bnb_jython_exemplo/countdown.py | SHIFT_JIS | 828 | 3.1875 | 3 | [] | no_license | #-
# Name: countdown.py
# Role: Simple demonstration of a Jython Module
#-
'A holding place for some potentially useful functions'
#-
# Name: countdown()
# Role: Simple function
#-
def countdown( start=10 ):
'Simple function used to display countdown data'
while start > 0 :
print start,
start -= 1
print 'd... | true |
0eca859cdf9f7fa29fb9a9222875b8cfc845397c | Python | ttschuemp/Neural-Network-Optimization-Using-Evolutionary-Based-Algorithms | /support/plotting_helper.py | UTF-8 | 10,811 | 2.5625 | 3 | [] | no_license | #Plotting_helper.py
import numpy as np
import matplotlib
import seaborn as sns
from scipy import stats
import matplotlib.pyplot as plt
plt.style.use("seaborn-whitegrid")
from matplotlib.collections import LineCollection
from matplotlib import colors as mcolors
from matplotlib import cm as CM
import matplotlib.gridspec... | true |
44e95d792a6127023f6e24ef28f79ce982ec1647 | Python | MatMoore/hacks | /pyweek-8/gamelib/units.py | UTF-8 | 15,580 | 3.125 | 3 | [] | no_license | import math
import random
import pygame
import animation
import mapobject
import stuff
from constants import *
def vecadd(a, b):
try:
return (a[0] + b[0], a[1] + b[1])
except:
return (a[0] + b, a[1] + b)
def vecdel(a, b):
return (a[0] - b[0], a[1] - b[1])
def vecmul(a, b):
try:
... | true |
960b80f59c10fc206def0a75a830aea3b348a4d5 | Python | andressl91/UiO | /MEK4450 Offshore/oblig3/temperature.py | UTF-8 | 1,969 | 3.03125 | 3 | [] | no_license | import numpy as np
class Pipe:
def __init__(self, **kwargs):
self.wellhead = []
self.shore = []
self.wellpipe = []
self.shorepipe = []
for key in kwargs:
setattr(self, key, kwargs[key])
def temp(self, x, Q):
T = self.Tsea + (self.Tres - self.Tsea) \
*np.exp(-(np.pi*self.U*self.D*x/ \
(... | true |
fbc1744292f97dec47537aeda69900b7c2460b30 | Python | acorg/dark-matter | /dark/intervals.py | UTF-8 | 6,017 | 3.46875 | 3 | [
"MIT"
] | permissive | from math import log
from collections import Counter
class ReadIntervals:
"""
Hold information about the set of reads that match a subject.
@param targetLength: The C{int} length of the target sequence that the
reads are against.
"""
EMPTY = 0
FULL = 1
def __init__(self, targetL... | true |
0ebe37da4a5c175bc5f6089a7c10bd01c7dc2d93 | Python | OmerEkinci1/Test-Driven-Development | /lanes.py | UTF-8 | 3,950 | 3.640625 | 4 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
#şeritlerin koordinatlarını yakaldım
def make_coordinates(image, line_parameters):
slope , intercept = line_parameters
print(image.shape)
y1 = image.shape[0]
y2 = int(y1*(3/5))
x1 = int((y1 - intercept)/slope)
x2 = int((y2 - interce... | true |
ac917778e95dbfa556a73bdc3da9178a38d5d25e | Python | Aasthaengg/IBMdataset | /Python_codes/p03944/s297668517.py | UTF-8 | 579 | 3.453125 | 3 | [] | no_license | W, H, N = [int(x) for x in input().split()]
x_min, x_max, y_min, y_max = 0, W, 0, H
num_lists = [[int(x) for x in input().split()] for _ in range(N)]
for num_list in num_lists:
if num_list[2] == 1 and num_list[0] > x_min:
x_min = num_list[0]
if num_list[2] == 2 and num_list[0] < x_max:
x_max = ... | true |
38203e4a65b15a3bad00c21a253b422a561d1da8 | Python | josephbunton/corona | /exponential_fit.py | UTF-8 | 1,188 | 2.890625 | 3 | [] | no_license | import numpy as np
from scipy.optimize import curve_fit
import plotly.graph_objects as go
x = np.array(range(58))
y = np.array(
[3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 13,
22, 22, 26, 28, 38, 48, 55, 65, 65, 92, 112, 134, 171, 210, 267, 3... | true |
c53df0a9de83303403e77ec405b2a2db824b301e | Python | romanrdgz/smartcondor | /pyOptionAnalyzer/ib_api.py | UTF-8 | 21,847 | 2.703125 | 3 | [
"MIT"
] | permissive | '''
This script will access the IB API and download the option chain for given
securities
'''
from threading import Thread
from Queue import Queue
from ib.opt import ibConnection
from ib.ext.Contract import Contract
from time import sleep
import pandas as pd
import logging
import traceback # TODO debugging purposes on... | true |
5580abd720a215c2fdf587b9e0058d5ddad66a1a | Python | NukeWolf/Advent-Of-Code-2020-Nukewolf | /19/rules - Copy.py | UTF-8 | 1,832 | 2.90625 | 3 | [] | no_license | from pprint import pprint
import itertools
with open('input.txt','r') as f:
lines = f.read().split('\n\n')
rawRules = lines[0].splitlines()
rules = {}
for rawRule in rawRules:
key = rawRule.split(": ")[0]
rule = rawRule.split(": ")[1]
pipes = rule.split(" | ")
newPipes = []
for pipe in pipes:
... | true |
feba8dbcbd1cee45721e5bdea2de0bd8868baa2c | Python | leihuagh/python-tutorials | /books/AutomateTheBoringStuffWithPython/Chapter16/P05_textMyself.py | UTF-8 | 560 | 3.328125 | 3 | [
"MIT"
] | permissive | #! python3
# P05_textMyself.py - Defines the textmyself() function that texts a message
# passed to it as a string.
from twilio.rest import Client
# Preset values:
filepath = '/home/jose/PycharmProjects/python-tutorials/books/AutomateTheBoringStuffWithPython/Chapter16/twilio_info'
with open(filepath) as config:
a... | true |
09d66d96b19a0932f453c743d5aed5c99d34cb71 | Python | biparnakroy/certiClone | /certify.py | UTF-8 | 2,310 | 2.78125 | 3 | [] | no_license | import cv2
import csv
import shutil
import os
PATH = "temp1.png"
NAME_LIST_PATH = "Shankh_Mitra_Regestration_Final - Form Responses 1.csv"
def convert(list):
return tuple(list)
def getNames(csv_path):
with open(csv_path) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
names = []
... | true |
f204d820391f86eed440719760f7244434eccecd | Python | duduzzang/2020design_project | /Measuring Algorithm/line_scan.py | UTF-8 | 1,454 | 2.578125 | 3 | [] | no_license | from pathlib import Path
import cv2
import numpy as np
def line_scan(img):
h, w = img.shape[:2]
max_coord = []
max_length = 0
for line_idx, line in enumerate(img):
min_x = 0
max_x = w - 1
for idx in range(w):
if line[idx] == 0:
min_... | true |
c071f9820f2de3c5c64ae6945b129c28f78e705f | Python | goareum93/Algorithm | /Codeup/6029.py | UTF-8 | 222 | 3.515625 | 4 | [] | no_license | # n = int(input(), 16)
# print('%o', % n)
a = input()
n = int(a, 16) #입력된 a를 16진수로 인식해 변수 n에 저장
print('%o' % n) #n에 저장되어있는 값을 8진수(octal) 형태 문자열로 출력 | true |
06abc9a70355a743771d51e13ceb38a5ad9809f9 | Python | suchana172/My_python_beginner_level_all_code | /basic6/Writing_to_a_empty_file.py | UTF-8 | 361 | 2.734375 | 3 | [] | no_license | #ekta empty file create krbo jr file e informantion thakbe but output e empty thakbe.automatically programming.txt file create hobe
#Important & Interesting...
filename = 'programming.txt'
with open(filename,'w') as file_object: # here 'w meaning we want to open a file in write mode..
file_object.write("Suchana S... | true |
8877eaaefd14f8b451285cec5d04f16108520731 | Python | ECE-UW/assignment-1-shahriarreal | /test.py | UTF-8 | 3,771 | 3.265625 | 3 | [] | no_license | ## A simple unit test example. Replace by your own tests
from __future__ import print_function
from __future__ import division
import sys
import unittest
import a1ece650
class MyTest(unittest.TestCase):
def test_1(self):
#Test for checking intersection of two lines
result = a1ece650.inter... | true |
91661e031caeb821f87a2531afba97631afa8cea | Python | lupin4/MazeGenerator | /Scripts/maze_logic/data_structure/grids/grid_polar.py | UTF-8 | 11,886 | 2.859375 | 3 | [] | no_license | from random import choice, seed
from math import pi, floor, cos, sin
from mathutils import Vector
from .. cell import CellPolar
from .. grids . grid import Grid
class GridPolar(Grid):
def __init__(self, rows, columns, levels, cell_size=1, space_rep=0, *args, **kwargs):
self.rows_polar = []
self.do... | true |
b97516c32063fefec8526a3bb771076410a5b07c | Python | meliatiya24/Python_Code | /Lawas/Python/tugas algo/tugas5.py | UTF-8 | 1,197 | 3.65625 | 4 | [] | no_license | print ("Nama: Muhammad Agung Santoso")
print ("NIM : 182410103081")
print ("Algoritma dan Pemrograman II F")
print("selamat datang ditabungan study excursie ")
harga=1500000
cicilan=0
bulan=0
batas=12
kurang=0
terbayar=0
a=input("apakah anda akan membayar cicilannya ? ya/tidak ")
if a=="ya":
while bulan<=... | true |
bd6b478d86c3bb8df59342f5cc64d18cb6c50b32 | Python | RoKu1/cracking-the-coding-interview | /Stacks_and_Queues/5Sort_Stack.py | UTF-8 | 982 | 4.25 | 4 | [
"Apache-2.0"
] | permissive | """
3.5 Sort Stack: Write a program to sort a stack such that the smallest items are on the top. You can use
an additional temporary stack, but you may not copy the elements into any other data structure
(such as an array). The stack supports the following operations: push, pop, peek, and is Empty.
"""
from Stacks_and_... | true |
c4aa098422810cd368e576f1d982d35573abd2c3 | Python | Aasthaengg/IBMdataset | /Python_codes/p03231/s959015528.py | UTF-8 | 135 | 2.625 | 3 | [] | no_license | import math
N, M = map(int, input().split())
S = input()
T = input()
g = math.gcd(N,M)
print(N*M//g if S[::N//g] == T[::M//g] else -1)
| true |
e7486c9c93b155abbee28209410a3d335e070a21 | Python | xiang-daode/Python3_codes | /3_input交互输入二例.py | UTF-8 | 155 | 3.75 | 4 | [] | no_license | #交互输入:
s = input("Please enter you your name : ")
print('My god ! ',s)
n = int(input("Please enter an integer: N="))
print('2^N=',pow(2,n))
| true |
479c744cc8888e23765de9ebb0b0bee6c9cbe3b1 | Python | eschoeffler/homeauto | /thermostat/temp_util.py | UTF-8 | 481 | 2.640625 | 3 | [] | no_license | import json
from . import dbutils
def setf(sql, tempf):
set(sql, ftoc(tempf))
def set(sql, tempc):
cnx = sql.connect()
dbutils.write_therm(cnx, tempc)
cnx.close()
def get_current(sql):
cnx = sql.connect()
temp = dbutils.read_current_temp(cnx)
cnx.close()
return temp
def get_therm(sql):
cnx = sql.c... | true |
18a111805dbfd5b327d3966a98535337088a675f | Python | koushik192/DataScience_2019501103 | /introtoML/Code Camps/Logistic Regression/Logistic_regression_cc2.py | UTF-8 | 5,510 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.impute import KNNImputer
from sklearn.decompos... | true |
0a3945540c0d8a243bf3c24dae4a5f578a6cd0d0 | Python | dongkyu92/TIL | /Python/Algorithm/예산.py | UTF-8 | 279 | 3.09375 | 3 | [] | no_license | def solution(d, budget):
d.sort()
for idx, value in enumerate(d):
if value <= budget:
budget -= value
else:
idx -= 1
break
return idx+1
# print(solution([1, 3, 2, 5, 4], 9))
print(solution([2, 2, 3, 3], 10)) | true |
eb8b8ef9f3151c087962a6d9a1d1cc2e484e1a6f | Python | ausaki/data_structures_and_algorithms | /leetcode/reorder-routes-to-make-all-paths-lead-to-the-city-zero/381286751.py | UTF-8 | 980 | 2.84375 | 3 | [] | no_license | # title: reorder-routes-to-make-all-paths-lead-to-the-city-zero
# detail: https://leetcode.com/submissions/detail/381286751/
# datetime: Sun Aug 16 00:50:13 2020
# runtime: 920 ms
# memory: 38.8 MB
class Solution:
def minReorder(self, n: int, connections: List[List[int]]) -> int:
g1 = collections.defaultdi... | true |
1ab8feba631f8dc15beb8681bc20d55f13b0d9a8 | Python | grumpfou/AthenaWriter | /TextLanguages/TextLanguagesRules.py | UTF-8 | 10,735 | 2.828125 | 3 | [] | no_license |
from PyQt5 import QtGui, QtCore, QtWidgets
from CommonObjects.CommonObjects import COChoice,COTextCursorFunctions
from .TextLanguages import TLLanguage
from TextEdit.TextEditPreferences import TEDictCharReplace
all_quotes = ("“„«「","”»」")
all_spaces = ' \u00A0'
class TLRuleAbstract:
title="None"
description="None... | true |
43721fff2ae19a0f425c197538225dcaca326cdd | Python | kouhei-k/atcoder_submissions | /abc126/abc126_b/7854068.py | UTF-8 | 256 | 3.40625 | 3 | [] | no_license | S = input()
p = int(S[:2])
s = int(S[2:])
if (p > 12 or p == 0) and (s <= 12 and s > 0):
print("YYMM")
elif (p > 0 and p <= 12) and (s > 12 or s == 0):
print("MMYY")
elif p < 13 and s < 13 and p > 0 and s > 0:
print("AMBIGUOUS")
else:
print("NA")
| true |
8c758739af91a30240e6bb8923e5eef0f879ff11 | Python | Eqliphex/python-crash-course | /chapter02 - Variables & Simple Data types/name.py | UTF-8 | 398 | 4.375 | 4 | [] | no_license | name = "ada lovelace"
print(name.title()) # Makes all words titlecase
print(name.upper()) # Makes all characters uppercase.
print(name.lower()) # Makes all characters lowercase, good for storing data.
first_name = "ada"
last_name = "lovelace"
full_name = first_name + " " + last_name
print(full_name.title())
favor... | true |
3f3332ad029642a0b233eb699e9350abe435bbb9 | Python | qingpeng/jgi-ViCA | /scripts/modify_class_for_training.py | UTF-8 | 457 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import random
file_old_vector_obj = open(sys.argv[1], 'r')
file_new_vector_obj = open(sys.argv[2], 'r')
file_out_obj = open(sys.argv[3], 'w')
class_list = []
for line in file_old_vector_obj:
fields = line.split()
class_list.append(fields[0])
i = 0
for line in file_new_vecto... | true |
d513014d7308e6f1655f2648be35aaf511232fda | Python | mjlaali/housing_model | /src/housing_model/modeling/naive_deep/model_builder_test.py | UTF-8 | 2,212 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import tensorflow as tf
from housing_model.modeling.naive_deep.configs import (
HyperParams,
ArchitectureParams,
ModelParams,
)
from housing_model.modeling.naive_deep.model_builder import (
bits_to_num,
ModelBuilder,
)
def test_bits_to_num():
bits = tf.constant([[1, 0, 1], ... | true |
6db596ac2e57b27d8a33c39ad1990ac3d5140d66 | Python | kevinsogo/compgen | /examples/split/checker_generic.py | UTF-8 | 1,116 | 2.984375 | 3 | [
"MIT"
] | permissive | from kg.checkers import * ### @import
def get_sequence(stream, exc=Exception):
[m] = stream.read.int().eoln
ensure(m >= 0, exc("Invalid length"))
[b] = stream.read.ints(m).eoln
return b
def check_valid(a, b, exc=Exception):
# check subsequence
j = 0
for i in range(len(a)):
if j < l... | true |
e98f9a5e6c657152c55f6e9fa3d4e0844dcf1a04 | Python | DiegoD94/CapstoneAnormalyDetection | /Models/Sliding Window P-value.py | UTF-8 | 1,239 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
get_ipython().run_line_magic('matplotlib', 'inline')
sns.set()
# In[5]:
from scipy.stats import norm
import scipy.stats as stats
flatmiddle = pd.read_csv("artificialWithAnom... | true |
9a9034bbe357072d06200c17df30433209039e01 | Python | BlockResearchGroup/compas_cra | /src/compas_cra/algorithms/interfaces_numpy.py | UTF-8 | 5,164 | 2.6875 | 3 | [
"MIT"
] | permissive | """Identify interfaces for CRA extended assembly data structures."""
from math import fabs
from numpy import array
from numpy import float64
from scipy.linalg import solve
from scipy.spatial import cKDTree
from shapely.geometry import Polygon
from compas.geometry import Frame
from compas.geometry import local_to_wor... | true |
63de4173d5bf914899283b9da797c821d8190946 | Python | alkhenji/ecommercify | /store/models/products.py | UTF-8 | 3,921 | 2.53125 | 3 | [] | no_license | from django.db import models
from store.utils import *
from store.models.helpers import *
from store.models.stores import *
'''
Model representation of a Category.
A Category *should* have at least one Subcategory.
'''
class Category(models.Model):
class Meta:
verbose_name_plural = 'categories'
... | true |
6dc18e926bb43e0a90953fa8fafc2b90f021cb5a | Python | GBhavin/Hackerearth-Practice | /23. Array insert/arrayinsert.py | UTF-8 | 336 | 3.140625 | 3 | [] | no_license | arrayCount, queriesCount = list(map(int, input().split()))
array = list(map(int, input().split()))
for i in range(queriesCount):
operation, xPosition, yPosition = list(map(int, input().split()))
if operation == 1:
array[xPosition] = yPosition
elif operation == 2:
print(sum(array[xPosition:... | true |
836c7a47ce8340a5c243b899cf3ec8ab7b5ce7b1 | Python | LucaCappelletti94/dict_hash | /tests/test_hashable.py | UTF-8 | 998 | 3.15625 | 3 | [
"MIT"
] | permissive | import pytest
from time import time
from dict_hash import Hashable, validate_consistent_hash, sha256, NotHashableException
class MyHashable(Hashable):
def __init__(self, a: int):
self._a = a
self._time = time()
def consistent_hash(self) -> str:
return sha256({
"a": self._... | true |
7d07488cc30ffe3d95a188b3cc25389e4962e626 | Python | raviguru123/ajirasoft-com-chalange | /Leaders_in_an_array.py | UTF-8 | 644 | 3.3125 | 3 | [] | no_license | #code
def Leaders_in_an_array(list1):
length=len(list1)-1;
max=-9999;
leaders=[];
while(length>=0):
if(max<list1[length]):
max=list1[length];
leaders.append(max);
length-=1;
return reversed(leaders);
def main():
numtest=int(input());
out... | true |
0d1901d133c2610030d45e35fefcb6338285dbd1 | Python | dmcbffeng/coms_project | /SVMp_plus_Python_implementation/train_utils.py | UTF-8 | 16,089 | 2.765625 | 3 | [] | no_license | """
Utils for training SVMp+
Author: Fan Feng
"""
import numpy as np
import time
import os
import pandas as pd
from copy import deepcopy
from data_utils import get_kernel, get_Hessian, generate_start, get_obj_func_value, get_gradient_at_point, normalize_features
from direction_utils import permn, find_feasible_directio... | true |
75a082aed9d298397a32e75e0ca914e062234f60 | Python | ykmc/atcoder_old | /2019/0120_ABC116/B_AC.py | UTF-8 | 136 | 3.015625 | 3 | [] | no_license | S = int(input())
A = set([])
while S not in A:
A.add(S)
if S%2==0:
S //= 2
else:
S = S*3+1
print(len(A)+1)
| true |
996ff8507a9ffed1eb424a307f65e84a37bc085c | Python | Gagangithub1988/Python | /Python_basics/module1.py | UTF-8 | 159 | 3.1875 | 3 | [] | no_license | from random import *
for i in range(10):
print(randint(0,9),chr(randint(65,90)),randint(0,9),chr(randint(65,90)),randint(0,9),chr(randint(65,90)),sep='') | true |
667ae4255a1a9bb1251b2d3541a786191e640deb | Python | jackyops/examples | /threadeg/file_op.py | UTF-8 | 780 | 3.046875 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = 'Jacky.zhou'
# Date: '2018/3/1 22:06'
# r+ 读写
# w+ 写读 是先创建文件
f = open("txt",'w+',encoding="utf-8")
# for i in range(5):
# print(f.readline())
# for index,line in enumerate(f.readlines()):
# if index == 2:
# print("-------")
# con... | true |
9d8ac6300ad0ab0afaa5cf1bd8076b54efe60ab9 | Python | JamCrumpet/Lesson-notes | /Lesson 8 functions/8.22_python_standard_library.py | UTF-8 | 1,406 | 3.890625 | 4 | [] | no_license | # the python standard library is a set of module that comes with every python installation
# you can used the standard library to import modules, classes .ect to help completed tasks
# an example of this is OrderedDict from the module collections
# dictionaries allow you to connect pieces of information but they d... | true |
9fc29a2a57f6dd35196d0bce809acdda774a836a | Python | trumpumpumpum/ITEA_py | /lesson3_task2.py | UTF-8 | 216 | 3.5625 | 4 | [] | no_license | import functools
my_random_list_or_tuple = [1, 3, 3, 8]
print ("Сумма всех элементов : ",end="")
def function(a, b):
return a + b
print (functools.reduce(function, my_random_list_or_tuple)) | true |
fb12c234c2b1cf274d45e987ccb591b5c151455c | Python | Geminimax/PDIClassifier | /classifier.py | UTF-8 | 3,355 | 2.65625 | 3 | [] | no_license | import numpy as np
import mahotas as mh
import matplotlib.pyplot as plt
import skimage
import os
import joblib
from skimage import color, feature, exposure, io
LBP_PATH = "trained_models/knn_lbp.pkl"
HARALICK_PATH = "trained_models/knn_haralick.pkl"
COLOR_HIST_PATH = "trained_models/knn_colorHist.pkl"
LBP = "Linear Bi... | true |
3d152a00e871705d31db3a833338bdcc58028ed8 | Python | FernandotapiaCalua/t08_Tapia | /longitud15.py | UTF-8 | 138 | 2.828125 | 3 | [] | no_license | #longitud15
cadena ="espero mañana me puedas acompañar"
msg ="la longitud del tex es {}"
tex = cadena[1:20]
print(msg.format(len(tex)))
| true |
e7620557724424bc387fd5615c75d6d082239bec | Python | misrashashank/Competitive-Problems | /bubble_sort.py | UTF-8 | 481 | 4.5 | 4 | [] | no_license | #Bubble sort
def swap_custom(num1, num2, arr):
ind1 = arr.index(num1)
ind2 = arr.index(num2)
temp = arr[ind1]
arr[ind1] = arr[ind2]
arr[ind2] = temp
def count_swaps(a):
count = 0
for _ in range(len(a)):
for item in range(len(a)-1):
if a[item] > a[item+1]:
swap_custom(a[item], a[item+1], a)
count +... | true |
6933cdd1ae6f04cb92358a27ccbfb8b9b6246620 | Python | asmw/andOTP-decrypt | /andotp_decrypt.py | UTF-8 | 4,471 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""andotp-decrypt.py
Usage:
andotp-decrypt.py [-o|--old] [--debug] [-h|--help] [--version] INPUT_FILE
Options:
-o --old Use old encryption (andOTP <= 0.6.2)
--debug Print debug info
-h --help Show this screen.
--version Show version.
"""
import os
import sys
import hashlib
... | true |
13afaf76abdbda56559ef5d5005f8776ce435bc9 | Python | peterpark77/project | /multiple.py | UTF-8 | 2,515 | 3.09375 | 3 | [] | no_license |
import numpy
import matplotlib.pyplot as plt
from brownian import brownian
import matplotlib.animation as animation
from matplotlib.figure import Figure
import sys
import numpy as np
def main():
fig = plt.figure(figsize=(8,8))
ax = fig.add_axes([0.1, 0.1, 0.8,0.8])
# Total time.
T = 50.0
# max N... | true |
b6328326b3c08265a3bfff749460d851d44b1057 | Python | ivenpoker/Python-Projects | /Projects/Project 0/Warm-up/python-division.py | UTF-8 | 538 | 3.875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
#: Program Purpose:
#: Read two integers 'a' and 'b' print two lines.
#: The first line should contain integer division, a // b.
#: The second line should contain float division, a / b .
#:
#: Program Author: Happi Yvan <ivensteinpoker@gmail.com>
#: P... | true |
2725c3a45ecef6816f0bfb7b07bd61ecd90c5526 | Python | daveatrandom/Assignment3 | /Assignment3_2_1.py | UTF-8 | 1,722 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# David Paculdo
# W205
# Assignment 3
import os
import pymongo
import string
from collections import Counter
#Global program variables
db_name="db_tweets"
db_name2="db_restT"
db_name3="db_followers"
coll="tweets"
users="userlist"
conn=pymongo.MongoClient()
#Make sur... | true |
37d1b1b21b44f1e79bfcaef8c108ac6c7bdc8a0a | Python | singnet/snet-marketplace-service | /contract_api/consumers/event_consumer.py | UTF-8 | 2,955 | 2.84375 | 3 | [
"MIT"
] | permissive |
class EventConsumer(object):
#move s3 util to this construc
def _comapre_assets_and_push_to_s3(self, existing_assets_hash, new_assets_hash, existing_assets_url, org_id,
service_id):
"""
:param existing_assets_hash: contains asset_type and its has value s... | true |
4abe2dc4cede774e82ccd2b99d5cfd0c5a200731 | Python | brandontrabucco/best_first | /data/create_tfrecords.py | UTF-8 | 3,181 | 2.625 | 3 | [
"MIT"
] | permissive | """Author: Brandon Trabucco, Copyright 2019"""
import tensorflow as tf
import pickle as pkl
import os
import sys
import argparse
def create_sequence_example(
inner_image_path,
inner_sample
):
image_path_feature = tf.train.Feature(
bytes_list=tf.train.BytesList(value=[bytes(inner_image_pa... | true |
01af7c366f92d47abf7949c5a15d53a28f37f04f | Python | sergebsn/python | /hm3_task_3.py | UTF-8 | 329 | 3.640625 | 4 | [] | no_license | def first_func(var_1, var_2, var_3):
if (var_1 + var_2) > (var_2 + var_3):
return print('If first Sum =', var_1 + var_2)
elif (var_2 + var_3) > (var_3 + var_1):
return print('If second Sum = ', var_2 + var_3)
else:
return print('If third Sum = ', var_3 + var_1)
print(first_func(20,... | true |
a6d920417c2c07ff52e18da80dc9588a9306e8f2 | Python | fredkeemhaus/zero_base_algorithm | /python_basic/section07-1-1.py | UTF-8 | 523 | 3.515625 | 4 | [] | no_license | # 초기화
class UserInfo:
# ① 속성(프로퍼티), ② 메서드로 구분된다
# 1. __init__ 을 통해 초기화를 헤야 한다
# 2. 인스턴스 생성 시에, (매직 메서드) __init__이 실행된다!
def __init__(self, name):
self.name = name
print(self.name, '으로 초기화!')
def user_info_p(self):
print("Name:", self.name)
user1 = UserInfo('junhee')
user2 ... | true |
3a30547e07c311adce2b1ffa8c6678ad9ebd0c06 | Python | aashishrai3799/gender-classification | /classify_gender.py | UTF-8 | 1,489 | 3.0625 | 3 | [
"MIT"
] | permissive | # import necessary packages
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import numpy as np
import argparse
import cv2
import os
# handle command line arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to input image")
ap.add_a... | true |
26dc6a62ac0ea02cf588316e6268cc846400f74b | Python | gokarna123/Gokarna | /lab2.exe12.py | UTF-8 | 37 | 2.84375 | 3 | [] | no_license | x=5
a=x+3
print("The value of x:", a) | true |
6b72af4a335bef774043933d234a6c79af0ae0d5 | Python | geyixin/Data-Analysis-In-Action-python3 | /code/discrete_point_detect.py | UTF-8 | 2,945 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
__author__ = 'geyixin'
'''
利用k-means实现离群点检测
'''
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
inputpath = '../Data/consumption_data.xls'
data = pd.read_excel(inputpath, index_col='Id')
# print(data.head(3))
dat... | true |
1fa21147a63cd70788f0b9976e9cc3c9b293ad05 | Python | Rajshreed/Robotics-crowdNav | /CNN/util/Solver.py | UTF-8 | 268 | 2.609375 | 3 | [] | no_license | import tensorflow as tf
class Solver:
def __init__(self, loss):
self.lr = tf.placeholder(dtype=tf.float32,shape=[])
solver = tf.train.GradientDescentOptimizer(self.lr)
#solver = tf.train.MomentumOptimizer(self.lr,0.95)
self.minimize = solver.minimize(loss)
| true |
aad573bea5dc59e409c04537ff8a72a94e0f3a3a | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2340/60703/249777.py | UTF-8 | 668 | 2.90625 | 3 | [] | no_license | n=int(input());
ans=[];
for i in range(n):
N=int(input());
height =[int(x) for x in input().split()];
MAX = max(height);
MAXindex = 0;
area=0;
for i in range(N):
if(height[i]==MAX):
MAXindex = i;
leftMax=0;
for i in range(MAXindex):
if(height[i]<leftMax):
... | true |
9e18c6c93bd56e25a984d3d8608c50c78e4de7b0 | Python | Jesuvi27/Best-Enlist-2021 | /day19.py | UTF-8 | 2,461 | 2.734375 | 3 | [] | no_license | import openpyxl
path = "studdata.xlsx"
wb_obj = openpyxl.load_workbook(path)
sheet_obj = wb_obj.active
cell_obj = sheet_obj.cell(row = 5, column = 3)
print(cell_obj.value)
for i in range(1,12):
cell_obj = sheet_obj.cell(row = 5, column = i)
print(cell_obj.value)
import mysql.connector
mydb = mysql.conne... | true |
3f86a6fdf3138f13f55f16229713642436bb1f81 | Python | ishulai/ZotCalc | /public/javascripts/data/importclasses.py | UTF-8 | 2,469 | 2.734375 | 3 | [] | no_license | # coding: utf-8
from bs4 import BeautifulSoup
import re
import json
import urllib2
import unidecode
reg = re.compile("^\((.+)\)\.?$")
def parseGE(s):
s = s.replace(", ", " and ").split(" and ")
b = []
for a in s:
if reg.match(a) != None:
b.append(reg.match(a).groups()[0].split(" or "))
else:
b.append(a.... | true |
84626a3e937783f6da2ebafdbe828d73864cf868 | Python | kkkgabriel/rubiks_solver | /notebooks/solver.py | UTF-8 | 5,430 | 3.765625 | 4 | [] | no_license | from rubiks import *
# solver class
class solver():
# parameters:
# startCube (cube): the cube you want to solve
# h (function): the heuristic that you want the solver to use to solve the cube
# The heuristic function should take in a tuple of (c, moves),
# where c is th... | true |
1737f385d4e40e773279a8941de7b9dd7789f38e | Python | nathan-ocampo/SHG_analysis | /SHG_Data_Analysis_FOV.py | UTF-8 | 30,913 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 8 10:46:08 2021
@author: natha
"""
from scipy.stats import ttest_ind
import math
import os
import pandas as pd
#Ask User Heart and Location to fetch dataset and later create excel sheet with series name
heart = input("Heart #: ")
ltn = input("Location #: ")
con = 'ctrl'... | true |
fcb4a088121b3150c69b6a784a43bf8954028ff5 | Python | zuosong/python | /code_in_book/tkhello3.py | UTF-8 | 264 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
import Tkinter
top = Tkinter.Tk()
hello = Tkinter.Label(top,text = 'Hello World!')
hello.pack()
quit = Tkinter.Button(top,text = 'QUIT',command = top.quit,bg = 'blue',fg ='white')
quit.pack(fill = Tkinter.X,expand =1)
Tkinter.mainloop()
| true |
d3b9a05e8980a8e767d3a80c78e29269a1287fe1 | Python | fangyue6/MyPythonCode | /pythonCode/workspace/Study/src/PythonCore/09/09_02.py | UTF-8 | 1,992 | 3.65625 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Created on 2015年4月10日
@author: fangyue
'''
'''
文件模式 操作
r 以读方式打开
rU 或 Ua 以读方式打开, 同时提供通用换行符支持 (PEP 278)
w 以写方式打开 (必要时清空)
a 以追加模式打开 (从 EOF 开始, 必要时创建新文件)
r+ 以读写模式打开
w+ 以读写模式打开 (参见 w )
a+ 以读写模式打开 (参见 a )
rb 以二进制读模式打开
wb 以二进制写模式打开 (参见 w )
ab 以二进制追加模式打开 (参见 a )
rb+ 以二进制读写模式打开 (参见... | true |
6a4d228202c62391704ce3ce6fe21d94e88d6c5a | Python | afterIife/sources | /webhook-spammer/webhook-spammer.py | UTF-8 | 982 | 2.78125 | 3 | [] | no_license | import discord_webhook
from discord_webhook import DiscordEmbed, DiscordWebhook
import string
import random
import discord
import os
import colorama
from colorama import Fore, Style
import requests
import time
from colorama import Fore
import time, datetime
import json
def sbammah():
webhook = input(f... | true |
b43beedcba0bc78b0e9d7e7daaca448aad193118 | Python | Emanuele96/RL-Peg-Solitaire | /main.py | UTF-8 | 1,754 | 3.3125 | 3 | [] | no_license | import game
import actor
import critic
import variables
import matplotlib.pyplot as plt
from progress.bar import IncrementalBar
if __name__ == "__main__":
#initializate actor and critic modules
actor_module = actor.Actor()
critic_module = critic.Critic(actor_module)
# Initializate lists used for pl... | true |
d4429c2ac254e50ce37c027d2a3469c7ab6150d6 | Python | algby/pyBomberman | /GameOverLogic.py | UTF-8 | 2,593 | 2.84375 | 3 | [] | no_license |
class GameOverLogic:
game = None
def __init__(self, nick):
self.nick = nick
stage = GameOverLogic.game.mapa.stage
players = GameOverLogic.game.players
teamScores = None
if players != None:
if stage == "STAGE1_4":
self.setStatus(self.getWinners... | true |
3e8e66ff86fdbec84de1c5af6b216fe67042b582 | Python | ByronHsu/Parallel-Computing | /chap6/6_13/seq.py | UTF-8 | 1,316 | 3.15625 | 3 | [] | no_license | import copy
state = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
]
next_state = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
]
m = len(state)
n = len(state[0])
n_iter = 10
for _iter in range(n_... | true |
f9bbf836bd3cc41a8b5e216574cf6a0f406f1c61 | Python | ruduran/advent_of_code | /2017/python/src/aoc/day18/part1.py | UTF-8 | 1,137 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
from . import BaseProcessor, BaseProgram
class Program(BaseProgram):
def __init__(self, instruction_list):
super().__init__(instruction_list)
self.played_sound = 0
self.is_sound_recovered = False
def snd(self, operand):
self.played_sound = self.get_valu... | true |
18f13fd7e38b67600e5c2c8a6686fc73ff92459f | Python | BryantLuu/daily-coding-problems | /20 - Intersecting LinkedList.py | UTF-8 | 1,461 | 3.515625 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class ListNode():
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
aLen... | true |
f03d1e57935b1d3ff1cedc7ef4dcdaddcaaf773b | Python | FXIhub/hummingbird | /hummingbird/utils/array.py | UTF-8 | 4,475 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive | # --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# ----------------------------------------------------------------... | true |
441d2c1f4e5a72a33e9a6242320a04d889c49381 | Python | SungJaeYu/SpreadNodes | /neighbor.py | UTF-8 | 355 | 2.9375 | 3 | [] | no_license | class Neighbor:
idNum = -1
posX = 0
posY = 0
posZ = 0
def __init__(self, idNum, posX, posY, posZ):
self.idNum = idNum
self.posX = posX
self.posY = posY
self.posZ = posZ
def getNeighborID(self):
return self.idNum
def getNeighborPos(self):
ret... | true |
dcd0b9e2e6cd2ecb6b90ac2254dc547fbb2f4226 | Python | mcannamela/mike-cs-code | /pyrticle/particleSolver.py | UTF-8 | 22,039 | 2.6875 | 3 | [] | no_license | import helpers
from helpers import *
import solvers as sol
import particle as part
import scipy
from pylab import *
from plotMacros import *
from numpy import *
import cPickle
import time
import pdb
import cProfile
import pstats
import threading
#import mlabMacros as mlm
#try:
# from mayavi import mlab as ml
#except... | true |
a109f5d43fced0cd831ec368df93844b2da422fb | Python | advaitb/EEG-NeuroLinguistics | /Code/ynclassify.py | UTF-8 | 1,464 | 2.625 | 3 | [] | no_license | # Author: Aparajita Haldar (@ahaldar)
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from keras.optimizers import SGD
import numpy
from sklearn.decomposition import PCA
from sklearn.preprocessing import normalize
# fix random seed for reproduc... | true |
95598078019c1d6d2bec95eff5908c6ac644d69b | Python | SylvainGuieu/i3cm | /process/motors_function.py | UTF-8 | 727 | 2.859375 | 3 | [] | no_license | import time
from ..core.process import add_simulator_callback, simulator_dict
import numpy as np
# this is a simulator for the motors function
# to be replaced by real function
N=4
simulator_dict['motors_currents'] = {i:0.0 for i in range(N)}
def read_current(bit):
return simulator_dict['motors_currents'][bit]... | true |