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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
81a20ede57a2393e8832da6e660876845740fb71 | Python | ian-chelaru/Puzzle | /controller.py | UTF-8 | 1,739 | 3.03125 | 3 | [] | no_license | from problem import Problem
class Controller:
def __init__(self, problem):
self.__problem = problem
def get_problem(self):
return self.__problem
def bfs(self, root):
queue = [root]
while len(queue) > 0:
current_state = queue.pop(0)
if current_state... | true |
b3fc1fd3ba4f1a2f11d715ef5efed35a00b7d620 | Python | austinogiza/meeting-planner | /meetings/models.py | UTF-8 | 734 | 2.734375 | 3 | [] | no_license | from django.db import models
from datetime import date, time
# Create your models here.
class Meetings(models.Model):
title = models.CharField(max_length=500)
date = models.DateField()
start_time = models.TimeField()
duration = models.IntegerField()
room = models.ForeignKey('Room', on_delete=mode... | true |
08bd9b2b70504ec645ed157293d0661bb1cb3246 | Python | parampavar/incubator-dolphinscheduler | /tools/release/github/changelog.py | UTF-8 | 5,400 | 2.8125 | 3 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | true |
12c8b45e68b0affee313e1bab6be4c962e881746 | Python | akshaychawla/Accelerated-Training-by-disentangling-neural-representations | /loss_layers.py | UTF-8 | 2,420 | 3.203125 | 3 | [
"MIT"
] | permissive | import keras.backend as K
from keras.layers import Lambda, concatenate
def triplet_loss(y_true, y_pred):
"""
y_true : FAKE
y_pred : (3,embedding_units) vector
"""
alpha = 0.1
anchor = y_pred[0, :]
positive = y_pred[1,:]
negative = y_pred[2,:]
loss = K.sqrt(K.sum(K.square(anchor-posi... | true |
6db350a58a8ad622463aff8706c2f730b8d9b83b | Python | rrichy/boilerplate-time-calculator | /time_calculator.py | UTF-8 | 1,172 | 3.390625 | 3 | [] | no_license | def add_time(start, duration, day = None):
hh, mm, nn = start.replace(':', ' ').split()
days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
time_start = 0
if hh == '12' and nn == 'AM': time_start = int(mm)
elif nn == 'AM': time_start = int(hh) * 60 + int(mm)
el... | true |
df6fde5963642da6e86b746d3345b523cf7be202 | Python | ahmadrana24/Game-code-Python | /GAME FINAL.py | UTF-8 | 120,846 | 3.109375 | 3 | [] | no_license | import time
import sys
import turtle as t
def drawline(x1,y1,x2,y2):
t.speed(4)
t.penup()
t.goto(x1,y1)
t.pendown()
t.goto(x2,y2)
def map():
x1=-600
y1=300
x2=-450
y2=300
drawline(x1,y1,x2,y2)
x1=-450
y1=300
x2=-450
y2=150
drawline(x1,y1,x2,y2)
x1=-450... | true |
1a748702779e78b729420b2e577403dec15795fc | Python | drageryd/IronPythonEngine | /Examples/test4.py | UTF-8 | 185 | 2.59375 | 3 | [] | no_license | import time
print("HELLO FROM PYTHON")
print(cube.get_name())
print(cube.get_commands())
cube.test(600)
time.sleep(2)
cube.test2(200)
time.sleep(5)
print("hej")
time.sleep(5)
| true |
0a82a45011518a6d95c9186c5c33922e1957655d | Python | cjustus7984/Insight-interview | /VisualizeClusters.py | UTF-8 | 6,627 | 2.671875 | 3 | [] | no_license |
__author__ = 'Chris'
import os
import sys
import csv
import string
import datetime
import statistics
import numpy as np
import glob
import time
import itertools
import matplotlib.pyplot as mplt
#from pylab import *
from collections import defaultdict
def SpreadCmp( CL1, CL2 ):
if CL1.GetSpr... | true |
82d6346dd5b6689efe9b2669c4637d742bf24ff9 | Python | BruceEckel/ThinkingInPython | /residual/code/PythonForProgrammers/list.py | UTF-8 | 106 | 3.6875 | 4 | [] | no_license | # QuickPython/list.py
list = [ 1, 3, 5, 7, 9, 11 ]
print(list)
list.append(13)
for x in list:
print(x) | true |
432a473dd5e3bf67a2d58f76973d1e6f10d8c354 | Python | bartoszmaleta/4th-Self-instructed-week | /errors_and_exceptions_cd2.py | UTF-8 | 1,935 | 4.5 | 4 | [] | no_license | # print('------------------------------------------------ The with statement, Using the exception object')
# Code works, COMMENTED JUST TO RUN THE NEWEST CODE FASTER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# try:
# age = int(input("Please enter your age: "))
# except ValueError as err:
# print(err, '\nwrong type')... | true |
137e9b4de972f739a1bc4f5fc76deef35bcc34d8 | Python | gregmuellegger/annotatedocs | /annotatedocs/contrib/metrics/textstats.py | UTF-8 | 832 | 2.703125 | 3 | [] | no_license | from __future__ import division
import nltk
from ... import Metric, NodeType, metrics
__all__ = ('TextStats',)
@metrics.require(NodeType)
class TextStats(Metric):
'''
Adds some statistics like average word length, sentence length etc.
'''
def limit(self, nodeset):
return nodeset.filter(is... | true |
4f60e22e9385d85040c6f5892751b1ee066d07c5 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/590.py | UTF-8 | 1,262 | 3.140625 | 3 | [] | no_license | '''
Created on Apr 11, 2014
@author: mandy
'''
import sys
numLinePerTest = 10
def magicTrick(fileName):
f = open(fileName, 'r')
lines = f.readlines()
numTests = int(lines[0])
for i in xrange(numTests):
currentRow = i*numLinePerTest+1
firstRow = getChosenRowData(currentRow, lines)
... | true |
419f30cf626a724480d29520f476d1b1ef1bda40 | Python | Magnus9/pandairc | /irctab.py | UTF-8 | 6,776 | 2.75 | 3 | [] | no_license |
from nick import Nick
import gtk
import gobject
import pango
import time
class IRCTab(gtk.VBox):
'''
The IRCTab class represents a tab that contains
textural data. This can either be a private chat
with a person, or a channel. Other than keeping track
of the data within the tab, it... | true |
127c69788e1466c59ce934c7037ae4469cca5850 | Python | FazedAI/OpenSeq2Seq | /open_seq2seq/optimizers/lr_policies.py | UTF-8 | 7,842 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2017 NVIDIA Corporation
"""
Module containing various learning rate policies. Learning rate policy can
be any function that takes arbitrary arguments from the config (with additional
``global_step`` variable provided automatically) and returns learning rate
value for the current step.
"""
from __future_... | true |
0c5bab4b95d6bfd3a15f3868619a407a818c2315 | Python | dhmit/gender_analysis | /gender_analysis/analysis/dunning.py | UTF-8 | 27,294 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | import math
from collections import Counter
from operator import itemgetter
import matplotlib.pyplot as plt
import seaborn as sns
import nltk
from gender_analysis.gender.common import HE_SERIES, SHE_SERIES
from gender_analysis.text.common import (
load_graph_settings,
MissingMetadataError,
store_pickle,
... | true |
ea45ebbb7708f3a4c2f819773840836d2f5cb518 | Python | Nofitaika/Belajar-Git | /Kuis kamus.py | UTF-8 | 4,034 | 2.90625 | 3 | [] | no_license | Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> data3 = [1,2,3,4,5,6,7,8,9,10,11,12,13]
>>> data3
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
>>> ganjil = []
>>> for i in data3:
if i%2 == 1;
... | true |
b95dd7fff8c275cb1925d60b659c3808be3536ad | Python | AugustoDipNiloy/Uri-Solution | /Python3/uri1013.py | UTF-8 | 339 | 3.421875 | 3 | [
"MIT"
] | permissive | class Main:
def __init__(self):
self.li = []
self.li = input().split()
def maxValue(self):
return max(max(int(self.li[0]), int(self.li[1])), int(self.li[2]))
def output(self):
print("{mx} eh o maior".format(mx = self.maxValue()))
if __name__ == '__main__':
obj = Main(... | true |
45f3ac80a9adeb5f71e1f0fc49f0b30f87fc1e08 | Python | MANOJPATRA1991/Data-Structures-and-Algorithms-in-Python | /Searching and Sorting/Binary Search/bsmain.py | UTF-8 | 1,062 | 4.6875 | 5 | [] | no_license |
def binary_search(input_array, value):
"""
Binary search
Args:
input_array: List in which to search
value: Item to search for
Returns:
Integer: Index of the element if found else -1
"""
# Keeps track of start index
first = 0
# Keeps track of end index
last = ... | true |
a0a5a0ec24a343e5c9dab15a9329ee923deb5717 | Python | JanKalo/RelAlign | /thirdParty/OpenKE/models/Model.py | UTF-8 | 4,425 | 2.65625 | 3 | [
"MIT"
] | permissive | #coding:utf-8
import numpy as np
import tensorflow as tf
class Model(object):
@staticmethod
def __orthogonal_procrustes(r, a, b):
return tf.norm(tf.subtract(tf.matmul(r, a), b), ord='fro', axis=(0, 1))
@staticmethod
def _tensor_alignment(a, b):
# assuming that b is a successor of a tha... | true |
9ad84aef435a8ea6d013469b8d21a3538be2c303 | Python | galactocalypse/python | /Unit4/sol20.py | UTF-8 | 1,182 | 3.6875 | 4 | [] | no_license | # Prob20: Mastermind
s = raw_input('Enter 4-digit key: ')
iarr = list("0123456789")
arr = list("0123456789")
for i in range(10):
iarr[i] = 0
for i in s:
if ord(i) >= 48 and ord(i) <= 57:
iarr[ord(i) - 48] += 1
tries = 0
gs = []
while True:
invalid = True
while invalid:
print 'Used guesses: ', gs
invalid = Fal... | true |
cb1a9029ce76e2782e959e31334ee87f22b0443d | Python | joshuaNewman10/ml | /ml/text/experiment/char_level_language_model.py | UTF-8 | 435 | 2.734375 | 3 | [] | no_license | from keras import Input, Model
from keras.layers import LSTM, Dense
class CharLevelLanguageModelExperiment:
def get_model(self, max_document_length, vocabulary_size):
input = Input(shape=(max_document_length, vocabulary_size))
x = LSTM(units=75)(input)
y = Dense(vocabulary_size, activation... | true |
0f8e0e76de80f4be342baaef82598dca4eec1927 | Python | joeljosephjin/La-MAML | /get_data.py | UTF-8 | 1,423 | 2.609375 | 3 | [] | permissive | # Copyright 2019-present, IBM Research
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import download
import argparse
def get_mnist_data(url, data_dir):
print("Downloading {} into {}".format(url, data_dir))... | true |
45e3f8875e1315b702da71c089ff8984af3768cc | Python | kikijtl/coding | /Candice_coding/Practice/test.py | UTF-8 | 173 | 3.203125 | 3 | [] | no_license | class A(object):
def __init__(self):
self.a = 0
A.b = 1
a1 = A()
print a1.a, a1.b
A.b = 2
a2 = A()
print a1.a, a1.b, A.b
print a2.a, a2.b, A.b | true |
d5c13d07d331c79ac9ee3aa64038073e31d8e82c | Python | Heanthor/rosalind | /proj4/cmsc423_project4-master/cmsc423_project4-master-ed5d0fae5f139092241f814406dc136d09a08fb8/pileup_user.py | UTF-8 | 1,290 | 3.125 | 3 | [] | no_license | from pileup import PileUp
from approximate_matcher import ApproximateMatcher
from Bio import SeqIO
def read_fa_file(filename):
f = open(filename, 'rU')
reads = []
for record in SeqIO.parse(f, "fasta"):
reads.append(record.seq._data)
if len(reads) == 1:
return reads[0]
else:
... | true |
9311b167d4421fe6d29a0c5eac28a0f456ed5f1d | Python | danielzgsilva/CL-MOT | /src/lib/utils/image.py | UTF-8 | 12,605 | 2.671875 | 3 | [] | no_license | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... | true |
2dc3b12e2ebbae8301a4e6b89d775bc852a82c45 | Python | kamelzcs/leetcode | /next_permutation.py | UTF-8 | 948 | 3.296875 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 zhao <zhao@kamel-Desktop>
#
# Distributed under terms of the MIT license.
class Solution:
# @param num, a list of integer
# @return nothing (void), do not return anything, modify num in-place instead.
def nextPermutation(... | true |
88a0d00b1093e24d38beb455d38ffb430a9e5c5a | Python | joemzhao/generative | /adversarial/full/helpers.py | UTF-8 | 2,756 | 2.75 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import json
def generate_samples(sess, trainable, candidates, output_file):
generated_samples = trainable.generate(sess, candidates)
with open(output_file, "w") as fout:
for item in generated_samples:
temp = ' '.join([str(x) for x in item]) + '\n'
... | true |
5e706118980e642541b84d9dce825261c1b107c0 | Python | kylin910/python | /Demos/Guess_Game/Guess_game2_Limited Times.py | UTF-8 | 577 | 3.796875 | 4 | [] | no_license | print("猜猜我心里想的数字是几?\n");
record=3;
result=6;
guess=0;
while guess!=result and record>=1:
guess=int(input("\n输入你猜得数字:\n"));
if guess==result:
print("哇哦!心有灵犀一点通!^_^");
else:
if guess<8:
record=record-1;
print("猜错了哦! 猜得有点小了哦!"+" 还有"+str(record)+"次机会了!");
... | true |
5e56a602c2d91713d19750a490c6beadd13d614b | Python | penyugalova/dz | /dz4/dz4_functions.py | UTF-8 | 7,532 | 3.21875 | 3 | [] | no_license | # encoding: utf-8
__author__ = 'Liubov Penyugalova'
import sys
import pickle
import os
import sys
#1.1 Берем задачу из дз №3. Выделяем следующие процессы в функции: ввод команды - отдельная функция
def action_func():
act = input('Нажмите 1 чтобы внести данные. 2 чтобы увидеть весь список. 3 чтобы найти определен... | true |
6c9ea3a6c27c4775d12f84ed52ef5a4e358d7810 | Python | daemon/keras-base | /base.py | UTF-8 | 1,581 | 2.546875 | 3 | [
"MIT"
] | permissive | from collections import deque
from collections import namedtuple
import os
import re
class Learner(object):
def __init__(self, model, model_io_mgr=None, save_interval=100):
self.model = model
self.model_io_mgr = model_io_mgr
self.n_iter = 0
self.save_interval = save_interval
if model_io_mgr:
... | true |
dde1d65e4c0621431960d4f9f29616c44da73d64 | Python | tlevine/data-guacamole | /groceries.py | UTF-8 | 1,155 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python2
'''Here are some queries against the SupermarketAPI.
I didn't wind up using them.'''
import os
from urllib import urlencode
from urllib2 import urlopen
from lxml.etree import fromstring
APIKEY = os.environ['SUPERMARKETAPI_APIKEY']
def get_xml(url):
'Download a url and parse it to an XML t... | true |
e697daba745b0baa6d91e6c797980d23e748b9dc | Python | quemazon/mycode | /misc/work/rename files.py | UTF-8 | 1,698 | 2.671875 | 3 | [] | no_license | #this generates a file list for the database and
# Import the os module, for the os.walk function
import os
import re
import pickle
from Tkinter import Tk
from tkFileDialog import asksaveasfilename
from tkFileDialog import askdirectory
from numpy import genfromtxt
global namedic
namedic = {}
Tk().withdraw() # we do... | true |
d219661a37113899e016fffbdf6103fda556bbe2 | Python | Aasthaengg/IBMdataset | /Python_codes/p03496/s125620312.py | UTF-8 | 654 | 3.125 | 3 | [] | no_license | n = int(input())
A = list(map(int, input().split()))
ans = []
maxa = max(A)
mina = min(A)
if abs(mina) > abs(maxa):
for i in range(n)[:0:-1]:
if A[i-1] > A[i]:
while A[i-1] > A[i]:
ma = min(A)
argmina = A.index(ma)
A[i-1] += ma
ans.... | true |
f3637a9e0e0ad058e87504fa37b255000bcca657 | Python | markanethio/gretel-python-client | /src/gretel_client/transformers/fpe/fpe_prefix_cipher.py | UTF-8 | 1,300 | 2.90625 | 3 | [
"Apache-2.0",
"Python-2.0"
] | permissive | from Crypto.Cipher import AES
from gretel_client.transformers.fpe.crypto_aes import IV_ZERO, CipherError
class FpePrefixCipher:
def __init__(self, min: int, max: int, key: bytes):
self.min = min
self.max = max
self.range = max - min
weights = []
cipher = AES.new(key, AES.MO... | true |
5c6ad791d38d23ce29445086fb55370978458e70 | Python | ksaisujith/Course-Projects-Python | /Balances/balances.py | UTF-8 | 9,456 | 3.65625 | 4 | [] | no_license | __author__ = "Sai Sujith Kammari"
'''
CSCI-603: LAB 8
Author1: SAI SUJITH KAMMARI
Author2: KEERTHI NAGAPPA PRADHANI
Draws the balance with the weights provided. If the torque on the right doesn't match then exits
'''
import sys
import turtle
# global constants for turtle window dimensions
WINDOW_WIDTH = 2000
WIN... | true |
24743dd4564c0fdff078aea75adc154eb5cc738b | Python | UT-CHG/meteor | /meteo_data/hwind_data/hwind_file.py | UTF-8 | 6,475 | 3.03125 | 3 | [] | no_license | import sys
import numpy as np
import matplotlib.pyplot as plt
import re
import datetime as dt
from utilities.utilities import haversine
class HwindFile:
def __init__(self, pressure_central, ramp, file_path):
self.pressure_central = pressure_central
self.ramp = ramp
self.file_path = file_p... | true |
dbc134f9eabe1f526de3ed71800dab6041d77d6c | Python | noahbroyles/minecraft-server | /main.py | UTF-8 | 3,050 | 2.65625 | 3 | [] | no_license | import os
import shutil
import subprocess
import requests
from tqdm import tqdm
dir_path = os.path.dirname(os.path.realpath(__file__))
server_dir = dir_path + "/server/"
""" Description
:type file:
:param file:
:type word:
:param word: - what should be replaced
:type replacement:
:p... | true |
295eafbea5cd7070d2783c137bb2948a8185e540 | Python | markm3010/counter-code | /count_words.py | UTF-8 | 557 | 3.59375 | 4 | [] | no_license | import re
'''
Count number of words in a file
'''
def count_words(f: object) -> object:
with open(f) as fh:
data_src = fh.read()
word_detector = re.compile(r'(\b[1-9a-z?.-]+)(\s|\n)?', re.IGNORECASE)
data_set = word_detector.finditer(data_src)
ct = 0
for word in data_set:... | true |
ff7f4e4f1a81b71362babf772e2e1d1ec2fe6ee4 | Python | 718795325/python-code | /django/2_模板/代码/day02/App/views.py | UTF-8 | 2,130 | 2.625 | 3 | [] | no_license | from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
# Create your views here.
from django.urls import reverse
def index(request):
return HttpResponse("首页")
def show(request,name,age):
return HttpResponse(name + ":"+str(age))
def call(req... | true |
08f3c7e10bd0de4de6b784737e3223f46c944a48 | Python | MrHowdyDoody/testrepo | /a2.py | UTF-8 | 3,759 | 3.8125 | 4 | [] | no_license | # Do not import any modules. If you do, the tester may reject your submission.
# Constants for the contents of the maze.
# The visual representation of a wall.
WALL = '#'
# The visual representation of a hallway.
HALL = '.'
# The visual representation of a brussels sprout.
SPROUT = '@'
# Constants for... | true |
ae7911f2694aeccd46c077661c21c6a8a22d65cc | Python | smwhr/lahotline | /Action.py | UTF-8 | 1,267 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def playable(func):
def wrapper(*args):
func(*args)
if(args[0].description is not None):
args[1].player.say(args[0].description)
return wrapper
class Action(object):
pass
class Goto(Action):
def __init__(self, room_name):
self.room_name = room_name
def execute(se... | true |
e5695ff36da356cdaf8e8573a6f062b15adf588e | Python | rev233/huolala | /wordcount.py | UTF-8 | 2,611 | 3.1875 | 3 | [] | no_license | import re # 正则表达式库
import collections # 词频统计库
import numpy as np # numpy数据处理库
import jieba # 结巴分词
from wordcloud import wordcloud, ImageColorGenerator # 词云展示库
from PIL import Image # 图像处理库
import matplotlib.pyplot as plt # 图像展示库
# 读取文件
fn = open('result.txt', 'r', encoding='utf-8') # 打开文件
string_data = fn.read... | true |
5dca326063709c96415eda832062845e04ea0eea | Python | Moscdota2/Archivos | /python1/UniversidadPython/iterarrangos.py | UTF-8 | 71 | 3.015625 | 3 | [] | no_license | tupa = (13,1,8,3,2,5,8)
for n in tupa:
if n <= 5:
print(n) | true |
b90f6431bdde74a842c606d97d34e5157e56d900 | Python | partho-maple/coding-interview-gym | /leetcode.com/python/785_Is_Graph_Bipartite.py | UTF-8 | 789 | 3.21875 | 3 | [
"MIT"
] | permissive | from collections import deque
class Solution(object):
def isBipartite(self, graph):
"""
:type graph: List[List[int]]
:rtype: bool
"""
color = {}
for node in range(len(graph)):
if node not in color and graph[node]:
queue = deque([node])
... | true |
c5232323f9f1372e57cad7793479f4e85c98df78 | Python | cgcai/alfred-currency-convert | /lib/currency.py | UTF-8 | 2,664 | 2.671875 | 3 | [] | no_license | import json
import time
from lib.openexchangerates import OpenExchangeRates as API
CURRENCY_CACHE = 'currencies.json'
RATES_CACHE = 'latest.json'
RATES_FRESHNESS = 6 * 60 * 60 # 6 hours
class Conversion(object):
def __init__(self, api_key, currency_cache=CURRENCY_CACHE,
rates_cache=RATES_CACH... | true |
af4e345f89c61cdce08df2dd2472ef6cb8631dd5 | Python | MaximDmitrievich/IT-master | /MasterWork/MLVision/ViolaJohnes/main.py | UTF-8 | 1,658 | 2.71875 | 3 | [] | no_license | from argparse import ArgumentParser
import time
import cv2
import numpy as np
def integral_image(img):
int_img = np.zeros(img.shape)
for i, _ in enumerate(img):
for j, _ in enumerate(img):
if i is not 0 and j is not 0:
int_img[i, j] = img[i, j] + img[i - 1, j]
el... | true |
c2ec202b8dbf99de4f510121007aa9c4e1568952 | Python | aDENTinTIME/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/backup_9.py | UTF-8 | 125 | 3.5 | 4 | [] | no_license | #!/usr/bin/python3
def print_last_digit(number):
string = str(number)
print(string[-1:], end="")
return int(string[-1:])
| true |
6c2cb90bb432ffecd85dcded88c9daf27c2b9ad5 | Python | Fluorescence-Tools/tttrlib | /examples/release_highlights/plot_release_highlights_0_20_0.py | UTF-8 | 2,472 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | """
========================================
Release Highlights for tttrlib 0.23
========================================
.. currentmodule:: tttrlib
We are pleased to announce the release of tttrlib 0.20, which comes
with many bug fixes and new features! We detail below a few of the major
features of this release. Fo... | true |
950da2d4636b8e267f88af63ac5388760cb13eaa | Python | PranaliDesai/Algorithms_DataS | /Calculate_Size_of_a_binary_tree.py | UTF-8 | 124 | 3 | 3 | [] | no_license | def size(node):
if node is None:
return 0
else:
return (size(node.left)+ 1 + size(node.right))
| true |
2f1676db0602c195803aa12116e38b0ad6b0c22e | Python | leonamtv/mlp | /main_and.py | UTF-8 | 582 | 2.875 | 3 | [] | no_license | from core.MLP import MLP
from random import shuffle
EPOCHS = 2000
mlp = MLP(2, 3, 1, 0.3)
dataset = [
([ 0, 0 ], [ 0 ]),
([ 0, 1 ], [ 0 ]),
([ 1, 0 ], [ 0 ]),
([ 1, 1 ], [ 1 ])
]
for i in range ( EPOCHS ) :
erroAproxEpoca = 0
erroClassEpoca = 0
data = dataset
shuffle ( data )
for... | true |
5e05d44ae8a5a45becbaad7e8b2fbc01623113e4 | Python | CommissarMa/PythonTutorCMa | /3Python重要数据类型/3_2字符串/3_2_1概述.py | UTF-8 | 362 | 3.09375 | 3 | [] | no_license | # 字符串是一种有序的字符集合,用于表示文本数据。
# 字符串中的字符可以是ASCII字符、各种符号以及各种Unicode字符。
# 严格意义上,字符串属于不可变序列,意味着不能直接修改字符串。
# 字符串中的字符安装从左到右的顺序,具有位置顺序,即支持索引、分片等操作。 | true |
c758f8567c9a8b1c0d9ca89edaf81a2fb38bc733 | Python | vandosant/data-science-from-scratch | /correlation.py | UTF-8 | 1,368 | 3.625 | 4 | [] | no_license | from __future__ import division
def dot(v1, v2):
return sum(v1_i * v2_i for v1_i, v2_i in zip(v1, v2))
def mean(x):
return sum(x) / len(x)
def de_mean(x):
x_bar = mean(x)
return [x_i - x_bar for x_i in x]
def covariance(x, y):
n = len(x)
return dot(de_mean(x), de_mean(y)) / (n - 1)
def sum_... | true |
7115100d1cf7ece4342ec27c55c7ec63a26b218b | Python | pperone/FinnBot | /finn_bot.py | UTF-8 | 2,483 | 2.609375 | 3 | [] | no_license | import os
import time
import re
from slackclient import SlackClient
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
finn_bot_id = None
RTM_READ_DELAY = 1
MENTION_REGEX = "^<@(|[WU].+?)>(.*)"
def parse_bot_commands(slack_events, counter):
for event in slack_events:
if event["type"] == "mes... | true |
14ec6f114ee407067bcb866e1d0c80e634a6a33c | Python | Edyta2801/Python-kurs-infoshareacademy | /code/Day_12/pole_klasy.py | UTF-8 | 4,134 | 4.21875 | 4 | [] | no_license | # pola klasy
class Pracownik(object):
'''Definiuje Pracownika'''
# pola klasy - widoczne przez wszystkie instancje
liczba_pracownikow = 0
roczna_podwyzka = 5
def __init__(self, imie, stanowisko):
'''Konstruktor.
imie, nazwisko - str, str
'''
self.imie = imie
... | true |
d3467921ec0bc0b28137f2f039a963fe2c66979b | Python | YJAJ/Intelligent_systems | /Assignment1/Breadth_First_Search.py | UTF-8 | 3,553 | 3.484375 | 3 | [] | no_license | from collections import deque
from Utility import is_goal_state, total_state, is_queen_safe_col
class Breadth_First_Search():
'''Implement pruned breadth first search'''
def __init__(self):
self.frontier = deque()
self.explored = set()
self.solutions = list()
self.nSolution = 0
... | true |
9feaaf3cde25820ed476bbbf290055e4ebc16c54 | Python | du4182565/dctest | /python/python_test/storage.py | UTF-8 | 1,039 | 2.828125 | 3 | [] | no_license | __author__ = 'Administrator'
class StoreTest(object):
databases = []
def initbase(basename):
basename = {}
basename[1] = {}
basename[2] = {}
basename[3] = {}
def add_database(self,basename):
initbase(basename)
dabases.append(basename)
return
de... | true |
9a7fa26211cc1a8accbef8933cedd62375a3784e | Python | gottaegbert/penter | /tensorflow_v2/dragen1860/Tutorials/01-TF2.0-Overview/conv_train.py | UTF-8 | 5,027 | 2.796875 | 3 | [
"MIT"
] | permissive | import os
import time
import numpy as np
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # or any {'0', '1', '2'}
import tensorflow as tf
from tensorflow.python.ops import summary_ops_v2
from tensorflow import keras
from tensorflow.keras import datasets, layers, models, optimizers, metrics
model = tf.keras.Sequential([... | true |
3a9bcd279b40b916a8df92da5169d37780d57d4e | Python | EinarK2/einark2.github.io | /_site/Forritun/Forritun 2/Skila 4/mætingarlisti.py | UTF-8 | 362 | 2.96875 | 3 | [
"CC-BY-4.0"
] | permissive | n, r, c = [int(x) for x in input().split()]
l1 = []
l2 = []
l3 = []
for x in range(r):
radirnofn = input()
l1.append(radirnofn)
for x in l1:
l3.extend(x.split())
for x in range(n):
nofn = input()
l2.append(nofn)
if l3[:c] == l2[:c]:
print("left")
else:
print("right")
if l3[c:] == l2[c:]:
... | true |
5f570d811bd2ca14f441341e3f869262250fbd06 | Python | sabeeh99/Batch-2 | /Marjana_Sathar.py | UTF-8 | 289 | 3.703125 | 4 | [] | no_license | #MARJANA SATHAR-2-COUNTDOWN(TIME MODULE)
import time
'''we import time module so we can use sleep which delays time'''
def num():
'''returns value from 1 to 10 in descending order with a time delay of 1 sec'''
for i in range(10,0,-1):
print(i)
time.sleep(1)
num()
| true |
e2102084ef2d969dc1c157500d9b91c11fbec9f7 | Python | git123hub121/Python-spider | /爬取王者荣耀图片/wzry.py | UTF-8 | 2,268 | 2.765625 | 3 | [] | no_license | import requests
import os
url = 'https://pvp.qq.com/web201605/js/herolist.json'
header = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36'
}
reponse =requests.get(url=url,headers=header)
hero_list = reponse.json()#这个方法要查一下 见txt 用来对j... | true |
ba070f30cb1e3213971c6d937339db63a9020041 | Python | ravalrupalj/BrainTeasers | /Edabit/Retrieve_the_Subreddit.py | UTF-8 | 429 | 3.609375 | 4 | [] | no_license | #Retrieve the Subreddit
#Create a function to extract the name of the subreddit from its URL.
import re
def sub_reddit(string):
r=re.findall(r"/(\w+)/$",string)
return ''.join(r)
print(sub_reddit("https://www.reddit.com/r/funny/") )
#➞ "funny"
print(sub_reddit("https://www.reddit.com/r/relationships/") )
#➞ "re... | true |
2084449f72b58dff73d3131e0ee8ed12b44acd71 | Python | phattymcG/useful_scripts | /hashcrack.py | UTF-8 | 1,122 | 3.734375 | 4 | [] | no_license | #!/usr/bin/python
import sys
from hashlib import sha1
def main(wordlist):
"""Crack a hash using a wordlist.
Simple loop to crack a hash. Default is the default user password
algorithm for post-4.1 mySQL. A simple sha1 alternative is listed
as well.
Assumes a wordlist consisting of words separate... | true |
9487a25bb3ee7a9804e97d4058e2c6f5bbfea889 | Python | victorfarias/Exemplos_sala_ML_2020_1 | /5_normalizacao.py | UTF-8 | 824 | 3.40625 | 3 | [] | no_license | import numpy as np
def normalizacao01(x):
minx = np.amin(x)
maxx = np.amax(x)
return (x-minx)/(maxx-minx)
def normalizacao_media(x):
minx = np.amin(x)
maxx = np.amax(x)
meanx = np.mean(x)
return (x-meanx)/(maxx-minx)
def padronizar(x):
meanx = np.mean(x)
stdx = np.std(x)
retur... | true |
0724f64598fdbea3ea80d4b1cfd122c57dbef522 | Python | hassyGo/NLP100knock2015 | /iwai/set6/exp57.py | UTF-8 | 1,732 | 3.03125 | 3 | [] | no_license | # !/usr/bin/python
# coding:UTF-8
# 6-(57):かかり受け解析
#Stanford Core NLPの係り受け解析の結果(collapsed-dependencies)を有向グラフとして可視化せよ.可視化には,係り受け木をDOT言語に変換し,Graphvizを用いるとよい.また,Pythonから有向グラフを直接的に可視化するには,pydotを使うとよい.
#.dotの実行方法 -> dot -Tpng 57.dot -o 57.png
import re
import sys
import exp50
def make_collapsed_dependencies(document): ... | true |
84918c08eea792888062a74b508da24969ceb1f8 | Python | MYMSSENDOG/leetcodes | /16. 3Sum Closest.py | UTF-8 | 1,392 | 3.359375 | 3 | [] | no_license | def differ (a:int, b:int)->int:
if a>b:
return a-b
else:
return b-a
nums = [0,2,1,-3]
target = 1
difference = 9999999
min_def = 99999999
nums.sort()
n = len(nums)
for mid in range(1, n - 1):
left = 0
right = n - 1
#################################### 기본틀에 추가한 부분 다음#까지 ...
bigges... | true |
f2c0e4114b4ec2169941d3eb03d12e26f62d9706 | Python | TrickyOldFox/UsefullThings | /Modules/mod_math.py | UTF-8 | 294 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 14 23:36:35 2019
@author: ihor
"""
def Lsin(a):
import math
return list(map(math.sin,a))
def Lcos(a):
import math
return list(map(math.cos,a))
def Lexp(a):
import math
return list(map(math.exp,a))
| true |
2750753b983a258eadd65a61d585c4ca9ed246b7 | Python | DevaO7/Applied-Programming-Assignments | /APL/A5/Report Files/code1.py | UTF-8 | 1,118 | 3.21875 | 3 | [] | no_license | # Initializing the Potential Array
phi = zeros([Nx, Ny])
x = arange(-(Nx-1)/2, (Nx+1)/2)
y = arange(-(Ny-1)/2, (Ny+1)/2)
X, Y = meshgrid(x, y)
ii = where(X*X+Y*Y <= radius*radius)
phi[ii] = 1
error = []
# Updating the Potential, Computing the Error , Updating the Boundary Conditions
for i in range(Niter):
... | true |
ad6f89bb4a59c8a0565151cb269dad69d8fbe2fc | Python | giga487/invertedPendulum | /Amato_Visualizzatore_NoFilter_Quaternioni_CuboNuovo/lettura_seriale.py | UTF-8 | 2,223 | 2.6875 | 3 | [] | no_license | import serial
import threading
from threading import Thread
import filtraggio
import time
import math
class LetturaSeriale(Thread):
def __init__(self,nome,time_read,imu):
Thread.__init__(self)
self.nome = nome
self.time_read = time_read
self.imu = imu
self.lock = threading.... | true |
7d36e3995d31b68b3465f05eaf5a17273d2d9e0e | Python | Aasthaengg/IBMdataset | /Python_codes/p00005/s272165987.py | UTF-8 | 194 | 3.328125 | 3 | [] | no_license | def gcd(a,b):
if a%b==0:
return b
return gcd(b,a%b)
while True:
try:
a,b=sorted(map(int,input().split()))
except:
break
print(gcd(a,b),a//gcd(a,b)*b) | true |
fe588f222435a0f560d27014c4f1b996f65ae1c2 | Python | OldJohn86/Langtangen | /chapter3/Heaviside.py | UTF-8 | 252 | 3.5625 | 4 | [] | no_license | def Heaviside(x):
'''
Computes the Heaviside funtion
'''
if x < 0:
return 0
else:
return 1
for i in range(-1,2):
print 'Heaviside(%d) = %d' % (i, Heaviside(i))
'''
python Heaviside.py
Heaviside(-1) = 0
Heaviside(0) = 1
Heaviside(1) = 1
'''
| true |
5f8182c743e4afad041afbc3ad586072d01185f3 | Python | Shrey09/Sentiment-Semantic-Analysis | /sentiment_analysis.py | UTF-8 | 2,777 | 3.328125 | 3 | [] | no_license | import csv
import re
from langdetect import detect
tweet=[] #store raw tweets
tweets=[] # store cleaned tweets
f1=open("positive-words.txt","r") #dictionary of positive words
f2=open("negative-words.txt","r") #dictionary of negative words
f3=open("stop-words.txt","r") #dictionary of stop-words
pos=f1.read()
pos=... | true |
3b18bcf021a56f2f10f8339a555cf61746135a39 | Python | j1nn33/study | /python/conspect/Parser/regular/parse_dhcp_snooping.py | UTF-8 | 3,134 | 3.3125 | 3 | [] | no_license | # Разбор вывода команды show ip dhcp snooping с помощью именованных групп
# -*- coding: utf-8 -*-
import re
#'00:09:BB:3D:D6:58 10.1.10.2 86250 dhcp-snooping 10 FastEthernet0/1'
regex = re.compile('(?P<mac>\S+) +(?P<ip>\S+) +\d+ +\S+ +(?P<vlan>\d+) +(?P<port>\S+)')
"""
(?P<mac>\S+) + - в группу с... | true |
dc7ef09e6638691654877ee6d8cf4e083183516f | Python | jonahhill/mlprojects-py | /TimeSeriesRegression/algorithms/XGBoost.py | UTF-8 | 617 | 2.828125 | 3 | [] | no_license | import pandas as pd
import xgboost as xgb
#http://datascience.stackexchange.com/questions/9483/xgboost-linear-regression-output-incorrect
#http://xgboost.readthedocs.io/en/latest/get_started/index.html
#https://www.kaggle.com/c/higgs-boson/forums/t/10286/customize-loss-function-in-xgboost
df = pd.DataFrame({'x':[1,2... | true |
7f3a82c677345ec89c558e12350012870464fac5 | Python | ck-china/pythonjc | /mon2/p02/zuoye.py | UTF-8 | 1,109 | 3.140625 | 3 | [] | no_license | class ZhiWu:
def __init__(self,name,gongneng,dongzuo):
self.name=name
self.gongneng=gongneng
self.dongzuo=dongzuo
def jieshao(self):
print('我是 %s ,我的作用是 %s'%(self.name,self.gongneng))
def zhuangtai(self):
print('%s 正在 %s '%(self.name,self.dongzuo))
def __str__(sel... | true |
6d4f3767ee7015a8802e65a6813daf7c5f5616c4 | Python | kidache97/CasualNotes | /leetcode/leetcode2.py | UTF-8 | 10,665 | 3.59375 | 4 | [] | no_license | from typing import List
from collections import defaultdict
import collections
'''
01背包问题
二分查找
快速排序
两数之和(数组无序)
两数之和(数组有序)
....
'''
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def removeNthFromEnd(head, n): # 删除链表倒数第n个结点
global i
if head is None:
... | true |
5b2b8e34c41a318c08bc56c1da453ceaf9bda640 | Python | psioro/CoffeMachine_for_hyperskill | /CoffeeMachine.py | UTF-8 | 4,048 | 3.9375 | 4 | [] | no_license | class CoffeeMachine:
coffee_machine_existence = 0
water = 400
milk = 540
coffee_beans = 120
disposable_cups = 9
money = 550
def __new__(cls):
if cls.coffee_machine_existence < 1:
cls.coffee_machine_existence += 1
return object.__new__(cls)
def __init__(s... | true |
9c826b51daa700d6ad3799776693f0742cbec099 | Python | aismail/AmI-Platform | /core/echo_pdu.py | UTF-8 | 389 | 2.5625 | 3 | [] | no_license | from pdu import PDU
class EchoPDU(PDU):
def __init__(self, **kwargs):
self.QUEUE = kwargs.pop('input_queue', 'echo')
self.OUTPUT_QUEUE = kwargs.pop('output_queue', 'echo_outputs')
super(EchoPDU, self).__init__(**kwargs)
def process_message(self, message):
self.log("Echo-ing me... | true |
d23521f16ff3e7b8908c7559b531d936d0f2d814 | Python | Belco90/smartninja-wd1 | /lesson_7/conversor.py | UTF-8 | 626 | 4.3125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
print "Hello! This is a unit converter that converts kilometers into miles."
choice = 'yes'
while choice.lower() == "y" or choice.lower() == "yes":
print "Please enter a number of kilometers that you'd like to convert into miles. Enter only a number!"
km = raw_input("Kilometers: ")
... | true |
430bca74f48f1cb33f892cc2692fde47cc95e1af | Python | Dan4ik2504/2021-1-MAILRU-SDET-Python-D-Mashkovtsev | /Homework_7/utils/wait.py | UTF-8 | 511 | 2.78125 | 3 | [] | no_license | import time
import exceptions
def wait(method, error=Exception, timeout=10, interval=0.5, **kwargs):
st = time.perf_counter()
last_exception = None
while time.perf_counter() - st < timeout:
try:
result = method(**kwargs)
return result
except error as e:
... | true |
9a456f8329a291c351c50f42934b2aacb0b6f135 | Python | nciefeiniu/python-test | /web/flask_test/flask_test.py | UTF-8 | 456 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/hello/<name>')
def hello_world(name):
return render_template('hello.html', name=name)
@app.route('/user/<username>', methods=['POST','GET'])
def show_user_profile(username):
# show the user profile for that user
... | true |
75ce77882d8d26f58762fe65e70fb14ffb4bf5aa | Python | UKPLab/naacl2019-like-humans-visual-attacks | /code/VIPER/viper_dces.py | UTF-8 | 8,429 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | '''
Use an external lookup method to disturb some text. In this case, we take the textual descriptions of each character,
and find the nearest neighbours in the list of unicode characters by finding characters with the largest number of
matching tokens in the text description.
Example usage:
python3 viper_dces.p... | true |
ff290be9dd7300a4d2824664b7b4d0a2c0510857 | Python | alexanderjardim/crawler-sample-1 | /app/extractor.py | UTF-8 | 280 | 2.578125 | 3 | [] | no_license | from lxml import html
from urllib.parse import urlparse
def extract(page_string):
document = html.fromstring(page_string)
items = document.xpath('//img[re:test(@src, "\\.png($|\\?)", "i")]/@src', namespaces={'re': 'http://exslt.org/regular-expressions'})
return items | true |
de8458fff84c7e32f1e0edb6ab6af9e6cb2ea577 | Python | kartik-devops/Myprogs_Public | /pythonAssignment_1.py | UTF-8 | 732 | 3.890625 | 4 | [] | no_license | """
a=int(input("Enter First num : "))
b=int(input("Enter Second num : "))
c=int(input("Enter Third num : "))
print("SUM IS :")
print(a+b+c)
"""
"""a=input("Enter First string : ")
b=input("Enter Second string : ")
c=input("Enter Third string : ")
print("CONCATENATION IS : ")
print(a+" "+b+" "+c)
"""
"""
... | true |
a8b4f78ff8983610337e2f901c43284e60f9ddee | Python | nischalshrestha/automatic_wat_discovery | /Notebooks/py/tino76/assignment-2-titanic/assignment-2-titanic.py | UTF-8 | 4,917 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import skew
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
get_ipython().magic(u"config ... | true |
a1ed13b97c21c96e007b744a32d186976729c448 | Python | alardosa/python-hero | /amP7tf.py | UTF-8 | 279 | 3.703125 | 4 | [] | no_license | def square(n):
result = n**2
return result
print(square(2))
# output: 4
# simplify
def square(n):
return n**2
print(square(2))
# output: 4
# simplify
def square(n): return n**2
print(square(2))
# output: 4
square = lambda num: num ** 2
print(square(2))
# output: 4 | true |
0afcfc6adac53dc421a5d8a914edb47996cc9136 | Python | ZhengKeli/OpticalInterpretation | /model_chemical.py | UTF-8 | 3,800 | 2.875 | 3 | [] | no_license | import braandket as bnk
from components import Cavity, Band
from utils import eig_map
class Atom(bnk.KetSpace):
""" Atom with 2 electron orbits, having 4 possible states. """
def __init__(self, potential_0=0.0, potential_1=-1.0, potential_2=-4.0, potential_3=-5.0, name=None):
super().__init__(4, name... | true |
aa2d044d06d2e3be6f263d069c1502c72c56c758 | Python | 10to8/django-tastypie-extendedmodelresource | /example/api/tests.py | UTF-8 | 3,469 | 2.625 | 3 | [] | no_license | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.contrib.auth.models import User
from django.test import LiveServerTestCase
import requests
import simplejson
from api.model... | true |
7053a62ef4f15977b4a6b945c292937307b6ee9b | Python | Greek-and-Roman-God/Athena | /codingtest/week08/level11_brute_force/black_jack.py | UTF-8 | 338 | 2.828125 | 3 | [] | no_license | # 블랙잭
n, m=map(int, input().split())
cards=list(map(int,input().split()))
sum_list=[0]*n
for idx,card in enumerate(cards):
for idx2,card2 in enumerate(cards[idx+1:]):
sum=card+card2
for card3 in cards[idx+idx2+2:]:
if sum+card3<=m and sum+card3>sum_list[idx]:
sum_list[idx]=sum+card3
print(max... | true |
8c23b56fcbfdfd4201f8bde48c712264997b19bf | Python | Askhat-Bukeyev/my_robotiq | /robotiq_USB.py | UTF-8 | 6,344 | 2.84375 | 3 | [] | no_license | # Python class to connect and control Robotiq 3-f gripper
# Writing with python 3.5
class Robotiq_USB:
def __init__(self, LINUX_PORT = '/dev/ttyUSB1',WIN_PORT = 'COM6' , my_baudrate=115200):
import sys
import serial
# Variables
self.gripper_status = [] #
self.cur... | true |
b68c0ce4167007947ba148041d606344926fa180 | Python | luyajie/stockmining | /stock charting/basicgraph.py | UTF-8 | 6,534 | 2.890625 | 3 | [] | no_license | import time
import datetime
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
# change font of the labels
import matplotlib
matplotlib.rcParams.update({'font.size': 9})
# candle stick
from matplotlib.finance import candlestick_ochl
stocks = 'AAPL',... | true |
bafcff98f24fc6e229b92d24bfbf7d737a260cb9 | Python | uenewsar/nlp100fungos | /chap1/02.py | UTF-8 | 350 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 02. 「パトカー」+「タクシー」=「パタトクカシーー」
# 「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ.
a = "パトカー"
b = "タクシー"
c = ''
for i in range(len(a)):
c += a[i]
c += b[i]
print(c)
| true |
f20935e0cd5d6c9ccbadff570790fac797a28205 | Python | ushiko/AOJ | /ALDS1/ALDS1_4_A.py | UTF-8 | 485 | 2.546875 | 3 | [] | no_license | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_A&lang=jp
# Linear Search : python3
# 2018.12.08 yonezawa
#from collections import deque
import sys
input = sys.stdin.readline
#import cProfile
def main():
n1 = int(input())
s1 = set(map(int,input().split()))
n2 = int(input())
s2 = ... | true |
7ec2e322ce2ef332f7713ea1b995a75f808b7df7 | Python | picaindahouse/Code-Wars-Projects | /The Beginning- 1 to 20/Side Project 19- Two Sums/Retry after NS 19/Redo 19- Idle.py | UTF-8 | 120 | 2.8125 | 3 | [] | no_license | def two_sum (tom, n):
return [[i,j] for i,x in enumerate(tom) for j,y in enumerate(tom) if x + y == n and i != j][0] | true |
4e34965373351d238b063c5ba410b265b65a28a3 | Python | rajash/Machine-learning | /regression/boston.py | UTF-8 | 671 | 2.78125 | 3 | [] | no_license | import numpy as np
from featureScaling import featureScale
from regression import Regression
from sklearn.datasets import load_boston
boston = load_boston()
X = boston['data']
y = boston['target']
feature_names = boston['feature_names']
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, ... | true |
d5a28e3e18cca4272dbb9707a49c1b68f2b2e187 | Python | andreassjoberg/advent-of-code-2017 | /day22.py | UTF-8 | 2,762 | 3.765625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Day 22 of advent of code"""
def build_grid(input_lines, size):
"""Builds grid"""
grid = []
for y in range(size):
row = []
for x in range(size):
row.append('.')
grid.append(row)
input_length = len(input_lines[0])
start_x = start_y = (size... | true |
efc5fc0d7e206532d71d4f22c665b5588869128e | Python | bzhulex/CS3251_PA2 | /p2pclient.py | UTF-8 | 27,396 | 2.84375 | 3 | [] | no_license | """
Follow the instructions in each method and complete the tasks. We have given most of the house-keeping variables
that you might require, feel free to add more if needed. Hints are provided in some places about what data types
can be used, others are left to students' discretion, make sure that what you are returni... | true |
bd5a7aafc2a007e300086f58552a3d6174b04195 | Python | AlexBlazee/Learningcurve-opencv | /timestamp.py | UTF-8 | 987 | 2.984375 | 3 | [] | no_license | import picamera
import cv2
from subprocess import call
from datetime import datetime
from time import sleep
#OUR file path
filepath = "C:/Users/Royale121/Desktop/lane dec/"
#grabbing present time
currentTime = datetime.now()
#creating file name for pic
picTIme = currentTime.strftime("%Y.%m.%d-%H%M%S")
... | true |
8e63217eea47bd86f375f646534c1de91aec0e0d | Python | aspose-email/Aspose.Email-Python-Dotnet | /Examples/POP3/GettingMailboxInfo.py | UTF-8 | 755 | 2.65625 | 3 | [
"MIT"
] | permissive | from aspose.email.clients.pop3 import Pop3Client
from aspose.email.clients import SecurityOptions
def run():
client = Pop3Client("pop.gmail.com", 995, "username", "password")
client.security_options = SecurityOptions.AUTO
#ExStart:GettingMailboxInfo
#Get the size of the mailbox, Get mailbox info, numb... | true |
f0c2a3870ac1dcb68067875025265ce8a9f8c8ff | Python | csaddison/Physics-129L | /Homework_5/exercise3.py | UTF-8 | 568 | 3.046875 | 3 | [] | no_license | #------------------------------------------------------------
# Conner Addison 8984874
# Physics 129L
#------------------------------------------------------------
# Homework 5, Exercise 3
import math
import numpy as np
import matplotlib.pyplot as plt
from ccHistStuff import statBox
# Loading data
txt_file = 'mass.t... | true |
e35b24507213967fbf4938e57799d61684108985 | Python | a-khomitskyi/SJ-Practice | /Task 2/app.py | UTF-8 | 593 | 2.53125 | 3 | [] | no_license | from flask import Flask, request, render_template
from aggregator import parse
app = Flask(__name__)
@app.route('/convert_currency/', methods=['GET'])
def convert_func():
user_currency = request.args.get('currency')
user_amount = request.args.get('amount')
for i in parse():
if user_currency.uppe... | true |