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
752b01127105406114550b193daf1356929b335a
Python
burhan/pyipay
/fsspyipay/pyipay.py
UTF-8
8,334
2.59375
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
# -*- coding: utf-8 -*- import time import xml.etree.ElementTree as ET from urllib import parse from iso4217 import Currency from .util import Action from .util import decrypt_payload as decrypt from .util import encrypt_payload as encrypt from .util import read_resource_file, sanitize, validate_gw_url from .util impo...
true
198079cf81363cb3356b1fd1323d362fce1c3543
Python
Praful932/PySyft
/tests/syft/core/pointer/pointer_test.py
UTF-8
2,810
2.5625
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
# third party import pytest import torch as th # syft absolute import syft as sy @pytest.mark.parametrize("with_verify_key", [True, False]) def test_make_searchable(with_verify_key: bool) -> None: bob = sy.VirtualMachine(name="Bob") root_client = bob.get_root_client() client = bob.get_client() ten =...
true
c4ec37b49b66b8c689e6d07cf5837867fe489f53
Python
mukundajmera/competitiveprogramming
/Sorting/Shell Sort.py
UTF-8
436
3.640625
4
[]
no_license
#User function Template for python3 def shellSort(arr, n): # code here return arr.sort() #{ # Driver Code Starts #Initial Template for Python 3 if __name__ == "__main__": t = int(input()) while(t>0): n = int(input()) arr = [int(x) for x in input().strip().split()] shellSort...
true
0d452535151497471735edc58ac2e9d83dfa1ce0
Python
simonthor/decay2phasespace
/fulldecay.py
UTF-8
9,110
2.796875
3
[]
no_license
from phasespace import GenParticle from particle import Particle import tensorflow as tf import tensorflow.experimental.numpy as tnp from mass_functions import _DEFAULT_CONVERTER from typing import Callable, Union import itertools _MASS_WIDTH_TOLERANCE = 0.01 _DEFAULT_MASS_FUNC = 'rel-BW' class FullDecay: """ ...
true
3c3b6894dddc3bc5dae18247864610894d25a9b4
Python
vivekdubeyvkd/python-utilities
/get_index_for_unique_char_in_string.py
UTF-8
458
3.109375
3
[]
no_license
outputDict = {} def getUniqueCharacter(s): for i in range(len(s)): charVal = s[i] if charVal not in outputDict.keys(): outputDict[charVal] = i + 1 else: outputDict[charVal] = -1 for key in outputDict.keys(): if outputDict[key] != -1: return ...
true
7b4e1b3df90f27b76acbbeb727c5bfd00bf23865
Python
markbac17/web-trader
/app/view.py
UTF-8
2,615
3.578125
4
[]
no_license
import os def user_menu(): print('Welcome to Terminal Trader.\n') print('User logon\n') print('1. Login with username') print('2. Login with API key') print('3. Create account') print('4. Exit\n') choice = input('Select option: ') os.system('clear') return choice def login_username...
true
350bdb1ac7160a4c4d6a30d9f59c7f5767f01f8f
Python
AurelOnuzi/Scripts
/NameSearchGenerator.py
UTF-8
3,424
3.359375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 #Aurel Onuzi import csv import os.path import sys #user input names_file = input('Enter a text file with a list of name: ') nickname_file = input('Enter a file with a list of nicknames, or just enter 0 to skip this step: ') name_var = input('Select name variation: Single Line or Multiple Lines ...
true
20aa160dfbc17c9391dc4db209dd2149900db9f0
Python
atomichighfive/tealeaves
/tealeaves/util/histogram_bin_formulas.py
UTF-8
2,085
3.515625
4
[ "MIT" ]
permissive
# Author: Eyad Sibai import numpy as np from scipy.stats import iqr def histogram_square_formula(values): """ reference https://www.kdnuggets.com/2018/02/histogram-tips-tricks.html :param values: the values of the histogram data :return: number of bins and width of the bin """ bins = np.sqrt(len(va...
true
a65da1c2906756d6e21c3d0aca40fe7fb0e1b7d2
Python
liridonuka/python-projects
/web_gis/web_gis/note.py
UTF-8
43
2.5625
3
[]
no_license
a = "Hello World. I am here" print(len(a))
true
1e0df36fbeb22738110683edb35dd6594245a6b2
Python
cixinxc/Python
/classifier/perceptron/perceptron.py
UTF-8
2,368
2.828125
3
[]
no_license
from numpy import * import matplotlib.pyplot as plt def drawdata(train_x, train_y, train_label,bc,test_x): for i in range( train_x.shape[0] ): print(train_x[i, 0], train_x[i, 1]) if train_label[0, i] == -1: plt.plot(train_x[i, 0], train_x[i, 1], 'or') elif train_label[0, i] == 1...
true
04d6ae584bd7b4d1bd7bb625e5a762acc52f83b2
Python
dorabelme/Python-Programming-An-Introduction-to-Computer-Science
/chapter9_programming10.py
UTF-8
619
3.671875
4
[]
no_license
from random import random def main(): printIntro() darts = getNumDarts() pi_est = simThrows(darts) printEst(pi_est) def printIntro(): print("Dart Estimate of Pi") def getNumDarts(): return eval(input("Enter the number of darts to be thrown: ")) def simThrows(darts): hits = 0 for i in range(darts): if hitO...
true
9fc26531cfe9a90e3118bdc26a631bd7321c928f
Python
JheniferElisabete/EstruturasDeRepeticao
/Fatorial.py
UTF-8
412
4.65625
5
[]
no_license
'''Faça um programa que calcule o fatorial de um número inteiro fornecido pelo usuário. Ex.: 5!=5.4.3.2.1=120. A saída deve ser conforme o exemplo abaixo: Fatorial de: 5 5! = 5 . 4 . 3 . 2 . 1 = 120''' f = int(input('Informe um numero para ser calculado o seu fatorial ')) fa = 1 count = f for i in range(f, 0, -...
true
1cea3524a60f2e91f9f7cdac63934e97220d8552
Python
daniel-reich/ubiquitous-fiesta
/vnzjuqjCf4MFHGLJp_14.py
UTF-8
228
3.46875
3
[]
no_license
def shift_letters(txt, n): nospace = txt.replace(" ", "") x = len(nospace) count = 0 ans = "" for i in txt: if i == " ": ans += " " else: ans += nospace[(count-n)%x] count += 1 return ans
true
e6d127517d9edfad0b283f9b8ff3b1eb6864a4d0
Python
ColCarroll/autobencher
/autobencher/repository.py
UTF-8
763
2.75
3
[]
no_license
import os from subprocess import check_call from abc import ABCMeta, abstractmethod class SourceRepository(metaclass=ABCMeta): @classmethod def makeRepository(cls, url, branch, directory): return GitRepository(url, branch, directory) @abstractmethod def __init__(self): """Abstract co...
true
e699ebf0bea25bf4af9871835df32db2f8d128da
Python
kjaffel/ZA_FullAnalysis
/bamboo_/ZAMachineLearning/threadGPU.py
UTF-8
5,049
2.796875
3
[]
no_license
import os import sys import logging import subprocess import traceback from pynvml import * from pynvml.smi import nvidia_smi #import nvidia_smi from time import sleep from threading import Thread class utilizationGPU(Thread): """ Class generaring a parallel thread to monitor the GPU usage Initialize wit...
true
caced0f1b2eeea9a22fe60ccb2dfae4cb4325a77
Python
NahusenayH/ComptetiveProgramming
/take1/CD12/ConstructTargetArrayWithMultipleSums.py
UTF-8
643
3.03125
3
[]
no_license
class Solution: def isPossible(self, target: List[int]) -> bool: if len(target) <= 1 and target[0] != 1: return False if len(target) == 1 and target[0] == 1: return True heap = [] for i in target: heap.append(-i) heapq.heapify(heap) ...
true
41cf8b1f27d8761b8c6e21ceb99023164688536c
Python
jinlygenius/basics
/algorithm/sortings/run.py
UTF-8
1,030
2.796875
3
[]
no_license
import os import sys import time BASE_DIR = '/Users/ella/Dropbox/Study/basics' # BASE_DIR = '/Users/shs/Dropbox/Study/basics' sys.path.insert(0, BASE_DIR) import random from bucket_sort import bucket_sort from bubble_sort import bubble_sort from selection_sort import selection_sort from insertion_sort import inserti...
true
5593fa1039636229b0630ffddb5e490c6306a0fc
Python
330mlcc/mp
/src/fundamental/advance_feature/do_listcompr.py
UTF-8
216
3.046875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python #-*- coding: utf-8 -*- __author__ = 'liugang5' if __name__ == "__main__": L1 = ['Hello', 'World', 18, 'Apple', None] L2 = [s.lower() for s in L1 if isinstance(s,str) is True] print(L2)
true
0cec31d9bef996ac8723c934bbd5892e1ad84ad0
Python
nomad2001/2048
/model.py
UTF-8
16,658
2.640625
3
[ "MIT" ]
permissive
import random import json import copy import hashlib GOR = 'U' DOL = 'D' LEVO = 'L' DESNO = 'R' KONEC_IGRE = 'E' NEOBSTOJECA_SMER = 'N' ZMAGA = 'Z' NI_SE_ZMAGAL = 0 ZMAGAL = 1 ZE_PREJ_ZMAGAL = 2 DATOTEKA_ZA_SHRANJEVANJE = "podatki.json" DATOTEKA_ZA_UPORABNIKE = "uporabniki.json" class UporabnikiRazred: def __ini...
true
5ab0b6bf4655912ed6e9d1411e860726fb3be3a2
Python
mengpanqingyun/pogs-python
/pogs/types/high_level.py
UTF-8
1,296
3.015625
3
[]
no_license
from ctypes import c_int, c_float, c_double from numpy import zeros, ones class Solution(object): def __init__(self,double_precision,m,n): T = c_double if double_precision else c_float self.double_precision = double_precision self.x=zeros(n,dtype=T) self.y=zeros(m,dtype=T) self.mu=zeros(n,dtype=T) self.nu...
true
264bc8db5897e71fb6e8fa63777ab141d279f946
Python
0is4car/note
/summary.py
UTF-8
459
2.6875
3
[]
no_license
import os import sys def analy(dirname): for basename,dirname,filenames in os.walk(dirname): for file in filenames: try: notename = file.split('.')[0] type = file.split('.')[1] if type == 'md': print('* '+'['+notename+']'+'('+...
true
d5987f7ddd385a688d32c2afed1fa652bf9ab120
Python
alexandrucatanescu/neural-program-comprehension
/stimuli/Python/one_file_per_item/en/41_# math_if 5.py
UTF-8
189
3.234375
3
[ "MIT" ]
permissive
predicted = 13 actual = 11 error = 2 if (predicted - actual < error) or (predicted - actual > -1*error): print(predicted - actual + error) else: print(predicted - actual - error)
true
09d73185a1cb487d78afe41f21bb42766c472a92
Python
s-robota/OpenCV-Tracking
/cap_movie.py
UTF-8
3,796
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 3 2019 @author: robota """ import argparse import cv2 import datetime import numpy as np import os import sys import time # settings font = cv2.FONT_HERSHEY_SIMPLEX c_normal = (255, 255, 255) c_caution = (0, 0, 255) # BGR class FpsCounter(): def __init__(self): ...
true
a62309bd515209ac2b6e742b0057677a0da521ff
Python
ndsev/zserio
/compiler/extensions/python/runtime/src/zserio/walker.py
UTF-8
25,089
3.125
3
[ "BSD-3-Clause" ]
permissive
""" The module implements generic walker through given zserio object tree. """ import functools import re import typing from zserio.exception import PythonRuntimeException from zserio.typeinfo import TypeAttribute, MemberInfo, MemberAttribute class WalkObserver: """ Interface for observers which are called by...
true
530d0f701ad20b9f15fdaf471da31fd8dc41eb47
Python
souvikg10/spacy-fasttext
/load_fastText.py
UTF-8
2,165
2.828125
3
[]
no_license
#!/usr/bin/env python # coding: utf8 """Load vectors for a language trained using fastText https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md Compatible with: spaCy v2.0.0+ """ from __future__ import unicode_literals import plac import numpy import spacy import random from spacy.language im...
true
4fddc9f28a62dc39770c077705b7be6381ad0969
Python
kylapurcell/A01088856_1510_assignments
/A4/test_student.py
UTF-8
2,926
3.078125
3
[]
no_license
from unittest import TestCase from A4 import student from unittest.mock import patch import io class TestStudent(TestCase): def setUp(self): self.test_student = student.Student('Kyla', 'Purcell', 'A01088856', True, [80, 90, 75]) self.test_student2 = student.Student('dahlia', 'billings', 'A0109997...
true
214777220c89401a43433ca155b239d90e1f650a
Python
sysinit2811/self_taught
/python_dir/over/test/python_ex34.py
UTF-8
31
2.625
3
[]
no_license
hi = "Hello, World!" print(hi)
true
18168abafcb81aa8fc79501af6ca382b1d4add50
Python
nogsantos/python-design-patterns
/tests/test_chain_of_responsibility.py
UTF-8
2,717
3.25
3
[]
no_license
# -*- coding: utf-8 -*- from unittest import TestCase from src.chain_of_responsibility.item import Item from src.chain_of_responsibility.discount_calculator import DiscountCalculator, Budget class TestChainOfResponsibility(TestCase): def setUp(self): self.budget = Budget() def test_budget_it_should...
true
37982490c1cf3bdba1aaf1d02060f98072ecb8a9
Python
texus/codingame
/Community Puzzles/May the Triforce be with you.py
UTF-8
547
3.28125
3
[]
no_license
n = int(input()) piramidWidth = 1 + 2*(n-1) totalWidth = 2*piramidWidth + 1 print('.' + ' '*(2*(n-1)) + '*') for i in range(1, n): starsInRow = 1 + 2*i spacesBeforeFirstPiramid = (totalWidth - starsInRow) // 2 print(' '*spacesBeforeFirstPiramid + '*'*starsInRow) for i in range(n): starsInRow = 1 + 2*...
true
2610b18dd510a7da3fa14dd18316bb43763d55e0
Python
sinyi96/DA_Team3
/Recon.py
UTF-8
508
2.859375
3
[]
no_license
import requests # Set the target webpage url = 'http://172.18.58.238/creative/' r = requests.get(url) headers = { 'User-Agent': 'Mobile' } # Display Output Get and Ok print("Status code:") print("\t *", r.status_code,headers) # Display Website Header h = requests.head(url) for x in h.headers: print("\t", x, '...
true
cd44a820430475d00a2dd03d3fd2fd43e2c6f0e8
Python
artorious/python3_dojo
/custom_modules/get_positive_number_from_user.py
UTF-8
799
4.125
4
[]
no_license
#!/usr/bin/env python3 """ Prompt user for a positve number ( integer or floating-point number). Returns value (float) """ def get_positive_num(): """ Prompt user for a positive number (integer or floating-point number) Returns the float """ # init valid_value = False while not ...
true
3680d39a8072c669802d784805c0c8aa589b78db
Python
jkmrto/EulerProject
/Funciones.py
UTF-8
2,351
3.4375
3
[]
no_license
def imprime(vector): "function_docstring" print("Vector: {0}, Longitud: {1}.".format(vector, len(vector))) return def is_div_list(list_num, div): "Given a list of number, this functions gives back the function" \ "of numbers which are divisibles between div" return [i for i in list_num if i % div...
true
183be557ef520b24979b8b5170c387015ba125ff
Python
JJAleman/python-practice
/Python/basic_operators.py
UTF-8
297
4.53125
5
[]
no_license
""" 1. Assign two different types to the variables "a" and "b". 2. Use basic operators to create a list that contains three instances of "a" and three instances of "b". """ # Modify the code below to meet the requirements outlined above a = "juan" b = 2 my_list = a + str(b * 3) print(my_list)
true
3ca0625ed86aef62909d1aafe9a2763941b6e5dc
Python
freemanhm/session-knn-ae
/generate_folders.py
UTF-8
1,090
2.765625
3
[ "MIT" ]
permissive
import os import sys def generate_folder_structure(dataset): print("Generating Folders for: " + dataset) root = "data" os.makedirs("plots/results") os.makedirs(root + "/" + dataset + "/raw") os.makedirs(root + "/" + dataset + "/interim/infer") os.makedirs(root + "/" + dataset + "/interim/model...
true
a23d7d83048a5dc35bb352467a4e1cb7c8127c16
Python
ruidazeng/online-judge
/Kattis/timeloop.py
UTF-8
64
2.984375
3
[ "MIT" ]
permissive
for i in range(int(input())): print(str(i + 1) + " Abracadabra")
true
401b823efd9dbc306a6df8fe257704809d797132
Python
unnievarghese/originalpythonluminar
/pythondatastructures/dictionary/nested_dict.py
UTF-8
786
2.671875
3
[]
no_license
employee={101:{'id':101,'name':'ajay','designation':'qa','sallary':15000}, 102:{'id':102,'name':'vijay','designation':'developer','sallary':15000}, 103:{'id':103,'name':'sumesh','designation':'coustomer care','sallary':15000}, 104:{'id':104,'name':'virat','designation':'developer','sallary...
true
90e7a6b412a03e69bd66f3b4655c015d2f6ae587
Python
Gio1995/CodeUs
/codeus.py
UTF-8
9,415
2.609375
3
[ "Apache-2.0" ]
permissive
from flask import Flask, session, render_template, request, redirect, url_for, g import os from flask_pymongo import PyMongo #Modulo per usare il database MongoDB from flask_mail import Mail, Message #Modulo per inviare e configurare il servizio mail import hashlib #Modulo per criptare una stringa in sha256 from flask_...
true
89f49edee69abf6009aed133d5ca0a2f4c72ff3b
Python
tul1/py-mower
/tests/unit/resources/models/test_mower_model.py
UTF-8
13,020
2.921875
3
[]
no_license
import pytest from unittest import TestCase from mower.resources.models.directions import RelativeDirection, OrdinalDirection from mower.resources.models.mower_model import MowerModel, MowerPosition from mower.resources.models.lawn_model import LawnDimensions from mower.utils.exceptions import MowerModelLoadError, Mo...
true
2769efec8826410abdb8b363193d61f54a86bfdd
Python
xiwei26/CS510
/PA1/a1.py
UTF-8
2,132
2.859375
3
[]
no_license
import sys import numpy as np import cv2 import os #####input and output file directories and names##### if len(sys.argv) != 3: print "Usage: python a1.py <in_file> <out_file>" sys.exit() in_file=sys.argv[1] out_file=sys.argv[2] if os.path.isfile(out_file): os.remove(out_file) #####user input##### start_frame = i...
true
f88f66a0a10c1884d3caa88d0292f36da8cf32a8
Python
pahaz/events-site-example
/events_site_example/apps/common_app/tests/tests.py
UTF-8
858
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- from django.test import TestCase from apps.common_app.utils import add_model_prefix class TestUtils(TestCase): def test_add_model_prefix(self): experiments = [ { 'prefix': None, 'to': 'some_value', 'expected': 'some_value...
true
ff265f8d36d14ce0634717ef20c43ae2b74c866f
Python
VRER1997/leetcode_python
/easy/541 Reverse String II.py
UTF-8
298
3.296875
3
[]
no_license
class Solution: def reverseStr(self, s: str, k: int) -> str: res = [] for i in range(0, len(s), 2*k): res.append(s[i:i+k][::-1] + s[i+k:i+2*k]) return ''.join(res) if __name__ == '__main__': s = Solution() print(s.reverseStr(s = "abcdefg", k = 9))
true
9618346ca146adcaf0deeb8e17a32eb269c89f39
Python
BraulioAO/Taller_Cripto
/Cifrado_DH/dh.py
UTF-8
2,411
4.09375
4
[]
no_license
#!/usr/bin/python3 # UNIVERSIDAD NACIONAL AUTÓNOMA DE MÉXICO # FACULTAD DE INGENIERÍA # MANUAL DE ACTIVIDADES PRÁCTICAS DE CRIPTOGRAFÍA # 5. DH (DEFFIE - HELLMAN) # NOMBRE DEL ALUMNO: Arrieta Ocampo Braulio Enrique from math import log def es_primo(p): """ Comprueba si un número p es primo o no mediante la opera...
true
8aad6c8d82ddcdb18cfd27b9b31d53ad606adac1
Python
milo71/md-to-html
/md-to-html.py
UTF-8
566
2.75
3
[]
no_license
import sys import markdown import argparse ap = argparse.ArgumentParser(description='Parse markdown to html') ap.add_argument('-i', '--input', required=True, help='input file name') ap.add_argument('-o', '--output', required=True, help='output file name') args = ap.parse_args() with open(args.input,'r') as inputfile...
true
59337cba3ddd09f3ca90ea9f9e3c084011e6ae8d
Python
ceholden/yatsm
/yatsm/vegetation_indices.py
UTF-8
790
3.65625
4
[ "MIT" ]
permissive
""" Functions for computing vegetation indices """ from __future__ import division def EVI(red, nir, blue): """ Return the Enhanced Vegetation Index for a set of np.ndarrays EVI is calculated as: .. math:: 2.5 * \\frac{(NIR - RED)}{(NIR + C_1 * RED - C_2 * BLUE + L)} where: - :math:...
true
7db2a2501aba087fd332e40667e31ca135fa4e97
Python
ganddev/IS
/Beleg3.py
UTF-8
4,168
3.03125
3
[]
no_license
__author__ = 'Daniel' #!/usr/bin/python import numpy as np import matplotlib .pyplot as plt ##create trainings data def create_data(): xValues = np.arange(0,np.pi+0.1, (np.pi / 5)) gauss = np.random.normal(0, 0.2, 6) yValues = np.sin(-xValues) + gauss return xValues, yValues ##transform x values to ...
true
50a09951af0b5f43d13078845709bc73e04262fd
Python
scortier/Leetcode-Submissions
/problems/number_of_ways_of_cutting_a_pizza/solution.py
UTF-8
3,410
3.296875
3
[]
no_license
# improting function tools import functools # definign class for Solution.py class Solution: # defining lists variables def ways(self, pizza: List[str], k: int) -> int: # defining m & n as a variable m, n = len(pizza), len(pizza[0]) # defining mod values MOD = 10 ** 9 + 7 ...
true
a917d2960396379e7b13ac47ccc85c6235a34057
Python
felixz2535/Halite-ML
/trainer.py
UTF-8
4,469
2.546875
3
[]
no_license
import tensorflow as tf import os import numpy as np import time import random from tqdm import tqdm from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten from tensorflow.keras.layers import Conv2D, MaxPooling2D from tensorflow.keras.callbacks import Tens...
true
159a56ddd48ee103085b1a4d2404e9582050d50b
Python
mmreyno/sao-paulo-crime-data
/crime-data-downloader.py
UTF-8
1,891
2.796875
3
[]
no_license
from selenium import webdriver from selenium.webdriver.support.ui import Select import time # set paths path_to_chromedriver = '/usr/lib/python2.7/chromedriver' browser = webdriver.Chrome(executable_path = path_to_chromedriver) url = 'http://www.ssp.sp.gov.br/novaestatistica/Pesquisa.aspx' browser.get(url) # find the...
true
44039900bf4375a16dade14aa4bdb079a1955893
Python
ajtanskanen/benefits
/fin_benefits/ben_utils.py
UTF-8
2,208
2.578125
3
[ "MIT" ]
permissive
import seaborn as sns import matplotlib.font_manager as font_manager import math def get_palette_EK(): colors1=['#003326','#05283d','#ff9d6a','#599956'] colors2=['#295247','#2c495a','#fdaf89','#7cae79'] colors3=['#88b2eb','#ffcb21','#e85c03'] colors=['#295247','#7cae79','#ffcb21','#e85c03','#88b...
true
3e622c42e8c9e709b221172d72d897bfb8311558
Python
haoyu-zhao/Multi-Objective-Optimization-for-Football-Team-Member-Selection
/ESP/code/mutation.py
UTF-8
1,696
2.75
3
[]
no_license
# -*- coding: utf-8 -*- """ This is the open source code of the paper "Multi-Objective Optimization for Football Team Member Selection" If you have any questions, please contact the author of the paper """ import random import copy def get_GK(data): GK_tag = data[data['attackscore']==0]['Tag'] player...
true
56ebc86946c6c5fb412aac31721b31e63c9c0ebf
Python
chianobi/nlp-final-slam
/data_collector.py
UTF-8
1,942
2.765625
3
[ "MIT" ]
permissive
""" Lucino Chiafullo Quick/dirty file that collects & pickles data """ import pickle import random from newsapi import NewsApiClient import datetime bait_headlines = [] legit_headlines = [] now = datetime.datetime.now() now_str = now.strftime('%Y') + "-" + now.strftime('%m') + "-" + now.strftime('%d') monthago = now...
true
986bfa374e8bf0e454af9778c76251408ec77c5a
Python
madtyn/pythonHeadFirst
/pythonDesignPatterns/src/composite/menuiterator/menu.py
UTF-8
2,826
3.40625
3
[]
no_license
from abc import ABCMeta, abstractmethod from pythonDesignPatterns.src.composite.menuiterator.iterator import NullIterator, CompositeIterator, Iterator class MenuComponent(metaclass=ABCMeta): """ A class which allowes to contain another instances of the same class """ def add(self, menuComponent): ...
true
57805dc3b1a32cb79ef67cac869846e5b9ae3f70
Python
srinjoychakravarty/parallel_ml
/part2.py
UTF-8
2,356
2.78125
3
[]
no_license
from pandas import read_csv from xgboost import XGBClassifier from sklearn.model_selection import GridSearchCV from sklearn.model_selection import StratifiedKFold from sklearn.preprocessing import LabelEncoder import matplotlib matplotlib.use('Agg') # prevents matplotlib error on discovery cluster from matplotlib impo...
true
7c6ab0e7aae8ea942fef2dcd0968506f9ab81c04
Python
subhamrex/Coding_Practice
/Python/Practice/Third_max.py
UTF-8
670
3.5625
4
[]
no_license
import sys def thirdLargest(arr, arr_size): if (arr_size < 3): return max(arr) if() first = arr[0] for i in range(1, arr_size): if (arr[i] > first): first = arr[i] second = -sys.maxsize for i in range(0, arr_size): if (arr[i] > second and ...
true
47342103e2a686f81eee223e0ea06020561bb28c
Python
tuoniaoren/code
/排序/radix_sort.py
UTF-8
560
3.46875
3
[]
no_license
def radix_sort(li): max_num = max(li) it = 0 # 计算位数,也可以直接用log(max_num)向下取整 while 10 ** it <= max_num: buckets = [[] for _ in range(10)] for var in li: # 987 it=1 987//10->98, 98%10->8; it=2 987//100->9, 9%10=9 digit = (var // 10 ** it) % 10 buckets[digit...
true
31ae452eee44a63ded92150e8325179a84cf8e3c
Python
GersonFeDutra/Python-exercises
/CursoemVideo/2020/world_2/ex040.py
UTF-8
370
3.84375
4
[]
no_license
SEMESTERS: int = 2 medium: float notes: list = [] for i in range(SEMESTERS): notes.append(float(input(f'What is your {i + 1}° note? '))) medium = sum(notes) / SEMESTERS print(f'Your medium is {medium:.1f}.') if medium < 5: print('\033[31mDISAPPROVED!') elif medium < 7: print('\033[33mRECOV...
true
aecbfbcad9ba3842382663558e3abce8cfa23454
Python
jordanblakey/algorithms-dojo
/Python/MultiProcessing/sharing_data.py
UTF-8
499
3.421875
3
[]
no_license
import multiprocessing result = [] def calc_square(numbers, result, value): value.value = 5.67 for i, n in enumerate(numbers): result[i] = n*n print('inside process ' + str(result)) if __name__ == "__main__": numbers = [2, 3, 5] result = multiprocessing.Array('i', 3) value = multipro...
true
922bc6a7ff9f6f8bbc8eb8b5b838e2a081814905
Python
Blnjjj/GENEA_2020
/VariationalAutoEncoder/vae.py
UTF-8
1,602
2.625
3
[]
no_license
import torch import torch.nn as nn from torch.nn.modules.loss import _Loss import torch.nn.functional as F HIDDEN_DIM = 40 INPUT_DIM = 45 OUTPUT_DIM = 20 class VariationalAutoEncoder(nn.Module): def __init__(self): super(VariationalAutoEncoder, self).__init__() self.encoder_hidden = nn.Linear(INPU...
true
39e3286b4fe9cdccd5142199f2dc684de5069e60
Python
Mauzey/MSc-Data-Science-and-Business-Analytics
/COMP5000/Week-4/Q3.py
UTF-8
833
3.703125
4
[]
no_license
# Q3: SQL and Python # import and setup import sqlite3 import pandas as pd connection = sqlite3.connect('student_record.db') cursor = connection.cursor() # task: create a script where the user can input an sql query, which is then executed def execute_query(query, head=False): """ execute a defined query ...
true
f736c6866167d2238394e08a9e6180432c4e8dfa
Python
maxxiefjv/ACVPR-ExpressionInvariantFaceRecognition
/Ananthu_face_detection/smile_face_detection_ananthu.py
UTF-8
2,478
3.578125
4
[]
no_license
# -*- coding: utf-8 -*- # Face Recognition + Smile Recognition # Importing the libraries import cv2 # Loading the cascades face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') # Load the cascade for the face. smile_cascade = cv2.CascadeClassifier('haarcascade_smile.xml') # Load the casc...
true
954983df98519dada265945e954455ef11266b86
Python
jeffknupp/link
/link/link.py
UTF-8
18,590
2.6875
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ link ~~~~~~~~~~~~ The link module helps you connect to all of the data sources you need through a simple configuration Sample Config to connect to mysql:: { "dbs":{ "my_db": { "wrapper": "MysqlDB", "host": "mysql-master.123fakestreet.ne...
true
277e526ded91446f8965124e163fd481e28f4239
Python
btil-99/skin-lesion-segmentation
/download_data.py
UTF-8
2,415
3.109375
3
[]
no_license
from tqdm import tqdm import requests import os import patoolib import zipfile # Download data from a specified URL def download_data(url, directory_name): response = requests.get(url, stream=True) # HTTP GET Request for url total_size_in_bytes = int(response.headers.get('content-length', 0)) ...
true
0b2f0c52efc96abbb09d4d8e047e3078560593a6
Python
Gani32231/Python-Caluclator
/Caluclatematrx.py
UTF-8
600
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 29 18:33:41 2020 @author: wwwds """ import numpy as np import tkinter as tk import tkinter.ttk as ttk win=tk.TK() win.title("2x3 Matrix Solver") def multiply(): a = entry1.get() a = list(map(int,a)) b = entry2.get() b = list(map(int,b)) ...
true
2ccb2da7bdff3d5b385c9a6ed570547226b2fcfc
Python
ebasuke226/ebaGit
/04.GuessBitcoin/GuessBitcoin.py
UTF-8
2,380
3.125
3
[]
no_license
import numpy as np import pandas as pd from sklearn import linear_model from sklearn.model_selection import train_test_split from pandas import DataFrame import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics import mean_squared_error import math # 終値情報を持つcsvから価格を得ます def ...
true
403856449d5bfb707081b8fdb63c30edea353b15
Python
xiliuhk/CryptoMobileGUI
/crypt.py
UTF-8
2,288
2.890625
3
[]
no_license
__author__ = 'x37liu' import os import sys import argparse from wrapper import Cipher def main(): # prepare cmd cheat sheet helpFile = open('helpFile', 'r') helpStr = helpFile.read() helpFile.close() # read args parser = argparse.ArgumentParser(formatter_class=argparse.RawDesc...
true
dd4836eb343d13a2042146a4df086af1333b1ca3
Python
mrmundt/pyomo
/pyomo/contrib/mpc/data/get_cuid.py
UTF-8
4,346
2.8125
3
[ "BSD-3-Clause" ]
permissive
# ___________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2022 # National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and # Engineering Solutions of ...
true
8030df2da810446a4ad2b2640e49a0e2c9c20a5f
Python
wsdxl/excises_python
/excise_unittest/练习代码/hander_request.py
UTF-8
1,781
2.640625
3
[]
no_license
""" ============================ Author : XiaoLei.Du Time : 2020/4/11 15:42 E-mail : 506615839@qq.com File : hander_request.py ============================ """ import requests class HandleRequest: '''使用token鉴权的接口,使用这个类去发送请求''' def send(self, url, method, data=None, json=None, params=None, headers=None...
true
4b17c1c972f79e5efc9438f2f0993ecf0ee572af
Python
xServo/Tic-Tac-Toe
/tictactoe.py
UTF-8
1,416
4
4
[]
no_license
#Tic-Tac-Toe import os row1 = [" ", " ", " "] row2 = [" ", " ", " "] row3 = [" ", " ", " "] turns = 1 def board(): os.system("clear") print(" | | ") print(" " + row1[0] + " | " + row1[1] + " | " + row1[2] + " ") print("___|___|___") print(" | | ") print(" " + row2[0] + " | " + row2[1] + " | " + row2...
true
f7a03878b17b8dfe452423f022ccae027881c55e
Python
liubing1545/tensorflow-learn
/tensor.py
UTF-8
858
3.125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Fri Mar 9 10:53:59 2018 @author: liu.bing """ import tensorflow as tf import numpy as np # create 100 phony x,y data points in numpy x_data = np.random.rand(100).astype("float32") y_data = x_data * 0.1 + 0.3 # try to find values for w and b that compute y_data = W * x_data + ...
true
025b77c98a7e6c0d34bcd7d114ebff6ad172c4ca
Python
vedcoder/python
/pascal triangl.py
UTF-8
485
3.484375
3
[]
no_license
rows = int(input("how many rows do u want in da pascal triangle ?")) pascal = 1 numbersList = [] for r in range(1, rows+1): pasNum = " " * (rows-r) rowList = [] for c in range(1, r+1): pascal = 1 if c != 1 and c != r: lastnumberlist = numbersList[r - 2] pascal = lastn...
true
70cb62e865caffef0a538ed5619e902013fdc421
Python
b-eyselein/rose
/sp_validation.py
UTF-8
1,010
3.21875
3
[]
no_license
from base.field import Field, Cell def __compare_cells__(user_cell: Cell, sample_cell: Cell, mind_colors: bool) -> bool: if mind_colors: return user_cell.color == sample_cell.color else: return user_cell.is_marked() == sample_cell.is_marked() def __fields_equal__(user_field: Field, sample_fi...
true
b6b08d58d64007b1382b5433716b710db30a824b
Python
est271/geomstats
/geomstats/geometry/riemannian_metric.py
UTF-8
12,290
3.078125
3
[ "MIT" ]
permissive
"""Riemannian and pseudo-Riemannian metrics.""" import math import autograd import geomstats.backend as gs from geomstats.geometry.connection import Connection EPSILON = 1e-4 N_CENTERS = 10 TOLERANCE = 1e-5 N_REPETITIONS = 20 N_MAX_ITERATIONS = 50000 N_STEPS = 10 def loss(y_pred, y_true, metric): """Compute ...
true
c025aab5799d9f72cfd586472200cf9072a45d3f
Python
dkarlss/video-scripts
/buildpage.py
UTF-8
1,328
3.15625
3
[]
no_license
# # This script creates a html page with links using HTML5 video tags to # all files given as arguments. # import sys from string import Template def getEpisodeName(path): return getPathElement(path, 0) def getPathElement(path, num): if path == None: return None parts = path.split('/') if (le...
true
f515b0ec5758cda4630509b8e10bf56620aea139
Python
trevorw22/Sentiment-Analysis-Scripts
/nltk/stemming.py
UTF-8
1,077
4.375
4
[]
no_license
# Stemming is a form of preprocessing, we take the root word. ex. ridding is not rid (or rode) # We can have several variations of words with the same meaning # Word net is a newer program that can do the same thing as stemming but better # The actual meaning of a word is unchanged because the root words are the same....
true
6bf28cf77950f00d3c13784f78f98f9df92f12f6
Python
MrNewaz/Learning-Dgango
/Done/lesson 2/nones.py
UTF-8
82
2.71875
3
[]
no_license
walet = None if walet is None: print('Shetaii') walet = 98 print(walet)
true
7ef73839d159a50f4c408e7173ecfe20a467def5
Python
CBermingham/Photonic_Force
/psd_graph.py
UTF-8
611
2.828125
3
[]
no_license
import matplotlib.pyplot as plt time = [] psd = [] fit = [] f = open('psddata', 'rU') lines=f.readlines() f.close() for l in lines: b = l.split() time.append(float(b[0])) psd.append(float(b[1])) fit.append(float(b[2])) plt.scatter(time, psd, color='c', s=1, label='experiment') plt.plot(time, fit,...
true
dd70f6a83bcce7466d1086d58041e39f22719a2a
Python
DamocValentin/PythonLearning
/PasswordGenerator.py
UTF-8
722
4.375
4
[]
no_license
# Write a programme, which generates a random password for the user. # Ask the user how long they want their password to be, # and how many letters and numbers they want in their password. # Have a mix of upper and lowercase letters, as well as numbers and symbols. # The password should be a minimum of 6 characters lon...
true
76977e29416ca1e5a1edc4f46d346c96def86b1b
Python
zafodB/aoc2020
/aoc06.2.py
UTF-8
521
3.25
3
[]
no_license
with open('6.1.input.txt', 'r', encoding='utf8') as input_file: input_lines = input_file.readlines() questions_sum = 0 group = set() new_group = True for line in input_lines: if line == "\n": this_group_questions = len(group) questions_sum += this_group_questions new_group = True ...
true
04eaf8b81b8af8c025c2f610310fc62e3fddf398
Python
azguen/My_100_Days_Of_Python
/58-60-twitter-api/my-code/Twitter_API/ask_user.py
UTF-8
218
3.328125
3
[ "MIT" ]
permissive
def ask_user(): print("Do you want to save?") response = '' while response.lower() not in {"yes", "no"}: response = input("Please enter yes or no: ") return response.lower() == "yes" ask_user()
true
7fd9f8b6a38a2e5b156ab89da27d66e21c71a2cf
Python
houfire/iotedgedev
/iotedgedev/solution.py
UTF-8
1,213
2.796875
3
[ "MIT" ]
permissive
import os import zipfile class Solution: def __init__(self, output, utility): self.output = output self.utility = utility def create(self, name): if name == ".": dir_path = os.getcwd() else: dir_path = os.path.join(os.getcwd(), name) if not self...
true
5531e802e6e0131bfab313bbb6fe0f400f8fc8d2
Python
HuichuanLI/Recommand-Algorithme
/FM/deepfm/deepfm_movielens_sample.py
UTF-8
1,684
2.9375
3
[]
no_license
import pandas as pd from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from deepctr.models import DeepFM from deepctr.inputs import SparseFeat,get_feature_names #数据加载 data = pd.read_csv("movielens_sample.txt") spar...
true
716f00e47675cf8dfc270ec58df9a4701e42b2d3
Python
qiliu08/frequency-refinement-defense
/helper_functions.py
UTF-8
4,408
2.734375
3
[]
no_license
import numpy as np from PIL import Image import os import copy import cv2 import torch def save_input_image(modified_im, im_name, folder_name='result_images', save_flag=True): """ Discretizes 0-255 (real) image from 0-1 normalized image """ modified_copy = copy.deepcopy(modified_im)[0] modified_...
true
ad6143e8059c0c6fa6b8d480f47100c147182b10
Python
here0009/LeetCode
/Python/1478_AllocateMailboxes.py
UTF-8
2,992
3.859375
4
[]
no_license
""" Given the array houses and an integer k. where houses[i] is the location of the ith house along a street, your task is to allocate k mailboxes in the street. Return the minimum total distance between each house and its nearest mailbox. The answer is guaranteed to fit in a 32-bit signed integer. Example 1: ...
true
133c1e06527e9621b9bd80524c2ad148d7d6e8df
Python
marcvifi10/Curso-Python
/Python 2/20 - Expresiones regulares/69 - Expresiones regulares I. Vídeo 69.py
UTF-8
951
4
4
[]
no_license
import re cadena="Vamos a aprender expresiones regulares" print(re.search("aprender",cadena)) print(re.search("aprenderrr",cadena)) textoBuscar = "aprender" # Buscar el textoBuscar dentro de cadena if re.search(textoBuscar, cadena) is not None: print("He encontrado el texto") else: print("No he encontrado el ...
true
0da6016f3bdc93f61cec5bbced2f1f75ce4d18e1
Python
TheHistorian/DanRTS
/Window.py
UTF-8
1,111
3.171875
3
[]
no_license
import pygame, sys class Window: def __init__(self, title, height): self.title = title self.height = height self.width = int(height * (16.0 / 9.0)) # 16:9 aspect ratio self.screen = pygame.display.set_mode((self.width, self.height), 0, 32) pygame.display.set_caption(title) self.background = pygame.rect.Re...
true
a0f537231c07304393411e054f80ee53e3f0aeaf
Python
superfk/opeCV-demo
/main.py
UTF-8
8,533
2.703125
3
[]
no_license
import numpy as np import cv2 as cv import glob import matplotlib.pyplot as plt from PIL import Image from baslerCam import Cam def basic_numpy(): new_list = [1, 2, 3] print(type(new_list)) np_arr = np.array(new_list) print(np_arr) print(type(np_arr)) print(np.max(new_list)) zeros_1D = np....
true
49b80548762e0414fa66bd66bd12f5010cdcef26
Python
saltchang/caten-music
/caten_music/models/users_profile.py
UTF-8
783
2.5625
3
[]
no_license
# models/users_profile.py from flask import current_app from .base import db from caten_music import helper class UserProfile(db.Model): # SQL Table Name __tablename__ = "users_profile" # 資料欄位設定 id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('users.i...
true
6961d0c6fc66e4b4536c8d3e70b0c67a18c88563
Python
katepisova/Python-1
/task-5.py
UTF-8
430
2.890625
3
[]
no_license
import sys, cmath try: outfilename = sys.argv[1] except: print("Usage:", sys.argv[0], "outfile") sys.exit(1) ofile = open(outfilename, 'w') def myfunc(y): if y >= 0.0: return y ** 5 * cmath.exp(-y) else: return 0.0 i = 2 while i < sys.argv.__len__(): x = float(sys.argv[i]) y ...
true
15df56df7a2c07b3c3a040315b6b2fc953f587ce
Python
ynvtlmr/Fundamentals
/day_03/cats_and_birds/game.py
UTF-8
488
3.96875
4
[]
no_license
from cat import Cat from bag import Bag from bird import Bird # create a cat print("Creating an instance of a cat") cat1 = Cat("Felix") print("The cat's name is {}.".format(cat1.name)) # create a bag print("Creating an instance of a bag") bag1 = Bag(10) print("The bag's size is {}.".format(bag1.size)) ...
true
11a2389763379204bf4309de9efc7e0f062b9bf2
Python
marceluphd/IL-LORA1272
/Sample-Java/01-command/ap8-reciver.py
UTF-8
889
2.921875
3
[]
no_license
import serial #ser = serial.Serial ("/dev/ttyAMA0") #Open named port ser = serial.Serial ("/dev/tty.usbserial") ser.baudrate = 115200 #Set baud rate to 9600 #data = ser.read(10) #Read ten characters from serial port to data #ser.write("you send:") #ser.write(data) ...
true
3031d69377eaa691741201af218b822dc0ba3646
Python
CE4301-ACI-IEE/proyecto-1
/tools/create_mem_kernel_mif.py
UTF-8
1,354
2.78125
3
[]
no_license
# Date: 04/17/18 print( "Starting..." ) import os OUTPUT_BITS = 16 DEPTH = 9 # convert to signed dec to hex def tohex( val, nbits ): a = hex((val+(1<<nbits))%(1<<nbits)) return a[2::] # Convert the matrix given as mem_kernel.mif file # kernel blur (box blur) #kernel_matrix = [ [1,1,1], [1,1,1], [1,1,1] ]...
true
759f68552910b1c1602699078a67c69cd7944036
Python
Aasthaengg/IBMdataset
/Python_codes/p03041/s384935089.py
UTF-8
93
2.71875
3
[]
no_license
A=list(map(int,input().split())) S=input() K=A[1] s=S[K-1] s=s.lower() print(S[:K-1]+s+S[K:])
true
3c45501a109ce1f870eaeb20ee0c89a9152aa806
Python
batmanuel-sandbox/pipe_supertask
/python/lsst/pipe/supertask/graph.py
UTF-8
3,297
2.578125
3
[]
no_license
# # LSST Data Management System # Copyright 2017-2018 AURA/LSST. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # 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 ...
true
2e9aee301e3645d5d2e5d06c12c6d8d14083d4d8
Python
podhmo/htmlpp
/htmlpp/lexer.py
UTF-8
1,730
2.75
3
[]
no_license
# -*- coding:utf-8 -*- from .utils import parse_attrs, create_html_tag_regex class Token(object): pass class Open(Token): def __init__(self, name, attrs): self.name = name self.attrs = attrs def __repr__(self): return '<@{} at {}>'.format(self.name, hex(id(self))) class OpenCl...
true
1ddc5d030ec5e5085d14154b21e96c2f77e3ae05
Python
Sai-Sumanth-D/MyProjects
/Guess Location Game.py
UTF-8
526
4.15625
4
[]
no_license
#USING A WHILE LOOP FOR BUILDING A VERY SIMPLE GUESSING GAME. answer_location = "HYDERABAD" guess_count = 0 guess_limit = 3 #here we are using the while loop with the required condition while guess_count < guess_limit: guess =input('Where is Charminar located in India? : ') #WE ARE USING THE BELOW LINE T...
true
0a9bdfdc9abf985d9b4fd89635bc4e3e8e23435a
Python
Vovenberg/AnekBot_telegram
/dao/topPostsDao.py
UTF-8
1,816
3
3
[]
no_license
import sqlite3 from dto.post import Post class TopPostsDao: def __init__(self): self.con = sqlite3.connect('topPosts.db') self.cursor = self.con.cursor() self.cursor.execute("CREATE TABLE IF NOT EXISTS post (id INT PRIMARY KEY, text TEXT, likes INT)") def create_single(self, post): ...
true
45beed09e5392355ab8ecd4a510a2be32933f55f
Python
Nick-SDB/XXQG_bot
/wechat_ftqq.py
UTF-8
1,018
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- encoding=utf8 -*- import datetime import json import requests def sendWechat(text='', desp=''): sc_key = 'SCU87767Tb88d67f50de1408fdc46c93967c23a715e5f18618ecd9' if not text.strip(): print('Text of message is empty!') return now_time = str(datetime.datetime.n...
true
025f6fff72e1c9462f82e805e30d8d049eb35990
Python
abhiramsingh0/karplus_strong_algorithm
/ks.py
UTF-8
699
2.953125
3
[]
no_license
import matplotlib import matplotlib.pyplot as plt import numpy as np from scipy.io.wavfile import write from playsound import playsound as ps def KS_1(x, N): # given the initial buffer x, produce a N-sample output # by concatenating identical copies of the buffer y = x while len(y) < N: # kee...
true
1836b7e50186d65e8f16c47060175b6ebfb837c9
Python
Kang-Hoon/Python_reviews
/190426_lec/190426_3_거북아for반복그림그리자.py
UTF-8
311
3.6875
4
[]
no_license
# 스크립트 모드입니다. # 거북아 원을 채우자 import turtle t1 = turtle.Turtle() t1.shape("turtle") color_list = ["yellow", "red", "blue", "Pink", "green", "" ] n = 0 for n in range(4): t1.fillcolor(color_list[n]) t1.begin_fill() t1.circle(100) t1.end_fill() t1.fd(100)
true
85687bff08f738590426ebf71d70916e536e0ede
Python
kondrashov-do/hackerrank
/10_Days_of_Statistics/Day_0/Weighted_Mean.py
UTF-8
358
3.046875
3
[]
no_license
#import numpy as np n = int(input()) x = list(map(int, input().split())) w = list(map(int, input().split())) #print(np.average(x, weights=w)) """ elementsSum = 0 weightsSum = 0 for i in range(n): elementsSum += x[i]*w[i] weightsSum += w[i] print('{0:.1f}'.format(elementsSum/weightsSum)) """ print(round((sum([i*...
true