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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
be984359813ff69a89cf37ca1c54303d1437c4e2 | Python | cgiroux86/leetcode- | /reverseParentheses.py | UTF-8 | 595 | 3.28125 | 3 | [] | no_license | class Solution:
def reverseParentheses(self, s: str) -> str:
res = ''
stack = []
for char in s:
if char == "(":
stack.append([])
elif char == ")":
if len(stack) == 1:
res += "".join(stack.pop()[::-1])
... | true |
69cc87cdedff5a6dbf19ef1d3b8f51ea1158c2b4 | Python | webclinic017/sagetrader_api | /mspt/apps/users/crud.py | UTF-8 | 1,580 | 2.53125 | 3 | [] | no_license | from typing import Optional
from sqlalchemy.orm import Session
from mspt.apps.users import models
from mspt.apps.users import schemas
from mspt.settings.security import verify_password, get_password_hash
from mspt.apps.mixins.crud import CRUDMIXIN
class CRUDUser(CRUDMIXIN[models.User, schemas.UserCreate, sc... | true |
f84081aeef5fdae433e2bbc77b0d5b699b7035c4 | Python | Ford-z/Nowcoder | /天弃之子.py | UTF-8 | 1,024 | 3.46875 | 3 | [] | no_license | #作者:一只酷酷熊
#链接:https://www.nowcoder.com/discuss/612463
#来源:牛客网
#题意
#游戏共有 nn 关,每一关有 a_i个按钮,其中只有一个可以过关,选择错误就会重新开始
#玩家可以通过试错记住正确的按钮
#问玩家运气最差时(每一关都要试 a_i次才过关)共需要按多少次按钮才能通关。
#分析
#这道题最重要的环节就是读懂题目
#从题意中分析出【每一关都要试 a_i次】之后就比较容易了
#对于每一关来说,都要进行 a_i - 1a次失败
#每次失败要先通过前面的 i - 1关,再算上当前这关,需要按 ii 次按钮
#所以往答案里累加 (a_i−1)⋅i
#再算上最... | true |
047970cbc89ffb4bc43549e72f2f2853b8aa765b | Python | harsha444/toppr_training | /day_wise_work_done/22nd_june/python_prac/multiple_inheritance.py | UTF-8 | 720 | 4.1875 | 4 | [] | no_license | class Aquatic:
def __init__(self, name):
self.name = name
def swim(self):
print(self.name + " is swimming")
def greet(self):
print(self.name + " from Sea")
class Amulatory:
def __init__(self, name):
self.name = name
def walk(self):
print(self.name + " is w... | true |
28d22c2b07ab128d30bfbf99e0a727a97c89a635 | Python | zephod-exodius/pysecuritycenterdevelop | /examples/sc4/lce_wmi_tuner/wmi_config_gen.py | UTF-8 | 4,330 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import securitycenter
import os
from ConfigParser import ConfigParser
# Main configuration template
conf_tpl = '''
options = {
log-directory {LOG_DIR}
lce-server {LCE_HOST} {
client-auth auth-secret-key {LCE_AUTH_KEY}
}
server-port {LCE_PORT}
{SYSLOG_SERVERS}
heart... | true |
7ec96bb2bbfd69ae53fb3f3ba8462a852468be99 | Python | abhishekgupta5/loktra_task | /crawler/crawl.py | UTF-8 | 3,171 | 3.640625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
#Standard library import
import sys
#Third party imports
import requests
from bs4 import BeautifulSoup as bs
class CrawlIt(object):
#For 1st query(total number of results for a given keyword). Argument- kw:keyword
def query_one(self, kw):
#URL construction
kw = '+'.join(kw... | true |
57d2d3112aa79b188a38aaddcb7256531879aaca | Python | VargheseVibin/dabble-with-python | /Day38_ApiWorkoutTracker/main.py | UTF-8 | 1,702 | 3 | 3 | [] | no_license | import requests
import datetime
import os
# Nutritionix API Details
APP_ID = os.environ["NT_APP_ID"]
API_KEY = os.environ.get("NT_API_KEY")
print(f"APP_ID:{APP_ID}")
GENDER = "male"
WEIGHT_KG = 89.9
HEIGHT_CM = 178.2
AGE = 36
exercise_endpoint = "https://trackapi.nutritionix.com/v2/natural/exercise"
headers = {
"... | true |
77bc399538bafd2c04ec7dad1e8dce9d3a61e6d9 | Python | StephTech1/Joke1 | /main.py | UTF-8 | 400 | 3.96875 | 4 | [] | no_license | print("Do you want to hear a joke?")
print("Pick your favourite number!")
number = int(input("Choose a number between 1 and 3!:"))
if (number == 1):
print("Why did the chicken cross the road? To get to the other side!")
elif (number == 2):
print("Why dont scientists trust atoms? Because they make up everthing!")
... | true |
efd978fb5993aa3ea94abb0cef90a165a669b460 | Python | Zombor00/tequila | /tests/test_binary_pauli.py | UTF-8 | 6,964 | 2.796875 | 3 | [
"MIT"
] | permissive | import tequila as tq
from tequila.hamiltonian import QubitHamiltonian, PauliString, paulis
from tequila.grouping.binary_rep import BinaryPauliString, BinaryHamiltonian
from collections import namedtuple
import numpy as np
BinaryPauli = namedtuple("BinaryPauli", "coeff, binary")
def prepare_test_hamiltonian():
''... | true |
f914ce9ffd9cf4a66820ad8f655a1e8253d139ef | Python | Willbeckh/Hussle-flask-app | /app/forms/forms.py | UTF-8 | 2,254 | 2.515625 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField, DateField, TextAreaField, IntegerField
from wtforms.validators import DataRequired, Email, EqualTo, Length, ValidationError
from app.models.models import User
from datetime import date
#register form
class Regist... | true |
8bbcb87a69de46c370dfce48b018b0b98abb55e5 | Python | takecian/ProgrammingStudyLog | /hackerrank/30-days-of-code/day2.py | UTF-8 | 284 | 2.90625 | 3 | [] | no_license | import itertools
from collections import Counter
from collections import defaultdict
import bisect
def main():
meal = float(input())
tip = int(input())
tax = int(input())
print(round(meal + meal * tip / 100 + meal * tax / 100))
if __name__ == '__main__':
main()
| true |
771e5d93d4d0e53df2c0a8092a8244bb36e93759 | Python | spaceuniverse/QLSD | /CORE/fSandFun.py | UTF-8 | 4,264 | 2.828125 | 3 | [] | no_license | # ---------------------------------------------------------------------# IMPORTS
import numpy as np
# ---------------------------------------------------------------------# MAIN
class Features(object):
@staticmethod
def normal(wfn):
fmax = np.max(wfn)
if fmax == 0.0:
fmax = 1.0... | true |
5655db244b3ee432741ac72cae9f8ee751e94cc9 | Python | upasanapradhan/IW-Python-Assignment | /IW-PythonAssignment/5.py | UTF-8 | 228 | 3.6875 | 4 | [] | no_license | str1 = input("enter a string: ")
if len(str1) >= 3:
for i in str1:
if 'ing' in str1:
result = str1 + 'ly'
else:
result = str1 + 'ing'
print(result)
else:
print(str1) | true |
c9adf542ceee354cf573cd411250fe6cc4fa8eab | Python | wanng-ide/Algorithms-and-Data-Structures | /SelectionSort.py | UTF-8 | 590 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 3 01:00:53 2019
@author: wanng
SelectionSort
O(n^2)
find the smallest #, and pop it, then find the smallest # in the rest
"""
def FindSmallest(array):
small = array[0]
small_index = 0
for i in range(1, len(array)):
if array[i] < small:
small = array[i]
smal... | true |
b867dc9323bf68d1800a3efea3f6c1486a1c1415 | Python | vskritsky/fasten | /like rates.py | UTF-8 | 993 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 29 23:05:45 2017
@author: administrator
"""
import numpy as np
import pandas as pd
#initialize random like rates for 100 couriers
couriers = np.random.rand(100,1)
#round floats to 2 decimals to be like
np.around(couriers, decimals=2, out=couriers... | true |
0fb04792f8299f4e505db2d9ea62df0e12054c6b | Python | mrklees/market-agent | /script/train_model.py | UTF-8 | 4,121 | 2.828125 | 3 | [] | no_license | import sys
sys.path.append('.')
import random
import numpy as np
import pandas as pd
import tensorflow as tf
from multiprocessing import Pool, freeze_support
from tqdm import tqdm
from MarketAgent.Market import Market, StockData
from MarketAgent.Trader import ValueTrader
gpus = tf.config.experimental.list_physical_dev... | true |
50ca2561d9be6a7ab3163931f8513d9c8d17d7a8 | Python | yukou-isshiki/aizu_online_judge | /JOI-Prelim/0663.py | UTF-8 | 210 | 3.5625 | 4 | [] | no_license | input_str_list = input().split(" ")
dict = {}
dict[1] = 0
dict[2] = 0
for input_str in input_str_list:
if input_str == "1":
dict[1] += 1
else:
dict[2] += 1
print(max(dict, key=dict.get)) | true |
968aedbebb9816db43510d813aeb74c4efd543c7 | Python | tgremi/queueSimulation | /Processador.py | UTF-8 | 1,597 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
-- Analise e desempenho de Software
"""
import numpy as np
import copy
import matplotlib.pyplot as plt
import time, threading
import random
class Processador :
ocupedTime = 0
packagesProcess = 0
packagesFinished = 0
flagProcess = False
def setFlagProcessam... | true |
6b2967de3dbe281792c04729453d8c911660ea3b | Python | JaehunYoon/Study | /Programming Language/Python/Facebook/fb_sdk.py | UTF-8 | 1,641 | 3.265625 | 3 | [] | no_license | import facebook
# 생성된 액세스 토큰을 인수로 전달해 사용할 수 있는 객체를 만들어 obj에 저장합니다.
obj = facebook.GraphAPI(access_token="users-token")
limit = int(input("몇건의 게시물을 검색할까요? "))
# facebook객체에서 obj.get_connections함수를 실행시킵니다. get_connections함수는 해당 아이디에서 connection_name으로 전달된 데이터를 가져오는 역할을 합니다. 세 번째 인수로 전달된 limit은 한번에 가져올 게시물의 개수를 정해주는 역할을 합... | true |
635d2977671951cee88434d30cb97c53f07000a8 | Python | wagamama/alg-practice | /hashtable.py | UTF-8 | 2,110 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
class HashTable(object):
def __init__(self):
self.size = 11
self.slot = [None] * self.size
self.data = [None] * self.size
def put(self, key, data):
hashvalue = self.hashfunction(key)
if self.slot[hashvalue] == None:
self.slot[hashva... | true |
04b2eda4672b32051fd0071a1072b8e149675a3d | Python | alptureci/AWS-BOTO-PYTHON-S3 | /UploadFile.py | UTF-8 | 1,793 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import boto
user_bucket_extension = '-ucscext-alptureciaws'
def isUserExists(username, password):
s3 = boto.connect_s3()
#first check is users exists
usersbucket = 'alptureci-users-bucket'
bucket = s3.get_bucket(usersbucket)
k = boto.s3.key.Key(bucket)
k.key ... | true |
5bf812d8cd60f89bd98cb3420695bf7806551a03 | Python | dovedevic/droiddevic | /Games/Gomoku.py | UTF-8 | 11,306 | 3.03125 | 3 | [
"MIT"
] | permissive | import datetime
import logging
import random
import re
from GameParent import Game
from GameParent import SetupFailure, SetupSuccess
logger = logging.getLogger(__name__)
handler = logging.FileHandler('../logs/{}.log'.format(str(datetime.datetime.now()).replace(' ', '_').replace(':', 'h', 1).replace(':', 'm').split('.... | true |
cc7e787ce99f60917564bfb13b2653d588f40a9d | Python | Stasnnm/dz1 | /Lesson2/5.py | UTF-8 | 134 | 3.265625 | 3 | [] | no_license | x = float(input('введите х '))
if x>0:
print('sign(x) = 1')
elif x<0:
print('sign(x) = -1')
else:
print('x = 0') | true |
77d86174cbef14a8b2a852225756e6d77a9d0fa3 | Python | littlelienpeanut/DART_predicting_users_demographic_information | /kms_demo_KNN.py | UTF-8 | 12,846 | 2.59375 | 3 | [] | no_license | import pandas as pd
import itertools
import csv
from sklearn.model_selection import cross_val_predict
from sklearn.model_selection import cross_val_score
from sklearn.cluster import KMeans
import random
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn... | true |
925681aecdce742d9d981b56dbbe1acbd5c1e56e | Python | moret/peuler | /run | UTF-8 | 965 | 2.90625 | 3 | [] | no_license | #! /usr/bin/env python
from __future__ import division
import sys
from subprocess import call
import timeit
def sh(cmd):
try:
call(cmd)
except:
pass
def clear():
sh('find . -name "__pycache__" -delete')
sh('find . -name "*.pyc" -delete')
sh('find . -name "*~" -delete')
def mai... | true |
c03904fddc708b458edd749711c9b566ea5cd029 | Python | sreeshavenkat/Machine-Learning | /hw7/low_rank/low_rank.py | UTF-8 | 522 | 2.515625 | 3 | [] | no_license | import scipy.io
import numpy as np
from skimage.io import imread
import matplotlib.pyplot as plt
ranks = [i for i in range (1, 101)]
MSE = []
for r in ranks:
print(r)
data = imread("face.jpg")
U, sigma, V = np.linalg.svd(data, full_matrices = False)
for i in range(sigma.shape[0]):
if i >= r:
sigma[i] = 0
img... | true |
2c74c9f3eb867ca4ab799c5c2f04f9cf1d4c6b32 | Python | JernejHenigman/Machine-Learning-6-Homeworks | /DN1/linear_regression.py | UTF-8 | 2,929 | 3.234375 | 3 | [] | no_license | __author__ = 'Jernej'
import time
import Orange
from matplotlib import pyplot as plt
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
def load_data():
"""Loads the data. Returns one-column matrix X and vector y."""
y = np.loadtxt("alc_elim.dat.txt")[:,1:2]
X = np.loadtxt("alc_elim.dat.txt")[:... | true |
5711ef324e9e997e3fb83db18ae5ddc5225f4d37 | Python | miguel-mzbi/computer-vision | /P5/picture.py | UTF-8 | 1,798 | 3.0625 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
def getMask(hsvImage):
lowerRed1 = (0,55,40)
upperRed1 = (20,255,255)
maskRed1 = cv2.inRange(hsvImage, lowerRed1, upperRed1)
lowerRed2 = (160,55,40)
upperRed2 = (180,255,255)
maskRed2 = cv2.inRange(hsvImage, lowerRed2, upperRed... | true |
0817de1991218f4d7dd8b94924436416c1764635 | Python | eacevedof/prj_python37 | /platziventas/pv_pruebas/decorators.py | UTF-8 | 928 | 3.921875 | 4 | [] | no_license | PASSWORD = "agua"
def password_required(func):
def envoltorio():
password = input("Cual es tu contrasena? ")
if password == PASSWORD:
#se le pasas needs_password. Imprime la contraseña es correcta
return func()
else:
print("La contraseña no es correcta.")... | true |
7eaada350c88c1848a64225f5d02494c203196f0 | Python | adishavit/cvxpy | /cvxpy/atoms/elementwise/elementwise.py | UTF-8 | 2,391 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | true |
30098b9b5431d6aac57eec15ae1ed9eba0cedff3 | Python | mapooon/SLC | /slc/modeling/classification/SLCsvm.py | UTF-8 | 2,283 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import os
sys.path.append(os.getcwd()+"/modeling/common")
from Model import Classification
from sklearn import svm
import pickle
class SLCsvm(Classification):
"""
サポートベクターマシン(分類)クラスです。
"""
def __init__(self):
super().__init__()
def make_parser(self):
"""
parse_argsによって内部的に... | true |
182e29040aa2dc8a583eaa49e199ad50e1457200 | Python | bellerophons-pegasus/ssciwr_sdc_team14 | /src/team14-software/statistics14.py | UTF-8 | 2,387 | 3.65625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*- #
# statistics14.py
# docstring with sphinx and napoleon
"""
Module for statistic analyses.
Does correlation and euclidean distance.
"""
# import pandas
import numpy as np
def correlatedata(data, corrmethod='pearson', dropcols=[]):
"""Compute pairwise correlation ... | true |
524790ca4befee15264eb8bb86ef23d407ab41dc | Python | jedzej/tietopythontraining-basic | /students/adam_wulw/lesson_05_lists/comma_code.py | UTF-8 | 244 | 3.046875 | 3 | [] | no_license | spam = ['apples', 'bananas', 'tofu', 'cats']
def coma_code(_list):
_str = ''
for item in _list:
_str = _str + ' ' + str(item)
if item != _list[-1]:
_str = _str + ','
return _str
print coma_code(spam)
| true |
dee251e88e2a4774fd31f0b4fa354317a7e172c2 | Python | javicercasi/computacion1 | /58004-Cercasi Javier/clase02/test_pipe.py | UTF-8 | 936 | 3.015625 | 3 | [] | no_license | import unittest
from pipe_fixer import pipe_fix
class TestPipeFixing(unittest.TestCase):
def test_fix_simple_pipe(self):
fixed_pipe = pipe_fix([1, 2, 3, 5, 6, 8, 9])
self.assertEqual([1, 2, 3, 4, 5, 6, 7, 8, 9],fixed_pipe)
def test_fix_complex_pipe(self):
fixed_p... | true |
18a5d269c64addc2a4da52da6a14123295495cf2 | Python | lasseleth/prakprog | /num/LinearEquations/main.py | UTF-8 | 1,561 | 2.890625 | 3 | [] | no_license |
import sympy as sy
import numpy as np
from GR import qr_gs_decomp, qr_gs_solve, qr_gs_inverse
n = int(5) # Number of lines
m = int(4) # Number of columns
A = np.random.rand(n, m)
print('\nQR Decomposition\n')
print('Random 5x4 matrix A:\n')
print(A)
# Decomposition QR
(Q, R) = qr_gs_decomp(A)
print('\nMatrix Q 5x4... | true |
056f03a85d56d640467011d2b3c91005867ebf4b | Python | ipavel83/Python | /031TypeCheck.py | UTF-8 | 629 | 3.796875 | 4 | [
"MIT"
] | permissive | #py3.7
import types #from types import MethodType, FunctionType
#i = 2
#type(i) is int #not recommended
#isinstance(i, int)
class SomeClass:
def fun():
pass
print('what type is SomeClass.fun?', type(SomeClass.fun)) #<class 'function'>
if isinstance( SomeClass.fun, types.MethodType): #False
pr... | true |
6663f11c10550ea5832ba706a1f101213490d56e | Python | O-oBigFace/HK-VQA | /misc/ques_layer.py | UTF-8 | 1,370 | 2.5625 | 3 | [] | no_license | """
author: W J-H (jiangh_wu@163.com)
time: Mar 8, 2020 at 11:42:18 PM
-----------------------------------
句子级别特征
"""
import torch.nn as nn
import torch
from misc.helper import fact_extract
class QuesLayer(nn.Module):
def __init__(self, hidden_size, rnn, img_attn, word_attn, mlp, fact_attn, poolin... | true |
5d4aa4fbbfdb2f3e0a5ca7c51aef92d2c77d4554 | Python | schneebergerlab/toolbox | /Support/Misc/tinytools | UTF-8 | 9,687 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 15:36:01 2017
@author: goel
"""
import argparse
import os
import sys
def unlist(nestedList):
"""Take a nested-list as input and return a 1d list of all elements in it"""
outList = []
for i in nestedList:
if type(i) in (list,... | true |
8e615161bfa114c34a58f7c4cdde595502b0b10c | Python | mrojas2005/TP1-TDA | /PycharmProjects/TP1/digrafo.py | UTF-8 | 3,360 | 3.625 | 4 | [] | no_license |
class Digrafo:
"""Grafo dirigido con un número fijo de vértices.
Los vértices son siempre números enteros no negativos. El primer vértice es 0.
El grafo se crea vacío, se añaden las aristas con agregarArista(). Una vez
creadas, las aristas no se pueden eliminar, pero siempre se pueden añadir
... | true |
e3f4bf2ac8fdab12102b6b1e6696fad51c013427 | Python | FrancoIII/Pavages | /Anciens programmes/substitutions_dim2.py | UTF-8 | 1,719 | 3.015625 | 3 | [] | no_license | # francois oder le 22 juin 2017
import math
def fibo(n):
phi = (1 + math.sqrt(5))/2
phi_ = (1 - math.sqrt(5))/2
return (1/(math.sqrt(5)))*(phi**n - phi_**n)
def iterer(L, n):
m = int(fibo(n+3))
q = int(fibo(n+2))
d = m - q
M = [[0 for i in range(m)] for i in range(m)]
d_y = 0
d... | true |
11033913cdb030ec16a5ba2a9fcaaae60931efb6 | Python | GabrielAranhaMello2007/Login_Cadastro | /Login_Cadastro0.py | UTF-8 | 4,397 | 3.1875 | 3 | [] | no_license | # Login_Cadastro
# Um programa em que é possível fazer Login(Usa outro arquivo como banco de dados) e Cadastro
# Para fazer a instalação do "PySimpleGui"
# Copie "pip install PySimpleGUI" e logo em seguida cole isso no terminal do Python
import PySimpleGUI as sg
from Banco_de_dados import *
import PySimpleGUI as Sg
... | true |
a8918620b5eba6b0b33a9854054622615a1266fd | Python | EvgenySenkevich/DynamicList | /test_module.py | UTF-8 | 1,505 | 3.25 | 3 | [] | no_license | import unittest
import main
class TestList(unittest.TestCase):
def test_append(self):
dy = main.DynArray()
self.assertEqual(dy.capasity, 16)
for i in range(16):
dy.append(i)
self.assertEqual(dy[i], i)
def test_append2(self):
dy = main.DynArray()
... | true |
f578ef3b88b45338a5d092fce12d10390f98e86c | Python | o-kei/design-computing-aij | /ch5/facility.py | UTF-8 | 1,028 | 3.03125 | 3 | [
"MIT"
] | permissive | import numpy as np # モジュールnumpyをnpという名前で読み込み
import csv # モジュールcsvの読み込み
from scipy import optimize # scipy内のoptimizeモジュールを読み込み
filename = 'out2' # 出力ファイル名
writer = csv.writer(open(filename + '.csv', 'w', newline='')) # 出力するcsvファイルの生成
writer.writerow(['step', 'f(x)', 'x1', 'x2']) # csvファイルへのラベルの書き込み
def f(x): #... | true |
cb446e07e8738201a91f01a04a0adba7c72cb9ab | Python | UchinoMENG/PersonalLearn | /PAT/python版/1069.py | UTF-8 | 555 | 3.046875 | 3 | [] | no_license | num = input().split()
for i in range(len(num)):
num[i] = int(num[i])
result = []
sign = 0
hh=0
for i in range(num[0]):
name = input()
if i+1==num[2] and sign==0:
sign=1
result.append(name)
continue
elif sign==1:
hh+=1
if(hh==num[1]):
if name not in res... | true |
a65da99e81cc5f28f1d70bd5f97364ad07f0172a | Python | Fowres-Co/personal-movie-dashboard | /app.py | UTF-8 | 2,461 | 2.609375 | 3 | [] | no_license | import movieSpider as spidy
import IMDB_scraper
#--- testing custom logger
from xlogger import Logger
xLogger = Logger(__name__, 'info')
logger = xLogger.log #getting logging object
#---
BASEPATH = 'C:\\movietest\\'
MEDIAEXTS = ['.mp4','.mkv','.avi']
METAFILE = 'metadata.vif'
scrapy = IMDB_scraper.IMD... | true |
ef0eac8b2f63951303472113e335c36fcf54b754 | Python | puneet87m/Python-Basics | /Python-Basic(local)/ListOverlap.py | UTF-8 | 404 | 3.59375 | 4 | [] | no_license | import random
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
l=[]
for i in a:
if i in b:
l.append(i)
print("static list match", l)
x=random.sample(range(10),5)
y=random.sample(range(10),5)
ls=[]
for i in x:
if i in y:
ls.append(i)
print... | true |
f1857bbddbbd7011a9289bd202b2a09a0d92430a | Python | xiaoge56/plot_beta | /beta_distribution_plot.py | UTF-8 | 1,858 | 3.109375 | 3 | [] | no_license | # coding=utf-8
from scipy.stats import beta
import matplotlib.pyplot as plt
import numpy as np
import math
class beta_distribution(object):
def __init__(self):
self.x = (np.linspace(0.001, 0.999,1000))
self.colors = "bgrcmykw"
self.colors_index=0
self.hyperparameter=self.choice_hype... | true |
56222617db3aa420108c971153c061487df0fa08 | Python | it-innoo/data-analysis | /hy-data-analysis-with-python-summer-2019/part01-e06_triple_square/src/triple_square.py | UTF-8 | 419 | 3.78125 | 4 | [] | no_license | #!/usr/bin/env python3
def triple(x):
"multiplies its parameter by three."
return 3*x
def square(x):
"raises its parameter to the power of two"
return x**2
def main():
for i in range(1, 11):
s = square(i)
t = triple(i)
if s > t:
break
print("triple(... | true |
d3de506bf5ea07d11999f4ec5b23fcfa714e8e4a | Python | Alfinus/crash_course_in_python | /chapter_5/5-1 conditional_tests.py | UTF-8 | 1,531 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 5-1 conditional_tests.py
#
# Copyright 2018 Devon <Devon@BETSY>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either versi... | true |
72f2d7c6c105702c3a9b86a0d4c4baebad13e033 | Python | maet3608/nuts-ml | /nutsml/reader.py | UTF-8 | 12,144 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
.. module:: reader
:synopsis: Reading of sample data and images
"""
from __future__ import absolute_import
import os
import pandas as pd
import numpy as np
from glob import glob
from collections import namedtuple
from fnmatch import fnmatch
from nutsml.imageutil import load_image
from nutsml.fileutil import r... | true |
be5d10132aebbf197177489930df5a8ea58ca2cc | Python | lishuang1994/-1807 | /02day/05-乘法口诀表面向对象.py | UTF-8 | 486 | 3.59375 | 4 | [] | no_license | '''
class mouse:
def lei(self):
for i in range(10):
for j in range i:
if i*j= k:
print("%d * %d = %d"%(i,j,k),end=\n)
ls = mouse()
ls.lei()
'''
class mouse():
def lei(self):
i = 1
while i < 10:
j = 1
while j <= i:
... | true |
ebc26444c79cee37ee54e58d6e33271a00f9db0f | Python | genialis/resolwe-bio-py | /src/resdk/exceptions.py | UTF-8 | 783 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """.. Ignore pydocstyle D400.
==========
Exceptions
==========
Custom ReSDK exceptions.
.. autoclass:: ValidationError
"""
from slumber.exceptions import SlumberHttpBaseException
class ValidationError(Exception):
"""An error while validating data."""
class ResolweServerError(Exception):
"""Error respons... | true |
d8797319f06670bb3953a57aaf3d330b13c582fd | Python | zemo20/guitarshop | /database_seed.py | UTF-8 | 1,164 | 2.71875 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, jsonify
from sqlalchemy import *
from database_setup import Base, Category, Item
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///catalog.db')
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSes... | true |
9e2c55cb6e15f89ff2b73a78d5f15310d3cac672 | Python | demohack/yute | /done/18-2-python-ds-practice/23_list_check.py | UTF-8 | 254 | 3.921875 | 4 | [
"MIT"
] | permissive | def list_check(lst):
"""Are all items in lst a list?
>>> list_check([[1], [2, 3]])
True
>>> list_check([[1], "nope"])
False
"""
t = [1 if isinstance(x, list) else 0 for x in lst]
return len(lst) == sum(t) | true |
d402b9280146486fcda2a1563379f074c4228b00 | Python | southpawgeek/perlweeklychallenge-club | /challenge-194/robert-dicicco/python/ch-2.py | UTF-8 | 693 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
'''
AUTHOR: Robert DiCicco
DATE: 2022-12-06
Challenge 194 Frequency Equalizer ( Python )
SAMPLE OUTPUT
python .\FrequencyEqualizer.py
Input: $s = abbc
Output: 1
Input: $s = xyzyyxz
Output: 1
Input: $s = xzxz
Output: 0
'''
ss = ["abbc", "xyzyyxz", "xzxz"]
x = 0
for ... | true |
138b36a7b1167f6dcf26fcd83693104960c716b2 | Python | beat-machine/beat-machine | /beatmachine/utils.py | UTF-8 | 268 | 2.984375 | 3 | [
"MIT"
] | permissive | import itertools
import typing as t
def chunks(iterable: t.Iterable[t.T], size: int) -> t.Generator[t.List[t.T], None, None]:
iterator = iter(iterable)
for first in iterator:
yield list(itertools.chain([first], itertools.islice(iterator, size - 1)))
| true |
deea2e6d9ae1fe341e13a80449c94576667819e5 | Python | SanGlebovskii/lesson_5 | /homework_5_7.py | UTF-8 | 343 | 3.03125 | 3 | [] | no_license | from random import randint
n = 6
m = 6
matrix_one = []
for i in range(n):
matrix_second = []
for j in range(m):
matrix_second.append(randint(1, 9))
matrix_one.append(matrix_second)
print(matrix_one)
for i in range(len(matrix_one)):
max_element = max(matrix_one[i])
matrix_one[i][i] = max_ele... | true |
4631969d60d57d7e3face53bd08cc96cbbebf629 | Python | aalexsmithh/exfoliated-neurons | /baseline.py | UTF-8 | 1,083 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 4 01:33:24 2016
@author: Sandy Wong
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model, datasets
import csv
from sklearn.model_selection import cross_val_score
x = np.fromfile('train_x.bin', dtype='uint8')
print (x.sha... | true |
aaac7d86603bd7ada9706f46fb9808d54aff6df1 | Python | michelelt/carsharing-prediction-moduled | /source/Vancouver/regression_svr.py | UTF-8 | 3,798 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 12 12:25:25 2019
@author: mc
"""
import pandas as pd
from sklearn.svm import SVR
# =============================================================================
# import datasets
# ================================================================... | true |
cab1a0ec5b264bc5e297308b6b4c8da63ce14a2a | Python | sativa/SPEED | /mod14g_spatial_statistics.py | UTF-8 | 4,354 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SPEED: Module 14: Spatial Statistics
GitHub repository: https://github.com/maplion/SPEED
@author: Ryan Dammrose aka MapLion
"""
import threading
from matplotlib.pylab import *
import speedcalc
import speedcli
from testcalculations import time
__author__ = "Ryan Dam... | true |
6b8b188e59fa314f65f18cbdc3fc2d1f4bcf7cc5 | Python | bary321/hongheishu | /honghei_err.py | UTF-8 | 582 | 2.890625 | 3 | [] | no_license | # coding:utf-8
__author__ = 'bary'
class LengthException(Exception):
def __init__(self, err='length not equal'):
Exception.__init__(self, err)
class RootNoBlack(Exception):
def __init__(self, err="root not black"):
Exception.__init__(self, err)
class HongChild(Exception):
def __init__(... | true |
afa240f3ed62cbbc8f1c7fdcdce565b9bf29ef2d | Python | PratylenClub/celegans3000 | /connectome_manager/neural_network_manager.py | UTF-8 | 7,180 | 3.125 | 3 | [] | no_license | import pandas as pd
import pickle as p
import numpy as np
INPUT_INDEX = 0
OUTPUT_INDEX = 1
INITIAL_CELL_STATE = []
NEURON_TYPE = "Neuron"
SENSORIAL_INPUT_TYPE = "Sensorial"
SENSORIAL_NEURON_TYPE = "Sensorial_Neuron"
MOTOR_NEURONS_TYPE = "Motor_Neuron"
MUSCLE_TYPE = "Muscle"
SENSORY_MOTOR_NEURON_TYPE = "Sensorial_Motor... | true |
8edf3bc82b9356b4be6c257d10798ee365fbad54 | Python | AngelPerezRodriguezRodriguez/CYPAngelPRR | /libro/Ejemplo3_02.py | UTF-8 | 205 | 3.359375 | 3 | [] | no_license | nomina = 0
for i in range(1, 11, 1):
sue = float(input("Ingresa el sueldo: "))
nomina += sue #nomina = nomina + sue
print(f"La nómina de la empresa es de: {nomina}")
| true |
2ab3ca717276288e8d6af19d080e53bff8bbed75 | Python | alexliyang/caffe2_android | /lamia_scripts/make_src.py | UTF-8 | 1,471 | 2.515625 | 3 | [] | no_license | import os
import sys
required_src = ['operators', 'android', 'core', 'test']
def list_dir(path):
return os.listdir(path)
def backend(file):
return os.path.splitext(file)[1]
def open_file(filename):
if os.path.exists(filename):
os.remove(filename)
f = open(filename, 'w')
return f
def add_to_fil... | true |
1d708ab083e8260866b75c20db60cf2fce749ceb | Python | alexdaube/MurphysBot | /glo/tests/common/map/decomposition_map/test_decomposition_cell.py | UTF-8 | 10,728 | 2.953125 | 3 | [] | no_license | import unittest
from mock.mock import Mock, MagicMock
from shapely.geometry import LineString
from common.map.decomposition_map.decomposition_cell import DecompositionCell
from common.map.position import Position
class TestDecompositionCell(unittest.TestCase):
top_left = Position(0, 15)
top_right = Position... | true |
d14ba8decc89dd33950235a9304b92468eba2c9b | Python | Justw8/webtesten | /fileHandling.py | UTF-8 | 1,688 | 4.21875 | 4 | [] | no_license | fileName = 'test.txt' # Het bestand waarin word geschreven
linebreak = '\n' # enter in een variable zetten voor duidelijkheid
def getItemsFromFile(): # Bestand Uitlees functie
try:
file = open(fileName, "r") # proberen het bestand te openen met als regel: r - Read
except:
return [] # Als het nie... | true |
41eab3f4c0418e50ef1ae8c725e03283d179030c | Python | anoukvlug/oggm | /oggm/sandbox/distribute_2d.py | UTF-8 | 12,419 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
import warnings
import oggm.cfg as cfg
from oggm import utils
import numpy as np
import xarray as xr
from scipy import ndimage
from scipy.stats import mstats
from oggm.core.gis import gaussian_blur
from oggm.utils import ncDataset, entity_task
# Module logger
log = logging.getLogger(__name__)
def fil... | true |
061434d24b3a8f1fbfbe3510ac4fa74b5729c203 | Python | YashRunwal/Understanding-Open-CV | /Edge Detection/edge_detect_and_gradient.py | UTF-8 | 1,022 | 2.90625 | 3 | [] | no_license | # Import libs
import cv2
def read_images(image1):
# Make sure that the images are of the same size
image_1 = cv2.imread(image1)
return image_1
def apply_gradient(show_laplacian, show_sobel):
img = read_images('pikachu.png')
cv2.imshow('Pikachu', img)
laplacian = cv2.... | true |
d1a60a5e447c472946e4b5699a6f2f4ac7eab3ef | Python | alan-lynch52/3rdYrProject | /toxic-comments/eda.py | UTF-8 | 570 | 3.046875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#load in toxic comments training data
train = pd.read_csv('train.csv')
LABELS = ["toxic","severe_toxic","obscene","threat","insult","identity_hate"]
y = train[LABELS]
#engineer clean labels
y['clean'] = (train[LABELS].sum(axis=1)==0)
c_dist... | true |
84261c1349f332f79eb215a8ed154a1681a408ad | Python | jpcarranza94/tiny_yolo3_masks | /generate_report.py | UTF-8 | 2,812 | 2.828125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime
from mdutils.mdutils import MdUtils
from mdutils.tools import Html
import markdown2
df = pd.read_csv("out.csv")
def labelParse():
labels = []
for i in range(0,len(df['label'])):
label_list = eval(df['label'][i])
... | true |
e3d322c207494edb875e6400896c429f52754c47 | Python | dubian98/Cursos-Python | /serializar_objetos.py | UTF-8 | 910 | 3.453125 | 3 | [] | no_license | #creacion
import pickle
class vehiculos():
def __init__(self, marca, modelo):
self.marca=marca
self.modelo=modelo
self.enmarcha=False
self.acelera=False
self.frena=False
def arranca(self):
self.enmarcha=True
def acelera(self):
self.acelera=True
... | true |
e1702f81fcf60b22fa54fd212152c40fca776f46 | Python | DreamingFuture/python-crawler | /日常/模拟浏览器尝试.py | UTF-8 | 565 | 2.65625 | 3 | [] | no_license | # 作者 :孔庆杨
# 创建时间 :2019/1/2215:08
# 文件 :模拟浏览器尝试.py
# IDE :PyCharm
import re
import time
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('https://tieba.baidu.com/p/2125145202#!/l/p1')
for i in range(0, 5):
browser.execute_script('window.scrollTo(0, document.body.scrollHe... | true |
e1d1800c56d7be2728bb645abf0dd0e64a36a949 | Python | kyjp/api_python | /section4/api.py | UTF-8 | 710 | 2.734375 | 3 | [] | no_license | # ホットペッパーapi
import os
from dotenv import load_dotenv
import requests
import pandas as pd
URL = 'http://webservice.recruit.co.jp/hotpepper/gourmet/v1/'
load_dotenv()
API_KEY = os.environ['RECUEST_API_KEY']
params = {
'key': API_KEY,
'keyword': '沖縄',
'format': 'json',
'count': 100
}
res = requests.g... | true |
352de48e6edebf1e0c0e01671bf7928aba418dd2 | Python | nikhil7127/AIO | /website/auth.py | UTF-8 | 2,398 | 2.53125 | 3 | [] | no_license | from flask import Blueprint, render_template, request, redirect, url_for, flash
from werkzeug.security import generate_password_hash, check_password_hash
from . import db
from .models import User
from sqlalchemy import exc
from flask_login import login_user, logout_user, current_user, login_required
auth = Blueprint("... | true |
d64da6146a53f2a2ae42be364a798c1b4645dd39 | Python | MaxAntony/ApuntesPythonCodigoFacilito | /7.funciones/1.definiendo.py | UTF-8 | 461 | 4.1875 | 4 | [] | no_license | def crear_mensaje(nombre):
return 'hola {}, bienvenido al curso'.format(nombre)
# si dejamos sin argumentos dara un error
nuevo_mensaje = crear_mensaje('max')
print(nuevo_mensaje)
def suma(val1, val2, val3):
return val1+val2+val3
print(suma(10, 20, 30))
# retornando multiples valores
def obtener_curso(... | true |
274a7a511eec0908eaed17d0cda839930b824178 | Python | jesellier-shell/point | /utils.py | UTF-8 | 670 | 2.953125 | 3 | [] | no_license | class StepFunction1D:
def __init__(self, time, values) :
self.time = time
self.values = values
def value(self, T) :
for (t, v) in zip(self.time, self.values):
if(T < t):
return v
return self.values[-1]
d... | true |
db3ec1a37a7ebd546aa60be8247affdbdc3fad56 | Python | Peng-YM/pymoo | /pymoo/usage/problems/usage_tsp.py | UTF-8 | 2,037 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
from pymoo.algorithms.so_genetic_algorithm import GA
from pymoo.model.repair import Repair
from pymoo.operators.crossover.order_crossover import OrderCrossover
from pymoo.operators.mutation.inversion_mutation import InversionMutation
from pymoo.operators.sampling.rand... | true |
6e4e818a21336f471e4896a0d4007bfaaeeecb5e | Python | ganye/modulus_old | /lib/path.py | UTF-8 | 532 | 2.734375 | 3 | [] | no_license | '''
Created on Feb 6, 2014
@author: xinv
'''
import os
import re
__all__ = ['get_base_dir','get_file_path','get_dir_path',]
def get_base_dir():
return os.path.dirname(os.path.dirname(__file__))
def get_file_path(*args):
pattern = re.compile('/+')
path = []
for arg in args:
path.append('/' + ... | true |
f1d74b8538865cf65b8218ee2b83d262b549edaf | Python | Lokeshwarrobo/Algorithms | /Sorting/InsertionSort.py | UTF-8 | 298 | 4.0625 | 4 | [] | no_license | array = [10, 9, 8, 6, 7, 5, 0, 1, 2, 3, 4]
def Insertion_Sort(array):
for i in range(1, len(array)):
j = i
while j > 0 and array[j] < array[j - 1]:
swap(j, j-1, array)
j -= 1
return array
def swap(i, j, array):
array[i], array[j] = array[j], array[i]
print(Insertion_Sort(array))
| true |
ab39cd578ac1cb302e58687465bc94be762b8328 | Python | Vtneang/StockResearch | /RandoTests/Searching.py | UTF-8 | 538 | 3.296875 | 3 | [] | no_license | # Performing google search using Python code
class Gsearch_python:
def __init__(self,name_search):
self.name = name_search
def Gsearch(self):
count = 0
try :
from googlesearch import search
except ImportError:
print("No Module named 'google' Found")
for i in search(... | true |
0a071e7a3b70446a742a0229747d5434b467f7ec | Python | Samatki/PyProjects-webTest | /webTest.py | UTF-8 | 275 | 2.6875 | 3 | [] | no_license | from sys import argv
import httplib as h
x = argv[1]
conn = h.HTTPConnection(x)
conn.request("GET","/")
y = conn.getresponse()
if 200<=y.status and y.status<400:
z = 'OK'
else:
z= 'BAD REQUEST'
print x, ' *** ', z,'\n\t', y.status, ' *** ', y.reason
| true |
f582c0358912e2edc26a79584fc51b9b10b2bad6 | Python | GrayJoKing/BeeBot | /discordBot/Randomcog.py | UTF-8 | 4,777 | 3.3125 | 3 | [] | no_license | import discord
from discord.ext import commands
#All
import random
#Dice
from math import ceil
#Cat
import json
#Dog and Cat
import aiohttp
#Dog
from re import search
#B.ook + clean function
import secrets
#roll
from functools import reduce
class Random():
def __init__(self, bot):
self.bot = bot
##Roll
##... | true |
2614c8d9fd238d33b81e76d6fd795eb8f0b450a0 | Python | jerryhan88/py_source | /python_source/src/gc.py | UTF-8 | 1,596 | 3.015625 | 3 | [] | no_license | from __future__ import division
import wx, time
class Node:
def __init__(self, _id, x, y):
self.id = _id
self.x, self.y = x, y
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'test', size=(640, 480))
MyPanel(self)
s... | true |
4329634a680a1067864152d7968894c870dd66a5 | Python | h-varma/Team-11 | /src/unit3/hridya_rectangle.py | UTF-8 | 260 | 3.984375 | 4 | [
"MIT"
] | permissive | def rectangle(length, width):
if length <= 0 or width <= 0:
raise ValueError("The side length cannot be negative or zero!")
measures = {"area": length * width}
print(f'The rectangle has area {format(measures["area"])}')
return measures
| true |
b6a126ab5a58eacb015311cead742ef6f43593e2 | Python | crystalDf/Automate-the-Boring-Stuff-with-Python-Chapter-06-String | /rawString.py | UTF-8 | 142 | 3.375 | 3 | [] | no_license | # A raw string completely ignores all escape characters and prints
# any backslash that appears in the string
print(r'That is Carol\'s cat.')
| true |
367c23676752e69644120df702bc95672722ef74 | Python | ctmackay/aesthetic_twitterbot | /bb_markov.py | UTF-8 | 5,603 | 3.21875 | 3 | [] | no_license | # Body Building Markov Model
# Charles MacKay
# this module will build 4 markov models based muscle group we selected.
# the source is the text we scraped from the body building website
# to produce 4 steps in our exercise.
# input: muscle group
# output: 4 markov models that can output a generated sentence correspond... | true |
260cfa7dc8066348847b5c85e75cb18b0847ec23 | Python | kristellef/FYPcode_backup | /createcsv.py | UTF-8 | 1,032 | 2.703125 | 3 | [] | no_license | import json, csv, os
mapping_csv = csv.reader(open('/Users/macbook/Desktop/mapping0.csv', 'rt'), delimiter=',')
count = 0
data = []
for row in mapping_csv:
count +=1
if count%50000==0:
print(count,'/346.516.753')
if len(row) <=3:
path = "/Users/macbook/Desktop/csvs/"+str(row[0][0:3])+".c... | true |
66a6a0935bc2228c049014958cfae6dd77a2306d | Python | Seneda/GameJam2020 | /References/wabley/game_funtions.py | UTF-8 | 1,512 | 3.21875 | 3 | [] | no_license | import sys
import pygame
def check_keydown_events(event, car):
"""Respond to keypresses."""
if event.key == pygame.K_RIGHT:
#rotate car clockwise
car.rotating_clockwise = True
elif event.key == pygame.K_LEFT:
#rotate car anticlockwise
car.rotating_anticlockwise = True
e... | true |
b0fa516fde2e1f7ec36bdca5f2d0cee4b2e11907 | Python | hcutler/civictech-blog-analysis | /initial-analysis/techpresident/tp-article-parse.py | UTF-8 | 2,345 | 2.65625 | 3 | [] | no_license | import urllib2
import time
from bs4 import BeautifulSoup as bsoup
from bs4 import BeautifulSoup
from yaml import load, Loader
import requests as rq
import re
import unicodedata
import sys
#write article urls to textfile
all_text = ""
secretURLs = []
with open("tp-333.txt", "r") as file:
data = file.read()
url_list... | true |
47d0a1694196a05fec47aa7fee1b130908b6e1f7 | Python | sunita6/python-assignment3 | /assignment3/pythonassign31.py | UTF-8 | 129 | 3.859375 | 4 | [] | no_license | n=int(input("enter the number:"))
sum1=0
while(n>0):
sum1=sum1+n
n=n-1
print("the sum of n natural number is",sum1)
| true |
9840caee869be9ffd0275ed3983cd5830d57eacd | Python | sumfish/music_pre-content | /model.py | UTF-8 | 16,140 | 2.6875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class Tripletnet(nn.Module):
def __init__(self, embeddingnet):
super(Tripletnet, self).__init__()
self.embeddingnet = embeddingnet
def forward(self, A, P, N):
'''
embedded_A, a = self.embeddingnet(A)
emb... | true |
08a4163ed74ee8b33c38b443e0307074c042b32b | Python | dgpllc/leetcode-python | /learnpythonthehardway/997-find-the-town-judge.py | UTF-8 | 1,873 | 3.78125 | 4 | [] | no_license | # In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town
# judge.
#
# If the town judge exists, then:
#
# The town judge trusts nobody.
# Everybody (except for the town judge) trusts the town judge.
# There is exactly one person that satisfies properties 1 an... | true |
1c9301d3e6092d1aa3ba777ac5a7212f3ae76def | Python | byceps/byceps | /byceps/blueprints/admin/attendance/views.py | UTF-8 | 2,110 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | """
byceps.blueprints.admin.attendance.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2023 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask import abort
from byceps.services.brand import brand_service
from byceps.services.party import party_service
from byce... | true |
521eb77c555736fbe679230d9374f162dddf4e52 | Python | lolozor/GeekBrains_courses_HW | /Алгоритмы и структуры данных на PYTHON/lesson_1/lesson1_hw6.py | UTF-8 | 1,041 | 4.46875 | 4 | [] | no_license | # 6.
# По длинам трех отрезков, введенных пользователем, определить возможность существования треугольника,
# составленного из этих отрезков.
# Если такой треугольник существует, то определить,
# является ли он разносторонним, равнобедренным или равносторонним.
a = int(input('Введите сторону 1: '))
b = int(inpu... | true |
868d2fd2a462a2601c29509f61b640b82632deb5 | Python | milena-mathew/coba-CCPO | /coba/tests/test_registry.py | UTF-8 | 7,739 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | import unittest
from coba.registry import CobaRegistry, coba_registry_class
class TestObject:
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
class TestArgObject:
def __init__(self, arg):
self.arg = arg
class CobaRegistry_Tests(unittest.TestCase):
def ... | true |
49705456258829f99aad487e64b2eed099440b4d | Python | KshanaRules/NOX | /NOX 0.1.py | UTF-8 | 2,619 | 3.328125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
def menor(datos):
poz = 0
for dato in datos:
if (dato>=-.19 and dato <=.21): #Establece un umbral en X y Y respcto a 0
if((dato>=0 and datos[poz+1]<=0) or (dato<=0 and datos[poz+1]>=0)): #Valida que el soguiente dato no se ecuentre dentro... | true |
f06eea176a3b053dffe88aa44a948f8d02c9b0b2 | Python | haolloyin/projecteuler | /solutions/1-9/p7XthPrime.py | UTF-8 | 389 | 3.203125 | 3 | [] | no_license |
# Project Euler - Problem 7
import prime
import time
start = time.time()
count = 0
p = 1
while True:
p = p+1
if prime.isPrime(p) == True:
count = count+1
print "%d : %d " % (count, p)
if count == 10001:
print "the 10001st prime is %d " % p
break
print "%.8f Secs... | true |
206d5f87188ba5e287c076aebb7a03c658226aa2 | Python | chorwonkim/__Algorithms__ | /BOJ/DataS/7785.py | UTF-8 | 445 | 3.59375 | 4 | [] | no_license | from sys import stdin
Read = stdin.readline
# list를 사용할 경우에는 삽입 및 삭제에 O(n)이 사용된다.
# 따라서 총 O(n^2)이 될 수 있으므로 Set 자료구조를 사용했다.
d = set()
for _ in range(int(Read())):
name, status = map(str, Read().split())
if status == "enter":
d.add(name)
else:
d.remove(name)
result = list(d)
result.sort(rev... | true |
cdf60e5f0b42fa8302094590fc00de5dc945044e | Python | Aasthaengg/IBMdataset | /Python_codes/p03331/s296434499.py | UTF-8 | 140 | 3.328125 | 3 | [] | no_license | n = int(input())
s = 0
while True:
s += n % 10
n = n // 10
if n == 0:
break
if s == 1:
print(10)
else:
print(s) | true |
d1badc6f211cdcfcafb39a5044a3a64484dbb9ea | Python | MustafaIsmaill/road_info_osm_extract | /scripts/map_extract.py | UTF-8 | 4,585 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import osmnx as ox
from road_info_osm_extract.msg import point
from road_info_osm_extract.msg import points
from road_info_osm_extract.msg import pointsList
class map_extract:
def __init__(self, node_name, place_name, publish_rate):
#initialise class variables
self._place... | true |