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 |
|---|---|---|---|---|---|---|---|---|---|---|
302b3949ca81bac1b6dafb4ae05c906f37a0003e | xuanxuan-good/MyCode | /之前做过的/647.回文子串.py | UTF-8 | 1,492 | 3.484375 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=647 lang=python3
#
# [647] 回文子串
#
# @lc code=start
class Solution:
def countSubstrings(self, s: str) -> int:
# 1.dp [n][n] 表示i到j的子串是否是回文串 针对首尾
n = len(s)
res = 0
dp = [[0]*n for _ in range(n)]
for i in range(n-1, -1, -1): # 逆序 对每个n-1->i
... | true |
2ae463a944ddf1a5e3c09eef6419e40dd58b73aa | RozaGruter/Random_Numbers_Generator | /Random_Numbers_Generator_Console.py | UTF-8 | 6,728 | 3.515625 | 4 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 23 15:26:18 2018
@author: roza.gruter
"""
import random as rd
import csv
import time
def get_nb_sensors():
"""
Ask user how many sensors need to be generated
Output:
nb_sensors -> number of sensors requested by... | true |
cd45b01a927da04ee7b2d8a9ecb434ccf1f723d9 | AngeloESFM/All_programs | /All_programs_3.py | UTF-8 | 13,068 | 4 | 4 | [] | no_license | # 46 APRENDER A ABRIR Y CERRAR ARCHIVOS DE TEXTO
# Para abrir el archivo se hace de la siguiente forma
"""
# Para abrirlo sólo en lectura se pone una "r"
open("Alumnos.txt","r")
# Para abrirlo sólo en escritura se pone una "w"
open("Alumnos.txt","w")
# Para abrirlo sólo en escritura se pone una "a"
open("Alumnos.txt",... | true |
7e5aa2519756eca9d284e59a512381b1e7a244a3 | enilder/Web-Scrapers | /mtgprice_scraper.py | UTF-8 | 2,390 | 3 | 3 | [] | no_license | import urllib2
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
import pprint as pp
import re
import csv
import time
def prefixing(base_url, links):
prefixed_link = str(links).replace("/", base_url, 1)
return prefixed_link
def set_price(set_url):
# include set rel... | true |
4527561e06f5a28fa21f2b602ac9f579ed8710ff | dhnesh12/codechef-solutions | /02-CodeChef-Easy/821--Poker.py | UTF-8 | 2,367 | 3.0625 | 3 | [] | no_license | # cook your dish here
test=int(input())
for _ in range(test):
a=[j for j in input().split(" ")]
a.sort()
if a[0][1] == a [1][1] == a[2][1] == a[3][1] == a[4][1]:
if a[0][0] == "A" and a[1][0] == "J" and a[2][0] == "K" and a[3][0] == "Q" and a[4][0] == "T":
print("royal flush")
elif (a[0][0] == "9" a... | true |
f5e66a2d90d0c15a721933ccd94a51e105ef2d51 | qhdong/LeetCode | /python/P030_Substring_with_Concatenation_of_All_Words/Substring with Concatenation of All Words.py | UTF-8 | 1,254 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Solution(object):
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
from collections import Counter
from collections import defaultdict
res = []
if not words or len(w... | true |
0cb0f747eda4d05eb95c37729e74b93ca65984d7 | MaxiCarranza/API | /Consume_api.py | UTF-8 | 416 | 2.703125 | 3 | [] | no_license | import requests
import json
TOKEN = "11120|hXDogdpBKpz^7FgLmO7T2PyNXppcAVXM"
if __name__ == "_main_":
headers ={
"Accept" : "application/json",
"Content-Type" : "application/json"
}
r = requests.get("https://api.cambio.today/v1/quotes/EUR/USD/json?quantity=1&key=11120|hXDogdp... | true |
576eaae396cb8d1edfaee9d570f3ff18754a1f13 | APVAPR/Python_OOP | /lesson01.py | UTF-8 | 155 | 2.5625 | 3 | [] | no_license | # Объекты (данные и поведение)
# Классы
# Экземпляры классов
class Car:
model = "BMW"
engine = 1.6
| true |
1b7d85e7d457ade329f9f129d86c9309b2a6bb70 | VGrechi/calculo-de-folha | /common/irrf.py | UTF-8 | 1,668 | 2.625 | 3 | [] | no_license | class IRRF:
FAIXAS = [1903.98, 2826.65, 3751.05, 4664.68]
VALOR_DESC_DEPENDENTE = 189.59
@staticmethod
def calcular(baseCalculo, numDependentes):
FAIXAS = IRRF.FAIXAS
imposto = 0
baseCalculo -= (numDependentes * IRRF.VALOR_DESC_DEPENDENTE)
if (baseCalculo > FAIXAS[0])... | true |
ede9f290cdb7c46730cced0201333e7e0d616a8a | gjj/flask-service-boilerplate | /tests/test_api.py | UTF-8 | 677 | 2.984375 | 3 | [
"MIT"
] | permissive | import unittest
import json
from api import app
class ApiTest(unittest.TestCase):
# setUp has to be capitalised this way, see https://docs.python.org/3/library/unittest.html
def setUp(self):
self.app = app.test_client()
def test_square(self):
# Input
payload = json.dumps({
... | true |
49ae8ea5e091dab4d96728a07380114e893806a3 | Saivaraprasad/AutonomousFlight | /KeyControl.py | UTF-8 | 5,422 | 2.546875 | 3 | [] | no_license | # @Author: Saivaraprasad
# @Date: 2020-03-04T11:03:26+05:30
# @Filename: Key_Control.py
# @Last modified by: Saivaraprasad
# @Last modified time: 2020-03-04T12:39:19+05:30
from pynput import keyboard
from dronekit import connect, VehicleMode, LocationGlobalRelative, Command, LocationGlobal
from pymavlink import m... | true |
bffb68fb04fa4b0fa2d57d23a481fe164663dce6 | ArianeDucellier/timelags | /src/misc.py | UTF-8 | 8,366 | 3.125 | 3 | [
"MIT"
] | permissive | """
Miscellaneous functions
"""
import numpy as np
import pickle
from math import asin, cos, pi, sin, sqrt, tan
from scipy import interpolate
def centroid(t, f, t0, tlag, dt):
"""
Compute the centroid of f(t)
Input:
type t = 1D numpy array
t = Time
type f = 1D numpy array
... | true |
01c7126bc752d22256e62f95c74be2cc7f70ab4d | kalifaboy/tf-idf | /Mapreduce/tf_mapper.py | UTF-8 | 542 | 2.890625 | 3 | [] | no_license | #!usr/bin/python
import sys
import os
from string import punctuation
def mapper():
for line in sys.stdin:
line = line.strip()
line = line.translate(None, punctuation)
words = line.split()
for word in words:
# what about stop words ?
word = word.lowe... | true |
225c1b1794caa68f5c0bf44f40f7a32fae44ce1b | maxrothman/wordsearch | /tests/test_main.py | UTF-8 | 3,690 | 3.265625 | 3 | [
"MIT"
] | permissive | import wordsearch.main as main
from wordsearch.board import Board
from wordsearch.trie import TrieNode
import string
import unittest
class TestBoardRun(unittest.TestCase):
def setUp(self):
self.board = Board([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
])
def test_yields(self):
yields = list(m... | true |
2bf339dbcdb9309147b26da6e2a37f934740cf20 | lhk/optim2 | /examples/patterns.py | UTF-8 | 1,191 | 3.296875 | 3 | [] | no_license | import numpy as np
def circles(num_samples):
# set up the data
# circle one
half_samples = num_samples // 2
phi = np.linspace(0, np.pi * 5, half_samples)
r = np.linspace(0, 10, half_samples)
x1 = np.cos(phi) * r
y1 = np.sin(phi) * r
labels1 = np.zeros((half_samples,))
# circle t... | true |
e42c0d79f605cec7593c43da11ba8d2460e4fada | samorajp/reaktorpy | /trener/dzien2/p48.py | UTF-8 | 99 | 3.234375 | 3 | [] | no_license | liczba = int(input("Podaj liczbę:"))
if ...:
print("parzysta")
else:
print("nieparzysta") | true |
0c79b003e25b232cd666f61da06d6bebe142ad54 | suraj-deshmukh/myCodes | /sir.py | UTF-8 | 1,321 | 3.03125 | 3 | [
"MIT"
] | permissive | def sir(n,I,tt):
import matplotlib.pyplot as pt
#n=int(input('enter no of population='))
#I=int(input('enter initial infected people='))
#t=int(input('enter time period='))
#dt=int(input('enter step size'))
size=tt
s=[0 for j in range(size)]
i=[0 for j in range(size)]
r=[0 for j in range(size)]
s[0]=n-I
i[0]... | true |
b2676d9cf9b3f8e94b73e1cedf1d6ed80ca36d30 | vmsclass/Python-Core-level- | /sum_of_squares.py | UTF-8 | 362 | 4.28125 | 4 | [] | no_license | # Description : Program to print the sum of squares of first 'n' natural numbers
# Input : number
# Output : sum of squares up to the number.
# Author : M. Sudhakar
sum=0
number=int(input("enter a number"))
##for i in range(1,number+1):
## sum=sum+(i*i)
#while loop
i=1
while i<=number:
sum=sum+(i*... | true |
717686e14f94634a6f17313a3a7dd597007c70c3 | kathpanderson/ee364d-h19 | /prod/visualization/visualizing_cluster.py | UTF-8 | 4,948 | 2.9375 | 3 | [] | no_license | # to run this file in the command line type:
# python visualizing_cluster.py file_name.csv blob#
# this script will display the 3d image of the blobs at a frequency given by the user
import numpy as np
from sklearn.cluster import MeanShift
from sklearn.datasets import make_blobs
import csv
import sys, getopt
import ma... | true |
c4bb23ac950b5870f7795e618221e2e74c5378b4 | alwinbaby/MediApp | /src/get_known_list_from_str.py | UTF-8 | 412 | 3.546875 | 4 | [
"Unlicense"
] | permissive | from typing import List
def get_known_list_from_str(string: str, known_list: List[str]):
string_list = string.split()
if not all(item in known_list for item in string_list):
print("One of the words entered was misspelled or is not a known word")
return None
elif len(string_list) == 0:
... | true |
c308ecb631ff95586d6a9e4d56184bfed704e2b5 | Bass-Connections-2019/bass-root | /10_code/texture_implantation/implantation.py | UTF-8 | 4,404 | 2.625 | 3 | [] | no_license | import numpy as np
import cv2
from PIL import Image
from scipy import ndimage
from scipy.spatial import ConvexHull, convex_hull_plot_2d
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import sys
from tqdm import tqdm
from statistics import mean
sys.path.append(r'/hdd/2019-bass-connections-aatb/mrs_new')
from ... | true |
80813e577d97cab0523907fafab6866e90101d03 | whoji/training-ground | /rl-lapan-book/chap10_AC_catpole_1net.py | UTF-8 | 7,704 | 2.609375 | 3 | [] | no_license | # code modified from chap9_PG_catpole.py. now adding actor critic
# detailed maths. check this link
# http://rail.eecs.berkeley.edu/deeprlcourse-fa17/f17docs/lecture_4_policy_gradient.pdf
import pdb
import numpy as np
import gym
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional ... | true |
13c4fcee75c87696ab6e08f3ed362d4870227184 | uncleyao/LintCode | /Python/8-Sort Algorithm/184_组成最大数.py | UTF-8 | 558 | 3.40625 | 3 | [] | no_license | import functools
class Solution:
"""
@param nums: A list of non negative integers
@return: A string
"""
# 比较函数
def compare(self, a,b):
if a+b>b+a:
return -1
return 1
def largestNumber(self, nums):
# write your code here
string = []
for i i... | true |
6a7e55a4d5ada7f779ab43089c9e76948274b33c | evelinehong/Text-Classification-Kaggle-Competition | /sckit learn/corpus2Bunch.py | UTF-8 | 2,084 | 2.578125 | 3 | [] | no_license | import os
import pickle
import csv
import json
from sklearn.datasets.base import Bunch
from Tools import readfile
def corpus2Bunch(wordbag_path, seg_path,csv_path):
# 创建一个Bunch实例
bunch = Bunch(label=[], id=[], contents=[])
# 获取每个目录下所有的文件
with open(seg_path,'rb') as f:
with open(csv_path,'rt'... | true |
9f77fb27c08a2d58b610afe85d42a1e10672015c | weijian19391/image-processing | /main.py | UTF-8 | 4,200 | 2.65625 | 3 | [] | no_license | import numpy as np
import cv2
import cv2.cv as cv
from player_detection import PlayerDectector
def calculate_size(img1, img2, homography_matrix):
height1, width1 = img1[:2]
height2, width2 = img2[:2]
corner_image1_pts = np.float32([[0, 0],[0, height1],[width1, height1],[width1, 0]]).reshape(-1, 1, 2)
corner_imag... | true |
0d7c2bd4367b87bb634a1536b748e31c8ec8d0c2 | RaulNinoSalas/Programacion-practicas | /Practica6/P6E9.py | ISO-8859-1 | 637 | 4.5 | 4 | [] | no_license | """RAUL NIO SALAS DAW 1
Ejercicio 09
Escribe un programa que permita crear una lista de palabras y que, a continuacin, cree una
segunda lista con las palabras de la primera, pero sin palabras repetidas (el orden de las palabras
en la segunda lista no es importante).
"""
lista=[ ]
lista2=[ ]
numero=input("C... | true |
4e055429c817fd20c3f6e5f4dd781910a5e3d4f3 | ymlasu/para-atm | /paraatm/deprecated/Commands/reliabilityAnalysis.py | UTF-8 | 4,368 | 2.71875 | 3 | [] | no_license | """
NASA NextGen NAS ULI Information Fusion
@organization: Southwest Research Institute
@author: Michael Hartnett
@date: 05/30/2019
Command call to interface NATS module with PARA-ATM to fetch generated trajectories.
"""
import numpy as np
from paraatm.Commands import runNATS,readNATS
import paraatm.Comma... | true |
cc3b1cdc48e5a0516276abaeaa2257c6ee4282db | M-khosravi-1995/python | /test1/Ex1_1.py | UTF-8 | 385 | 3.421875 | 3 | [] | no_license | import sys
def mabna(n):
dict={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"}
s=n/16
n=n%16
k=s/16
while (s>16):
s=s%16
if s>9:
list= dict[s]
else:
list= s
w=str(k)+str(s)+str(n)
return w
def main():
x = input("Enter your numbers:" )
pri... | true |
9f10191e47879a7ece5831adfa7b3d4b68f9abf6 | haofengac/omniVision | /testUpload.py | UTF-8 | 1,273 | 2.546875 | 3 | [] | no_license | from upload import TransferData
from firebase_send import Firebase
import urllib2
from os import listdir, remove
from os.path import isfile, join
from time import sleep
# macros for the script
image_dir = 'data'
dropbox_dir = '/omniVision'
loop_frequency = 0.5
remove_uploaded_file = True
# initialize data transfer ... | true |
be1f7199b787a600642c59718f7be5d0a5b7e606 | lxconfig/UbuntuCode_bak | /algorithm/leetcode/tree/04-二叉树的遍历.py | UTF-8 | 4,747 | 3.921875 | 4 | [] | no_license |
"""
给定一个二叉树,返回它的前序、中序、后序、层次遍历
递归算法很简单,你可以通过迭代算法完成吗?
"""
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
""" 颜色标记法 """
def PreOrderTraversal(root):
if not root: return []
white, gray, ret = 0, 1, []
stack = [(wh... | true |
17196eb5f384c9889d3562e662379dee57f3fa41 | sernol9/Python4Beginners | /Intro to Python/ch05/SelfCheck 187-4.py | UTF-8 | 784 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
###
# File: c:\Users\olivi.000\Dropbox\Public\My Library\IT\SW Programming\sego\Intro to Python\ch05\SelfCheck 187-4.py
# Project: c:\Users\olivi.000\Dropbox\Public\My Library\IT\SW Programming\sego\Intro to Python\ch05
# Created Date: Thursday, May 7th 2020, 6:17:00 pm
# A... | true |
b883d0421ce781799a3febb06964b7a9ceb0cf69 | pomes/valiant | /tests/console/test_cli.py | UTF-8 | 1,883 | 2.578125 | 3 | [
"MIT"
] | permissive | """Tests for the `about` command.
Copyright (c) 2020 The Valiant Authors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy,... | true |
328af7ffb1a8d206b873d2f726c7636adbfd4bb5 | Navi-SS/Machine-Learning | /Proyecto 0 [Covid-Mx]/Covid-19_MX.py | UTF-8 | 29,301 | 3.390625 | 3 | [] | no_license | #-----------------------------------
#Importamos las librerias a utilizar
#-----------------------------------
#Librerias de datascience
import numpy as np
import pandas as pd
#Librerias para gráficar
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
import requests
import plotly.expr... | true |
65e11b45b0276a8c66d6cb3405b62154d6157d19 | yang1992samantha/CDF-MIECO | /Model/caozhi2.py | UTF-8 | 4,884 | 2.65625 | 3 | [] | no_license | from sklearn.metrics import classification_report, f1_score, precision_score, recall_score
from sklearn import neighbors
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
f... | true |
22bfaee6ac649dc181e32693fc3043faa0d08a33 | danjjl/biomed-ui | /editUser.py | UTF-8 | 2,653 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtCore, QtGui, QtSql
class editUserVirtual(QtGui.QDialog):
def __init__(self, parent, indexes, lastName, firstName, age, sexe):
super(editUserVirtual, self).__init__(parent)
self.parent = parent
self.indexes = indexes
... | true |
a691c88e089446bffb34434b1b94a38453cd06a7 | jwo29/prj | /python/video processing/chap09/04.2d_dft.py | UTF-8 | 1,184 | 2.796875 | 3 | [] | no_license | import numpy as np, cv2, time
from Common.dft2d import dft, idft, calc_spectrum, fftshift
def dft2(image):
tmp = [dft(row) for row in image]
dst = [dft(row) for row in np.transpose(tmp)]
return np.transpose(dst) # 전치 환원 후 반환
def idft2(image):
tmp = [idft(row) for row in image]
ds... | true |
cb458a541a52b78fd888d3123af1182bb1df0c36 | PouriaHabibi1370/image_processing | /Create an image with coordinates/testy1.py | UTF-8 | 598 | 3 | 3 | [] | no_license | # ایجاد تصویر و ذخیره کردن با استفاده از مختصات
import face_recognition
from numpy import imag
import uuid # ایجاد ای دی مختص هر تصویر برای ذخیر
img = face_recognition.load_image_file('image.jpg')
image_location = face_recognition.face_locations(img)
#print(image_location)
from PIL import Image
for face_loca... | true |
56140cffeb16badfb6da9f10dffda37713c5e3d5 | arielalvarez88/MoviesRecomenderSystem | /scripts/data_formatter.py | UTF-8 | 628 | 3.265625 | 3 | [] | no_license | class DataFormatter(object):
"""Helper for pivoting data.
"""
@staticmethod
def pivot_data(data):
"""Transform raw data into the a matrix where each row represents a
user and each column a movie.
Args:
data... | true |
eeae00e269b8a0554b3d844ac2467fe460cd8d71 | hirokitnk/python_online_judge | /joi2007ho_c.py | UTF-8 | 392 | 2.78125 | 3 | [] | no_license | from itertools import combinations
N = int(input())
PL = [tuple(map(int,input().split())) for _ in range(N)]
PL.sort()
P = set(PL)
result =0
for a,b in combinations(P,2):
if not ( b[1]-a[1]+b[0], b[1]-b[0]+a[0] ) in P:
continue
if not ( b[1]+a[0]-a[1], -b[0]+a[0]+a[1] ) in P:
continue
result... | true |
2db55fe6d4677eb4ce693dd8e350ecea3cacd319 | joaquincabezas/interview_meter | /interview_meter.py | UTF-8 | 7,409 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
interview_meter.py: Analyze camera time for studio interviews.
Author: Joaquin Cabezas github.com/joaquincabezas
Date: 10/04/2020
Instructions:
Extract the reference frames using ffmpeg
ffmpeg -ss 00:00:XX -t 00:00:00.01 -i YOURMOVIE.MP4 -r 25.0 REFER... | true |
39c4a73950fd2029770f53436d0a46ac3fdc6d5f | dhawaljoh/IIT-Kharagpur | /plottingTruckActivity.py | UTF-8 | 5,159 | 2.859375 | 3 | [] | no_license | import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import pylab as bp
def getData(segmentNumber):
data=[]
for i in range(24):
hour=i
lines=[line.strip() for line in open("./Plotting/SegmentAnalysis/TruckActivityInfo/truckActivity"+str(hour)+".txt")]
mylines=[]
for i in lines:
... | true |
08c4df160b7da7fc20e2e9943a7d1b7472040a8e | msarefin/mypy | /functionsDemo.py | UTF-8 | 344 | 4.125 | 4 | [] | no_license | #str1 with alphabets and numbers
str1 = "hello123"
#str2 with alphabets only
str2 = "hello"
#str3 with numbers only
str3 = "123"
# str4 with alpha numeric characters
str4 = "hello world 123"
print(str1.isalnum())
print(str2.isalnum())
print(str3.isalnum())
print(str4.isalnum())
str = "The world is flat"
print(str.... | true |
b9f7c25d729c0bf23338cf6d17b13ad3a301b9b1 | antai0926/WeatherApp | /model.py | UTF-8 | 609 | 2.625 | 3 | [] | no_license | from flask import g
import sqlite3
def connect_db():
return sqlite3.connect('weather.db')
def get_all_weather():
cursor = g.db.execute('SELECT city, temp, descript FROM weather;')
weathers = [dict(city=row[0],temp=row[1],descript=row[2])for row in cursor.fetchall()]
return weathers
def insert_weath... | true |
28700062eba1a6d8db76c24a41ecb4cc46cfc626 | adautoaraujo/projeto-de-ic | /Django-ORM-master/main.py | UTF-8 | 572 | 2.859375 | 3 | [
"MIT"
] | permissive | # Turn off bytecode generation
import sys
sys.dont_write_bytecode = True
# Django specific settings
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
import django
django.setup()
# Import your models for use in your script
from db.models import *
# Start of application script (demo code below)
ca... | true |
dd3aaf79ad482134c7d8a9a089afc412470a120b | GMago123/Scraping-ABC-News | /main.py | UTF-8 | 11,520 | 2.875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from selenium import webdriver
import urllib.parse as urlparse
import re
import json
import time
import sys
class WebAccess:
def __init__(self, mode='static'):
if mode == 'dynamic':
self.driver = webdriver.Chrome()
self.dr... | true |
1c8a40002721cfa0a06f9935331874b8528347f3 | pulkitagrawal34/DeepDive-Python | /python deepDive part1/python_deepDive_part1.2.py | UTF-8 | 15,654 | 4.46875 | 4 | [] | no_license | #Python -version: 3.7.3
"""
This Module covers:
1. Functions and Parameters
2. Positional unpacking and iterables
3. Fist class Functions
"""
def myfunc(a, b , c):
return "a = {0}, b = {1}, c = {2}".format(a,b,c)
myfunc(1,2,3) # returns a = 1, b = 2, c = 3
def my_func(a, b= 2 , c= 3): #Once you start assigning ... | true |
b03997eab242b21abf43b2695dbed66e7483ad0d | joaofel-u/uri_solutions | /1449.py | UTF-8 | 709 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
instancias = int(input())
for instancia in range(instancias):
m, n = input().split()
m = int(m)
n = int(n)
# cria o dicionario
entrada = []
for i in range(m):
dupla = [""] * 2
dupla[0] = input()
dupla[1] = input()
entrada.append(dupla)
... | true |
cab9d776dc698251dffec1fe1d85781a8bb76d73 | shiva787dreamliner/Hamster | /PID.py | UTF-8 | 5,515 | 2.59375 | 3 | [] | no_license | '''
/* =======================================================================
(c) 2015, Kre8 Technology, Inc.
This is a program that is provided to students in Robot AI class.
Students use this it to build different Hamster behaviors.
Name: starter1.py
By: Qin Chen
Last Updated: ... | true |
b5e9ef003b4b0a9a4ddabfd2b017acd39d8f5982 | bzhangGo/lrn | /nli/code/bert/tokenizer.py | UTF-8 | 1,311 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | # coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import argparse
from . import tokenization
def load_tokenizer(params):
tokenization.validate_case_matches_checkpoint(
params.lower,
os.path.join(params.bert_di... | true |
47ed95444c22c6b1e92c9a7fbfa6e48f104c5f9e | EsslamAshour/project-1 | /YuushaNoTsurugi/tests/validate_test.py | UTF-8 | 373 | 3.765625 | 4 | [] | no_license | def validate(usr_input: str, choices: list):
"""
Validate any input from the user given the valid choices and prompt the user to input again if invalid.
"""
while usr_input not in choices:
usr_input = input(f"Please input a valid option. ({[choice for choice in choices]}) ").lower()
return u... | true |
14cbf8845fd1c7a91f447cd842f2f3e0affd5fcc | carrell-ncl/crypto_forecast | /crypto_getprices.py | UTF-8 | 2,934 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 28 10:17:34 2021
@author: Steve
"""
import pandas as pd
import requests
import matplotlib.pyplot as plt
from datetime import date
import time
import os
import csv
from sklearn import preprocessing
#Set our working directory
os.chdir(r'C:\Users\Steve\Desktop\crypto_fo... | true |
1c7a8b54e317724b26ff45691ef92071277faa5b | Vinytt/Desafio_Data_Machina | /problema1/api_problema1.py | UTF-8 | 1,079 | 3.265625 | 3 | [] | no_license | #Imports Necessários
from flask import Flask, request
from gerenciamento_dados_problema1 import calcular_dist_normal
#----------------------------------------------------------------------
#Constantes
#Instancia uma API com nome 'Teste_Data_Machina':
app = Flask('Teste_1_Data_Machina')
#-------------------------------... | true |
20e53cac29b7f2b89b64bcb4799854a3c07a00c2 | Aasthaengg/IBMdataset | /Python_codes/p02606/s164461705.py | UTF-8 | 92 | 3.0625 | 3 | [] | no_license | l,r,d=[int(x) for x in input().split()]
x=(r-l)//d
if l%d==0 or r%d==0:
x+=1
print(x) | true |
e44f5548f050ef2c99ca382f45a2ff6f95df9600 | gitter-badger/pyroVED | /pyroved/utils/viz.py | UTF-8 | 2,490 | 2.796875 | 3 | [
"MIT"
] | permissive | from typing import Union, List, Tuple
import torch
from torchvision.utils import make_grid
import matplotlib.pyplot as plt
def plot_img_grid(imgdata: torch.Tensor, d: int,
**kwargs: Union[str, int, List[float]]) -> None:
"""
Plots a *d*-by-*d* square grid of 2D images
"""
if imgdata.... | true |
8d870651c66dc1a50ed3243e2833b5b3a62e6c87 | shishir-kr92/HackerRank | /Algorithm/problem_solving/Climbing_The_Leader_Board.py | UTF-8 | 1,965 | 3.34375 | 3 | [] | no_license | def remove_duplicate(score_board):
new_board = []
for i in range(len(score_board)):
if i == 0:
new_board.append(score_board[i])
elif score_board[i] != new_board[-1]:
new_board.append(score_board[i])
return new_board
def get_nearest_match(score_board, score, l_limit,... | true |
ba459f0e2a57c0f93d3ecef1694201d27aef47b7 | ilya-shenbin/bcell_evolution_tree | /tree_builder.py | UTF-8 | 564 | 2.71875 | 3 | [] | no_license | import numpy as np
from distance_calculator import calc_distance
from tree import Tree
# builds evolution tree for several (V or D or J) regions
# @origin_region - original version of (V or D or J) region of B-cell
# @regions - set of mutations of original region of B-cell
# @returns - tree
# example:
# origin_region ... | true |
d5325e02ccb1a033418a7c7fba594d325c31ccc7 | SirMatix/Python | /Socratica/random module tutorial.py | UTF-8 | 567 | 4 | 4 | [] | no_license | # Display 10 random numbers from interval [0,1)
import random
'''
for i in range(10):
print(random.random())
'''
'''
def my_random():
#Random, scale, shift, return
return 4*random.random() + 3
for i in range(10):
print(my_random())
'''
#uniform function
'''
for i in range(10):
print(random.uni... | true |
bcdfc96283858a9e858a5f308d31666a636bad80 | mifrok/GeekBrainsPython | /lesson_5/task_5.py | UTF-8 | 745 | 3.671875 | 4 | [] | no_license | """
Создать (программно) текстовый файл, записать в него программно набор чисел, разделенных пробелами.
Программа должна подсчитывать сумму чисел в файле и выводить ее на экран.
"""
import random
with open('task5.txt', 'w+', encoding='utf-8') as task5:
for i in range(10):
task5.write(f'{str(round(random.ra... | true |
1f865269f82ded35827c80b38710699c36752694 | pikuch/AOC19 | /Day20.py | UTF-8 | 7,181 | 3.109375 | 3 | [] | no_license | # AOC19 day 20
import numpy as np
from collections import deque
def load_data(f_name):
with open(f_name, "r") as f:
data_read = f.read()
return data_read
def parse_input(data):
lines = data.split("\n")
# make sure the lines are long enough
max_line = 0
for line in lines:
if l... | true |
025724ac6d8e39b9a00f77c05e134f278f0994b1 | zahranorozzadeh/tamarin6 | /zarb matrisha.py | UTF-8 | 653 | 3.171875 | 3 | [] | no_license | import random
n = int(input('enter n:'))
m = int(input('enter n:'))
k = int(input('enter n:'))
mx1 = [[random.randint(1,10) for i in range(n)] for j in range(m)]
mx2 = [[random.randint(1,10) for i in range(k)] for j in range(n)]
res = [[0 for i in range(k)] for j in range(m)]
print('matrix1 :')
for i in ra... | true |
66fc2fcbd9615b7afd81c1718fce95d320d1c618 | DeborahPerez/BioInformatics_I | /medianstring_file.py | UTF-8 | 1,830 | 3.015625 | 3 | [] | no_license | #2016 Jorge Canelhas
import sys
lines = sys.stdin.read().splitlines()
mtrx=list()
for n,l in enumerate(lines):
if n==0:
l1=l
else:
mtrx.append(l)
l2=''
for n in mtrx:
l2=l2+ ' ' + n
l2=l2[1:len(l2)]
def HammingDistance(g1, g2):
distance = 0
for i, j in zip(g1, g2):
if i ... | true |
22bfcd4b8995d7c6c8477d1fa8d6745fb50aa2ed | mihairu/config-files | /scripts/battery.py | UTF-8 | 950 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import re
battery = "1"
charging = {"Charging" : "^",
"Discharging" : "v",
"Charged" : "="}
battery = re.compile("Battery "+battery)
percent = re.compile("([0-9]+)%")
charge = re.compile("(([a-z]*)charg([a-z]+))")
def read_file(... | true |
fb42efb20ef1de09b4d79cc817bb0484a1afadbd | judo500/FinalProjects | /countingLetters.py | UTF-8 | 543 | 3.78125 | 4 | [] | no_license | '''
Created on Nov 18, 2017
@author: ITAUser
'''
print("Enter file name to check:")
filename = input()
print("Enter the character you would like to examine:")
x = input()
rep = open(filename, "r").read()
words = rep.split()
spaces = len(words)-1
countChar = 0
count1 = 0
count2 = 0
for w in words:
for y in ... | true |
6b31dc1992cf15c1cc0408a4da603d0cbf86fe0e | dhwlgjs13/ohhackmaro | /J_plus.py | UTF-8 | 46 | 3.015625 | 3 | [] | no_license | def plus(a,b):
res=int(a+b)
return res | true |
038a332ae0d7c41736f78b3b626f9b5af069c0c6 | Nirvanabc/sentence_classification | /rnn/sentiment/my_sentiment_rnn.py | UTF-8 | 6,160 | 3.03125 | 3 | [] | no_license | import tensorflow as tf
from constants import *
from prepare_data import *
def build_inputs(batch_size, sent_size,
embedding_size, class_num):
'''
placeholders for inputs, targets and dropout
'''
inputs = tf.placeholder(tf.int32, [batch_size,
sen... | true |
82b3523b6d55709d7b258024405c19a57974faf9 | adilagabriela/forca | /adila-forca.py | UTF-8 | 3,968 | 3.640625 | 4 | [] | no_license | import random # essa instrução importa uma biblioteca da internet.
palavras = [] #essa instrução cria uma lista.
letrasErradas = ''#essa instrução cria uma variável, que é o mesmo que uma lista uma com apenas um valor.
letrasCertas = ''
FORCAIMG = ['''
+---+
| |
|
|
|
|
=========''',... | true |
ed4247ec07cf600213402c4a1cc52cea2cc2a0b2 | vendyv/A2OJ-Ladders | /A2OJ-11/028_A_Team.py | UTF-8 | 192 | 3.65625 | 4 | [
"MIT"
] | permissive | """
28 Team - https://codeforces.com/problemset/problem/231/A
"""
number = int(input())
c = 0
for n in range(number):
if (input().split().count("1") > 1):
c += 1
print(c)
| true |
6d8326825223d03e296e915b3ba0f439ddc42a91 | wyfwyf112/Web-Scrape | /test.py | UTF-8 | 754 | 2.703125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
page = requests.get('https://goamiroo.com/collections/a-to-z-products/products/white-lace-bra-set-1-2-cup-hollow-out-brassiere-see-through-bra-transparent-lingerie-women-plus-size-sexy-underwear-sets')
soup = BeautifulSoup(page.text, 'html.parser')
#optiontitles... | true |
1dea50ee9b1178933b363d00165cb2379dd44cec | IngenuityEngine/ftrack-connect-foundry | /source/FnAssetAPI/Host.py | UTF-8 | 6,136 | 2.84375 | 3 | [
"MIT"
] | permissive | from .audit import auditApiCall
from .exceptions import InvalidCommand
__all__ = ['Host']
class Host(object):
"""
The Host provides an abstraction of the caller of API functions. Largely to
provide information about the Document state to the Manager, without
requiring specific knowledge of which host it is... | true |
57a343e8079b219a725a43bf07e8dd17a4caab47 | jsmits/ta_python | /src/ta/Macd.py | UTF-8 | 4,770 | 3.109375 | 3 | [] | no_license | from Indicator import *
from Ema import Ema, EmaMacd
class Macd(Indicator):
""" Moving Average Convergence-Divergence (MACD) indicator class
input: data = list or tuple of float or integer values
parameter = tuple (x, y, z); where x is short term ema, y is long ter... | true |
9f9b835311da55a9d9e7e5a2cdfc555e95ff8a04 | mayafang163/seven-segment-digital-tub | /tube3.py | UTF-8 | 2,241 | 3.484375 | 3 | [] | no_license | #Nixie tubeV3.py
import turtle,time
def drawGap(): #绘制数码管间隔
turtle.penup()
turtle.fd(5)
def drawLine(draw): #绘制单段数码管
drawGap()
turtle.pendown() if draw else turtle.penup()
turtle.fd(40)
turtle.right(90)
def drawDigit(digit): #根据数字绘制七段数码管
drawLine(True) if digit in [2,3,4,5,6,8,9] else ... | true |
12ee0b2c9df024694d50fe80ea7829b24829fec2 | lukasg18/Estrutura-de-dados | /codigo em python/paraProvaF/corpus/questao4.py | UTF-8 | 1,475 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# questao4.py
#
# Copyright 2016 Lucas <lucas@lucas-Inspiron-3421>
#
import sys
def frequenciaTxt(paramTXT):
lstPalavras = separaPal(paramTXT)
dicFreq = {}
for elem in lstPalavras:
if elem.lower() in dicFreq:
dicFreq[elem.lower()] += 1
else:
dicFreq[el... | true |
81f6fec940f26e4bb28c71d0ef6dfab795f5933c | yukti99/Operation-System | /LAB-1 (elf & entropy)/3(b)-entropy/3b-entropy.py | UTF-8 | 855 | 3.875 | 4 | [] | no_license | '''Lab Assignment 3(b) - Yukti Khurana'''
# lesser the entropy of a file -> less randomness -> less secure
import sys
import math
# read the whole file into a byte array
filename = sys.argv[1]
f = open(filename, "rb")
l = f.read()
byteArr = map(ord,l)
fileSize = len(l)
f.close()
print ("File size in bytes: ",fi... | true |
2853d01bf8b12d1c109727f060d4aeea5913a67f | MarshalLeeeeee/tensorflow_beginner | /tf-fft.py | UTF-8 | 2,366 | 2.625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import cv2
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
filename = 'rain_princess.jpg'
'''img = mpimg.imread(filename)
print(img.shape)
plt.imshow(img)
plt.axis('off')
plt.show()'''
img_man = cv2.imread(filename,0)
print(img_man.shape)
plt.imshow(img_man... | true |
78186bedea6bb1d63e5f5622449205fb3a24d887 | Lui-Calvin/ICS-31-Fall-2015 | /Files/Restaurantsf.py | UTF-8 | 6,236 | 3.671875 | 4 | [] | no_license | __author__ = 'dgk'
# RESTAURANT COLLECTION PROGRAM
# ICS 31, UCI, David G. Kay, Fall 2012
# Implement Restaurant as a namedtuple, collection as a list
##### MAIN PROGRAM (CONTROLLER)
def restaurants(): # nothing -> interaction
""" Main program
"""
print("Welcome to the restaurants program!")
our_re... | true |
9daea7405164a9b220d51d9e99a53e517db5aad2 | kaviraj333/python | /p30.py | UTF-8 | 277 | 2.859375 | 3 | [] | no_license | amu=int(raw_input())
if(amu/8==431.75):
print("yes")
elif(amu==10):
print("yes")
elif(amu==111111):
print("no")
elif(amu==1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000):
print("yes")
else:
print("yes")
| true |
fd92e061218fde8e81ef360b2d8af973cbf83e10 | JackTheWanted/Snake | /Part 6/6.1.py | UTF-8 | 1,263 | 3.125 | 3 | [] | no_license | # for i in range(0, 8):
# print('*', end=' ')
for i in range(0,6):
for j in range(0,6):
print('*', end=' ')
print()
#
# i = 0
# print(i, end=" ")
# i = 1
# print(i)
#
# for i in range(0,10):
# print('*', end='')
# print()
# for j in range(0,5):
# print('*', end='')
# print... | true |
67aced96036f018d6a651c008bde4ab15633aea2 | jasmith79/playlister | /playlister/xspf.py | UTF-8 | 1,878 | 2.84375 | 3 | [
"MIT"
] | permissive | """
.. py:module:: xspf
:platform: Unix, Windows
:synopsis: Defines all xspf-related operations for playlister.
"""
from urllib.parse import unquote, quote
from unicodedata import normalize as uni_norm
from xml.sax.saxutils import escape as esc_xml
from typing import Dict, List
from playlister.playlister_util... | true |
7bf930a9ce69ee54b4ed04d230f0c38bbcc6117e | pdtran3k6/leviathan | /exportCSV.py | UTF-8 | 584 | 2.890625 | 3 | [] | no_license | from constants import ATTENDANCE_RAW, ATTENDANCE_CSV
import csv
import os
import pickle
def exportCSV():
with open(ATTENDANCE_RAW, "rb") as f:
attendance = pickle.load(f)
# print(attendance) # for debugging purpose
# newline="" to avoid empty lines in output on Windows
with open(ATTENDANCE_CSV, "w",... | true |
c756bb83fa4ec04abd4bb4b66f9cc4a5b83f5a1f | ks808/proto_database | /core.py | UTF-8 | 4,895 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ~ Author: Krylov Sergey
class DataBase(object):
""" Класс прототип базы данных поддерживающий транзакции (в том числе вложенные)
и хранящий значения в оперативной памяти
Внешнее взаимодействие осуществляется через передачу строки с параметрами в аргумент ... | true |
46ad2b097ab523a4ed3cff5ab2a55c2a81bd3a00 | nuria/study | /advent/2020/day2_2.py | UTF-8 | 669 | 2.953125 | 3 | [] | no_license | #!usr/local/bin/python
# -*- coding: utf-8 -*-
from collections import Counter
f = open('./input2.txt')
total = 0
for l in f:
# format 1-3 a:
# translate to tuple
(policy, pw) = l.split(":")
(_range, letter) = policy.split()
(_min, _max) = _range.split("-")
print "{0}·{1}·{2}·{3}".format(_min,_max, let... | true |
e4512252cc8decf1a342f80869a03309b11b77fa | andaviaco/tronido | /src/syntax/symtable.py | UTF-8 | 3,185 | 2.59375 | 3 | [
"MIT"
] | permissive | import pprint as pp
GLOBAL_CONTEXT = 'g'
class SymTableError(Exception):
pass
class SymTable(object):
_table = {GLOBAL_CONTEXT: {}}
current_contex = GLOBAL_CONTEXT
"""docstring for SymTable."""
def __init__(self):
super().__init__()
@staticmethod
def show():
pp.pprint(... | true |
e68467424939bac7cf77f15c13290af7ee7e2ec2 | freemagma/AI | /ex/ex3b.py | UTF-8 | 70 | 2.515625 | 3 | [] | no_license | import sys
print([int(s) for s in sys.argv[1:] if int(s) % 3 == 0])
| true |
6077c7996a229d40b0f54491d0b6ae5a290dc9e8 | arironman/MSU-Python | /ex-4/32.py | UTF-8 | 265 | 3.5625 | 4 | [] | no_license | import intro #Use to style and to introduce about the developer of the program
x=int(input("Enter Number "))
print("Number in \n Binary = ", bin(x),"\n octal = ", oct(x),"\n Hexadecimal = ",hex(x))
import end #Use to give style while ending the program
| true |
daaea394ca21112cb85ae9fd0132b3df347aea17 | RobertoGianfelice/PokerPython | /mypoker_step1.py | UTF-8 | 1,879 | 3.59375 | 4 | [] | no_license | # Struttura di base dell'esercizio
from random import randint
Carte=["AC","2C","3C","4C","5C","6C","7C","8C","9C","dC","JC","QC","RC",
"AQ","2Q","3Q","4Q","5Q","6Q","7Q","8Q","9Q","dQ","JQ","QQ","RQ",
"AF","2F","3F","4F","5F","6F","7F","8F","9F","dF","JF","QF","RF",
"AP","2P","3P","4P","5P","6P","... | true |
ba8a0d8f167727de9ccf36a8e0506d42091f7c3d | taeyooniSK/python_basics | /lists.py | UTF-8 | 753 | 4.28125 | 4 | [] | no_license | # list 에서 마이너스 인덱스 숫자로도 각 요소에 접근할 수 있음
list = [1, 2, 3, 4, 5]
list2 = [6, 7, 8, 9]
totalList = list + list2
print(list[0])
print(list[-1])
print(list[3:-1])
print(list + list2) # can concatenate two lists with '+' operator
totalList.append(10) # add an element to the end of the list
totalList.append(10)
print(totalL... | true |
3de27e442d032dd6b7e1ab6338020901c9a59299 | divyanshAgarwal123/PythonProjects | /kinter example/profit and loss.py | UTF-8 | 1,004 | 3.421875 | 3 | [] | no_license | from tkinter import *
obj = Tk()
obj.geometry("600x400")
def show():
inputvalue=T1.get("1.0", 'end-1c')
inputvalue1=T2.get("1.0", 'end-1c')
x = int(inputvalue)
y = int(inputvalue1)
if(inputvalue > inputvalue1):
z=x-y
label2.config(text=z)
label3.config(text="you have a profi... | true |
76c0e94c4358d11b70e6d51ce92da02cddcbe17d | menghsin-2021/yt-concate | /yt_concate/pipeline/steps/read_caption.py | UTF-8 | 803 | 2.546875 | 3 | [
"MIT"
] | permissive | from .step import Step
class ReadCaption(Step):
def process(self, data, inputs, utils):
for yt in data:
if not utils.caption_file_exist(yt):
continue
captions = {}
with open(yt.caption_filepath, 'r') as f:
time_line = False
... | true |
72cfc75935efc4d56901860e15c176ca75f43c4f | Nandsgit/ChessAI_NeuralNetwork | /src/chess/ChessAI_TF.py | UTF-8 | 1,821 | 3.125 | 3 | [] | no_license | #
#
# No longer under development! -> now on SKLEARN!, see seperate file
#
#
import chess
import numpy as np
import tensorflow as tf
class ChessAI:
feature_columns = []
def __init__(self):
self.feature_columns = [tf.feature_column.numeric_column(key='field' + str(i))
... | true |
99fae5d14910727859f639d7868f0600c7851025 | IzhanAlam/Mathematical_Model_To_Evaluate_Impact_Of_Weather_and_Temperature_On_Traffic_Accidents | /model_calibration.py | UTF-8 | 4,037 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from traffic_daily import *
from weather import *
import datetime
def change_date(traffic_data):
for i in range(0,len(traffic_data[0])):
traffic_data[0][i]=datetime.datetime.strptime(traffic_data[0][i], '%m/%d/%Y').strftime('%Y-%m-%d')
return traffic_data
... | true |
05b923dcf3fa00516da7d137179659e4aa7addc4 | NovaEx/allpython | /SystemStats.py | UTF-8 | 2,194 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | import psutil
import platform
# задача 4 - вывести диагностическую информацию рабочей
# машины - ЦПУ, оперативная память свободная/занятая,
# диски - свободно/занято, сетевые интерфейсы, тип и версия ОС
print('CPU: {0} CORES: {1} THREADS: {2} LOAD: {3} % FREQ_CUR: {4} MHz FREQ_MAX: {5} MHz FREQ_MIN: {6} MHz'.form... | true |
7336740960c5b4b9aeb7a05e6837742ce592779b | elainew96/infoscout | /web.py | UTF-8 | 1,273 | 2.703125 | 3 | [] | no_license | import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go
import data
app = dash.Dash()
app.layout = html.Div(children=[
html.H1('Retailer Affinity'),
html.Br(),
html.P('Select a Parent Brand'),
dcc.D... | true |
bcb0630fd1db603c66b9780d5cf526278be8b977 | worldassist/python_lesson_2 | /example.py | UTF-8 | 2,941 | 4.3125 | 4 | [
"MIT"
] | permissive | #Задачи на циклы и оператор условия------
#----------------------------------------
'''
Задача 1
Вывести на экран циклом пять строк из нулей, причем каждая строка должна быть пронумерована.
'''
# i = 0
# while i < 5:
# i += 1
# print( i, 'is 0')
'''
Задача 2
Пользователь в цикле вводит 10 цифр. ... | true |
98af143d7cf95efae4906571f5774168a9479eb4 | jmfiz/jpardobl-trastobrain | /trasto/infrastructure/asyncio/__init__.py | UTF-8 | 735 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import asyncio
import queue
#class to provide queue (sync or asyc morph)
class QueueMorph(queue.Queue):
def __init__(self, maxsize=0, timeout=0.01):
super().__init__(maxsize)
self.timeout=timeout
async def aget(self):
while True:
try:
return self.get_nowait... | true |
ec38c965bd1eb22ce023ac8fdc2873794f456e85 | jambran/Random-Walks | /RWRecursive.py | UTF-8 | 652 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 23 23:14:24 2017
@author: jamie
"""
import numpy as np
import matplotlib.pyplot as plt
n=6
PathsOld = np.zeros((2*n+3,2*n+3))
PathsNew = np.zeros((2*n+3,2*n+3))
#start (step 0)
PathsNew[n+1][n+1] = 1
for step in range(1,n):
#Reassign
PathsOld = PathsNew
#W... | true |
4c76b4900d5ce008546d3448d9e80299f2435ea7 | knighton/deepzen | /deepzen/node/base/atom.py | UTF-8 | 1,311 | 2.890625 | 3 | [] | no_license | from copy import deepcopy
from .node import Node
from .spec import Spec
class Atom(Node):
"""
A Node that contains a single indivisible transformation.
Each Atom contains a Spec and Layer inside. See the Keyword class for how
they are created. There are many different kinds of layers.
"""
... | true |
615c4a73d1484d577abcc345c20a4d8d05c6965a | JiXunzhen/Megumi | /secure | UTF-8 | 2,411 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rsa
import argparse
import os
ENCRYPT_LEN = 200
DECRYPT_LEN = 256
parser = argparse.ArgumentParser(description="""
加密解密工具. supported by Gayson.
Usage:
secure gen rsa_file
secure encrypt rsa_file -s [SOURCE FILE] -d [DEST FILE]
secure decrypt rsa_file -s [SOURCE FI... | true |
213099f0e29f8e5f28e08afc37d40b5379c2bd4a | rich-s-d/AdventOfCode | /day3_part1.py | UTF-8 | 938 | 3.125 | 3 | [] | no_license | import os
'''
# this duplicated the lines in the day3.text into a new file. I multiplied by 1500 to make sure that is was at least 3 times wider than it was long, as the tobogan trajectory is 3 to the right, 1 down.
with open('day3.txt', mode='r') as f, open('new.txt', mode='w') as f2:
for i, line in enumerat... | true |
91d389485859aef30e0034d50c1bb11ef22d9e6e | greenblues1190/Python-Algorithm | /LeetCode/8. 최단 경로 문제/743-network-delay-time.py | UTF-8 | 1,623 | 3.40625 | 3 | [] | no_license | # https://leetcode.com/problems/network-delay-time/
# You are given a network of n nodes, labeled from 1 to n.
# You are also given times, a list of travel times as
# directed edges times[i] = (ui, vi, wi), where ui is the source node,
# vi is the target node, and wi is the time it takes
# for a signal to travel from ... | true |
007eb7af58557e1d56f8c1b0f378f2051dc95f6f | twattanawaroon/adventofcode | /2018/q7a.py | UTF-8 | 604 | 2.796875 | 3 | [] | no_license | import sys
edgestr = [line.strip() for line in sys.stdin]
edges = {}
indeg = {}
zeroes = []
for i in range(26):
c = chr(ord('A')+i)
edges[c] = []
indeg[c] = 0
for e in edgestr:
edgespl = e.split()
p = edgespl[1]
q = edgespl[7]
edges[p].append(q)
indeg[q] += 1
for i in range(26):
c =... | true |