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 |
|---|---|---|---|---|---|---|---|---|---|---|
0512c9b6b938de1117778a217cfdbb7597345687 | aimhigh53/AlgoWing | /inseok/3week/backtracking/2.py | UTF-8 | 875 | 2.609375 | 3 | [] | no_license | Testcase=int(input())
#선택을,,, 모든 경우를 다 돌것인가
#아님 선택해서 돌것인가
#들어갈 수 있는 곳의 최소를 찾아라
def findmin(i):
tmp=0
minval=1000
for k in range(N):
if check[k]==0:
if minval>=field[i][k]:
minval=field[i][k]
tmp=k
print(tmp)
return m... | true |
bf77f3605a9ad8ab8cd6e6be3bac0023420db451 | OrriO/jupyter_myworkspace | /workspeace/utils/feature/__init__.py | UTF-8 | 2,451 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
feature.py -- main entrance of feature
Author: wanglei <wanglei8@guahao.com>
Create on 2020-01-20.
"""
from utils.feature.common import get_feature_classes
import yaml
from copy import copy
import collections
import os
base_dir = os.path.dirname(os.path.abspath(__file__... | true |
7cc5a1ce1a57ec2ce4da6dc5fa79b3b014c4ccb1 | ThierryJudge/NeuralNetworkFromScratch | /NeuralNetwork.py | UTF-8 | 3,298 | 3.109375 | 3 | [] | no_license | from FCLayer import FCLayer
from InputLayer import InputLayer
from OutputLayer import OutputLayer
from matplotlib import pyplot as plt
import numpy as np
from scipy.interpolate import spline
class NeuralNetwork:
epochs = 100000
learning_rate = 0.01
def __init__(self, input_size, output_size, layers=None... | true |
499aa5a93900337c787b348ef3683664f5b71c1e | infknight/FaceMaskProject | /learning_process/video_cap.py | UTF-8 | 405 | 2.921875 | 3 | [] | no_license | import cv2
# create a video capture thing and use parameter 0 for default camera
cap = cv2.VideoCapture(0)
# use a inf loop to capture frame
while(True):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# this will show in the window
cv2.imshow("video frame", gray)
if cv2.... | true |
4763b54b41754d6c7f462e24d313a4ccf0d07fdb | dennisrm/chloroplast-trna | /tRNAdber.py | UTF-8 | 5,047 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# Created by Dennis Mulligan
# Process tRNAscan-SE tables, construct tRNA databse,
import sqlite3
## Object for storing tRNAscan-SE row information representing a tRNA gene
class tRNA:
def __init__(self,line,seqdic,chromosome):
self.accession = line[0]
self.num... | true |
fe2d946c5f30da215480ed002a606a70c45a87c9 | w9ahmed/underwater-video-enhancement | /src/camUtils.py | UTF-8 | 1,647 | 2.671875 | 3 | [] | no_license | import cv2
import vidUtils
import dirUtils
import filterUtils
import time
import datetime as dt
def startCamera():
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
while(1):
cv2.imshow('frame',frame)
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindow... | true |
60ba2bbc470bafa9630935d5608c85a2606ca74e | sheilapaiva/LabProg1 | /Unidade3/dia_normal/dia_normal.py | UTF-8 | 457 | 3.046875 | 3 | [] | no_license | #coding: utf-8
dia_semana = str(raw_input())
quantidade_clientes = int(raw_input())
if dia_semana == "segunda" or dia_semana == "terça" or dia_semana == "quarta" or dia_semana == "quinta" or dia_semana == "sexta":
if quantidade_clientes >= 40 and quantidade_clientes <= 60:
print "normal"
else:
print "atípico"... | true |
412b36dfa1c33df3660727e12a09bec7e7010696 | alewis/jax_vumps | /testing/old_contractions.py | UTF-8 | 29,728 | 2.703125 | 3 | [
"MIT"
] | permissive | """
A docstring
"""
import numpy as np
import scipy as sp
import numpy.linalg as npla
import scipy.linalg as spla
from functools import reduce
from bhtools.tebd.scon import scon
import bhtools.tebd.utils as utils
#from scipy.linalg import solve
"""
Conventions
2 3 4
| | |... | true |
cbf3373711af146e6395197e29ec95e42bd51704 | MatejMecka/SubtitleExtractor | /Amazon_XmlToSrt.py | UTF-8 | 902 | 2.921875 | 3 | [] | no_license | import re
import sys
from bs4 import BeautifulSoup
def toSrt(xml_string):
srt = ''
xml_string = xml_string.replace("<tt:br/>", "\n")
texts = BeautifulSoup(xml_string, "lxml", from_encoding="utf8")
listOfTranscripts = texts.findAll("tt:p")
# TODO parse xml instead of regex
captionNumber = 1
... | true |
59601ce3ec785c5b1280dcb3ddad7553e7e86be0 | jy149/Practice__pycharm | /파이썬입문과 크롤링기초 부트캠프/2020크롤링꿀팁.py | UTF-8 | 4,577 | 3.65625 | 4 | [] | no_license | # https://davelee-fun.github.io/blog/crawl_test
'''
꿀팁 1. F12 누르고 크롬 개발자 모드로 들어가자.
'''
import requests
from bs4 import BeautifulSoup
res = requests.get('https://davelee-fun.github.io/blog/crawl_test')
soup = BeautifulSoup(res.content, 'html.parser')
titles = soup.find_all('li', 'course')
for title in titles:
pri... | true |
9f228bb52d77c0dee8459d66a1526b6fac01f3b3 | kumariakansha/Text-Analytics | /cosine_similarity.py | UTF-8 | 980 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 20 17:41:17 2017
@author: akank
"""
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_simi... | true |
4294f4646852f8e86ed960cf7c72871dc7717ed2 | Aasthaengg/IBMdataset | /Python_codes/p03135/s954357636.py | UTF-8 | 89 | 2.75 | 3 | [] | no_license | lst_1 = input().split()
T = float(lst_1[0])
X = float(lst_1[1])
ans = T / X
print(ans) | true |
f3c3992ae173a133a702cecb203ec613b9b91467 | siberiax/Advent-of-Code-2020 | /day12.py | UTF-8 | 854 | 2.828125 | 3 | [] | no_license | import sys
from copy import copy
data = open(sys.argv[1]).readlines()
curr = [0,0]
wp = [10,1]
dirs = [(1,1), (-1,1), (-1,-1), (1,-1)]
for d in data:
l = d[0]
n = int(d[1:])
if l == 'F':
orig = copy(wp)
for i in range(n):
curr[0] += wp[0]
curr[1] += wp[1]
eli... | true |
43ee0b4dec77c0cb5eccedccc7cc0df1e205fe15 | 0x232/BOJ | /1100.py | UTF-8 | 176 | 3.390625 | 3 | [] | no_license | board = [input() for i in range(8)]
answer = 0
for i in range(8):
for j in range(8):
if (i+j) % 2 == 0 and board[i][j] == 'F':
answer += 1
print(answer) | true |
c71d1e52a6c2745f0093830c65fcbc86c75a57a1 | Atif-Bashir-1998/JustDialScrapper | /Linkedin.py | UTF-8 | 12,346 | 2.78125 | 3 | [] | no_license | # import Libraries
from selenium import webdriver
import pandas as pd
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
def login(url, name, password):
path = r'chromedriver.exe'
chrome_options = Options()
chrome_options.add_argument("--star... | true |
ad5629aa09d3c981396f9e269bef882fc9f99168 | jcobian/battleship-ai | /battleship/board.py | UTF-8 | 9,436 | 3.4375 | 3 | [
"MIT"
] | permissive | from collections import defaultdict
import random
from typing import List, Optional, Set, Tuple
from battleship.errors import AlreadyFiredError
from battleship.ship import Ship, ShipPiece, ShipType
BOARD_NUM_ROWS = 8
BOARD_NUM_COLS = 8
class BoardCell:
def __init__(self):
"""Creates an empty cell on the... | true |
da432d3eca21bcdc0ed1d234959143160a9c3f2b | mrtong96/aigames_blockbattle | /code/tmp.py | UTF-8 | 1,090 | 3.046875 | 3 | [] | no_license |
f = open('test_output.txt', 'r').read()
f = f.split('\n')
times_taken = []
nodes_expanded = []
no_path_counter = 0
for line in f:
if 'time taken' in line:
line = line[line.index('time taken'):]
line = line[len('time taken: '):]
times_taken.append(float(line))
if 'nodes expanded' in line:
line = line[... | true |
7270d4f6c910f61516e42026d9bc37da034c697e | UNCOVer-Project/UNCOVer-Main-Final-RaspberryPi | /uncoverMain.py | UTF-8 | 11,993 | 2.65625 | 3 | [] | no_license | from posutil import findObjectLocation as findObLoc
from util import ObjectDetection
from util import getImageSize
from util import TextToSpeech
from util import playSound
from util import OCR
from util import FingerDetection
from posutil import findObjectLocation
from posutil import findClosestObjectFromFinger
from po... | true |
ebc6028a686d4f0f9b7867087eef35a6aa02d9ba | wuxiukai/python-3.7-daimaku | /classes and objects/Person22Overload.py | UTF-8 | 544 | 4.09375 | 4 | [] | no_license | class Person22: #定义类Person22
def say_hi(self,name): #定义类方法say_hi.带两个参数
print("您好,我叫",self.name)
def say_hi(self,name,age): #定义类方法say_hi,带三个参数
print("hi,{0},年龄:{1}".format(name,age))
p22 = Person22() #创建对象
p22.say_hi('Lisa... | true |
8bdc8124c3e55b2882889ab7f5254eab8a602e97 | zJoyceLee/DataBase | /Lab/CourseSelectionSystem/001.py | UTF-8 | 7,762 | 3.171875 | 3 | [] | no_license | # SQL
import MySQLdb
# bar chart
import numpy as np
import matplotlib.pyplot as plt
# print Table
def printResult(cursor, sql):
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
print(row)
print("\n")
# Students:operate after login successful---------------------------------... | true |
537d8fdddbe6c7aae156a89ecc41a4641a7c4e4e | neizod/problems | /acm/unsorted/movement.py | UTF-8 | 1,918 | 3.21875 | 3 | [
"MIT"
] | permissive | # acm thailand 2011
def refill(lf_c, lf_h, lf_v, path=''):
'''recursive fill the walk path, if filled check if the walk are valid'''
global answer
if answer:
return
if lf_c == 0 and lf_h == 0 and lf_v == 0:
if chk(path):
## on valid path, ignore furthermore path ##
... | true |
39a641e6714d3b67d58aefa5a29856d3eaf5474b | malcops/advent-of-code-2020 | /day19.py | UTF-8 | 2,414 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
import re
messages = []
rules = dict()
with open('day19.txt', 'r') as f:
strings = f.read().splitlines()
for item in strings:
if item:
if ": " in item:
idx, info = item.split(": ")
idx = int(idx)
if '"' in info:
... | true |
36c63d1dd9e7c9c28f8b17b8ae2454f65caeb501 | nickliqian/keep_learning | /MixNotes/other/wsgidemo.py | UTF-8 | 652 | 3.0625 | 3 | [
"MIT"
] | permissive | from wsgiref.simple_server import make_server
def application(environ, start_response):
"""
符合WSGI标准的一个HTTP处理函数,web程序入口
:param environ: 请求的信息
:param start_response: 返回响应的回调函数
:return:
"""
# 响应信息
start_response("200 OK", [("Content-Type", "text/html")])
text = "<h1>hello world</h1>... | true |
84978b02a6a52d96db8714ba45d1e6224acf79d0 | cricketclub/gridspace-stanford-harper-valley | /experiments/src/models/recognition/ctc.py | UTF-8 | 4,976 | 2.796875 | 3 | [
"CC-BY-4.0"
] | permissive | import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.rnn as rnn_utils
from src.utils import edit_distance
class CTCEncoderDecoder(nn.Module):
"""
Connectionist Temporal Classification Model. Use a bidirectional
LSTM as the encoder and a li... | true |
c38d78f73f95f199424682ca4a40d7476437c18f | JelleAalbers/blueice | /blueice/data_reading.py | UTF-8 | 1,310 | 3.015625 | 3 | [] | permissive | """Utilities for reading files specified in configuration dictionaries
"""
from copy import deepcopy
import os
import pandas as pd
import numpy as np
from .utils import data_file_name
from .utils import read_pickle
__all__ = ['read_csv', 'read_files_in']
def read_csv(filename):
result = pd.read_csv(filename, d... | true |
f202765c9cb2b5fecf6beed2914d9719e10b845d | globus/gcsv5_installer | /utils/clients.py | UTF-8 | 7,617 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import os
import sys
import requests
APP_TEMPLATE_IDS = {
'Production' : 'f340796d-d2b8-4957-a544-0eaa3716c5f7',
'Preview' : 'bdbaaf2c-2925-401e-8ce8-c2b3fe6491e0',
'Staging' : 'd5e6a0c7-2540-4421-a961-eaf454e8f6b5',
'Test' : 'a8398609-32fa-4f3f-bad5-b9b9717ff64f',
'Integration' : '... | true |
aca8afbff3b92e904ae7f18611fcbf592841c292 | segasai/cmdstanpy | /cmdstanpy/install_cmdstan.py | UTF-8 | 15,270 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
"""
Download and install a CmdStan release from GitHub.
Downloads the release tar.gz file to temporary storage.
Retries GitHub requests in order to allow for transient network outages.
Builds CmdStan executables and tests the compiler by building
example model ``bernoulli.stan``.
Optional command... | true |
8e8d359ca0c895b7c2f4e50202e24421b184d008 | Coola4kov/algorothms | /lesson1/random_d.py | UTF-8 | 1,422 | 3.671875 | 4 | [] | no_license | import random
import string
def rand_range(int_=True, float_=False, alph=False):
if int_:
type_ = 'Целых чисел'
func = int
rand_func = random.randrange
elif float_:
type_ = "Вещественных чисел"
func = float
rand_func = random.uniform
else:
type_ = "б... | true |
b460d4501827c8b82219c385b81aa389f416a1ec | kbobs/prog1 | /commission.py | UTF-8 | 1,345 | 4.34375 | 4 | [] | no_license | # This program calculates sales commissions.
# Create a variable to control the loop.
keep_going = 'y'
# Calculate a series of commissions.
while keep_going == 'y' or keep_going == 'Y':
# Get a salesperson's sales and commission rate.
sales = float(input('Enter the amount of sales: '))
comm_rate ... | true |
6791482823ca0e627416a63b2e8f02397b973c41 | MSaaad/Scientific-Calculator | /Calculator/main.py | UTF-8 | 4,370 | 3.390625 | 3 | [] | no_license | #import Combination
#import angle_converter
#import Cube
#import cube_root
#import factorial
#import length_converter
#import log
#import matrix
#import nth_power
#import nth_root
#import Percentage
#import reciprocal
#import simple
#import Square
#import Temp_converter
#import sine
#import cosine
#imp... | true |
48d17686c09799afc0a6735be64dd0bea93d3aa3 | tharasavio/My-Python-scripts | /delta2.py | UTF-8 | 350 | 3.03125 | 3 | [] | no_license | import csv
from collections import Counter
with open('Sample_file.csv', mode='r') as infile:
reader = csv.reader(infile)
with open('Sample.csv', mode='w') as outfile:
writer = csv.writer(outfile)
mydict = {rows[0]:rows[1] for rows in reader}
print(mydict)
c = Counter()
for... | true |
a2391e7591f5517c04f0e649e5d1ccee6ca74c9b | yihua7/A-journey-to-tensorflow | /Week3 Multi_layer Convnet by loop.py | UTF-8 | 2,047 | 2.59375 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist=input_data.read_data_sets("MNIST_data",one_hot=True)
def get_weight(shape,lam):
# Declare a variable as weight.
var=tf.Variable(tf.truncated_normal(shape=shape,stddev=0.1))
# Add the regularization loss to the collect... | true |
ca9cb8cbf80a9950f02f7c46674b1c236c98d64b | Litreily/Python-scripts | /img2ascii/ascii.py | UTF-8 | 1,197 | 3.046875 | 3 | [] | no_license | # -*- coding=utf-8 -*-
# fork from www.shiyanlou.com
from PIL import Image
import argparse
#命令行输入参数处理
parser = argparse.ArgumentParser()
parser.add_argument('file') #输入文件
parser.add_argument('-o', '--output') #输出文件
args = parser.parse_args()
IMG = args.file
OUTPUT = args.output
chars = list("$@B%8&WM#*oahkb... | true |
6df9ba54e26c236251358c63a103f9e15d36a8e8 | Arpafaucon/rob311 | /3-pomdp/main.py | UTF-8 | 8,035 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python3
#coding: utf-8
"""
Partially Observable Markov Decision Process
author: Grégoire ROUSSEL
states : names 1->8
indices 0->7
actions 'LRUD'
observation 'ULTX'
3 5
| |
1 - 2 - 4 - 7
| |
6 8
"""
import numpy as np
NUM_STATES = 8
# Transition matrices
#line : o... | true |
28dec1a8fb459fcd0dfc0232288b28fdd7bc719b | arshmohd/daily_coding_problem | /problems/42/problem_42.py | UTF-8 | 644 | 3.53125 | 4 | [
"Unlicense"
] | permissive | def coding_problem_42(numbers, target):
"""
Given a list of integers S and a target number k, write a function that returns a subset of S that adds up to k.
If such a subset cannot be made, then return null.
Integers can appear more than once in the list. You may assume all numbers in the list are posit... | true |
ad5cd0c84328a79b1ef4cc8527cb772ea8862078 | helloworld729/40_torch-self-learning | /numpy/16_view©.py | UTF-8 | 2,320 | 3.8125 | 4 | [] | no_license | import numpy as np
# 视图view:是数据的引用,地址一致对一个改变, 另一个也会改变;
# 副本copy:对数据的完整拷贝,内存改变,操作副本不会影响原始数据。
print("********************************* view视图 *********************************")
# 1 直接赋值-->相当于视图
# 2 视图/浅拷贝
a = np.array([[1, 2, 3], [4, 5, 6]])
b = a.view()
print("a:", id(a), "\n", a)
print("b:", id(b), "\n", b)
print("视图... | true |
076cefb866d74cdcb07598f61b77a7d272651601 | josecervan/Python-Developer-EOI | /module2/leet_code/add_search_word/add_search_word.py | UTF-8 | 774 | 3.703125 | 4 | [] | no_license | class WordDictionary:
def __init__(self):
self.lst = list()
def add_word(self, word: str) -> None:
if word not in self.lst:
self.lst.append(word)
def search(self, word: str) -> bool:
if '.' not in word:
return word in self.lst
lenw = len(word)
... | true |
c2447b9550ccfff997921c342bf469fb70785acc | echalkpad/Data_Mining_Final_Project | /csvTest.py | UTF-8 | 4,223 | 2.75 | 3 | [] | no_license | ###
# Unit Tests for Converting Raw Parking Violation Data into Clusterable Tuples
###
import unittest
from csv_process import *
class csvUnitTests(unittest.TestCase):
# Failing Unit Test
def test_RunDummy(self):
self.assertEqual(0, 0)
def test_AssignCategory_ShouldBe5_withViolationCode56(self):
self.a... | true |
1a4cdb4b931304ed34166619aba71d94f8f4ca11 | BattleRush/FaceView | /web/backend/src/common/common.py | UTF-8 | 748 | 2.546875 | 3 | [
"MIT"
] | permissive | from .enums import LiveResolution
def getResolutionAndFramerate(liveResolution):
live_width = 1280
live_height = 720
live_fps = 24
if liveResolution == LiveResolution.Live_3264_2464:
live_width = 3264
live_height = 2464
live_fps = 5
elif liveResolution == LiveResolution.Li... | true |
f72dfa9e37ceb34e8599a6595b7e30e8a2cf1a2e | sergred/unit-tests-ml-python | /settings.py | UTF-8 | 1,151 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3.6
# -*- coding: utf-8 -*-
"""Settings getter functions."""
import json
import os
def settings():
"""Settings getter."""
with open(os.path.join(os.getcwd(), 'settings.json')) as data_file:
settings = json.load(data_file)
return settings
def get_param(model_name, param_name):
... | true |
3996d94db1d0782df58f2ef5ab84ee7745b1319a | pichouk/mytube | /subscriptions/models.py | UTF-8 | 910 | 2.625 | 3 | [] | no_license | """Django data models"""
from django.db import models
from django.contrib.auth.models import User
class Channel(models.Model):
"""Describe a Youtube channel object"""
id = models.CharField(max_length=24, unique=True, primary_key=True, verbose_name="Youtube channel ID")
name = models.CharField(max_length=... | true |
41a12bf826330a2007ab8447a6f3e2af14b3f711 | datlife/deepcom | /evaluate.py | UTF-8 | 4,361 | 2.578125 | 3 | [] | no_license | """Evaluate a neural decoder at multiple SNR (Signal to Noise) values.
python evaluate.py \
--checkpoint_dir ./reports/logs/BiGRU-2-400::dropout-0.3::epochs-50 \
--dataset ./rnn_120k_bl100_snr0.dataset \
--batch_size 600
"""
import os
import argparse
import pickle
import numpy as np
import commpy as cp
import multipro... | true |
349eb0aaa29090d943b9a3d9e61be039f8741a73 | ElkanaGam/PhotosBrowser | /saver.py | UTF-8 | 2,227 | 2.890625 | 3 | [] | no_license | from pathlib import Path
import pymongo
# #conect to server
# client = pymongo.MongoClient('mongodb://localhost:27017')
# # create database
# db = client['db']
# # create collection ( = table in SQL)
# collection = db['collection']
# droped = collection.drop()
# # prepare document (= record in SQL)
# # insert docu... | true |
3decc892d676589eb590e73dbb3bfc7e8bf2962a | ayahito-saji/2019autumn2 | /fri/2/knapsack.py | UTF-8 | 722 | 3.265625 | 3 | [] | no_license | items = [(7, 4), (8, 5), (1, 1), (2, 3)]
cost = 6
items = sorted(items, key=lambda x:-x[0]/x[1])
def z(res):
sum = 0
for i in range(len(res)):
sum += items[i][0] * res[i]
return sum
# 実数可能解を調べる
print(items)
i = cost
tmp_ans = []
for item in items:
if i >= item[1]:
tmp_ans.append(1)... | true |
a9b2e2c026c1cae02e03aca54e876d8775ab4040 | Wino0/SPO | /lexerCl.py | UTF-8 | 2,167 | 2.78125 | 3 | [] | no_license | import re
class lexerCl(object):
token = {"IF": "^if$", "ELSE": "^else$", "WHILE": "^while$","OP": "^[-+*/]$", "LOGICAL_OP": r"^==|>|>=|<|<=|!=$","LBreaket": "[(]", "RBreaket": "[)]", 'POINT': r'\.',"END_COM": "^;$", "LFBreaket": "^[{]$",'LINKED_LIST_KW': r'LinkedList',"RFBreaket": "^[}]$", "ASSIGN_OP": "^=$","EN... | true |
a8167afa35e1e462546a1cf4a4b205eb61d72dc8 | ccchowww/python-knightly-kakapo | /turtle-presentation/python turtle 5.py | UTF-8 | 1,919 | 3.828125 | 4 | [] | no_license | # "Animation 2"
# Part 6(List example)
import turtle
t = turtle.Turtle()
t.speed(10)
t.ht()
# Header 1
t.up()
t.goto(-620,265)
t.write("e.g. List", align="left", font=("Ariel", 35, "normal"))
# Header 2
t.goto(-620,150)
t.write("X = [10] \nX[0] = 20", align="left", font=("Ariel", 30, "normal"))
# X's square
t.begin... | true |
e33cf6879afbf14a71628489d0feca0e1c88a587 | S-a-b-r/PythonProject1 | /tests/test_api.py | UTF-8 | 6,757 | 2.59375 | 3 | [] | no_license | import requests
import time
import pytest
import urllib
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
#Декоратор, измеряющий время
def benchmark(func):
def wrapper... | true |
1be847225410f2532de8de149722ebfe02d5470e | PDR-SY/Challenge5 | /challenge5_3/awesome_movie/awesome_movie/spiders/awesome_movie.py | UTF-8 | 922 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from awesome_movie.items import MovieItem
class AwesomeMovieSpider(scrapy.spiders.CrawlSpider):
name = 'awesome-movie'
allowed_domains = ['movie.douban.com']
start_urls = ['https://movie.do... | true |
9e3cc74e518610589206b5782264f55a2de0464d | ayoshimatsu/python_game | /chap11/botaishi_labyrinth.py | UTF-8 | 1,886 | 3.28125 | 3 | [] | no_license | import pygame
import sys
import random
CYAN = (0, 255, 255)
GRAY = (96, 96, 96)
LABY_WIDTH = 11
LABY_HEIGHT = 9
laby = []
for y in range(LABY_HEIGHT):
laby.append([0] * LABY_WIDTH)
def make_labyrinth():
XP = [0, 1, 0, -1]
YP = [-1, 0, 1, 0]
for x in range(LABY_WIDTH):
laby[0][x] = 1
... | true |
34ea974d38c3033b6738a43ed24b9d05fa38ee57 | tanayuk/python_playground | /random_check.py | UTF-8 | 287 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
import random
name_list = ['yu-pon', 'mattsun', 'shinshin', 'mae-chan', 'takatan','nisshi-']
result = {}
for name in name_list:
choice = random.randint(1,6)
while choice in result.values():
choice = random.randint(1,6)
result[name] = choice
print(result)
| true |
c3c796d4fd5cd1b190a2431057eb9c42079d3095 | btillack/CourseraDataScienceStudies | /test_py.py | UTF-8 | 58 | 2.78125 | 3 | [] | no_license | ## test Python program
a=3.1415
b =2
p=a*b**2/4
print (p)
| true |
4b0c197572c02799b00baf8b1f9497f686cb4b21 | TimWildey/CBayes-MLMF | /pycharm/cbayes-mfmc/convergence_studies/conv_lambda_p_prior_pf_l1.py | UTF-8 | 7,547 | 2.5625 | 3 | [] | no_license | # Standard stuff
import numpy as np
import matplotlib.pyplot as plt
# Model stuff
import lambda_p
# Framework stuff
from Distribution import Distribution
from Model import Model
from MFMC import MFMC
# ------------------------------------------------- Config - General -------- #
np.random.seed(42)
# Number of samp... | true |
d5a4e96dc1615e4e84bda4888233ef7f96af0704 | py-lab/RxPY | /rx/core/abc/observable.py | UTF-8 | 246 | 2.546875 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
class Observable(ABC):
"""Observable abstract base class. Untyped."""
__slots__ = ()
@abstractmethod
def subscribe(self, observer=None, *, scheduler=None):
raise NotImplementedError
| true |
a12742bc53c8ae7b7166028d84a378befc592382 | scottbenton/AdventOfCode2020 | /Day25/ComboBreaker.py | UTF-8 | 1,284 | 3.78125 | 4 | [] | no_license | FILE_NAME = "./Day25/input.txt"
SUBJECT_NUMBER = 7
# Read in our two keys
def parseFile():
cardPublicKey = 0
doorPublicKey = 0
with open(FILE_NAME, 'r') as file:
data = file.read()
keys = data.split("\n")
cardPublicKey = int(keys[0])
doorPublicKey = int(keys[1])
return cardPublicKey, doorPub... | true |
8f1c25691e07a7f60db41706172e37008811559a | rh01/gofiles | /lcode1-99/ex135/DynamicPathPlanning.py | UTF-8 | 1,759 | 3.1875 | 3 | [] | no_license | #!/bin/python
# -*- coding: utf8 -*-
import sys
import os
import re
#请完成下面这个函数,实现题目要求的功能
#当然,你也可以不按照下面这个模板来作答,完全按照自己的想法来 ^-^
#******************************开始写代码******************************
def DynamicPathPlanning(matrixGrid):
rows = len(matrixGrid)
cols = len(matrixGrid[0])
# initialize dp
dp =... | true |
10b1f7fcaf89b302166b9174df473c00ec2c8c91 | JimmyLamothe/autofront | /autofront/tests/simple_script_args.py | UTF-8 | 212 | 3.140625 | 3 | [
"BSD-3-Clause"
] | permissive | import sys
args = sys.argv
print('It works!')
if len(args) == 1:
print('But you forgot the args.')
sys.exit(0)
else:
args = args[1:]
print('Here are your args:')
for arg in args:
print(arg)
| true |
23762791563b00d50ef35f1e236a948d067c6aa1 | lzb863/dr1ven | /planning/synthetic/entities/car.py | UTF-8 | 2,064 | 2.828125 | 3 | [] | no_license | import typing
from state.constants import EGO_POSITION_DEPTH
from state.entity import EntityType
from state.highway import Highway
from planning.agent import Agent
from planning.agents.adas import ADAS
from planning.synthetic.entity import SyntheticEntity
CAR_EXECUTION_DAMPING = 3
class Car(SyntheticEntity):
d... | true |
cdc9e60d9e10abdbb551288fe64efcc9f647f697 | taeyang916/yolov1 | /_load.py | UTF-8 | 1,709 | 2.671875 | 3 | [] | no_license | # %%
import sys
import os
import matplotlib.pyplot as plt
import xml.etree.ElementTree as Et
from xml.etree.ElementTree import Element, ElementTree
from PIL import Image, ImageFont, ImageDraw
# path
dataset_path = '/home/vim/Desktop/tykim/workspace/VOC2012'
IMAGE_FOLDER = 'JPEGImages'
ANNOTATIONS_FOLDER = "Annotatio... | true |
29a0ca6d921fe4528d3828599f0a91a4092c2efe | key999/os-sim-memory | /prepare.py | UTF-8 | 849 | 3.421875 | 3 | [
"Unlicense"
] | permissive | from random import randint
# prepares 'chains' amount of 'length' long random reference chains
# writes them to input.csv
def prepare(length=100, pages=20, chains=100):
with open("input.csv", "w") as f:
# for every chain
for _ in range(chains):
to_write = ""
# write a line ... | true |
d0b716abe9864386860456110e226f13a70d9613 | lxdlam/CP-Answers | /Facebook/2018/Qualification/C.py | UTF-8 | 548 | 3.46875 | 3 | [
"MIT"
] | permissive | T = int(input())
def match(A, B):
i = j = 1
while True:
if i > len(A):
return True
if j > len(B):
return False
if A[i - 1] == B[j - 1]:
i += 1
j += 1
elif i == 1:
j += 1
else:
i = 1
def solve(s):
... | true |
8e2e255519317eda3608374682d84409d359bb8e | JituS/GeeksForGeeks | /GreaterOnRight.py | UTF-8 | 319 | 3.203125 | 3 | [] | no_license | def greaterOnRight(numbers):
numbers[-1], maxValue = -1, numbers[-1]
for i in range(len(numbers) -2, -1, -1):
numbers[i], maxValue = maxValue, max(maxValue, numbers[i])
return numbers
for x in range(int(input())):
numberCount = input()
print(" ".join(map(str, greaterOnRight(list(map(int, input().split()))))))
| true |
14f15421ac54acfa0e3722727ecebf3c4ea7598f | numselli/XdHacks | /Climate Code 2021/Workshop/discord bot/main.py | UTF-8 | 1,186 | 2.59375 | 3 | [] | no_license | import json, os, asyncio, random, discord
from discord.ext import commands
config = json.load(open('config.json', 'r'))
bot = commands.Bot(command_prefix="+", case_insensitive=True)
@bot.event
async def on_ready():
print("loged in")
# @bot.event
# async def on_message(message):
# if message.author.bot:
# ... | true |
01471e09af490fc72f69b4f6f9e1f7a44a19cfed | HuiJing-C/PythonLearning | /cjh/04finctional_programming/03anonymous_function.py | UTF-8 | 942 | 4.5 | 4 | [] | no_license | # 当我们在传入函数时,有些时候,不需要显式地定义函数,直接传入匿名函数更方便
def build():
return lambda x: x * x
if __name__ == '__main__':
# 在Python中,对匿名函数提供了有限支持。还是以map()函数为例,计算f(x)=x^2时,除了定义一个f(x)的函数外,还可以直接传入匿名函数
print(list(map(lambda x: x * x, [1, 2, 3]))) # 1 4 9
# 匿名函数有个限制,就是只能有一个表达式(x * x),不用写return,返回值就是该表达式的结果
# 用匿名函数有个好处,... | true |
d8113410358e7b1b3b38906947464ce4de8a033c | MaartenVanDuren/azure-functions-python-examples | /CosmosDBExample/__init__.py | UTF-8 | 332 | 2.609375 | 3 | [] | no_license | import logging
import azure.functions as func
def main(documents: func.DocumentList) -> func.Document:
logging.info(f"CosmosDB trigger executed!")
for doc in documents:
logging.info(f"Document: {doc.to_json()}")
returnDoc = func.Document.from_dict({"text": "Hello World", "foo": "bar"})
retur... | true |
828ead87e44e8c6cd154965c9e9509fffa73af92 | PDE26jjk/YJLocalBak | /com/zxxj/test/Tree.py | UTF-8 | 5,994 | 3.390625 | 3 | [] | no_license | class Node:
def __init__(self,left,right,data):
self.left = left
self.right = right
self.data = data
def __str__(self):
return str(self.data)
class Tree:
def __init__(self):
self.root = None
self.len = 0
def isBalanced(self,root):
d1 = 0
... | true |
3d56f3febc74f8cfb45373b27f2ea29c3ce1294e | RoboCupULaval/UI-Debug | /Model/DataObject/DrawingData/BaseDataDraw.py | UTF-8 | 977 | 2.640625 | 3 | [
"CC-BY-SA-3.0",
"MIT"
] | permissive | # Under MIT License, see LICENSE.txt
from abc import abstractmethod
from Controller.AbstractDrawingObject import AbstractDrawingObject
from Model.DataObject.BaseDataObject import BaseDataObject
__author__ = 'RoboCupULaval'
class BaseDataDraw(BaseDataObject):
""" Données entrantes pour les paquets de données pou... | true |
844304eb1ff57ca3ec709d50a54387060ca0bccd | fms-santos/DeepSolar | /generate_data_list.py | UTF-8 | 2,725 | 2.75 | 3 | [
"MIT"
] | permissive | """ Generate lists containing filepaths and labels for training, validation and evaluation. """
import pickle
import os.path
import random
import pandas as pd
##### generate training set #####
TRAIN_SET_DIR = 'SPI_train'
train_set_list = []
pos_num = 0
neg_num = 0
# negative samples
for i in xrange(1, 320378):
img... | true |
99d86cba0d677ef441840f2484e4cd8dd0c337cb | daniel-reich/ubiquitous-fiesta | /KCmjq9m5dKoRFyHBd_4.py | UTF-8 | 699 | 3.0625 | 3 | [] | no_license |
def which_side(poly, vert):
# reverse order of vertices if orientation is clockwise
if sum([(p2[0]-p1[0])*(p2[1]+p1[1]) for p1, p2 in zip(poly, (poly+[poly[0]])[1:])]) > 0:
poly = poly[::-1]
vi, pl = poly.index(vert), len(poly)
# translate preceding, target and succeeding points so that precedi... | true |
e94afa74943d8e8e144b0e067d11bab0c15a1cec | ehfkdl94/Learing-Python | /2019-06-30(calc).py | UTF-8 | 750 | 3.734375 | 4 | [] | no_license | print(3>1)
print(10 == 10)
print(10 != 5)
print('Hello' == 'Hello')
print('Python' == 'python')
print('Python' != 'python')
print(10 > 20)
print(10 < 20)
print(10 >= 10)
print(10 <= 10)
print(1 == 1.0)
print(1 is 1.0)
print(1 is not 1.0)
print(id(1))
print(id(1.0))
print(True and True)
print(True and False)
print(... | true |
b6286d5a8d93c8a0a23610afdb253bc6b1019f6b | MaxMignolet/intro-progra-uliege-bac1 | /gen.py | UTF-8 | 1,265 | 2.96875 | 3 | [] | no_license | #!
#shebang différent selon la machine, a executer en python 3.6
if __name__ == "__main__":
first_part="""
#define typename(x) _Generic((x), _Bool: "_Bool", unsigned char: "unsigned char", char: "char", signed char: "signed char", short int: "short int", unsigned short int: "unsigned short int", int: "int", unsign... | true |
d0fc43dadc20c5682795cd64e9f294b6bdde845f | carolina-sl/algoritmo_programacao_II | /exercicios/exercicio_aula14/main.py | UTF-8 | 1,275 | 2.921875 | 3 | [] | no_license | from aula_exercicios_14_14_06.Torre import Torre
from aula_exercicios_14_14_06.Apartamento import Apartamento
from aula_exercicios_14_14_06.Vaga import Vaga
if __name__ == '__main__':
# while True:
v1 = Vaga("10")
v2 = Vaga("20")
list_vagas_livres = [v1, v2]
t1 = Torre(1, "Torre 1", 'Meu enderec... | true |
fc7745e4429bda51cdc61d71d74d915712e771d9 | ifirat/8.hafta_odevler-Fonksiyonlar | /odev 8 - Faktoryel.py | UTF-8 | 217 | 3.59375 | 4 | [] | no_license | number = int(input("Please enter a number :"))
def faktor(number):
if number==0:
return 1
else:
b=1
for a in range(1,number+1):
b *=a
return b
print(faktor(number)) | true |
6bca02a3db43cf4ad5702ea3c55b5bd520dd0968 | Sakalya100/GeekWeek-Local | /Sakalya100_Day3/Day3-Problem3.py | UTF-8 | 856 | 3.046875 | 3 | [] | no_license | import math
import os
import random
import re
import sys
# Complete the arrayManipulation function below.
def arrayManipulation(n, queries):
arr = [0] * (n+1)
# add the value at first index
# subtract the value at last index + 1
for q in queries:
start, end, amt = q
arr[start-1] += amt
... | true |
f5aec3211aa0056f33062ff88e118d7e429c0f95 | dlwnstjd/python | /pythonex/0819/exam3.py | UTF-8 | 359 | 2.625 | 3 | [] | no_license | '''
Created on 2020. 8. 19.
@author: GDJ24
'''
import pandas as pd
infile = "../0818/sales_2013.xlsx"
outfile = "sales_2013_amt.xlsx"
df = pd.read_excel(infile,"january_2013",index_col=None)
df_value = df.loc[:,["Customer Name", "Sale Amount"]]
writer = pd.ExcelWriter(outfile)
df_value.to_excel(writer,sheet_name="ja... | true |
ce01e6d6a2a23f02a59ed3a0a569670d4c26f767 | smoltis/hackerrank | /Python Scripts/set_ops.py | UTF-8 | 518 | 3.78125 | 4 | [] | no_license | """
Print the sum of the elements of set on a single line.
Sample Input
9
1 2 3 4 5 6 7 8 9
10
pop
remove 9
discard 9
discard 8
remove 7
pop
discard 6
remove 5
pop
discard 5
"""
n = int(input())
s = set(map(int, input().split()))
n_cmd = int(input())
for _ in range(n_cmd):
action = input().split()
if len... | true |
3dd92ddeecefa3c4133b0de26da0f0c95a04a3ea | catlee/hashsync | /hashsync/utils.py | UTF-8 | 1,873 | 3.0625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
import calendar
import time
import email.utils
from functools import partial
import os
import logging
log = logging.getLogger(__name__)
# The SHA-1 hash of zero bytes
SHA1SUM_ZERO = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
def traverse_directory(dirname... | true |
7d74b4e40945f0ab9067c7a7b6c032362c5fc84b | sgriffin10/ProblemSolving | /Classwork/Sessions 1-10/Session 5/mypolygon.py | UTF-8 | 1,198 | 3.890625 | 4 | [] | no_license | import turtle
import math
ProfLiTheGod = turtle.Turtle()
ProfLiTheGod.speed(0)
print(ProfLiTheGod)
turtle.mainloop
#refactored code
def polyline(t, n , length, angle):
""" frees up the code"""
for i in range(n):
t.fd(length)
t.lt(angle)
# Exercise 2.1
# def square(t):
# for i in range(... | true |
870bcf07441030000008ce1c388ce024021a0a0e | ww12-wq/unitest_project | /selenium_unitest/test/test01.py | UTF-8 | 140 | 2.828125 | 3 | [] | no_license | #!/user/bin/env python3
# -*- coding: utf-8 -*-
#editor whp
def Printele(*ele):
for i in ele:
print(i)
a=[1,2,3]
Printele(*a) | true |
c02467926cc677973f80852468390cb7fefef4ba | 9310gaurav/BTP | /flipkart_code/test.py | UTF-8 | 158 | 2.515625 | 3 | [] | no_license | import csv
import json
with open("model_id.csv",'rb') as csvfile:
spamreader = csv.DictReader(csvfile)
i = 0
for row in spamreader:
print row['model_id'] | true |
723e9e76a0f3247f2055077bfaf5728ad4c0c5e3 | vpallavi91/api-example-django-1 | /drchrono/post_drchrono_data.py | UTF-8 | 1,629 | 2.78125 | 3 | [] | no_license | import requests
def patch_to_url(url, access_token, params={}):
'''
MAIN FUNCTION TO PATCH DATA TO DRCHRONO API
'''
headers = {'Authorization': 'Bearer %s' % access_token,
'Content-type': 'application/json',}
print("inside patch_to_url")
response = requests.patch(url, json=param... | true |
d02216758211246482a47fd81b10652efc34c7eb | Sun-Yize/Time-Series | /2_State_Space_pdf/python code/Seasonality/Multiplicative seasonality.py | UTF-8 | 2,129 | 2.875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
np.random.seed(7)
n = 103
e = np.random.normal(0, 0.5, n)
u = np.random.normal(0, 0.4, n)
y = np.empty(n)
alpha = np.empty(n)
factor = [1.7, .3, 1.9, .1]
seasonal = np.tile(factor, n // 4+1)[:n]
y[0] = e[0]
alpha[0] = 5 + u[0]
for t in range(1, n):
y[t] = seasona... | true |
eb195e3c85e75a3636b0a5ce4b7fc6a10d18ad0f | lanSeFangZhou/pythonbase | /python100days/day11/json2.py | UTF-8 | 322 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | '''
写入JSON文件
'''
import json
teacher_dict = {'name': '白元芳', 'age': '25', 'title': '讲师'}
json_str = json.dumps(teacher_dict)
print(json_str)
print(type(json_str))
fruits_list = ['apple', 'orange', 'strawberry', 'banana', 'pitaya']
json_str = json.dumps(fruits_list)
print(json_str)
print(type(json_str)) | true |
4f3bd9ce65435a205b18af6009970e7673cddeb3 | SimonFans/LeetCode | /Breadth-First-Search/L490_The_Maze.py | UTF-8 | 2,310 | 3.9375 | 4 | [] | no_license | '''
There is a ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through the empty spaces by rolling up, down, left or right, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction.
Given the m x n maze, the ball's start p... | true |
42dc480a9d66f5183b165ef8eded5fb9a2230624 | vitor-tadashi/nanodegree-machine-learning-ai-foundations | /exercise/fifth-lesson/compute-exponent.py | UTF-8 | 261 | 4.09375 | 4 | [] | no_license | # Quiz: Compute an Exponent
# It's your turn to import and use the math module.
# Use the math module to calculate e to the power of 3. print the answer.
#
# Refer to the math module's documentation to find the function you need!
import math
print(math.exp(3)) | true |
d27100b78f37d2a6bf39bc5cced86efe716929fe | avisekghosh/interview-project-dr | /src/m2.py | UTF-8 | 1,644 | 2.59375 | 3 | [] | no_license | import sqlite3
from flask import Flask, request
from slack import WebClient
from slack.errors import SlackApiError
from config import *
app = Flask(__name__)
def send_msg_to_slack(msg="HelloWorld", channel_name="#test"):
try:
client = WebClient(token=API_TOKEN)
response = client.chat_postMessag... | true |
017a814a071400517f0f7fba0948c9d44504f6a3 | lesyuk/learning_python | /pythontutor/lists/different_elements_number.py | UTF-8 | 62 | 2.875 | 3 | [] | no_license | s = [int(i) for i in input().split()]
c = set(s)
print(len(c)) | true |
71cdb70e54a519b14a9490953684aa3a55a9eedc | tor4z/compiler01 | /tests/test_test_utils.py | UTF-8 | 1,251 | 3 | 3 | [
"MIT"
] | permissive | import unittest2
from utils import line_split, line_cmp, doc_cmp
doc1 = """hello
world
!
"""
doc2 = """
hello
world
!
"""
doc3 = """hello
my
world
!
"""
doc4 = """hello
!
world
"""
doc5 = """
hello world !
who is you dady ?
"""
doc6 = """ hello world !
who is you dady ?
"""
doc7 = ""... | true |
78328bca08f5c806fc6028acaadbe540462fef74 | Sangeeth-S/Python_Training | /class example.py | UTF-8 | 340 | 3.3125 | 3 | [] | no_license | class Tea_powder():
def __init__(self,name,quantity,rate):
self.name = name
self.quantity = quantity
self.rate = rate
def my_function(self):
print(self.name)
print(self.quantity)
print(self.rate)
obj = Tea_powder("Three roses","100g","Rs:200")
obj.my_fu... | true |
805e0c6034c8990ef74eee1839f4c259af4d21d5 | thilinicooray/mac-network-pytorch | /vqa_encoder.py | UTF-8 | 3,161 | 2.84375 | 3 | [
"MIT"
] | permissive | import torch
import random
from collections import OrderedDict
import csv
import nltk
#This is the class which encodes training set json in the following structure
#todo: the structure
class vqa_encoder():
def __init__(self, train_ann_set):
print('vqa encoder initialization started.')
self.max_lab... | true |
d33b9d1ae2f086c2c90906fc3c62fa58744ca2ab | alinensgarcia/vanhack-ormuco | /ab_items/string_utilities.py | UTF-8 | 1,100 | 4.59375 | 5 | [] | no_license | ## Question B
# The goal of this question is to write a software library
# that accepts 2 version string as input and returns whether
# one is greater than, equal, or less than the other.
# As an example: “1.2” is greater than “1.1”.
# Please provide all test cases you could think of.
class ComparisonsBetweenTwoSt... | true |
3142945f6736482adddfdc584321e0798e3da799 | ajinkya933/storingfiles | /test3.py | UTF-8 | 339 | 2.78125 | 3 | [] | no_license | import os
# the open keyword opens a file in read-only mode by default
#f = open('/Volumes/aj/hello/hello world.txt','w')
# read all the lines in the file and return them in a list
#f.write("Foobar")
#f.close()
with open("/Volumes/aj/VLP16_Points_2017-10-24-11-21-21.bag", 'r', errors='ignore') as f:
print(f.read... | true |
eb7e615e2af98d16a0361ab9b7018fee4bcc381f | SamuelHabtu/Kick-Start-2020 | /round a/plates.py | UTF-8 | 847 | 3.15625 | 3 | [] | no_license |
def getInput():
return list(map(int, input().split()))
def pickPlates(N, stacks, P, K):
#edge case if Dr.Patel can take every single plate
if(P == (N * K)):
return sum(sum(x) if isinstance(x, list) else x for x in stacks)
tab = [[0] * (P + 1)]* K
for i in range(1, N... | true |
37fc53da1b8f9ed0804cb329f819ed8c279df49f | TopZeraProductions/estrutura-de-dados | /AtividadesContinuas/AC-07/DoubleLinkedList.py | UTF-8 | 2,480 | 4.03125 | 4 | [] | no_license | class Node:
def __init__(self, arg):
self.__value = arg
self.__prev = None
self.__next = None
def get_value(self):
return self.__value
def get_next(self):
return self.__next
def set_next(self, node):
self.__next = node
def get_prev(self):
r... | true |
73af439ecd3cc6f6aef3b11e3a45b856271d4a10 | robert-anderson/neci_visualiser | /matrix_factory.py | UTF-8 | 362 | 2.78125 | 3 | [] | no_license | import numpy as np
def random_symmetric(dim):
A = (np.random.random((dim, dim)) - np.random.random((dim, dim)))
return A+A.T
def random_symmetric_blocked(dims):
A = np.zeros((sum(dims), sum(dims)))
tot = 0
for i in range(len(dims)):
A[tot:tot+dims[i], tot:tot+dims[i]] = random_symmetric(di... | true |
0caa7aeccc1de246356a78f5c10a1e7b06e2b447 | BeatrizOliveiraFerreira/DesafiosPython | /exercicio27.py | UTF-8 | 306 | 4.15625 | 4 | [] | no_license | name = str(input('Digite o seu nome: ')).strip()
print('Muito prazer em te conhecer {}{}{} !'.format('\033[31m', name, '\033[m'))
nome = name.split()
print('O seu primeiro nome é: {}{}{}'.format('\033[33m', nome[0], '\033[m'))
print('O seu último nome é: {}'.format(nome[len(nome) - 1]))
| true |
69de8caab31efae927ec4c28bb6703be41b5a155 | PandemicPIG/binStore | /exp/makerand.py | UTF-8 | 453 | 2.84375 | 3 | [
"MIT"
] | permissive | #write 1Mb of random data to file
import random
file_loc = './test.file'
max_val = 1024 * 1024
for i in range(0,max_val) :
random.seed(i)
byte = random.getrandbits(2)
random.seed(max_val%(i+1))
sec_byte = random.getrandbits(2)
hex_eq = hex(byte)[2:-1]
hex_sec = hex(sec_byte)[2:-1]
if (len(h... | true |
c479d515dc3e5b1f3fd82a75d2f5fe9018cfb93f | jessica-slee4275/bell-students-grades | /studentGrades.py | UTF-8 | 1,089 | 3.84375 | 4 | [] | no_license | while True:
studentNum = int(raw_input("Enter Student Number: "))
if(studentNum <= 0 or studentNum > 60):
print("Student number can not be under 0 and over 60")
break
else:
grades = []
outputGrades = []
for i in range(studentNum):
grades.append(raw_input(... | true |
7bfb45bc1a84717065e783773c8462f43b4d349e | sun9121/codingTest_Python | /Binary Search/07_Make rice cake 02.py | UTF-8 | 544 | 3.09375 | 3 | [] | no_license | # 떡의 개수 N, 손님이 요청한 길이 M을 int로 받기
N, M = map(int, input().split())
# 모든 떡의 개별 길이를 rc에 list로 받기
rc = list(map(int, input().split()))
# 이진탐색을 위한 값을 설정해준다.
start = 0
end = max(rc)
result = 0
while start <= end:
sum = 0
mid = (start + end) // 2
for tteok in rc:
if tteok > mid:
sum += tteok ... | true |
26de473f2e83ac2c74064dd36eb235043eee4dc1 | gabriel-galdino/carca_socket | /server.py | UTF-8 | 1,825 | 2.5625 | 3 | [] | no_license | from carca_socket import CarcaSocket
from carca_packet import CarcaPacket
import utils
from random import randint
from time import sleep
class CarcaServer():
def __init__(self, carca_socket, data):
self._data = data
self._socket = carca_socket
self._last_acked = 0
self._byte_list =... | true |
d4c63c352d059efc3ec2d0d9d08ca506b70d4e33 | shnikita-cr/course-site-python3 | /content.old/2015-2016/solutions/lab3/leaf3.py | UTF-8 | 216 | 2.625 | 3 | [] | no_license | #!/bin/env python3
from record import start, finish
from leaf import draw
import turtle
L = 400
N = 3
LL = L/N*(N+1)
start(LL, LL, 0, -LL/2, 50, __file__)
turtle.speed('fast')
turtle.left(90)
draw(L, N)
finish() | true |