blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
79c6f740b08f1e0dc582ec4074396a3daf364951 | adityakuriti/Hands-On-Python | /usrinput.py | UTF-8 | 357 | 3.75 | 4 | [] | no_license |
#Take string type value
inp = input("Enter the value : ")
print("The user input is : ",inp)
print (type(int(inp)))
#Take int type value
inp = int(input("Enter the value : "))
print("The user input is : ",inp)
print (type(int(inp)))
#Available in python2 only
# inp = raw_input("Enter the value : ")
# print("The user ... | true |
56a2a4f3575e12a587f0a314ad5a693921542c7d | sand0val/RGB-LED-Graduation-Cap | /AccelerometerLEDCombo.py | UTF-8 | 16,498 | 2.8125 | 3 | [] | no_license | """Code used by me in the designing of the RGB LED graduation cap. The RGB strip
digital input was plugged in on GPIO 18 using the BCM setting. The math is a bit sporadic
BUT it is tuneable in senstivity. Hat is embedded with a raspberry pi and connected to 24 leds total on 4 led strips. The goal here was to
"""
imp... | true |
0d9f0c227b20591f9c0eeaa2d9ab726dea8b2b8f | andreslopezr/bibliolens | /Conocimiento/js-python json/hello.py | UTF-8 | 1,357 | 2.78125 | 3 | [] | no_license | import sys
import json
titulo, autor, editorial, genero, color, contenido, prioridad = 1, 2, 3, 4, 5, 6, 7 #referencia de index
'''crear busquedas con los argumentos enviado por js'''
sys.argv[titulo]
sys.argv[autor]
sys.argv[genero]
sys.argv[contenido]
'''Con la busqueda recuperar consultas de sql'''
Titulo = "la ... | true |
32c1640a587308c4e001a36ca0a966d9c074f23c | mzllmz/wanju | /common/log/logHandler.py | UTF-8 | 1,355 | 2.640625 | 3 | [] | no_license | # !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/3/12 15:23
# @Author : fanfan
# @File : logHandler.py
# @Project : kaoYanBang
import logging
import time
class time0():
def time1(self):
# 时间戳 路径当中不要有冒号
__t = time.strftime("%Y-%m-%d %H-%M-%S", time.localtime()).split("-")
__t2 = _... | true |
7b5c1825d1b4a9204c399e6ef45f3d01f6dd1f0e | LittleDumbass/meiduo | /meiduo/meiduo/apps/carts/views.py | UTF-8 | 7,810 | 2.625 | 3 | [] | no_license | from django_redis import get_redis_connection
from rest_framework.views import APIView
from rest_framework.response import Response
from carts import constants
from carts import serializers
from goods.models import SKU
from utils import myjson
class CartAddView(APIView):
"""添加购物车视图"""
def perform_authentica... | true |
05fcd1d21e8438f9e968500226c6070275a8d2f7 | jlandman/CSE517A-Application-Project | /milestone_1/model_evaluator.py | UTF-8 | 1,883 | 2.953125 | 3 | [] | no_license | from sklearn import linear_model
import numpy as np
from matplotlib import pyplot
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error, explained_variance_score
with open('../dataset/OnlineNewsPopularity/OnlineNewsPopularity.csv', 'r') as file:
input = file.readlines()
names = input[0]
na... | true |
a1d5fd57d7fb00b4dfa0e04a0886909124c49a38 | gabriellaec/desoft-analise-exercicios | /backup/user_140/ch15_2019_08_29_12_16_08_923560.py | UTF-8 | 107 | 2.703125 | 3 | [] | no_license | def volume_de_pizza (z,a):
import math
volume_de_pizza = (math.pi*z*z*a)
return volume_de_pizza | true |
9afc2bf3319bf935c1ce8dae0e6b8ac625f14ac3 | wzz2019/mystudynote | /homework/pytestwork/test_cal.py | UTF-8 | 1,280 | 3.1875 | 3 | [] | no_license | import yaml
import pytest
import allure
from cal import Calculator
@allure.feature("测试计算器")
@pytest.mark.usefixtures("test_fixture")
@pytest.mark.usefixtures("cal_fixture")
class TestA:
@allure.story("加法")
@pytest.mark.parametrize(["a", "b","c"],
yaml.safe_load(open("./data_cal_add... | true |
0a12a4dbc5b095459bc042643a2832cda0dbf19b | suren9393/django-oscar | /src/oscar/core/decorators.py | UTF-8 | 1,201 | 2.546875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | try:
from types import ClassType
except ImportError:
# Python 3
CHECK_TYPES = (type,)
else:
# Python 2: new and old-style classes
CHECK_TYPES = (type, ClassType)
import warnings
from oscar.utils.deprecation import RemovedInOscar20Warning
def deprecated(obj):
if isinstance(obj, CHECK_TYPES):
... | true |
feacfbe4091f769f9448806fa7b17405dde801b4 | summer-0401/Coding_Test | /Programmers/Level 1/포켓몬.py | UTF-8 | 190 | 2.921875 | 3 | [] | no_license | def solution(nums):
types = len(set(nums))
n = len(nums)//2
return (types if types<n else n)
print(solution([3,3]))
print(solution([3,3,3,2,2,4]))
print(solution([3,3,3,2,2,2])) | true |
5f9ef895714cb6f03955361d8d1f89b72c082c0f | PatrickSampaio/Data-Wranglling-with-Mongo | /Mongo_Agreggation/Brasilia_Tweets/user_mentions.py | UTF-8 | 1,029 | 2.515625 | 3 | [] | no_license | import pdb
def get_db(db_name):
from pymongo import MongoClient
client = MongoClient('localhost:27017')
db = client[db_name]
return db
def make_pipeline():
pipeline = [ ]
pipeline_unwind = {"$unwind": "$entities.user_mentions"}
pipeline_group = {"$group": {"_id": "$user.screen_name", "coun... | true |
08c205d9c0b4cb41ee7af38a8da130fe6cb1fc40 | M-Bab/digicorder-tool | /technisat_digicorder_comm.py | UTF-8 | 13,385 | 2.625 | 3 | [] | no_license | '''
class Technisat Digicorder communication protocoll
'''
import socket
import collections
import sys
import datetime
import time
import os
filmelement = collections.namedtuple('filmelement','name, number, type, seenflag, size, date')
directory = collections.namedtuple('directory','name, unknownint')
filetype = coll... | true |
77c0ed81488c577273ef7c3c1f449fd30658c6fe | OCHA-DAP/gisrestlayer | /importapi/helpers/zip.py | UTF-8 | 1,121 | 2.625 | 3 | [] | no_license | import os
import zipfile
from builtins import str as text
class Unzipper(object):
def __init__(self, filepath):
self.relative_zip_dir = '/zip'
self.filepath = filepath
def unzip(self):
basedir = os.path.dirname(self.filepath)
self.zipdir = basedir + self.relative_zip_dir
... | true |
327436f3c0edc1d541d6b64d79b7d23068546f3a | thepabloaguilar/pablopoly | /kivyTeste.py | UTF-8 | 1,634 | 2.84375 | 3 | [] | no_license | import kivy
kivy.require('1.10.0')
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.progressbar import ProgressBar
boardPositions... | true |
291cbece85ca91694306eb0be7aabdac9d4ffcb7 | VictorQuerecuto/Selekti | /personalized/config.py | UTF-8 | 958 | 2.609375 | 3 | [] | no_license | # import the necessary packages
# We use this import in order to concatenate paths properly.
import os
# initialize the path to the *original* input directory of images
# We will change this to the directory the user chose.
ORIG_INPUT_DATASET = "output"
# initialize the base path to the *new* directory that will cont... | true |
efe8ae39ea370ced1dede2723a39a77b2a25cb78 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2115/60641/296779.py | UTF-8 | 648 | 3.234375 | 3 | [] | no_license | def main():
n = int(input())
for i in range(0, n):
num_of_vertices, num_of_edges = map(int, input().split(" "))
graph = [[0 for a in range(0, num_of_vertices + 1)] for b in range(0, num_of_vertices + 1)]
for j in range(0, num_of_edges):
x, y = map(int, input().split(" "))
... | true |
bd8c83139dbd640d1c2c69f2683ed7535919f9a4 | huangyingw/submissions | /38/38.count-and-say.234345555.Accepted.leetcode.py | UTF-8 | 239 | 3.078125 | 3 | [] | no_license | class Solution(object):
def countAndSay(self, n):
result = '1'
for i in range(n - 1):
result = "".join(str(len(list(group))) + str(digit) for digit, group in itertools.groupby(result))
return result
| true |
729c804cbe1af297b053bbb1e76a5874c4612a06 | Luomiou/stock_review_sentiment_analysis | /stock_review_sentiment_analysis/spider/stock_review_spider.py | UTF-8 | 2,943 | 2.53125 | 3 | [] | no_license | # encoding = utf - 8
from lxml import etree
import pymongo
import requests
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/67.0.3396.79 Safari/537.36'}
# MongoDB的连接
# client = pymongo.MongoClient('***.***.***.***', 27017)
cli... | true |
0e79fbc8e8686fec75ecd032964a9f64fc0513a0 | khvictoryman/user-signup | /main.py | UTF-8 | 3,172 | 2.984375 | 3 | [] | no_license | from flask import Flask, request, render_template
import string
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def display_form():
return render_template('index.html')
@app.route('/', methods=['POST'])
def validate_form():
chosen_username = request.form['username']
password = request.f... | true |
331e1c077331797f4d30725df8c6b175f013d7e5 | hu-guanwei/coding | /first_occur.py | UTF-8 | 818 | 3.65625 | 4 | [] | no_license | class Solution(object):
def first_occur(self, arr, target):
if arr is None or len(arr) == 0:
return -1
l = 0
r = len(arr) - 1
while l < r - 1:
m = (l + r) // 2
if target == arr[m]:
# then arr[m+1, :] cannot be the 1st occ... | true |
82f56cf14c98eef9f03b0b8170388444b560946d | TETRX/WikipediaKeywordsPMML | /src/data_vectorization/vectorizers/word_count_v.py | UTF-8 | 978 | 3.109375 | 3 | [] | no_license | import json
class WordCountVectorizer:
def __init__(self, path_to_corpora_data,word_counter):
self.path_to_corpora_data=path_to_corpora_data
with open(self.path_to_corpora_data,"r") as file:
self.corpora_data=json.load(file)
self.word_counter=word_counter
def vectorize(... | true |
9333a8163ac2dca7c278f616c9029642f841d65b | alexashka/bale-py | /other-try.py | WINDOWS-1251 | 808 | 3.671875 | 4 | [] | no_license | # coding: utf-8
def _all_first_item_to_upper_and_remove_spaces(sentence):
""" ...
Args:
Returns:
"""
#
result_string = ''
space_was = False
for at in sentence:
if at != ' ':
if space_was:
result_string += at.upper()
space_was =... | true |
db8276564e6b1e8568ff67ca4126038ba6d9250b | KavehShoorideh/GrassrootsDonor | /grassrootsdonor/engineer_features.py | UTF-8 | 6,911 | 2.71875 | 3 | [] | no_license | from datetime import datetime
import pandas as pd
from dateutil.parser import parse
from collections import defaultdict
import grassrootsdonor.config as cfg
import os
def engineerFeatures(start_date=None, end_date=None):
""" Engineers features, based on given dates"""
if start_date is None:
start_dat... | true |
82eaff5fb7eec4f091c165eb3e30ea2556888d9a | layacheadeth/quiz | /assign16.py | UTF-8 | 171 | 3.546875 | 4 | [] | no_license | string = str(input("string: "))
def compute_length(string):
z = 0
for i in string:
z += 1
return z
print("length of string: ",compute_length(string))
| true |
8cf65ad35cd04809a0cf216ab8cc134168aed117 | bentheiii/council_py | /council/return_value.py | UTF-8 | 3,178 | 2.734375 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
from abc import abstractmethod
from itertools import chain
from typing import Iterable
from council.council_member import CouncilMember
class MemberAction:
"""
A member action is an object that, when returned by a member, may influence the computation of the council
""... | true |
e0eb69d928214e023e4ee2d94ecfcc8e1f061357 | robingreig/raspi-git | /spidev/spidev_test03.py | UTF-8 | 875 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
import spidev
import time
spi=spidev.SpiDev()
spi.open(0,0)
def readadc(adcnum):
if adcnum > 7 or adcnum< 0:
return -1
r= spi.xfer2([1, 8 + adcnum << 4, 0])
adcout = ((r[1] & 3)<< 8) +r [2]
return adcout
while True:
value0 = readadc(0)
print ("Value0: ",value0)
value1 = ... | true |
ccda30fe63fe5b767f15c6a7c60d504f7edc85a6 | LetianFeng/makeDataset | /src/tools/nt2json.py | UTF-8 | 939 | 2.765625 | 3 | [] | no_license | import os
import json
from rdflib import Graph
# input parameters
file_name = '2017.nt'
n = 259640
# path settings
current_path = os.path.abspath(os.path.dirname(__file__))
data_path = os.path.join(current_path, '../../data')
nt_path = os.path.join(data_path, file_name)
tmp_path = os.path.join(data_path, 'tmp.txt')
j... | true |
b06376b73af40b16f11e60d45b440936ef48b3ca | poonam5248/MachineLearning | /Day21____11-July-2019/3.MQTT.py | UTF-8 | 1,065 | 2.78125 | 3 | [] | no_license | #### Add Another Publisher
# It is a kind of socket programming
import paho.mqtt.client as mqtt
client=mqtt.Client()
def on_connect(client,u,c,rc):
print("Connected Successfully",rc)
# u= user data
# c= client method
# rc= return connect(status - which tell us whether connect or not)
def on_msg(client,u,m):... | true |
53f974c3d3fe3fcc13eaf1a7c3a3a4552ecd9957 | eliseomartelli/pygtt | /pygtt/models.py | UTF-8 | 1,141 | 3.078125 | 3 | [
"MIT"
] | permissive | """Models for pygtt."""
import datetime
import attr
from typing import List
@attr.s(auto_attribs=True, frozen=True)
class BusTime:
"""BusTime object for pygtt."""
time: datetime.datetime
real_time: bool = False
def __lt__(self, other):
"""Compare two BusTime objects."""
return self... | true |
8da52621b6531bb701afab82adb3df44f5584d21 | ManthanKeim/code-attempt1 | /code1/map.py | UTF-8 | 54 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | line = input()
a,b,c,d = tuple(map(int,line.split())) | true |
8c4e1ab9b3316da1cea54e875f966f7f740ca008 | jsalinlee/DojoAssignments | /Python/Python_Fundamentals/Python Algorithms/push_front.py | UTF-8 | 306 | 3.125 | 3 | [] | no_license | def push_front(arr):
arr.append("floople")
print arr
for count in range(len(arr)-1):
print len(arr)
print count
arr[len(arr)-1-count], arr[len(arr)-2-count] = arr[len(arr)-2-count], arr[len(arr)-1-count]
return arr
print push_front([2, 15, "ghad", 382, 39, "woei"])
| true |
0b27c61cc3793dc8b1975544556e0aaf227dfd21 | microsoft/onnxruntime | /onnxruntime/test/python/onnxruntime_test_python_mlops.py | UTF-8 | 9,582 | 2.546875 | 3 | [
"MIT"
] | permissive | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os # noqa: F401
# -*- coding: UTF-8 -*-
import unittest
import numpy as np
from helper import get_name
import onnxruntime as onnxrt
class TestInferenceSession(unittest.TestCase):
def test_zip_map_string_float... | true |
0110ec4be69db032eceb20fa591747edf765e654 | piotrwinkler/chameleon | /image_colorization/cielab_research.py | UTF-8 | 2,749 | 3.078125 | 3 | [] | no_license | """
https://pl.wikipedia.org/wiki/CIELab
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from skimage import io, color
img_path = 'datasets/samolot_mini_mini.jpg'
"""
Tak długo aż używamy tego samego formatu Lab do kodowania i dekodowania to wszystko powinno być w p... | true |
693b7812d05a693e05999a6dfa7865980a0c4295 | BabitsPaul/pythonplayground | /ai/hello_world_genetic.py | UTF-8 | 1,487 | 3.265625 | 3 | [] | no_license | from random import choice, random
from string import printable
mutate_prob = 0.1
population_size = 10
drop_last = .75
generations = 1000
def rnd_str(len):
return ''.join(choice(printable) for i in range(0, len))
def genetic_algo(n, cost, mate, mutate, restrict):
population = sorted([rnd_str(n) for i in ran... | true |
fa05f9f589a0bb6a0c4de43b365fae151c9554a9 | danielleasavage/SudoFood | /application/forms.py | UTF-8 | 3,438 | 2.796875 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, \
DateField, IntegerField, SelectField, TextAreaField
from wtforms.validators import DataRequired, ValidationError, Email, EqualTo, \
Length
from application.models import User
class LoginForm(FlaskForm)... | true |
361ed69f9ced8af9d62fb72b7fb60cc939f04d18 | hardy-pham/Algorithms | /happy_number.py | UTF-8 | 1,298 | 4.5 | 4 | [] | no_license | """
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process:
Starting with any positive integer, replace the number by the tot of the squares of its digits, and repeat the process
until the number equals 1 (where it will stay), or it loops endlessly in a cyc... | true |
28862e82915b0f620aa1329a907c0b582b08a1fe | LIYIHUANna/LIYIHUANna.github.io | /信号波形与频谱/练习5.py | UTF-8 | 950 | 2.6875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from thinkdsp import Chirp
from thinkdsp import normalize, unbias
from thinkdsp import decorate
from thinkdsp import read_wave
PI2 = 2 * np.pi
class TromboneGliss(Chirp):
def evaluate(self, ts):
l1, l2 = 1.0 / self.start, 1.0 / self.end
... | true |
f0e3c4ca0a22e6e304efaa94dce7e4b3af0b0d8f | AigerimNaubetzhanova/team_1 | /pygame try.py | UTF-8 | 514 | 2.796875 | 3 | [] | no_license | import pygame
pygame.init()
size=(900,500)
screen=pygame.display.set_mode(size)
clock=pygame.time.Clock()
done=False
fps=100
black=(0,0,0)
white=(255,255,255)
yellow=(255,255,0)
grey=(192,192,192)
red=(200,0,0)
graphcolor=yellow
gridcolor=grey
screen.fill(white)
font=pygame.font.SysFont('arial',14) #шрифт и размер т... | true |
cc9d198c20a09e18911dd73d39946e21ab54e8b1 | yamauchih/ifgi-path-tracer | /ifgi/base/enum.py | UTF-8 | 402 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
#
# Copyright (C) 2010-2011 Yamauchi, Hitoshi
#
#
class Enum(list):
"""Enum emulation class.
This is a list. set is more efficient, but it does not keep the
initialization order."""
def __getattr__(self, _name):
if _name in self:
return _name
raise Attri... | true |
c1bf4a5deecfe03f7906186c9071d190c559cf92 | ClearCorp/odootools | /users_export/users_export/export/csv.py | UTF-8 | 316 | 3.140625 | 3 | [] | no_license | import csv
def writefile(filename, header, data):
with open(filename, 'w') as csvfile:
filewriter = csv.writer(
csvfile, delimiter=',', quotechar='"',
quoting=csv.QUOTE_MINIMAL)
filewriter.writerow(header)
for line in data:
filewriter.writerow(line)
| true |
2aee6105d307ab412da1518b1733bfa0204716d0 | malford/mrbucket | /mrbucket.py | UTF-8 | 2,305 | 2.984375 | 3 | [] | no_license | #! /usr/bin/env python
# right now this script reports usage of an s3 bucket in gigs
# import some modules
import boto, os, argparse, sys
from hurry.filesize import size, verbose
from datetime import datetime
# setup argparse
parser = argparse.ArgumentParser(description='Mrbucket is a script to output S3 usage. It\'s... | true |
ace3eaaa1da93c68ea52c188fc125bb6b8cf8dd8 | yusoojeong/code | /2020/BJ_IM/2559.py | UTF-8 | 213 | 2.875 | 3 | [] | no_license | N, K = map(int, input().split())
day = list(map(int, input().split()))
max = -987654321
sum_day = 0
for i in range(N-K+1):
sum_day = sum(day[i:i+K])
if sum_day > max:
max = sum_day
print(max) | true |
97e69472ddb1f1fdcac275ace97aa2b7b397b783 | freyzor/efficacy | /mathutil.py | UTF-8 | 325 | 3.296875 | 3 | [
"MIT"
] | permissive |
def clamp(value, min_value=0.0, max_value=1.0):
if value < min_value:
return min_value
if value > max_value:
return max_value
return value
def normalize_value(value, min_value, max_value):
value = clamp(value, min_value, max_value)
return (value - min_value) / (max_value - min_va... | true |
67d2866207666adebc368f805e0debdb5432ac94 | janinewhite/sqlalchemy-challenge | /.ipynb_checkpoints/app-checkpoint.py | UTF-8 | 6,023 | 2.765625 | 3 | [] | no_license | # Dependencies
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, inspect, func, desc, select
from flask import Flask,jsonify
# Database Setup
engine = create_engine("sqlite:///Instructions/Resources/hawaii.sq... | true |
0e8a22e60de897a29c4bc8ecdcdc217bb95d3850 | johnlahut/python-heapsort | /heap.py | UTF-8 | 2,890 | 4.21875 | 4 | [] | no_license | """
:author:
John Lahut
:description:
Implements a max-heap as per described in Cormen et. al
"""
from copy import deepcopy
class Heap:
"""
Represents a heap data structure with the appropriate methods
"""
def __init__(self, arr: list):
"""
Constructs a heap given an array
... | true |
584c68833757d30e794278807a9d50db963f22b8 | n0bode/APIIUI | /model/product.py | UTF-8 | 273 | 2.96875 | 3 | [] | no_license | import json
class Product:
def __init__(self, id, name, categoryID, price, stock):
self.id = id
self.name = name
self.categoryID = categoryID
self.price = price
self.stock = stock
def toJson(self):
arr = json.dumps(self.__dict__)
print(arr)
return arr | true |
6997219164a450345cb899d0cb74009363379754 | krnets/codewars-practice | /6kyu/can you guess what it is/index.py | UTF-8 | 734 | 3.78125 | 4 | [] | no_license | # 6kyu - can you guess what it is ?
""" You've just entered a programming contest and have a chance to win a million dollars.
This is the last question you have to solve, so your victory (and your vacation) depend on it.
Can you guess the function just by looking at the test cases?
There are two numerical inputs an... | true |
03696b394e72a5064a11699b6cada0f29b9009db | entrekid/daily_algorithm | /2020/0411/2606.py | UTF-8 | 448 | 3 | 3 | [] | no_license | import sys
input = sys.stdin.readline
N = int(input())
connect = int(input())
graph = [[] for _ in range(N)]
for _ in range(connect):
a, b = map(int, input().split())
a -= 1
b -= 1
graph[a].append(b)
graph[b].append(a)
check = [False] * N
def dfs(start):
check[start] = True
for elem in grap... | true |
9ae56c8a0e20426f94a62683d0bc3f701d20c00d | Divij-berry14/Python-with-Data-Structures | /Exception_Handling.py | UTF-8 | 1,489 | 3.40625 | 3 | [] | no_license | #class ZeroDenominatorError(ZeroDivisionError):
# pass
#while True:
# try:
# n = input('Enter the numerator :')
# num = int(n)
# n = input('Enter the denominator :')
# denom = int(n)
# if denom == 0:
# raise ZeroDenominatorError('Denominator should not be zero')
# value = num/denom
# except ValueError:
# print... | true |
a9b1146e2216a5fe75a02978eac9092fd32bac0a | KedoKudo/xproc | /tomoproc/util/peakfitting.py | UTF-8 | 6,231 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usefule functions for peak fitting
"""
import numpy as np
import scipy as sp
from typing import Tuple
from scipy.special import wofz
from scipy.optimize import curve_fit
from lmfit.models import VoigtModel
def gauss1d(x:... | true |
b3eab4cbfc26a3a9155cd67af104dae5a37927fd | curdog4/crispy-octo-hockeypuck | /weather_conditions.py | UTF-8 | 4,234 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
import os, sys
import urllib2
import time
import logging
import json
import ConfigParser
from string import Template
from argparse import ArgumentParser
cfgParser = ConfigParser.ConfigParser()
parser = ArgumentParser(description='Communicate with the WeatherUnderground API')
parser.add_argument... | true |
55fc3b144cdb73eaed04edf57d91afe3f40b6073 | saper0/StatML | /ex1_kNN_binary.py | UTF-8 | 3,873 | 3.28125 | 3 | [] | no_license | #######################################################################
# Author: Lukas Gosch
# Date: 14.10.2018
# Description: Implementation of a k-NN algorithm.
#######################################################################
import sys
import argparse
import numpy as np
import matplotlib.pyplot as plt
def ... | true |
747377494f75a5dced1efd194ed535470349782d | RobertIBM/TASLP-EAREE | /AI_RC/util/porgress_util.py | UTF-8 | 1,470 | 3.515625 | 4 | [
"CC-BY-NC-4.0",
"Apache-2.0"
] | permissive | """进度条"""
import sys
class ProgressBar(object):
"""
显示处理进度的类
调用该类相关函数即可实现处理进度的显示
"""
# 初始化函数,需要知道总共的处理次数
def __init__(self, epoch_size, batch_size, max_arrow=80):
self.epoch_size = epoch_size
self.batch_size = batch_size
self.max_steps = round(epoch_size/batch_size) ... | true |
e5bf7faa40717cc9f25999144eb68e058d19aa97 | chelseashin/AlgorithmStudy2021 | /chelseashin/Programmers/08_DFS&BFS/단어변환.py | UTF-8 | 1,408 | 3.640625 | 4 | [] | no_license | # 19:00 start
# 20:20 finish
# 50분 소요,, 혼자 고민하다가 다른 사람 풀이 보고 품
# dfs로 접근
# (시작 단어, 비교 단어, 단어의 길이)를 인자로 넣으면 두 단어의 다른 알파벳 갯수 리턴
def isDifferent(x, y, L):
temp = 0
for i in range(L):
if y[i] != x[i]:
temp += 1
if temp > 1: # 2개 이상 다르면 그냥 2 리턴
return temp
retu... | true |
84ab6d2d2fb7b560e1b7127a0a8b77523b7dd573 | ejandre/Final-Project | /calculations.py | UTF-8 | 1,641 | 2.671875 | 3 | [] | no_license | import json
import requests
import spotipy
import os
import sqlite3
import spotipy.util as util
import lyricsgenius
from spotipy.oauth2 import SpotifyClientCredentials
#import matplotlib.pyplot as plt
def set_connection(db_file):
try:
path = os.path.dirname(os.path.abspath(__file__))
conn = sqlite... | true |
0d001280567149cd32533882edefe582225b6db5 | csmaterial/helpOther | /combineData.py | UTF-8 | 10,744 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 6 08:36:16 2018
@author: chenc
"""
import numpy as np
import pandas as pd
from datetime import datetime
import math
import warnings
warnings.filterwarnings("ignore")
#取出日期区间内的数据
def getIndex(datatemp,startyear,startmonth,endyear,endmonth):
... | true |
ba66de7482ee0ca0f0b46cb1b27bb9682630cc3f | shivapk/Programming-Leetcode | /Python/Trees/check2BTareIdentical.py | UTF-8 | 949 | 3.9375 | 4 | [] | no_license | #Complexity of the identicalTree() will be according to the tree with lesser number of nodes. Let number of nodes in two trees be m and n then complexity of sameTree() is O(m) where m < n
'''
Given two trees, find if they are identical.
Two trees are said to be identical if they are structurally same and have same dat... | true |
79d0334a68fc0808e0e14036ced81785a658b5a6 | HuangJi/bitquant | /web/home/ipython/examples/pairplots.py | UTF-8 | 5,453 | 2.859375 | 3 | [
"BSD-2-Clause"
] | permissive |
# coding: utf-8
# Read in stock data
# ----
# In[ ]:
get_ipython().magic('matplotlib inline')
from pandas import *
import pandas_datareader.data as web
import scipy
def get_data(stock, start):
stock = web.DataReader(stock, 'yahoo', start)
stock['Daily Ret'] = scipy.log(stock['Close']/stock['Close'].shift(... | true |
74df7f07bc42482927dc96c93498fc589f746378 | RitvikDayal/FTH-Task-MemberActivity | /webapp/views.py | UTF-8 | 1,317 | 2.578125 | 3 | [] | no_license | from .models import Member
from .serializers import MemberSerializer
from rest_framework.decorators import api_view
from rest_framework.response import Response
@api_view(['GET'])
def home(request):
api_urls = {
'List': '/activity-logs/',
'Member Activity Log': '/member-activity/<int:pk>/',
... | true |
cefa86c07924bde2da3de0391825e321eb749f27 | math-nerd/pfe-sched | /move_sol2.py | UTF-8 | 2,725 | 2.546875 | 3 | [] | no_license | import random
import copy
from product import product
from jssp_instance import instance
from solution import solution
def get_prod_before(p, order_p, indice_p):
p2_pos = order_p[p] - 1
p2_indice = order_p.index(p2_pos) # indice du produit traité avant
p2_lot_index = indice_p[p2_indice] #indice du premier ... | true |
fa7743b2468e45e7f7a51fa88f719e3e826ea306 | Ved005/project-euler-solutions | /code/productsum_numbers/sol_88.py | UTF-8 | 1,338 | 4.0625 | 4 | [
"Apache-2.0"
] | permissive |
# -*- coding: utf-8 -*-
'''
File name: code\productsum_numbers\sol_88.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #88 :: Product-sum numbers
#
# For more information see:
# https://projecteuler.net/problem=88
# Problem Statement
'''... | true |
379dba8930332bf5e1388bd23590d622c4f0b319 | dnquang1996vn/robotic | /robot/client.py | UTF-8 | 2,200 | 2.671875 | 3 | [] | no_license | import sys
# addr ev3dev
# name 00:17:E9:F8:72:06
import bluetooth
import requests
from socketIO_client import SocketIO
serverMACAddress = 'A0:E6:F8:16:31:59'
url = 'http://localhost:3000'
port = 3
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
s.connect((serverMACAddress, port))
currentPos = 5
currentAction = 0
ma... | true |
000552ae07a600a7864ddc9f9baccae59c120b1b | jdburge/NN | /CS760Hw3/Driver.py | UTF-8 | 1,081 | 2.8125 | 3 | [] | no_license | from scipy.io import arff
from collections import defaultdict, Counter, OrderedDict
import numpy as np
import NN
data, meta = arff.loadarff('sonar.arff')
np.random.shuffle(data)
size = len(data)
data_sets = dict()
train_sets = dict()
for i in range(10):
data_sets[i] = []
train_sets[i] = []
i... | true |
69827e9e65fb7612c2e148c25e99de681cac891a | abhilashgcp/python-programs | /Dynamic_Programming/Nth_Fibanocci_Memoized/Nth_Fibanocci_Memoization.py | UTF-8 | 428 | 3.6875 | 4 | [] | no_license | # Memoization Steps:
# 1. Pass a hash to the function call and initialize to empty hash
# 2. Check vaule is there in memo the return that
# 3. Pass the memo in the function call
# 4. Save the computed value in memo
def fib(n, memo={}):
if n in memo.keys():
return memo[n]
if (n<=2):
return 1
... | true |
af8d7389acdb881bda5a3226e26f48bc190debb8 | Dmdv/SystemUtils | /ConsoleHelper.py | UTF-8 | 84 | 2.59375 | 3 | [] | no_license | __author__ = 'Dyachkov'
def prompt(prompt):
return input(prompt).strip()
| true |
37f33b1ed5297d2c03f28e1c20b3dbe0d703c1f3 | johmy592/thesis_data_prep | /scripts/make_term_vocab.py | UTF-8 | 1,134 | 3.375 | 3 | [] | no_license | import sys
from openpyxl import load_workbook
def keep_lower_only(terms):
return list(set([t.lower() for t in terms]))
def keep_up_to_trigram(terms):
return [t for t in terms if len(t.split()) < 4]
def write_terms_only(terms_list, write_filename):
wf = open(write_filename,'w+')
for w in terms_list:
... | true |
ce3565d2015476dcf31f960bc5709b4b4d089d82 | MY-LEMON/Covid-19-Pro | /backend_flask/DataCenter.py | UTF-8 | 8,559 | 2.6875 | 3 | [] | no_license | import requests
import json
import pandas as pd
import time
import os
class GetDataApi:
def __init__(self):
self.url = "https://lab.isaaclin.cn/nCoV/" # 原网址
self.url_area = 'api/area?latest=1'
self.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKi... | true |
cdf67cbe6f769ac39a4ca5d89016fbc80e0f8e0a | juliannbooth/Statistical-Models | /lab3.py | UTF-8 | 1,607 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 11:53:48 2015
@author: jbooth
"""
import pandas as pd
import numpy as np
import statsmodels.api as sm
#Use "header = None" to prevent the first row being used as the column names
data = pd.read_csv('http://faculty.tarleton.edu/crawford/documents/math505/L... | true |
c4f2f0cf458fc14765ecb036d400ebfefc07721e | Nachtalb/python_book_exercises | /book/kap_23/shop/shop.py | UTF-8 | 3,134 | 3.34375 | 3 | [] | no_license | #! c:\python23\python.exe #1
# ----------------------------------------------------
# Dateiname: shop.py
# CGI-Skript, das Teil eines online-Shops ist.
# Folgende Variablen eines HTML-Formulars werden verarbeitet:
# email: E-Mail-Adresse des Kunden
# artikel: Liste der ausgewaehlten Art... | true |
1ac0572545ec43c55c2a64c26817ab2a6f5fd8db | hiepnguyen034/Toxic-Comments-Classifer | /Classifier.py | UTF-8 | 2,884 | 2.84375 | 3 | [] | no_license |
import pandas as pd
import matplotlib as plt
import numpy as np
import seaborn as sb
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import GaussianNB
from sklearn import svm
from skl... | true |
596b53aa90bfd9e4d745cf1b8865fd0bed438b22 | rohangrge/covid_vaccine_bot | /redis_feed_cities.py | UTF-8 | 1,118 | 2.75 | 3 | [] | no_license | import requests
import json
import redis
r = redis.Redis('192.168.0.133')
states = ['Andaman and Nicobar Islands', 'Andhra Pradesh', 'Arunachal Pradesh', 'Assam', 'Bihar', 'Chandigarh', 'Chhattisgarh', 'Dadra and Nagar Haveli', 'Daman and Diu', 'Delhi', 'Goa', 'Gujarat', 'Haryana', 'Himachal Pradesh', 'Jammu and Ka... | true |
584bdb477afde5c185718fb2d320cbeeac2c21fd | byq-luo/Car_counter | /cvmath.py | UTF-8 | 743 | 3.46875 | 3 | [] | no_license | #Math
class dot:
def __init__(self,x,y):
self.x = x
self.y = y
def __str__(self):
return "("+str(self.x)+","+str(self.y)+")"
class line:
def __init__(self,p0,p1):
self.p0 = p0
self.p1 = p1
self.A = p1.x - p0.x
self.B = p1.y - p0.y
self.C... | true |
81aecd07005a0b27de45a4a7860ec5b418f8c4ba | Manuel-Argueta/CS119-Python | /CS119 PJ-5/CS119_PJ_5.py | UTF-8 | 7,869 | 4.53125 | 5 | [] | no_license | #=================================================================================
#Author: Manuel Argueta
#Date:10/06/20
#Purpose: The following program checks a password inputed by the user and prints all the violations of this password if any.
#MAIN Program=====================================================
n=1 #... | true |
9e8279903222049b0a1a950ab275b5a037add191 | fake-name/EORE | /Code/System-1/test.py | UTF-8 | 1,451 | 2.609375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
# Pylint cannot determine contents of multiprocessing.Manager, so turn off the warning.
# pylint: disable=E1101
import multiprocessing as mp
import threading
import time
import signal
import sys
import errno
def interruptibleSleep(duration):
'''
unfortunately, `time.sleep()` catches SIG... | true |
28eff7ad0545bfe9b06a7b0896e3e604ada5e109 | h3tch/pxt | /pxt/cpp.py | UTF-8 | 4,004 | 2.515625 | 3 | [
"MIT"
] | permissive | import ctypes
import inspect
import typing
import numpy as np
# Map python types to C types.
py2ctype = {
bool: ctypes.c_bool,
int: ctypes.c_longlong,
float: ctypes.c_double,
str: ctypes.c_char_p,
tuple: ctypes.py_object,
list: ctypes.py_object,
dict: ctypes.py_object,
object: ctypes.... | true |
4e3503bb6874d1e791e54cd397e5ecb044e8b66d | rohit645/learning_pygame_and_opengl | /displayimage.py | UTF-8 | 544 | 3.390625 | 3 | [] | no_license | def car(x,y):
gdisplay.blit(img,(x,y))
import pygame
pygame.init()
d_width=800
d_height=600
black=(0,0,0)
white=(255,255,255)
red=(255,0,0)
gdisplay=pygame.display.set_mode((d_width,d_height))
pygame.display.set_caption("Let's Race")
clock = pygame.time.Clock()
img=pygame.image.load('img.png')
x=(d_width*0.45)
y... | true |
ae7593eddcfb19ee03e6f13d80ff1e3e222d161f | Sacheiin/email_python | /email_sender.py | UTF-8 | 520 | 2.578125 | 3 | [] | no_license | import smtplib
from email.message import EmailMessage
from string import Template
from pathlib import Path
html = Template(Path('index.html').read_text())
email = EmailMessage()
email['from'] = 'Curious man'
email['to'] = 'sacheein1999@gmail.com'
email['subject'] = 'You won a $1,000,000!'
email.set_content(html.subst... | true |
a756445528e1f493c6398f7aad9032040819874e | boyinggong/twitter_project | /data_follow.py | UTF-8 | 3,172 | 2.53125 | 3 | [] | no_license | import json
import twitter
import csv
from time import sleep
import sys
import global_vars
FOLLOWING_DIR = global_vars.OUTPUT_DATA_DIR + "/following/"
FOLLOWER_DIR = global_vars.OUTPUT_DATA_DIR + "/followers/"
CONSUMER_KEY = "LMO6LXCAjzqF0DwO44YNX5PaY"
CONSUMER_SECRET = "TjmAEUqteMieEAIYVO9VtINBbiNYAHqJr6aEJ... | true |
5731fa951f6d568e380ef4513ff185d42f1aa03c | psul26/DPA_C | /Crypto Extra/Sol/svn_codes/sauvage_BS12bit/traces_database.py | UTF-8 | 5,185 | 2.703125 | 3 | [] | no_license | # traces_database.py allows to access a PostGreSQL database through either the
# PgSQL or pgdb libraries and retrieve side-channel traces from such database.
# Copyright (C) 2008 Florent Flament (florent.flament@telecom-paristech.fr)
# Copyright (C) 2009 Laurent SAUVAGE (laurent.sauvage@telecom-paristech.fr)
#
# This p... | true |
ffa85842f2260d83c6a3d72589af1c63a2da1788 | ygma/INTRO_TO_COMPUTERS_INTERNET_THE_WEB | /assignment_2/12_factors.py | UTF-8 | 156 | 3.6875 | 4 | [] | no_license | def cal_factors(n):
result = []
for i in range(1, n + 1):
if n % i == 0: result.append(i)
return result
print(cal_factors(10)) | true |
a5252fc3159e5e699f8cb81eb5cba139a769013c | freesan44/LeetCode | /LeetCode_88.py | UTF-8 | 541 | 3.34375 | 3 | [] | no_license | class Solution:
def merge(self, nums1: [int], m: int, nums2: [int], n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
for i in range(len(nums1)-m):
nums1.pop()
for j in range(n):
nums1.append(nums2[j])
nums1.sort()... | true |
0922812b1e6bfd39c8bb715d0f5a002075421eec | eronekogin/leetcode | /2020/magical_string.py | UTF-8 | 397 | 3.921875 | 4 | [] | no_license | """
https://leetcode.com/problems/magical-string/
"""
class Solution:
def magicalString(self, n: int) -> int:
s = [1, 2, 2]
rtIdx = 2 # Index to indicate how many times to repeat.
while len(s) < n:
s += [3 - s[-1]] * s[rtIdx]
rtIdx += 1 # Advance to the next repea... | true |
bf6f6b0f8f02105a7efd37e7e7e867b115d9d450 | amfei/Cracking-the-coding-interview-in-Python-master | /Ch2. Linked-Lists/Ch2-7 return Intersection node.py | UTF-8 | 856 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import unittest
def intersection(head1, head2):
A = {}
while head1:
A[head1] = 1
head1= head1.next
while head2:
if head2 in A:
return head2
head2 = head2.next
return None
class Node():
def __init__(self, data, next=None):
... | true |
2ae35d386d075e7e72c890425934177efbe498f1 | cosmologist10/Tail-call-optimization-and-memoization-in-Python | /fibo_tre.py | UTF-8 | 711 | 3.65625 | 4 | [] | no_license | import time
from tco import *
def stacktracker(f):
""" Wrapper for call stack count """
calls = {'count': 0}
def wrapper(*args):
calls['count'] += 1
print 'Call count =>', calls['count']
result = f(*args)
return result
return wrapper
@stacktracker
def fibonacci_tre... | true |
4905b27958004c449c3fe46bca74c5661fd28105 | yutiansut/PyPortfolioOpt | /pypfopt/black_litterman.py | UTF-8 | 19,441 | 3.21875 | 3 | [
"MIT"
] | permissive | """
The ``black_litterman`` module houses the BlackLittermanModel class, which
generates posterior estimates of expected returns given a prior estimate and user-supplied
views. In addition, two utility functions are defined, which calculate:
- market-implied prior estimate of returns
- market-implied risk-aversion par... | true |
108ec8ddfba54b7a9483ae10415fcd36a2a54ffb | DominicAntonacci/pyinstaller_bokeh_example | /run_all.py | UTF-8 | 2,416 | 3.203125 | 3 | [] | no_license | """
The Python script that starts all the processes.
This starts a data publishing function defined in data_publisher.py and
a bokehplotting function in bokeh_plotter.py. The two processes communicate
using a multiprocessing Connection object. This avoids the hassle of
trying to pass a Queue into the code that kicks ... | true |
a9ffab6f36f28c50733d289d44c6ca687ab342b9 | aweller/tsb_projects | /wtc_quasar_analysis/scripts/quasar_coverage_analysis.py | UTF-8 | 3,421 | 2.78125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import seaborn as sns
header_names = ["sample", "amplicon", "gene", "gc","depth","fwd_reads","rev_reads"]
df = pd.read_csv("C:\Users\wellera\\bioinfo\wt_validation\quasar\quasar_coverage_analysis\quasar_coverage.txt", sep = "\t", header = None, names = header_names)
#####... | true |
308bae1200db5a3a159c81eb41a894e87c6e6761 | sankleta/alfred-bot | /bot.py | UTF-8 | 2,365 | 2.921875 | 3 | [] | no_license | from message import Message
import re
class Bot:
private_response = "I'm adding a card with the title '%s' into list Develop DO and add you as a member."
public_response = "Please write me a direct message to add a task on the Trello board."
no_access_response = "Sorry, I'm not allowed to help you. Please... | true |
0627962ba38979de672a9afa29ffea5cb5c3df77 | sr-utkarsh/python-TWoC-TwoWaits | /day_5/third.py | UTF-8 | 302 | 3.5625 | 4 | [] | no_license | n=int(input("Enter the no. of houses: "))
lst=[]
print("Enter the value of the houses ")
for i in range (n):
ele=int(input())
lst.append(ele)
x=lst[0]
if(n==1):
print(x)
y=max(lst[0],lst[1])
if(n==2):
print(y)
m=None
for i in range (2,n):
m=max(lst[i]+x,y)
x=y
y=m
print(m)
| true |
637d8488ec7b36b25ee0cbcd0431cb8dd698ddee | Paulo-Jorge-PM/text-ide-kivy | /app/build/lib/databases/tries.py | UTF-8 | 446 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import marisa_trie
class Trie:
def __init__(self, db_list):
self.trie = marisa_trie.Trie(self.make_list(db_list))
def make_list(self, cursor):
words_list = []
for word in cursor:
words_list.append(word[0].lower())
retur... | true |
4f5d2ab3888858b53eee23e572ac8e3b7a17ce4e | duartegroup/autodE | /autode/atoms.py | UTF-8 | 46,007 | 3.4375 | 3 | [
"MIT"
] | permissive | import numpy as np
from copy import deepcopy
from typing import Union, Optional, List, Sequence, Any
from autode.log import logger
from autode.geom import get_rot_mat_euler
from autode.values import (
Distance,
Angle,
Mass,
Coordinate,
Coordinates,
MomentOfInertia,
)
class Atom:
def __init... | true |
c20ae31431e0af9a041c7d7b5ba5cb1572f617c7 | james4388/algorithm-1 | /algorithms/google/SentenceScreenFitting.py | UTF-8 | 637 | 3.375 | 3 | [] | no_license |
# Sentence screen fitting
# https://leetcode.com/problems/sentence-screen-fitting
# Concat all word list to one sentence, everytime find character of ending
# if not empty space, reduce it to space position
class SentenceSolution:
def wordsTyping(self, sentence, rows, cols):
"""
:type sentence: Li... | true |
abc126fd07c15ea92863c5e809b7c08d6dc63b72 | realdigit/Selenium_FlaskWebsite | /FlaskWebsite.py | UTF-8 | 916 | 2.75 | 3 | [] | no_license | from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
return '''<h1>主页</h1>
<a href="/login">登录</a>'''
@app.route('/login', methods=['GET'])
def signin_form():
return '''<form action="/loginstatus" method="post">
<p>用户... | true |
737a1fbd6ac861acbb58b98ee90adac3de92a3ff | marobo/notas | /topic/iteration/iteration.py | UTF-8 | 9,685 | 4.8125 | 5 | [] | no_license | # Iteration
A piece of code that loops.
## `while` loops
A while loop takes a condition and continues to loop if that condition returns `True`.
>>> x = 0
>>> while x < 5:
....: x = x + 1
....: print x
1
2
3
4
## !!! INFINITE LOOPS !!!!
An infinite loop will iterate forever and... | true |
ca0fe8e223b922980e76f5958386c460429a3099 | baah-romero/aprende-python | /ejercicios/2-estr-secuen-y-basicos/notaMedia.py | UTF-8 | 300 | 4 | 4 | [] | no_license | #Nota media
n1 = float(input('Introducir nota 1ª trimestre: '))
n2 = float(input('Introducir nota 2º trimestre: '))
n3 = float(input('Introducir nota 3er trimestre: '))
p = (n1 + n2 +n3) / 3
print('\n------------RESULTADO-----------')
print('La nota media final del curso es: ', round(p,1))
| true |
f62955f57c775e0e244a84c0bbdb501d4e061c6f | guillermorodriguez/tf-idf | /kmeans.py | UTF-8 | 2,442 | 3.28125 | 3 | [] | no_license | """
@Author: Guillermo Rodriguez
@Created: 10.17.2018
@Purpose: k-means clustering class
"""
import pandas as pd
import numpy as np
import operator
import copy
class kmeans():
def __init__(self, x, y, k):
np.random.seed(100)
self.data = pd.DataFrame({
... | true |
213fffe5ebeb533da6ac1e1836a3a64c262237f7 | hgt927/code | /train.py | UTF-8 | 2,471 | 3.09375 | 3 | [] | no_license | import numpy as np
from sklearn import *
import matplotlib.pyplot as plt
from sklearn.model_selection import cross_val_score
from sklearn.naive_bayes import GaussianNB
def load_data(path, num):
labels = np.zeros((num))
data = np.zeros((num, 100))
with open(path, 'r') as f:
for i, line in enumerate... | true |
285fde461dffdd4121684c72ade23c93037d639b | amitt001/cs-review | /ds/linkedlist/palindrom_ll_in_place.py | UTF-8 | 1,084 | 4.0625 | 4 | [] | no_license | """
Given a singly linked list, determine if it is a palindrome.
Example 1:
Input: 1->2
Output: false
Example 2:
Input: 1->2->2->1
Output: true
O(n), O(1) space
"""
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
... | true |
38f5f7764012ad6a48bc1f58fa0f676392657bcf | luoguoling/spider | /url3.py | UTF-8 | 309 | 2.53125 | 3 | [] | no_license | import chardet,urllib
url = "http://www.163.com"
content = urllib.urlopen(url).read()
print chardet.detect(content)
def automatic_detect(url):
content = urllib.urlopen(url).read()
result = chardet.detect(content)
encoding = result['encoding']
return encoding
a = automatic_detect(url)
print a
| true |
f04dfdea926aa4b775ec0e8dc90d987da40190f9 | wysocki-lukasz/CODEME-homework | /02_Zmienne i typy/2_Zadanie_5.py | UTF-8 | 119 | 3.5625 | 4 | [] | no_license | #Czy 43 - 13 będzie się równać 11 + 12 ?
print(f'Czy 43 - 13 będzie się równać 11 + 12 ? -> {43-13 == 11+12}') | true |