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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6b56e94844ef6db8f48beecb9cbc46aee6c3296c | Python | anhphamduy/eldp2 | /Untitled-1.py | UTF-8 | 1,762 | 2.90625 | 3 | [] | no_license | # To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%%
import pandas as pd
from constants import *
from helpers import normalise_number_data, normalise_word_data
import numpy as np
from sklearn import preprocessing
#%%
google_products = pd.read_csv(GOOGLE_SMALL_PATH)
amazon_products =... | true |
028c7999cc1a5f0b9da9ff3bc67995a611576ae7 | Python | ANh0r/LeetCode-Daily | /8.26 9key2Eng.py | UTF-8 | 944 | 3.640625 | 4 | [] | no_license | from typing import List
class Solution:
def letterCombinations(self, digits: str) -> List[str]:
conversion={'2':'abc','3':'def','4':'ghi','5':'jkl','6':'mno','7':'pqrs','8':'tuv','9':'wxyz'}
if len(digits)==0:
return []
product=['']
# print(product)
for k in dig... | true |
c8311f7c21e1148873f80028d0c0cfd0f8709a7f | Python | andreplacet/exercicios_python | /exercicio38.py | UTF-8 | 363 | 4.125 | 4 | [] | no_license | num1 = int(input('Digite um número: '))
num2 = int(input('Digite outro número: '))
if num1 > num2:
maior = num1
print('O número {}, é maior que {}'.format(num1, num2))
elif num2 > num1:
maior = num2
print('O número {}, é maior que {}'.format(num2, num1))
elif num1 == num2:
print('Não existe valor ma... | true |
bec1efa30d41393a374f6714aeabcaae9a3c5747 | Python | yongfang117/pro_useful_code | /pro_tcp/tcp socket编程/111.py | UTF-8 | 530 | 2.53125 | 3 | [
"MIT"
] | permissive | import socketserver
class Myserver(socketserver.BaseRequestHandler):
def handle(self):
conn = self.request
print(self.client_address)
conn.sendall("我能同时处理多个请求!")
flag = True
while flag:
data = conn.recv(1024)
if data == "exit":
flag =... | true |
24296b981626009fd8019942f9798d7a09df0c60 | Python | bipinaghimire/Turtle_project | /3.py | UTF-8 | 33 | 2.671875 | 3 | [] | no_license | a={1,2,3,4}
c= a.pop()
print(c) | true |
ae8c92be86eaa499e27c8ef205a0657bde8db861 | Python | luwis93choi/ML2020_Class | /Assignment_07_Dimensionality_Reduction_PCA/01_6_Kernel_PCA.py | UTF-8 | 6,267 | 2.71875 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_openml
from sklearn.model_selection import train_test_split
from sklearn.decomposition import KernelPCA
from sklearn.datasets import make_swiss_roll
from sklearn.model_selection import GridSearchC... | true |
d8b8a3865a56992727b76d446d05558040a5ef5e | Python | leemingee/CoolStuff | /NN/activation.py | UTF-8 | 766 | 3.015625 | 3 | [] | no_license | # Created by Ming Li at 3/7/2019
# Feature:
# Description:
# Contact: ming.li2@columbia.edu
import numpy as np
class relu:
def __init__(self):
pass
def relu_forward(self, x):
"""
Computes the forward pass for rectified linear units (ReLUs).
Input:
- x: inputs, of a... | true |
09513894398ce52ebc07ca56b083cab6d7e28607 | Python | PPL-IIITA/ppl-assignment-shubham-padia | /q1/helper.py | UTF-8 | 1,236 | 3.015625 | 3 | [] | no_license | import csv
from boy import Boy
from girl import Girl
import random
import logging
logging.basicConfig(filename='log.txt', filemode='a', format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S', level=logging.DEBUG)
def form_couple(boy, girl):
"""
Takes a bo... | true |
878b4ed3cdd2da076b59f7cab58fb5389e99e4c9 | Python | lrh12580/Course_PR_17 | /students/liruihao/experiment1/Kmeans/optimize_kmeans.py | UTF-8 | 3,196 | 3.078125 | 3 | [] | no_license | from matplotlib.pyplot import *
import pandas as pd
import random
import numpy as np
from collections import defaultdict
# function to calculate distance
def distance(p1, p2):
return ((p1[1] - p2[1]) ** 2 + (p1[2] - p2[2]) ** 2) ** (0.5)
# randomly generate around 100 cartesian coordinates
all_points = []
read_da... | true |
15afa49f28b83e1ab330443c76d5c1e32eed268b | Python | ritikkumar55/seoul_bike_trip_duration | /app.py | UTF-8 | 1,280 | 3.375 | 3 | [] | no_license | import streamlit as st
import numpy as np
from model import predict_duration
st.set_page_config(page_title="Bike Trip Prediction Web App",layout="wide")
st.title("Bike Trip Duration Prediction")
with st.form('prediction form'):
st.header("Enter the Deciding Factors:")
distance = st.number_input... | true |
31e4dee24aca654a3fd5ab56a5e2341b55826bb4 | Python | gabrielmcf/PySUS | /pysus/online_data/sinasc.py | UTF-8 | 1,282 | 2.640625 | 3 | [] | no_license | """
Download SINASC data from DATASUS FTP server
Created on 01/11/17
by fccoelho
license: GPL V3 or Later
"""
import os
from ftplib import FTP
from pysus.utilities.readdbc import read_dbc
from pysus.online_data import CACHEPATH
import pandas as pd
def download(state, year, cache=True):
"""
Downloads data dire... | true |
402c279c6c3efab5c2f3919e0a5fd407abcf01ff | Python | varunsridhar1/NBAShotPredictor | /GBDT.py | UTF-8 | 2,000 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 5 19:33:13 2017
@author: Varun
"""
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
print("GBDT... | true |
224f93a21e07e0970de6135348adeccb9bc691e4 | Python | MatsudaYoshio/study | /generate_graph/generate_bar_questionnaire_all.py | UTF-8 | 4,341 | 2.75 | 3 | [] | no_license | import numpy as np
import matplotlib
import matplotlib.colors as colors
import matplotlib.pyplot as plt
from matplotlib import rc
import csv
import statistics
import math
import subprocess
method_num = 3
operator_questions_num = 5
bystander_questions_num = 3
all_questions_num = operator_questions_num+bystander_questio... | true |
643a545d2a31d4706c8c58da86efb30532efaa7c | Python | ColinAnthony/NGS_analysis_pipeline | /calc_haplotype_freq.py | UTF-8 | 4,279 | 3.140625 | 3 | [] | no_license | import os
import argparse
import collections
from itertools import groupby
__author__ = 'colin.anthony'
def py3_fasta_iter(fasta_name):
"""
modified from Brent Pedersen: https://www.biostars.org/p/710/#1412
given a fasta file. yield tuples of header, sequence
"""
fh = open(str(fasta_name), 'r')
... | true |
26f30e782faa13d0d890954ffa42748bab4a2ef5 | Python | Bandude/MonsterQuestSPC2019 | /ClassWork/AddEnemy.py | UTF-8 | 1,477 | 3.609375 | 4 | [] | no_license | #Name, Health (Calls Dice), StrengthModifier, armor, atackBonus, weapon(dice, name)
#Dice is how many sides x, and how many rolls y dice(x,y)
enemyArray = {}
enemyArray['Rat'] = ['Rat', dice(4,1), -4, 10, 0, [1, "bite"]]
enemyArray['Spider'] = ['Spider', dice(4,1),-4, 12, 4, [1, "bite"]]
enemyArray['Skeleton'] = ['Skel... | true |
3b376e940307eef9577793957e7770435d84e737 | Python | UMP-Healthcare-AI/Self-Training-MRC | /general_util/multi_rc/measure.py | UTF-8 | 4,973 | 2.828125 | 3 | [] | no_license | import math
class Measures:
@staticmethod
def per_question_metrics(dataset, output_map):
P = []
R = []
# for p in dataset:
# for qIdx, q in enumerate(p["paragraph"]["questions"]):
# id = p["id"] + "==" + str(qIdx)
# if (id in output_map):
... | true |
537ca837135306303d0e82da67e706b57b86894f | Python | MaDITIY/iperf_util | /output_parser/parser.py | UTF-8 | 1,943 | 2.75 | 3 | [] | no_license | import re
from collections import namedtuple
Column = namedtuple('Column', ['name', 'is_measurement_unit'], defaults=(True, ))
EXPECTED_COLUMS = {
'Interval': Column('Interval'),
'Transfer': Column('Transfer'),
'Bandwidth': Column('Bandwidth'),
'Retr': Column('Retr', False),
'Cwnd': Column('Cwnd')... | true |
3d39b5103e588d3115c646bc51c2763a1fbc89a8 | Python | kjarmuzynska/tictactoe | /sample/sample1.py | UTF-8 | 201 | 3.859375 | 4 | [] | no_license | class A:
def funkcja(self):
print("Jestem A")
class B:
def funkcja2(self):
print("Jestem B")
a = A();
a.funkcja()
b = B();
b.funkcja2()
lista = [a, b]
for obiekt in lista:
obiekt.funkcja()
| true |
7d87f9a06f92e9fe7baff677102ed803af914ccf | Python | wsgan001/document-clustering | /Final_deliverables/Iteration_3/document_clustering/clustering.py | UTF-8 | 10,725 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 03 06:17:28 2017
@author: anbarasan.selvarasu
"""
from scipy.spatial.distance import cdist
from scipy.spatial.distance import pdist
from sklearn.cluster import KMeans, MiniBatchKMeans
from sklearn import metrics
from time import time
from sklearn.... | true |
846b87c8ccf0fe484ff78982035ee2f8f978d7f7 | Python | KarloLeksic/PSU_LV | /LV2/zadatak2.py | UTF-8 | 250 | 3.171875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
bacanje = np.zeros((100, 1))
for i in range(0, 100):
bacanje[i] = np.random.randint(1, 7)
print (bacanje)
plt.hist(bacanje, bins = 6, rwidth = 0.9) #nije dobar, treba poboljsat
plt.show() | true |
914d96b2b515f1d64e8eaabccb8475a64e53fa6e | Python | Peritract/text_adventure | /text_adventure/tests/test_game_class.py | UTF-8 | 322 | 2.578125 | 3 | [
"MIT"
] | permissive | """This module contains tests for the elements.game.py file."""
from unittest import mock
from text_adventure.elements.game import Game
@mock.patch('text_adventure.elements.game.display')
def test_game_main_menu(mock_display):
test_obj = Game()
test_obj.main_menu()
assert len(mock_display.mock_calls) == ... | true |
595c8515403f27bad819f537a92a2db6544ff3dc | Python | tuanzhang7/CMSmd5 | /xmlhelper.py | UTF-8 | 1,472 | 2.703125 | 3 | [] | no_license | import xml.etree.cElementTree as ET
def write_metadata_xml(filepath):
s = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
"""
root = ET.Element("properties")
ET.SubElement(root, "entry", key="cm:title").text = "A photo of a flower."
ET.S... | true |
c32aec0ea16b56064deb64c854e63307e8b0e525 | Python | Drewnicorn15/islandgame- | /test.py | UTF-8 | 146 | 2.546875 | 3 | [] | no_license | import json
with open("jsonFiles/storyPath.json", "r") as actionList:
data = json.loads(actionList.read())
print(type(data["Flee"])) | true |
c942856ecfe269b79b978f7d9993282cf70a5409 | Python | smartinsert/CodingProblem | /refresher/search_in_a_sorted_matrix.py | UTF-8 | 931 | 4.15625 | 4 | [] | no_license | """
Search in a matrix which is sorted left to right and top to bottom
"""
def does_number_exist(matrix, target):
row, column = len(matrix), len(matrix[0])
if not row and not column:
return False, (-1, -1)
current_column = column - 1
current_row = 0
while current_column >=0 and current_... | true |
467180e06a5ec281249320c31b4d1e9193599d60 | Python | jennychang-dev/python-tutorial | /hello.py | UTF-8 | 6,334 | 4.9375 | 5 | [] | no_license | # Simple prints
msg = "Hello world"
print(msg)
x = 1
if x == 1:
print("1")
else:
print("0")
print("Goodbye, world")
print("wow what a complex project")
## Variables and types
## Python is completely object oriented - we do not need to declare variables when we use them
myInt = 7
print(myInt)
myFloat = 8.5... | true |
a151d3f77d63cc789e75494e0b801663b61955a0 | Python | scrapinghub/article-extraction-benchmark | /tests.py | UTF-8 | 1,075 | 2.71875 | 3 | [
"MIT"
] | permissive | import pytest
from evaluate import string_shingle_matching, _ngrams, _tokenize
def test_tokenize():
assert _tokenize('a b,cd:e(foo,bar) ') == \
['a', 'b', 'cd', 'e', 'foo', 'bar']
@pytest.mark.parametrize(
['text', 'n', 'expected'],
[('!', 4, []),
('a,b c ', 5, [('a', 'b', 'c')]),
... | true |
e2f0313fea706fd4f5b42f1499d49b45e4a10b7a | Python | shreeviknesh/ScratchML | /tests/test_multiple_linear_regression.py | UTF-8 | 1,542 | 2.9375 | 3 | [
"MIT"
] | permissive | from .context import scratchml
from scratchml.regression import MultipleLinearRegression
import numpy as np
def test_initialization():
mr = MultipleLinearRegression()
assert isinstance(mr, MultipleLinearRegression)
def test_test():
mr = MultipleLinearRegression()
def test_simple_fit_and_predict():
mr... | true |
6cfa9ccacd1d4dde89b003c28b0ac31459ca822a | Python | jakubpulaczewski/codewars | /8-kyu/keep-hydrated.py | UTF-8 | 537 | 4.25 | 4 | [] | no_license |
"""
Keep Hydrated!
The link: https://www.codewars.com/kata/582cb0224e56e068d800003c
Problem Description:
Nathan loves cycling.
Because Nathan knows it is important to stay hydrated, he drinks 0.5 litres of water per hour of cycling.
You get given the time in hours and you need to return the number of litres Natha... | true |
3b3a3e4026070951c57c657cbf6a6f3c09c7767a | Python | andy3964600/RNN | /one hot coding for elements.py | UTF-8 | 887 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 14:41:30 2019
@author: andy3
"""
#################################################
#
#
#One-hot-encoding
#
#token trans to vector method(basic methiod) for 'word of elements'
#################################################
import numpy as np
import string
###initial ... | true |
248a2aeaad074cdee2874a4e001aef1997546995 | Python | diegorafaelvieira/Programacao-1 | /Aula 02/ListaDeExerciciosExtra/Lista7.py | UTF-8 | 202 | 3.921875 | 4 | [
"MIT"
] | permissive | ValorQuadrado = int(input("Digite o valor do lado do quadrado:"))
ValorArea = ValorQuadrado ** 2
print("O valor da area do quadrado é",ValorArea)
print("O dobro da area do quadrado é:",ValorArea * 2)
| true |
efc489faefbaae05049a3023132e7af42bc6da37 | Python | jennyhwei04/python | /.vscode/t.py | UTF-8 | 410 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
#用集合去除重复元素
import pprint
list_num = ['1', '2', '3', '4']
list_result = []
for i in list_num:
for j in list_num:
for k in list_num:
if len(set(i + j + k)) == 3:
list_result += [int(i + j + k)]
print("能组成%d个互不相同且无重复数字的三位数: " % len(list_... | true |
1cf04dd41895c2edd06c3ebc6b0e28229d2db139 | Python | noahbarros/Python-Exercises | /ex113.py | UTF-8 | 834 | 4.1875 | 4 | [
"MIT"
] | permissive | def leiaInt(msg):
while True:
try:
n = int(input(msg))
except (ValueError, TypeError):
print('Erro: por favor, digite um número válido.')
continue
except (KeyboardInterrupt):
print('OUsuário preferiu não digitar esse número.')
else:
... | true |
380b3de08a671ecd2a7e420bbf67dea4fb12b123 | Python | zhangbo111/0102-0917 | /day06/02-嵌套函数.py | UTF-8 | 390 | 3.671875 | 4 | [] | no_license | name = ['张大彪']
# func1表示外层函数
def func1(japen):
name = japen
# func表示内层函数
def func2():
name = '秀芹大妹子'
# 查找内层函数的name
print("内层函数", name)
func2()
# 查找外层函数的name
print("外层函数:", name)
func1("岗村宁次")
# 查找全局变量的name
print("全局:", name)
| true |
76cbab7fa2914751eb52a629bf6de2a0e97f9b4e | Python | smurfix/playground | /Pwnna/utils/sourcechecker.py | UTF-8 | 253 | 2.625 | 3 | [] | no_license | def checkEgyptian(fn):
with open(fn) as f:
while True:
line = f.readline()
if len(line) == 0:
break
if line.strip().startswith("{"):
return False
return True
| true |
b315bb421a9eb7211c405ccf2d67f945c959a6c6 | Python | nishant-mittal/PythonPractice | /guessing_game.py | UTF-8 | 534 | 3.90625 | 4 | [] | no_license | import sys
from random import randint
number = randint(1, 10)
print(number)
while True:
number_guessed = int(input("Guess a number between 1 and 10: "))
if number_guessed > number:
print("Too high! try again!")
elif number_guessed < number:
print("Too low! try again")
else:
print("You guesses it!... | true |
08cc2ed2e8669d2dd6f22ccf489f5202d8a5e186 | Python | onelieV/neorl | /neorl/evolu/pso.py | UTF-8 | 18,040 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#Created on Mon Jun 15 19:37:04 2020
#@author: Majdi Radaideh
import random
import numpy as np
from collections import defaultdict
import copy
import time
import joblib
class PSO:
"""
Parallel Particle Swarm Optimisaion (PSO) module
:param mode: (str) problem type... | true |
a18004ba90bbe934acbd8445618b35d3bea18c78 | Python | NPHackClub/BeginnerRoom-2020 | /Week 2 - Calculator/novel-calc.py | UTF-8 | 256 | 3.859375 | 4 | [
"Unlicense"
] | permissive | # import the math library to use the sqaure root feature
import math
# collect inputs
a = int(input("a: "))
b = int(input("b: "))
# use variables into formula
c = math.sqrt((a*a)+(b*b))
#print output
print("The length of side c is " + str(c)) | true |
f5e83e1d6dd3256fe2dfcb640cbac7abedde2db2 | Python | JurreVersluis/werken-met-gegevens | /berekening1verbeterd.py | UTF-8 | 305 | 3.15625 | 3 | [] | no_license | croissantjes = 17
kosten1 = 0.39
stokbroden = 2
kosten2 = 2.78
korting = 1.50
dekosten = (croissantjes * kosten1) + (stokbroden * kosten2) - korting
print("De feestlunch kost je bij de bakker " + str(dekosten) + " euro voor de 17 croissantjes en de 2 stokbroden als de 3 kortingsbonnen nog geldig zijn!") | true |
6a5deaf39179e7d2b68eaa192bee80138f3a9422 | Python | panluluy/project-name | /PycharmPorjects/test_case/unittest_assert1/testsub.py | UTF-8 | 477 | 2.921875 | 3 | [] | no_license | #coding=utf-8
import unittest
#unittest方法必须要test开头
from Python_assert.count import Count
class TestSub(unittest.TestCase):
def setUp(self):
print 'start testing-------------------------------------'
def tearDown(self):
print 'ending testing------------------------------------'
def test_... | true |
19ad6445e9fbcd8f234d436b1190b1dad3e6168b | Python | marokazu/pbl2 | /3_Handling_data/画像データ/find_edges.py | UTF-8 | 371 | 2.671875 | 3 | [] | no_license | from PIL import Image
import cv2
import numpy as np
from matplotlib import pyplot as plt
image = np.array(Image.open("cat.jpg"))
edge = cv2.Canny(image,50,110)
plt.imshow(edge)
plt.show()
cv2.imwrite("cat_edge.jpg", edge)
image_n = np.array(Image.open("noise.jpg"))
edge = cv2.Canny(image_n,50,110)
plt.imshow(edge)... | true |
b02c5ec76557d4a8d679aea9a8ff507687ccac54 | Python | Fereuz/projecteuler.net | /3.py | UTF-8 | 333 | 3.84375 | 4 | [] | no_license | #Problem 3 - Largest prime factor
"""
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
"""
i = 2
Number = 600851475143
while Number >= 0:
if Number % i == 0:
print(i)
ans = Number / i
print('ans = ', ans)
Number = ans
... | true |
9ca102e793bb3ccaaeb72b04e02c2f5f073b92ac | Python | alexgarciac/ontology-utils | /ontologyutils/__init__.py | UTF-8 | 5,294 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import re
import sys
#reload(sys);
#sys.setdefaultencoding("utf8");
class Ontology(object):
def __init__(self):
#keys are the term ids
self.terms = dict()
self.dbxrefs = dict()
self.altids = dict()
self.oboNamespace = 'http://purl.obolibrary.org/obo/'
s... | true |
9a0fb38f84297d79a38f433f8713bddbbdb20075 | Python | aokeke1/PMC | /project1/mymain3.py | UTF-8 | 3,779 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 23 10:44:10 2017
@author: aokeke
"""
import numpy as np
import pickle as pkl
import mymain1
import itertools
import time
np.set_printoptions(threshold=np.nan)
tags = ['EnterpriseID','LAST','FIRST','MIDDLE','SUFFIX','DOB',\
'GENDER','SSN','ADDRESS1','ADDRESS2','ZI... | true |
5fde8727e56853731f4990dd41c473e0182e5b41 | Python | oshaughn/research-projects-RIT | /MonteCarloMarginalizeCode/Code/bin/util_InitMargTable | UTF-8 | 6,775 | 2.703125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# S. Morisaki, based on his
# https://dcc.ligo.org/LIGO-T2100485
import argparse
import numpy as np
from scipy import integrate
from scipy.special import erfcinv, erf, erfcx, i0e
import warnings
import functools
import RIFT.likelihood.factored_likelihood as factored_likelihood
parser = argpar... | true |
3e31bc4bc94b2bdaf5aeb9b03b3c262a1c778661 | Python | marcus-aurelianus/codeforce | /GB2020/appolo.py | UTF-8 | 596 | 2.8125 | 3 | [] | no_license | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
mod = 10**9+7
def gift():
for _ in range(t):
n = int(input())
lst = list(map(int,input().split()))
sumCurr = 0
ans = 0
for i in range(n):
prevSum = sumCurr
sumCurr += lst[i]
... | true |
c5dc5c1bcc3fb21bb3c4ab0ee461b25d8a82908a | Python | MitchClarke/fluffy-octo-lamp | /TriggerBurst.py | UTF-8 | 483 | 2.875 | 3 | [] | no_license |
from Triggerable import Triggerable
import sys
from time import sleep
if __name__ == "__main__":
if len(sys.argv) != 4:
print 'Expected 4 paramters'
sys.exit(1)
else:
trigger = Triggerable(int(sys.argv[1]))
if sys.argv[2] == '1':
trigger.on()
sleep(float... | true |
5fcea3d43a84ebbb4fa193bfb0587eaf82e0fed3 | Python | chen-zhu/Log-Events-Generator | /fileManager.py | UTF-8 | 1,756 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | import pathlib
import os
from dotenv import load_dotenv
import csv
import json
from datetime import date, datetime
import pandas as pd
from multiprocessing import Lock
load_dotenv()
CASE_ID_FIELD = os.getenv('CASE_ID_FIELD')
OUTPUT_DIR = os.getenv('OUTPUT_DIR')
EVENT_DATE = os.getenv('EVENT_DATE')
def write_csv(event... | true |
5cbfb9d14afe680aefc72cf152500ae7ea71abd5 | Python | Beatrizpjunq/Learning_python | /dezenas.py | UTF-8 | 114 | 3.90625 | 4 | [] | no_license | num = int(input("Digite um número inteiro:"))
y = num // 10
x = y % 10
print ("O dígito das dezenas é", x)
| true |
a369705148d6a099ae61f6d0c732cf1a6831517e | Python | nicoknottnerus/programerenles2 | /les 3/pe3_1.py | UTF-8 | 156 | 2.734375 | 3 | [] | no_license | score = eval(input('hoeveel punten heb je..'))
if score > 14:
print('gefeliciteerd je bent geslaagd!')
else:
print('Helaas heb je keihard gefaald!') | true |
27af7d107e1cc3104c27d057cfee8aca7d94f3e2 | Python | stevenaci/Twitch.Tv-Wiki-Bot | /twitchbot.py | UTF-8 | 1,950 | 2.796875 | 3 | [] | no_license | from twitchio.ext import commands as commands
from bs4 import BeautifulSoup as soup
import requests
import re
token = "oauth:thisisnotarealoathtoken" # Oauth2 token that you generate
name = "NancyBot" # The bots username
channel = "Placeholder" # Twitch channel you are targetting
bot = commands.Bot(
... | true |
5fafd05dc82fb6b9e87c513ce03c15ed532e84f7 | Python | qqpoltergeist/BSUIR-IITP-2016-2020 | /Math-Statistics/lab004/pirrs.py | UTF-8 | 7,120 | 3.265625 | 3 | [] | no_license | from collections import OrderedDict
from prettytable import PrettyTable
import matplotlib.pyplot as plt
import scipy.stats as sts
import random
import math
def get_m(n):
if n <= 100:
m = int(math.sqrt(n))
else:
m = int(3 * math.log(n, 10))
return m
def f(x):
return 1 / (x + 3)
def... | true |
680c9af0b18fd533e0c02b64bfb49ee789d6e192 | Python | fepegar/torchio | /src/torchio/data/sampler/uniform.py | UTF-8 | 1,023 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from typing import Generator
from typing import Optional
import torch
from ...data.subject import Subject
from .sampler import RandomSampler
class UniformSampler(RandomSampler):
"""Randomly extract patches from a volume with uniform probability.
Args:
patch_size: See :class:`~torchio.data.PatchSamp... | true |
5e5d328c0c13bd808f2689d0143d6632a8dc0c32 | Python | djimenezpuche/ProyectoBCI | /High-Precision-AD-DA-Board-Code/RaspberryPI/DAC8532/python2/DAC8532.py | UTF-8 | 721 | 2.671875 | 3 | [
"MIT"
] | permissive | import config
import RPi.GPIO as GPIO
channel_A = 0x30
channel_B = 0x34
DAC_Value_MAX = 65535
DAC_VREF = 3.3
class DAC8532:
def __init__(self):
self.cs_pin = config.CS_PIN
config.module_init()
def DAC8532_Write_Data(self, Channel, Data):
config.digital_write(self.c... | true |
0e4dcbe20785edd777960020e717fb47176b40c5 | Python | pitcons/amarak-server | /examples/simple_client.py | UTF-8 | 696 | 2.90625 | 3 | [] | no_license | # encoding: utf8
import logging
import sys
from pprint import pprint
import requests
logging.getLogger("requests").setLevel(logging.WARNING)
def fetch_terms(word):
url = 'http://localhost:8000/rutez/fetch_terms?word={0}'.format(word)
response = requests.get(url)
result = response.json()
return result... | true |
f15594a706b67f5ff99640c391af44b2ae5dede1 | Python | yhay81/socialname | /socialname/result.py | UTF-8 | 2,755 | 3.390625 | 3 | [
"MIT"
] | permissive | """SocialName Result Module
This module defines various objects for recording the results of queries.
"""
import dataclasses
from enum import Enum
from typing import Optional, Dict, Any
class SocialNameStatus(Enum):
"""Query Status Enumeration.
Describes status of query about a given username.
"""
... | true |
6039f5795dbf8715e4f107dd8baa0e3fbb690074 | Python | TianXiaPy/PyExcel | /src/总结/worksheet.py | UTF-8 | 377 | 2.625 | 3 | [] | no_license | """
sheet.autofit(axis=None)如果参数省略,表示自动适应调整列宽和行高
若设置未"rows"或"r",表示自动适应调整行高,若设置为"columns"或"c"
表示自动适应调整列宽
"""
"""
调整行高和列宽,可以使用column_width和row_height属性
value = sheet.range("A1").expand("table")
value.column_width = X
value.row_height = Y
"""
| true |
3ebb38fc3a6a2dc22fdac07a94b8bdf434510927 | Python | cherry-wangyanping/PO_message | /base_data/base_data.py | UTF-8 | 761 | 3.09375 | 3 | [] | no_license |
from selenium.webdriver.support.wait import WebDriverWait
class Base(object):
#初始化driver
def __init__(self,driver):
self.driver = driver
#显示等待的方法定位元素并返回(二次封装)
def find_element(self,loc,timeout=5,poll=0.5):
return WebDriverWait(self.driver,timeout,poll).until(lambda x : x.find_element(*l... | true |
caa156f1ca21e03390fbbf452dc365b863e23fd9 | Python | geziaka/rater | /examples/lr_demo.py | UTF-8 | 2,424 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
"""
import os
import sys
import torch
import torch.nn as nn
from sklearn.metrics import roc_auc_score
from torch.utils.data.dataset import TensorDataset
sys.path.append("..")
from rater.datasets.criteo import Criteo
from rater.models.ctr.lr ... | true |
789ecf85be74bc08697090a594b9cafcbb8461d4 | Python | adilahiri/MachineLearning | /ANN_DigitRecog.py | UTF-8 | 2,786 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.preprocessing import Imputer
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
import tensorflow as tf
import keras
from keras.models import Sequential
from keras.layers import Dense
from sklearn.preprocessing import LabelEncoder, OneHotEnco... | true |
c53ffdb91dc62da550e26ee21b1409e08e647844 | Python | ilya0693/Lab2 | /PyCharm/user.py | UTF-8 | 228 | 3.609375 | 4 | [
"MIT"
] | permissive | nameUser = input("What is your name? " )
ageUser = input("How old are you? " )
liveUser = input("Where are you live? ")
print("This is {0}.\n"
"It is {1}.\n"
"(S)he lives in {2}".format(nameUser, ageUser, liveUser)) | true |
74fd61df9d97a69d09406bd323d2a1b05bd2cb7f | Python | Fradge26/TSP | /TSP_opt/helper_functions.py | UTF-8 | 2,332 | 2.640625 | 3 | [] | no_license | import numpy as np
from scipy.spatial import cKDTree
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from copy import copy
def plot_path(path, ids2x, ids2y, annotate):
fig = plt.figure()
ax = fig.add_subplot(111)
x = [ids2x[node] for node in path]
y = [ids2y[node] for node in path]... | true |
93d069b03adf507ed32c26bd8e398573721d3e48 | Python | ncar-xdev/xpersist | /xpersist/registry.py | UTF-8 | 2,522 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # Adapted from https://github.com/explosion/thinc
import sys
import typing
import catalogue
# Use typing_extensions for Python versions < 3.8
if sys.version_info < (3, 8):
from typing_extensions import Protocol
else:
from typing import Protocol
_DIn = typing.TypeVar('_DIn')
class Decorator(Protocol):
... | true |
bc4414667aa101d156e7b327172bec75b9e859d5 | Python | AmirMohamadBabaee/linearalgebra-projects | /LU factorization/src/LU_solver.py | UTF-8 | 1,895 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import numpy as np
# define function to calculate LU factor of matrix A
def calculate_LU(A):
length = np.shape(A)[0]
L = np.eye(length)
pivot_col = 0
pivot_row = 0
L_col = 0
while pivot_col < length and pivot_row < length:
while A[pivot_row, pivot... | true |
f2659339d4bce6197634a54555d281d631eac66d | Python | davidherzlos/progr-basica | /python/clase.py | UTF-8 | 938 | 4.21875 | 4 | [] | no_license | def main():
# Una clase bonita en python
class Mujer():
def __init__(self, nombre, apellido, saludo):
"""Inicializa el objeto"""
self.nombre = nombre
self.apellido = apellido
self.saludo = saludo
pass
def saludar(self):
""... | true |
adf2431152333d78704cd46e327aa0383c67289d | Python | Akhlaquea01/Python_Practice | /Operators.py | UTF-8 | 776 | 3.609375 | 4 | [] | no_license | '''Task
Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip),
and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost.
Round the result to the nearest integer.'''
import math
import os
import random
... | true |
6373619d1b68d94d54059154bfe0980aa54ab3ed | Python | Aasthaengg/IBMdataset | /Python_codes/p02744/s974660106.py | UTF-8 | 249 | 2.96875 | 3 | [] | no_license | N = int(input())
def main(l):
tmp = []
for a in l:
n = a[1]
for i in range(97, n+2):
tmp.append([a[0]+chr(i), max(i, n)])
return tmp
l = [['a', 97]]
for i in range(1, N):
l = main(l)
for i in range(len(l)):
print(l[i][0]) | true |
3ea188fcc0bba451810e2e618c6cc79ad76d083f | Python | Leenhazaimeh/data-structures-and-algorithms-2 | /python/tests/test_breadth_first.py | UTF-8 | 559 | 3.296875 | 3 | [
"MIT"
] | permissive | from code_challenges.BinaryTree.breadth_first import Node , BinaryTree, breadth_first
def test_breadth_first():
input = BinaryTree()
input.root = Node(2)
input.root.left = Node(7)
input.root.right = Node(5)
input.root.left.right = Node(6)
input.root.left.left = Node(2)
input.root.right.rig... | true |
2490cf81c5f3d44486584a27cfbed48039b91776 | Python | yuwern/simple_restapi | /secret_message_generator.py | UTF-8 | 1,156 | 2.578125 | 3 | [
"MIT"
] | permissive | import base64
import requests
from jwcrypto import jwk, jwe
from jwcrypto.common import json_decode
print('Please enter API domain (http://127.0.0.1:5000)')
DOMAIN = str(input())
if not DOMAIN:
DOMAIN = 'http://127.0.0.1:5000'
# login
resp = requests.post(DOMAIN + '/auth/login', json={'email': 'admin1234@admin.... | true |
362840a89c5c3ed217373f0708f0523ed625c36f | Python | cheryldunn/cheryldunn.github.io | /fourplaces.py | UTF-8 | 136 | 3.421875 | 3 | [] | no_license | to_visit = ["Greece", "Switzerland", "Australia", "Scotland"]
for place in to_visit:
print("I would like to visit " + place + ".")
| true |
ba8a63b7fe3cb8e2b86ac29117d34a8d0d853c9d | Python | xaidc/Python | /第一阶段/day7-字典和集合/02-字典.py | UTF-8 | 2,021 | 4.5625 | 5 | [] | no_license | # @Author :xaidc
# @Time :2018/8/28 9:07
# @File :02-字典.py
# 字典(dict)
'''
1.字典是容器类型(序列),以键值对作为元素(字典里面存的数据全是以键值对的形式出现的)
{key1:value1,key2:value2...}
2.键值对: 键:值 (key:value)
键(key):要唯一,不可变的(数字,布尔,字符串,元组,推荐使用字符串)
值(value):可以不唯一,可以是任何数据类型的数据
3.字典是可变的(增删改)---可指的是字典中的键值对的值和个数可变
'''
# 1.声明字典
dict1 = {'name':'tony', ... | true |
fd8a0af7ad1e4fb4f9cac934ea2837637355c92b | Python | thippeswamydm/python | /2 - Operators/9-membership-operators.py | UTF-8 | 1,003 | 4.34375 | 4 | [] | no_license | # Describe the usage of membership operators
# 'in' operator checks if an item is a part of a sequence or iterator
# 'not in' operator checks if an item is not a part of a sequence or iterator
lists = [1, 2, 3, 4, 5]
dictions = {"key": "value", "a": "b", "c": "d"}
# Usage with lists for
# 'not in' AND 'in'
if (1 in ... | true |
8a2a5fd8d2821e43cddf90288ad917c7c12fd3d0 | Python | jre233kei/procon-atcoder | /ABC124/D.py | UTF-8 | 140 | 2.71875 | 3 | [] | no_license | n, k = map(int, input().split())
s = [int(i) for i in input()]
ones = 0
zeros = 0
for i in range(n):
if s[i] == 0:
pass
| true |
1bf2db335029f98b22a3f1acd3987b7a6c078cb6 | Python | YingjingLu/TideSurf-1 | /tidesurf/engine/engine_manager.py | UTF-8 | 4,546 | 3.015625 | 3 | [] | no_license | """
The manager process that maintains the shared states among different processes
"""
from multiprocessing import Queue, Array, Value, Process, Lock
from multiprocessing.managers import SyncManager, BaseManager
import pandas as pd
import os, sys
import json
from tidesurf.lib.stock import Stock
from tidesurf.engine... | true |
a80fea749435998106e9434bdfe79fcc160b8599 | Python | AsaHoward7/Insta-User-Scrape-Filter-Message | /working_engagement_calc.py | UTF-8 | 1,279 | 2.625 | 3 | [] | no_license | import pandas as pd
from instaloader import Instaloader, Profile
input_file = '/Users/asaspadeshoward/Desktop/followers_over_9000.csv'
loader = Instaloader()
loader.login('yourusername','yourpassword')
insta_handles_list = list()
engagement_list = list()
profile_df = pd.read_csv(input_file)
#take out .head() to get ... | true |
ad742a0dee12dfea985c474d22a824cf3d1298b3 | Python | jiangmin-github/python | /Study/cf.py | UTF-8 | 12,989 | 2.671875 | 3 | [] | no_license | # coding:utf-8
"This is a program to match the chemical equation"
import numpy as np
from fractions import Fraction
from fractions import gcd
import copy
# periodic table of the elements
periodictable = {"H" :1 , "He":2 , "Li":3 , "Be":4 , "B" :5 , "C" :6 , "N" :7 , "O" :8 , "F" :9 , "Ne":10,
"Na":1... | true |
bbdcb1368e69dde22bcb8ddf918ffe94d68368ff | Python | Victor-Rodriguez-VR/Coding-challenges | /largestAnagram.py | UTF-8 | 593 | 3.234375 | 3 | [] | no_license | class Solution(object):
def findLongestWord(self, string, dictionary):
longest = ''
for anagram in dictionary:
lastIndex=0
isCorrect = True
for letter in range(len(anagram)):
lastIndex=string.find(anagram[letter] , lastIndex)+1
if(lastIndex==0):
i... | true |
0a06b36214f4181ad76c6b53428d0ca4529eddec | Python | seansio1995/MISC | /BinaryCheck.py | UTF-8 | 1,263 | 3.8125 | 4 | [] | no_license | trees_val=[]
def inorder(tree):
if tree!=None:
inorder(tree.getLeftChild())
trees_val.append(tree.getRootVal)
inorder(tree.getRightChild())
def sort_check(trees_val):
return trees_val==sorted(trees_val)
class Node:
def __init__(self,k, val):
self.key=k
self.val=v... | true |
7ae884fe7cf45454cfdbd1c77f2d11db3b9d7dc7 | Python | diogofbraga/OrphanPrincipalComponentAnalysis | /OPCA/tanimotoKernel.py | UTF-8 | 1,551 | 3.3125 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
def computeTanimotoMatrix_Diff(X1, X2):
"""
calculates tanimoto kernel matrix for two different data matrices X1, X2
(could also be realised via a global data matrix x and different index sets defining X1 and X2)
"""
NUM = np.dot(X1, X2.T)
X1X1T = np.diag(n... | true |
bd882c811fb118565f5b08d6c89cd97c4c172eac | Python | HeeJu9475/pythonPractice | /300-16.py | UTF-8 | 82 | 3 | 3 | [] | no_license | #300-16.py
num_str = "720"
num_str = int(num_str)
print(num_str, type(num_str))
| true |
950f2c3faa1187279031a69cf4ca6fe27c40099e | Python | yetiyeti-prog/practice-python | /practicePython/30_hangman.py | UTF-8 | 2,042 | 3.984375 | 4 | [] | no_license | import random
import sys
MAX_GUESSES = 6
def display_word(copy_word_list, input_list, user_input):
found = False
for i in range(len(copy_word_list)):
if user_input == copy_word_list[i]:
input_list[i] = user_input
found = True
print("".join(input_list))
return found
d... | true |
bcb7578c668af9e4ed7350df044595ed5ef008fd | Python | smart022/QAbot_system | /BusinessLogic/QU.py | UTF-8 | 1,828 | 2.640625 | 3 | [] | no_license | from . import LayerBase
from . import LayerType,BusinessType
import jieba
import jieba.posseg as pseg # 词性标注
class QU(LayerBase.LayerBase):
def __init__(self,config_path):
print('qu__init__')
super().__init__(config_path,LayerType.QU)
self.paddle_mode = False
self.use_rule_match = Tr... | true |
5e18dc7e8eead175a6025e72d472709100dd470e | Python | ming-fung/SavingThePlanet | /Spider/getproxy.py | UTF-8 | 2,779 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Description:
- 爬取免费IP,验证可用性放入csv文件,生成迭代器,没调用一次返回一个IP
author:https://github.com/HANKAIluo
2018.3.18
"""
import sys
import requests, csv
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko... | true |
f8ed75fd89dad6beae4cabc69ca528a6a640e6df | Python | Lithrun/HU-jaar-1 | /Python/Alarm systeem/alarm3.py | UTF-8 | 11,229 | 2.953125 | 3 | [] | no_license | from tkinter import *
from pygame import mixer
import sqlite3
import RPi.GPIO as GPIO
import threading
# SQL
databasename = 'alarm.db'
def isDatabaseConnection(databasename):
try:
connect = sqlite3.connect(databasename)
return True
except:
return False
def startDatabase(databasename): ... | true |
2a084d2a52e3f340da52acd907b54d2fd77fe441 | Python | AresusAsurantes/SGM-relate | /SGM_Genetic.py | UTF-8 | 4,191 | 2.8125 | 3 | [] | no_license | from sko.GA import GA
import numpy as np
import cv2 as cv
import pandas as pd
import matplotlib.pyplot as plt
class SGM_Genetic:
def __init__(self, left, right, GT, size_pop=50, tab="MSE"):
self.count = 1
self.generation = 1
self.left = left
self.right = right
self.GT =... | true |
7ca8e9b37d51d1f8f5ae060bd5d10e7cef87f191 | Python | hyo-eun-kim/algorithm-study | /ch21/misung/ch21_2_misung.py | UTF-8 | 1,173 | 3.65625 | 4 | [] | no_license | # 키에 따른 대기열 재구성
# 여러명의 사람들이 줄을 서있다.
# 각각의 사람은 (h,k) 의 두 정수 쌍을 갖는데, h는 그사람의 키
# k는 앞에 줄 서 있는 사람들 중 자신의 키 이상인 사람들의 수를 뜻한다.
# 이 값이 올바르도록 줄을 재정렬하는 알고리즘을 작성하라.
import heapq
class Solution(object):
def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[i... | true |
d682c2368273505310a31d455eb95aaea2a4449f | Python | andreihaivas6/University | /Numerical Calculus/Homework 8/app.py | UTF-8 | 3,903 | 2.953125 | 3 | [] | no_license | import math
import random
import time
NUMBER_OF_ITERATIONS = 100
EPS = 1e-16
DELTA_LIMIT = int(1e10)
def build_fi_1(f):
def fi(x, h):
return ( 3 * f(x) - 4 * f(x - h) + f(x - 2 * h) ) / (2 * h)
return fi
def build_fi_2(f):
def fi(x, h):
return ( -f(x + 2*h) + 8 * f(x + h) - 8*f(x-h) + f(... | true |
9306966e7b238941f6d37bb82836f0c76661d606 | Python | sfrasica/interviewcake | /fib.py | UTF-8 | 465 | 4.15625 | 4 | [] | no_license | def getNthFib(n):
# Write your code here.
if n == 1:
return 0
elif n == 2:
return 1
else: # 1 right now + 1 right now
return getNthFib(n - 2) + getNthFib(n - 1)
# getNthFib(3 - 2) == 1
# value of this is 0
# getNthFib(3 - 1) == 2
# value of this is 1
# 0 + 1 == 1 which is position n == 3
#... | true |
d02b5592c028845950c2201aad512e6620ae419c | Python | siddharth0801/Command-Line-Calculator | /CLC.py | UTF-8 | 15,840 | 3.671875 | 4 | [] | no_license | # Command Line Calculator
# Dylan Carroll
# Nov 28 2020
#
# A shell-interface for a calculator
import math
NUMBER_CHARS = "1234567890."
OP_CHARS = "=+-/*()%<>!^"
WHITESPACE_CHARS = [",", " ", "\n", "\t", "\v", "\r", ""]
MULTI_OPS = ["--", "++", "-=", "+=", "//", "==", ">=", "<=", "!="]
ALLOWED_UNARY_OPS = ["-", "!... | true |
c4159fcb156f8f5d59d8bc599a2f710cd3787d2d | Python | skuxy/polybar_now_scrobbling | /now_scrobbling.py | UTF-8 | 1,407 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# -*_ coding: utf-8 -*-
import time
import requests
NOTHING = 'Nothing :('
NO_CONNECTION = 'No connection :('
API_KEY = ""
USERNAME = ''
def make_request():
base_url = 'https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks'
parameters = {
'api_key': API_KEY,
... | true |
3b075dc7a4b5b3feaf4c332d1d60d161a0385013 | Python | willbrown600/CS241-OOP-Data_Structures | /Data Structures/ds6.py | UTF-8 | 1,759 | 4 | 4 | [] | no_license | ##############################################
# Team Activity 06, CS241
# Author: Will Brown
# Instructor: Brother N Parrish
#
##############################################
from collections import deque
class Student:
def __init__(self):
self.name = ""
self.course = ""
def... | true |
aee01afcf79246838a40aa654a50e51c2b45aa28 | Python | qinjian623/plib | /python/pjvm/attribute_parser.py | UTF-8 | 3,095 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from vm import instructiones
def parse_attribute_constant_value(info):
return int(info, 16)
def parse_attribute_code(info):
code_attribute = {}
start = 0
max_stack = info[start:start+2*2]
start += 2*2
code_attribute['max_stack'] = int... | true |
9cd24ce23aee716b0b121b09492fa82796bff065 | Python | theskinnycoder/python_crash_course | /7_DataStructures/2_Sets.py | UTF-8 | 1,513 | 3.75 | 4 | [] | no_license | # 7B) SETS : UnOrdered, Mutable, Duplicates-Not-Allowed(By Object, not by value)
my_set = {1, 5.5, 3 + 3j, 1, 'Johnny', 5.5}
print(my_set)
print(len(my_set))
print(type(my_set))
# 7B1) How is it UnOrdered?
# Cz elements can't be accessed by indices, since there isn't any indexing.
# 7B2) Why is it Mutable?
# a) Cz Ad... | true |
60cb98b75717a2526238efa8f52ef86d14657d0f | Python | SaurabhDRao/HackerRank | /jump-clouds-revisit.py | UTF-8 | 237 | 2.875 | 3 | [] | no_license | n, k = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
e = 100
i = 0
while(i < n):
try:
if(c[i] == 1):
e -= 2
i = i + k
except:
e -= 1
break
e -= 1
print(e) | true |
dd9b1989a9396a3c3e92da229b1ed43e60a2b5a7 | Python | yueningbo/python-100days | /day07/string.py | UTF-8 | 749 | 3.578125 | 4 | [] | no_license | def main():
str = "hello, world!"
print(len(str))
print(str.capitalize())
print(str.upper())
print(str.find('or'))
print(str.find('shit'))
print(str.index('or'))
# print(str.index('shit'))
print(str.startswith('he'))
print(str.startswith('He'))
print(str.endswith('ld!')... | true |
c7dd3fe788f15e828188a663d4ea7a5755074475 | Python | rohanrav/bank-churn-rate | /main.py | UTF-8 | 3,517 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
#data processing
import pandas as pd
#pd.set_option('display.max_rows', 100)
#pd.set_option('display.max_columns', 100)
#pd.set_option('display.max_colwidth', 20)
#pd.set_option('display.width', None)
#import the data set
dataset = p... | true |
a59d5de00f17be0d87f57100a46440e2665f160f | Python | brestyck/PytConf | /PyConfClient.pyw | UTF-8 | 1,187 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import socket
import tkinter
tk=tkinter.Tk()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind(('0.0.0.0',5081))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
... | true |
700f6e2cc367b13da2b5040856c7ef9968f5791c | Python | rumilutsch/yummly_codechallenge | /api.py | UTF-8 | 950 | 2.6875 | 3 | [] | no_license | """
3. If you could write an example of a GET and POST API test that validates a JSON response.
The api call can be made up for this exercise.
"""
#GET
import urllib.request
import json
import requests
r = requests.get(url = "http://yummly.co")
print(r.json())
#POST
# modify "recipe name" and "Author name"
"""
{
... | true |
d38bda963fb8d77bb290d86d2eb84f7dea559113 | Python | dishaa19/Searching-for-Novel-Predictive-and-Diagnostic-biomarkers-of-COVID-19 | /Covid-19 (XGBoost).py | UTF-8 | 3,280 | 2.546875 | 3 | [] | no_license |
import pandas as pd
from sklearn.model_selection import GridSearchCV
from xgboost import XGBClassifier
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.preprocessing import MinMaxScaler, StandardScaler
import numpy as np
from ... | true |
1baacb737487784ba4c7bdb01fbb483d26f61100 | Python | izquierdo/kr | /code/pybayes/DataStructures/cfactor.py | UTF-8 | 5,886 | 3.5 | 4 | [] | no_license | #!/usr/bin/python
# This class is << intended >> to be a faster implementation of
# a Factor structure.
import probstat # combinatorics module
class Variable:
" Defines a random variable object "
def __init__(self,domain):
" domain, ordered variable outcomes "
self.data = domain # discrete... | true |
0f93a7472f9defb4f34e2d2bef0cfe4388e94399 | Python | xumuyao/pythonchallenge | /004/004.py | UTF-8 | 1,332 | 2.96875 | 3 | [] | no_license | #!/bin/env python3
# -*- coding:utf-8 -*-
"""http://www.pythonchallenge.com/pc/def/linkedlist.php
谜面是图片链接 http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345
点击之后会有新的url。
网页注释中有提示:urllib may help. DON'T TRY ALL NOTHINGS, since it will never end. 400 times is more than enough.
所以思路是用urllib向图片包含链接发起连续请求,... | true |