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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14fad70791ce687a77bfae8aee441285e1a5b68c | Python | esddse/leetcode | /medium/279_perfect_squares.py | UTF-8 | 231 | 2.984375 | 3 | [] | no_license | import math
class Solution:
def numSquares(self, n: int) -> int:
dp = [0] * (n+1)
for i in range(1, n+1):
dp[i] = min([dp[i-j*j] for j in range(1, math.floor(i**0.5)+1)])+1
return dp[n] | true |
e2d79be05164b615059a53230acfde8769aac2a6 | Python | manojtummala/padishah | /scheduler.py | UTF-8 | 1,320 | 2.984375 | 3 | [] | no_license | import threading
# queue to hold waitlist, take to element to run
waitlist_queue = None
# running status
is_running = None
picked_item = None
waitlist_queue_lock = None
def init():
global waitlist_queue
# running status
global is_running
global picked_item
global waitlist_queue_lock
waitlist_q... | true |
3eab248c7c83b23c129f2b57ce24a807b758a6da | Python | mariogarcc/comphy | /package/deprox.py | UTF-8 | 1,242 | 3.265625 | 3 | [
"CC0-1.0"
] | permissive | import re
# import numpy as np
# Q: why not just round?
# A: rounding e.g. 1.2345670000004 with a fixed "tolerance" of 4 gives 1.2346
# instead of 1.234567.
def deprox_num(num, tol = 4, offset = 0):
"""
"""
numstr = '{:.24f}'.format(num) if num > 1e-24 else str(num)
tol = int(tol)
ov = int(offs... | true |
fb16640791e7df4891a96078b02a3a98f0134a2b | Python | edaral3/SO1-Proyecto1 | /Cliente/Cliente.py | UTF-8 | 1,596 | 3.25 | 3 | [] | no_license | import requests
url = 'http://servers1-a-b-1461907413.us-east-2.elb.amazonaws.com/'
ruta = ""
autor = ""
while (True):
print("1. Ingresa ruta.")
print("2. Ingresa autor.")
print("3. Ver datos.")
print("4. Enviar datos.")
print("5. Salir.")
print(">")
opcion = input()
if (opcion == "1"... | true |
360d779a51710669a521178add591c59ace15ebc | Python | ajj/ncnrcode | /combine/bt5reader.py | UTF-8 | 4,098 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
#import Tkinter as Tk
def numeric_compare(x,y):
x = float(x)
y = float(y)
if x < y:
return -1
elif x==y:
return 0
else: # x>y
return 1
def getBT5DataFromFile(fileName):
'''
Takes a filename and returns a dictionary of the detector values
keyed by varying value (ususally A2 or A5)
... | true |
68acbff90af1bf73cc2ca9989a7ee6aac38ca720 | Python | KenjiShiguma/Pokedex | /pokedex_classify_image.py | UTF-8 | 4,707 | 3.0625 | 3 | [] | no_license | # Author(s): Kermit Mitchell III, Zeke Hammonds
# Start Date: 05/06/2019 5:30 PM | Last Editied: 12/15/2020 1:00 PM
# This code uses the trained Pokedex SVMs to identify the Pokemon in an given image.
# Essential Imports
import cv2 as cv # Image processing like HoG
import numpy as np # Fast matrix manipulation
from ma... | true |
a5169d96fd4bb846ef08086775190b0726d5faea | Python | EliTheCreator/AdventOfCode | /2018/day03/task1.py | UTF-8 | 597 | 3.15625 | 3 | [] | no_license | import os
def main():
file = open("input", "r")
array = [[0 for y in range(1000)] for x in range(1000)]
s = 0
for line in file:
_, _, from_cords, to_cords = line.split()
fromx, fromy = from_cords.split(',')
tox, toy = to_cords.split('x')
fromx = int(fromx)
to... | true |
65cd9848e151ef55b2bae60ac3f3af4561ad9bc8 | Python | SofBro/DZ | /sotirovochka.py | UTF-8 | 467 | 3.109375 | 3 | [] | no_license | # Реализуйте в виде рекурсивной функции алгоритм Быстрой Сортировки для массива чисел.
def qui(s):
if len(s) <= 1:
return s
n = s[0]
m = []
r = []
b = []
for i in range(len(s)):
if s[i] < n:
m.append(s[i])
if s[i] == n:
r.append(s[i])
if s[i] > n:
b.append(s[i])
return qui(m) + r ... | true |
8efd8bc5d610be03451deb83365c4bdc56568100 | Python | hatooku/CS159 | /training/preprocess_pytorch.py | UTF-8 | 2,755 | 2.765625 | 3 | [] | no_license | import numpy as np
try:
from .key import *
except ImportError:
from key import *
LOG_FILE = 'base_left-11.log'
ACTIONS = {'Dash', 'Turn', 'Tackle', 'Kick'}
def fetch_data(logs):
"""Input: Array of log filenames"""
assert(isinstance(logs, list))
X = None
y = None
for log_file in logs:
... | true |
56cb5e7a9b6aba35c626ea486d45a83ac60d85f5 | Python | kartikeyakansal/covid-alert | /covid19.py | UTF-8 | 1,372 | 2.953125 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
import json
import time
#import winsound
from plyer import notification
def notifier(values):
notification.notify(
title = 'Covid Alert',
message = '''Increase: {increase}
Deaths: {deceased}'''.format(increase = values[0], deceased = value... | true |
706e12653f60f0217cec067d47501d0c301b2dfe | Python | Agent-INF/CycleGAN | /layers.py | UTF-8 | 2,740 | 2.875 | 3 | [] | no_license | import tensorflow as tf
def lrelu(inputs, leak=0.2, name="lrelu"):
with tf.variable_scope(name):
return tf.maximum(inputs, leak * inputs)
def instance_norm(inputs):
with tf.variable_scope("instance_norm"):
epsilon = 1e-5
mean, var = tf.nn.moments(inputs, [1, 2], keep_dims=True)
scale = tf.get_va... | true |
73a6ffd52be52f47dc21203c49a55cee84e8b31f | Python | IGI-111/AdventOfCode2018 | /8.py | UTF-8 | 940 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Node:
def __init__(self, data):
self.child_len = data.pop(0)
self.meta_len = data.pop(0)
self.children = []
for i in range(0, self.child_len):
self.children.append(Node(data))
self.meta = [data.pop(0) for _ in ... | true |
57fb1ff06a0e979df7336a47090ec716c241c5b6 | Python | AssiaHristova/SoftUni-Software-Engineering | /Programming Basics/for_loop/paycheck.py | UTF-8 | 353 | 3.34375 | 3 | [] | no_license | n = int(input())
paycheck = int(input())
for i in range(n):
tab = input()
if tab == 'Facebook':
paycheck -= 150
elif tab == 'Instagram':
paycheck -= 100
elif tab == 'Reddit':
paycheck -= 50
if paycheck <= 0:
break
if paycheck > 0:
print(paycheck)
else:
print... | true |
17d1b6ad9765fc3c7c0a94599454f17074098150 | Python | Nathan-Binkley/NYPD-Allegations | /process.py | UTF-8 | 3,095 | 3.140625 | 3 | [
"MIT"
] | permissive | import time
import math
'''
FORMAT:
# Police ID
# First Name
# Last Name
# Current precinct
# Complaint id
# Month recieved
# Year recieved
# Month closed
# Year Closed
# Command during incident
# Rank Abbreviation at incident
# Rank Abbreviation now
# Rank at incident
# Rank now
# Officer Ethnicity
# Officer Gender
#... | true |
e64ea61cdd58500a222e84520bf7079d6b1253a5 | Python | cetoli/kuarup | /poo09/kuarup/tribos/potiguara/peixe_guajajara.py | UTF-8 | 3,012 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF8 -*-
"""
:Author: Guajajaras
:Contact: `Guajajaras <http://kuarup2009.pbwiki.com/Tribo-Guajajaras>`__
:Date: $Date: 2009/03/24$
:Status: This is a "work in progress"
:Revision: $Revision: 1.00$
:Home: `LABASE <http://labase.nce.ufrj.br/>`__
:Copyright: ©2009, `GPL <http://is.gd/... | true |
9d8b4278b2b8c472862c8f9bfbf5052bd0ab7d7f | Python | ruangab/lista-uri-python-01 | /area_do_circulo.py | UTF-8 | 120 | 3.359375 | 3 | [] | no_license | raio = float(input("Digite aqui a área do circulo:"))
n = 3.14159
area = n * (raio**2)
print('A={:.4f}'.format(area))
| true |
5513a434756f6d32679f9baeea6fd75c19701a17 | Python | Girija-Mage/Girija-Mage.github.io | /app.py | UTF-8 | 1,045 | 2.515625 | 3 | [] | no_license | from __future__ import unicode_literals #UTF-8 encoded bytes
from flask import Flask #importing flask module
import os #allows interfacing with the underlying operating system that Python is running on(Windows,Linux)
app = Flask(__name__) ... | true |
ebc002bc910daa69a39d7b93ca3fcc98a716834d | Python | navarr393/a-lot-of-python-projects | /username.py | UTF-8 | 282 | 3.75 | 4 | [] | no_license |
# put your function here
def makeusername(first_name, last_name):
return first_name[:3]+last_name[:3]+'2'
firstname = input("Give me a first name: ")
lastname = input("Give me a last name: ")
print("Computer System name is:", makeusername(firstname,lastname)) | true |
95e387161d6abeaea14f72f6734a4b2b9b8abdf5 | Python | virtyaluk/leetcode | /problems/1046/solution.py | UTF-8 | 463 | 3.03125 | 3 | [] | no_license | from heapq import heapify, heappush, heappop
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
for i in range(len(stones)):
stones[i] *= -1
while len(stones) > 1:
heapify(stones)
s1 = heappop(stones)
s2 = heapp... | true |
95af77bfc8b592f5ccded3b03ffa495ddda256d1 | Python | hancx1990/hancx | /code/python/demo/com/hcx/100sample/test15.py | UTF-8 | 442 | 4.0625 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-80分之间的用B表示,60分一下的用C表示。
"""
score = int(input('input score:'))
if score >= 90:
grade = 'A'
elif score >= 80:
grade = 'B'
elif score >= 70:
grade = 'C'
elif score >= 60:
grade = 'D'
else:
grade = 'E'
print('%d belon... | true |
764a1c151713339d2d6fb44c41bd4339cf090779 | Python | anushbadalyan/lesson4 | /1.py | UTF-8 | 113 | 2.625 | 3 | [] | no_license | import os
x = os.getcwd()
print(x)
y = os.chdir(os.pardir)
print(os.getcwd())
os.chdir(x)
print(os.getcwd())
| true |
70966e8b97d485126673ff02aceeb4c5c650b8bb | Python | FishToucherrr/mathematical_modeling | /code/2_y=x.py | UTF-8 | 9,005 | 3.078125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import pulp
import matplotlib as mp
mp.use('tkagg')
import matplotlib.pyplot as plt
data = pd.read_excel(r"D:\Courses\additional\mathematical_modeling\题目\C\附件1 近5年402家供应商的相关数据.xlsx",
sheet_name='供应商的供货量(m³)')
data_1=pd.read_excel(r"D:\Courses\addit... | true |
727e2d637aeb1a8250440fda345c72bde57974e3 | Python | plumdog/project_euler | /problem012/python/main.py | UTF-8 | 565 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
sys.path.insert(0, '../../common/python/')
import itertools
from operator import mul
from functools import reduce
from primality import prime_factors
NUM = 500
def triangle(num):
return num * (num + 1) // 2
def first_tr_with_divisors(num):
for i in itertools.count():
... | true |
8c3348f20d7f95d1a7d3509b860074aae7b51e02 | Python | supersyz/Mathematical-modeling-of-Huawei-cup | /code/Q3pre.py | UTF-8 | 288 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
pr_mat=pd.read_csv('data3/pr.csv',index_col=0)
index=[]
for i,r in pr_mat.iterrows():
if r.values[0]>0.05 and r.values[1]>0.05:
pr_mat=pr_mat.drop(i)
index.append(i)
print(index)
print(len(index))
pr_mat.to_csv('./dropData.csv')
| true |
65df8e71877062d775867a38c637c37f80dd56aa | Python | BakinSergey/EquationBot | /GDriveFunc.py | UTF-8 | 2,208 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
"""
basic usage of the Drive v3 API.
Creates a Drive v3 API service and prints the names and ids of the last 10 files
the user has access to.
"""
from __future__ import print_function
import os
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
from htt... | true |
6ae9b69facc9fdd963e5953640213cec58dcdb39 | Python | holens/py-learns | /coroutines/3.async.py | UTF-8 | 821 | 3.640625 | 4 | [] | no_license | #!usr/bin/env python
# coding=utf-8
"""
@time: 2018/10/14
@desc: Python 3.5 async和await是针对coroutine的新语法,要使用新的语法,只需要做两步简单的替换:
把@asyncio.coroutine替换为async;
把yield from替换为await
"""
# 异步函数(coroutine)
# async def async_function():
# return 1
# 异步生成器(async_generator)
# async def async_genera... | true |
a4c73452f64e97ea8e5575c2932a7f22c4eb6318 | Python | dimitrantz/Codility | /9_MaximumSliceProblem/MaxDoubleSliceSum.py | UTF-8 | 276 | 2.734375 | 3 | [] | no_license | # 100%
def solution(A):
# write your code in Python 3.6
L_slice, R_slice, count = 0, 0, 0
for Z in range(3, len(A)):
L_slice = max(0, A[Z-2] + L_slice)
R_slice = max(L_slice, A[Z-1] + R_slice)
count = max(R_slice, count)
return count
| true |
bfcc8cbd873f52967ac91594792c66e194be1ccc | Python | quinnbp/PyLabyrinth | /src/main.py | UTF-8 | 475 | 2.796875 | 3 | [] | no_license | from labyrinth_cls import Labyrinth
from intro_help_defs import intro
from char_def import Character
def main():
"""
Top-level function call for PyLabyrinth v1.2
:return: None
"""
# calls function to generate intro text from file
charname = intro()
# initializes character
... | true |
80d86640b2686a152b51719e74e533a0f3a1bce3 | Python | stuvusIT/mail_alias_manager | /mail_alias_manager/babel.py | UTF-8 | 1,940 | 2.734375 | 3 | [
"Python-2.0",
"MIT"
] | permissive | """Module for setting up Babel support for flask app."""
from typing import Optional
from flask import Flask, request, g
from flask_babel import Babel, refresh as flask_babel_refresh
from werkzeug.datastructures import LanguageAccept
"""The list of locales to support."""
SUPPORTED_LOCALES = ["de", "en"]
BABEL = Babe... | true |
360b1035a85de5ccb426d1134312a9bb0a3cbfa2 | Python | coffeyk/BlackJackCalculatron | /BlackJack/Game.py | UTF-8 | 11,578 | 3.25 | 3 | [] | no_license | '''
Created on Dec 17, 2012
@author: Kevin
'''
INTERACTIVE = False
DEBUG = False
from BlackJack.Hand import Hand
from BlackJack.Player import Player
from BlackJack.PlayStyles import theHouseH17
from BlackJack.Helpers import Action, Card
import random
# Fixed seed helps spot functional changes to the algorithms
ran... | true |
251c0bc079aa7ca9d1d8d225d73c66185c6c3914 | Python | woobinyim/pythonproject | /if문.py | UTF-8 | 173 | 3.546875 | 4 | [] | no_license | number=input("정수 입력>")
number=int(number)
if number>0:print("양수입니다")
if number<0:print("음수입니다")
if number==0:print("0입니다")
| true |
eddc4e1e64443878d53bebc0f7c3d5024d302ca0 | Python | HatemHaddad/algo | /files/one_ticker.py | UTF-8 | 756 | 3.5625 | 4 | [] | no_license | # Import yfinance package
import yfinance as yf
# Import matplotlib for plotting
import matplotlib.pyplot as plt
# Set the start and end date
start_date = '1990-01-01'
end_date ='2021-07-31'
# Set the ticker
ticker = 'AMZN'
# Get the data
data = yf.download(ticker,start_date,end_date)
# Print 5 rows
print(da... | true |
7cf7f2d621b82e82b29158bfb23962674b9b68d6 | Python | smart1004/learn_src | /ncia_data_analysis/Day_01_04_pandas.py | UTF-8 | 2,363 | 4.1875 | 4 | [] | no_license | # Day_01_04_pandas.py
import pandas as pd
# 데이터를 분석하는 라이브러리, 상용 tool이 많은데, customize하기 위해서는 파이썬을 씀
# 데이터 frame이 중요함. 이것을 하려면 Series
def series():
s = pd.Series([5, 1, 2, 9]) # list --> series로 변환
print(s)
print(s.index)
print(s.values)
print(type(s.values)) # <class 'numpy.ndarray... | true |
919505d204b4465cc4787a44fe677fa2c56dff61 | Python | arnet95/Project-Euler | /euler500.py | UTF-8 | 882 | 2.8125 | 3 | [] | no_license | from eulertools import primes
from math import log
prime_list = primes(10**7)
def f(n):
l = [1] * n
min_next_log = [2*log(prime_list[i]) for i in xrange(len(l))]
switch = True
while switch:
switch = False
p_log = log(prime_list[len(l) - 1])
min_i, min_val = 0, p_log + 1
... | true |
0309b7791eaf67d22d6bc1084750677cb2809530 | Python | chena/divvy | /algorithms/linkedlist_test.py | UTF-8 | 594 | 3.3125 | 3 | [] | no_license | import unittest
import linkedlist as L
from linkedlist import Node
class LinkedlistTest(unittest.TestCase):
def setUp(self):
self.n1 = Node('a')
self.n2 = Node('b')
self.n3 = Node('c')
self.n1.next = self.n2
self.n2.next = self.n3
def test_delete_node(self):
head = L.delete_node(self.n1, 'b')
self.as... | true |
b6a573029a47973dc55c149ce9ef62a054521167 | Python | stauntonknight/algorithm | /euler/74.py | UTF-8 | 668 | 3.546875 | 4 | [] | no_license | def memoize(f):
memo = {}
def helper(x):
if x not in memo:
memo[x] = f(x)
return memo[x]
return helper
@memoize
def fact(n):
val = 1;
while n > 1:
val = val * n
n -= 1
return val
@memoize
def get_chain(n):
seen = {}
count = 0
while True:
... | true |
a09b98992a34f1b0b5a12f0902f4285f7fbc2d22 | Python | Elk21/pathologic | /main.py | UTF-8 | 8,079 | 3.5 | 4 | [] | no_license | import json
CURRENT_TURN = 0
DOCTORS_MOVES_COUNT = 2
ASSISTANTS_MOVES_COUNT = 2
PLAGUE_MOVES_COUNT = 1
def read_json_data(path):
''' Read data from json file
Returns
-------
dict
json readed into python dict
'''
with open(path, 'r') as file:
return json.load(file)
paths = re... | true |
a2a36d9bb47488506ab69fba11e84c06307e850d | Python | praneeth-bala/cp-hub | /CP_HUB/tmaker.py | UTF-8 | 516 | 2.859375 | 3 | [] | no_license | #Creating teams
import os
print("Enter team name : ")
tname=input()
print("Enter username and password : ")
uspass=input().split()
if not os.path.exists('./uploads/'+tname):
#Store creds and points in a txtfile
os.makedirs('./uploads/'+tname)
os.makedirs('./results/'+tname)
fo=open('./uploads/'+tname+'... | true |
ed8467daaa73c17096ea2c37132cf80901868f55 | Python | dannythorne/CSC115_SP16 | /dthorne0/32_Review/main.py | UTF-8 | 904 | 4.5 | 4 | [] | no_license |
print("Danny Thorne")
print("Review")
s = input("Enter a string: ")
# output the characters of the string one by one on separate lines
for c in s:
print(c)
# output the indices of the characters one by one on separate lines
for i in range(len(s)):
print(i)
# output the characters and their in... | true |
132df16f2e8267761f68432acb6fd5d6350df39d | Python | Hryo224/NBARecap | /gamethread.py | UTF-8 | 1,411 | 2.5625 | 3 | [] | no_license | import praw
import os
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from wordcloud import WordCloud
CLIENT_ID = os.environ.get("REDDIT_CLIENT_ID")
CLIENT_SECRET = os.environ.get("REDDIT_CLIENT_SECRET")
PASSWORD = os.environ.get("REDDIT_USER_PWD")
USER_AGENT = os.environ.get("REDDIT_USER_AGENT... | true |
d1ecf22d86034608f461e8a18189dfb5d0daa111 | Python | Eric-aihua/hadoop-snippets | /mr-netflow/jobs/Python/FlowsCountMapper.py | UTF-8 | 963 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
# we'll read input data from STDIN
# Hadoop will read the data from HDFS and pipe it here
for line in sys.stdin:
# split the line
split_line = line.split("\t")
# don't process the line if the last column doesn't hold a date
# simple check of the length and : characte... | true |
eb60ed29b0dc049d130a92a3169b2110dd3b9eed | Python | refnx/refnx | /refnx/analysis/test/test_model.py | UTF-8 | 3,344 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | import pickle
import numpy as np
from numpy.testing import (
assert_almost_equal,
assert_equal,
assert_,
assert_allclose,
)
from refnx.analysis import Parameter, Model, Parameters
def line(x, params, *args, **kwds):
p_arr = np.array(params)
return p_arr[0] + x * p_arr[1]
def line2(x, p):
... | true |
f5b6cb3a8b3c21bf83bacdc04505daa928a4d3da | Python | SigurdSundberg/FYS3150 | /project1/code/make_plot.py | UTF-8 | 1,241 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import sys
import os.path
def plot_file(in_file):
[x, app, *_] = read_file4(in_file)
plt.plot(x, app, '--', label=f"n = 10^{in_file[-1]:s}")
def read_file4(in_file):
if not os.path.isfile("./output/" + in_file):
print("File does not exists")
... | true |
383572c1a5b926f50bde6167aebab0a3460a36a4 | Python | James-Oswald/IEEE-Professional-Development-Night | /2-22-21/replaceAlphabet.py | UTF-8 | 344 | 3.484375 | 3 | [] | no_license |
def alphabet_position_max(seq):
rv = ""
for c in seq.upper():
if(ord('A') <= ord(c) <= ord('Z')):
rv += str(ord(c) - ord('A') + 1) + " "
return rv[:-1]
alphabet_position=lambda t,s=0:" ".join([str(s) for c in t.upper() if 1<=(s:=ord(c)-64)<=26])
print(alphabet_position("The sunset set... | true |
13ac7d5ac7b91cce69dcfb4eef5e72c4139e0458 | Python | tuozhanjun/AI_BIG_DATAS_ALGORITHM | /EnhancedLearningProject/GameAsMaze_Qlearning/MazeEnv.py | UTF-8 | 2,419 | 3.109375 | 3 | [] | no_license | import os
import time
import numpy as np
from MazeActions import LEFT, RIGHT, UP, DOWN
class MazeEnv:
def __init__(self, max_row, max_col, worker, treasure, refresh_interval, obstacles=None):
self.max_row = max_row
self.max_col = max_col
self.init_worker = worker.clone()
self.wor... | true |
687dce1f42c2228924841ae1be3d640357477745 | Python | NguyenTTin/PythonHomeWork | /Basic_Syntax/Mutiplication_Table.py | UTF-8 | 461 | 2.78125 | 3 | [] | no_license | __auth__ = 'NguyenTTin'
counter=0 # Create a variable to count the number of line
print("\t\t MUTILPLICATION TABLE")
for i in range(1,10):
if i==1:
print(" {0:5d}".format(i),end='')
else:
print(" {0:2d}".format(i),end='')
print("")
print("--"*20)
for j in range(1,10):
print(str(j) + '|'... | true |
ffc8abbde25c539d9b8ee8e65ff324f928676238 | Python | pokerSeven/leetcode | /76.py | UTF-8 | 870 | 2.890625 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
__author__ = 'lhj'
__date__ = '2017/10/30 17:21'
class Solution(object):
def minWindow(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
m_dict = {}
begin = 0
end = 0
head = 0
counter = len(t)
import sys
d = sys.maxint
for c in t:
if m_dict.has_key(c):
... | true |
8626a3cfd85d27c4a2067c058da0104df0ed60e7 | Python | JhonesBR/python-exercises | /4 - Python String Exercise/ex11.py | UTF-8 | 145 | 3.4375 | 3 | [] | no_license | # Reverse a given string
# Solution: https://github.com/JhonesBR
def reverseString(s):
return s[::-1]
s = "Jhones"
print(reverseString(s)) | true |
f1bc95188c961ec40d253acc4750d05507e9e871 | Python | rob-dalton/fantasy-football-analytics | /aggregators/game_player.py | UTF-8 | 682 | 2.5625 | 3 | [
"MIT"
] | permissive | """ Contains functions to aggregate NFL data contained in Pandas DataFrames. """
from typing import List
from .base import Aggregator
from etc.types import DataFrame
class GamePlayerAggregator(Aggregator):
""" Aggregator for game player level data """
def _clean_data(self) -> None:
""" Rename ID colu... | true |
7df4bc35f09c052c7b0b8c4d59eca0424192773f | Python | myarik/django-rest-elasticsearch | /rest_framework_elasticsearch/es_validators.py | UTF-8 | 1,876 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
import six
@six.add_metaclass(ABCMeta)
class BaseESFieldValidator:
# Elastycsearch field types
es_types = []
@staticmethod
@abstractmethod
def validate(value):
# must be implemented in your class, this method
# valid... | true |
9d5b84086275099503a5cdd8e22a44b2f1b0ad0f | Python | Zanuzzo96/exercicios-python-curso-em-video | /exercicio25.py | UTF-8 | 293 | 3.78125 | 4 | [] | no_license | nome = str(input("Qual é o seu nome completo? "))
print(f'Seu nome tem tem Silva? {"silva" in nome.lower()}')
'''Abaixo é um teste de contador de palavra dentro da string
Não tem nada haver com o exercicio foi um extra meu'''
print(f'Tem {nome.lower().count("silva")} Silva no nome')
| true |
5e30183a1a9cbb68a0767e934c3477225a31a270 | Python | ychuang789/AD_classifier | /train/build.py | UTF-8 | 2,452 | 2.78125 | 3 | [] | no_license | import torch
import pandas as pd
from pandas.core.frame import DataFrame
from torch.utils.data import Dataset, DataLoader
from transformers import AlbertTokenizer
from sklearn.model_selection import train_test_split
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
def read_data(filename):
d... | true |
0b278eec822354d418d3aa4d9e15b0a4831c324a | Python | Project-MONAI/MONAI | /monai/losses/focal_loss.py | UTF-8 | 11,733 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | true |
93d320c8080fab5bd0800321d810d7865e9135de | Python | simmsb/PyChat | /Chat/Encrypted/chatserver.py | UTF-8 | 3,720 | 2.59375 | 3 | [] | no_license | import socket, threading
def GetName(c):
SendData(c, 'NameTime')
name = RecvData(c, 1024)
SendData(c, name)
return name
def SendData(c, data):
try:
c.send(data.encode('utf-8'))
except ConnectionResetError:
ThreadLock1.aquire()
ThreadLock2.aquire()
for i in Cli... | true |
98578d8abaa6f9e68266d7cbee17108bf2b16b2e | Python | OCESS/orbitx | /orbitx/physics/electroconstants.py | UTF-8 | 10,088 | 2.65625 | 3 | [
"MIT"
] | permissive | """"
Hard-coded per-component physical and thermal constants.
I'm allowed to hard code data because I've already hard-coded the number of and
name of engineering components, and they're not going to reasonably change
per-savefile.
Some values imported from Dr. Magwood's OBIT5SEJ.txt.
YOLO.
"""
from typing import Nam... | true |
98cc3cfffc9f4888387957a774a0264226657da2 | Python | YeomeoR/codewars-python | /sort_vowels.py | UTF-8 | 1,679 | 4.4375 | 4 | [] | no_license | # Sort the Vowels!
# In this kata, we want to sort the vowels in a special format.
# Task
# Write a function which takes a input string s and return a string in the following way:
# C| R|
# |O n|
# D| ... | true |
3c49d2a4011440c08178ea547df5a793d60993f1 | Python | LHGames-2018/DCI1espace | /bot/bot.py | UTF-8 | 12,267 | 3.28125 | 3 | [
"MIT"
] | permissive | from helper import *
import math
from queue import PriorityQueue
#from path_finding import *
class Node():
def __init__(self, x, y):
self.coords = (x, y)
self.estimate = 0
self.cost = 0
def __gt__(self, other):
return self.estimate > other.estimate
def __eq__(self, other):... | true |
f4cf3cd381131119db2c9c8e213a65f8af80a9fb | Python | mikkelam/project-euler | /problem 21/p21.py | UTF-8 | 357 | 3.453125 | 3 | [] | no_license | def properDiv(num):
divs=0
half= num/2
for x in xrange(1,half+1):
if num%x==0:
divs +=x
return divs
def amicable(cap):
amicables=[]
for a in xrange(1,cap+1):
b = properDiv(a)
if a == properDiv(b):
if a != b:
if a and b not in amicables:
amicables.append(a)
amicables.append(b)
return ... | true |
ec67f50905a943a0834f7b00cfa37bf1f6758c30 | Python | psbskb22/autoencoder-for-image-processing | /preprocessing.py | UTF-8 | 1,305 | 2.828125 | 3 | [] | no_license | import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
def _load_lfw_dataset(RAW_IMAGES_NAME, dx=80, dy=80, dimx=45, dimy=45, grayScale=False):
all_photos = []
print('Data load initiated')
for subdir, dirs, files in os.walk(RAW_IMAGES_NAME):
for file in f... | true |
5027b0dc4f7710864d9f43631644fdc8951614b2 | Python | Yilisameen/cmpl_proj1 | /lexer.py | UTF-8 | 1,954 | 2.984375 | 3 | [] | no_license | import ply.lex as lex
# List of token names. This is always required
reserved = {
'extern' : "EXTERN",
'def' : 'DEF',
'return' : 'RETURN',
'while' : 'WHILE',
'if': 'IF',
'else': 'ELSE',
'print' : 'PRINT',
'true' : 'TRUE',
'false' : 'FALSE',
'int' : 'INT',
'cint' : 'CINT',
... | true |
950582c87c44b39e5d2dd5b01c547b8d8d69d6f5 | Python | camilariquelme/pythontalentodigital2020 | /CODINGDOJO/7.-PYTHON/3.- PYTHON OPP/BankAccount.py | UTF-8 | 1,247 | 4.125 | 4 | [] | no_license |
class BankAccount:
def __init__(self, account_number, balance, tasa_interes):
self.account_number = account_number
self.balance = balance
self.tasa_interes = tasa_interes
def deposit(self, amount):
self.balance+= amount
return self
def withdraw(self, amoun... | true |
430b2c8eb92e583918c2670ece9f9da3c9cb7775 | Python | 3toe/PyBasicFunc2 | /PyFuncBasic2.py | UTF-8 | 2,478 | 4.40625 | 4 | [] | no_license | # Countdown - Create a function that accepts a number as an input. Return a new list that counts down by one,
# from the number (as the 0th element) down to 0 (as the last element).
# Example: countdown(5) should return [5,4,3,2,1,0]
def countDown(x):
if x > 0 and x%1 == 0:
newL = []
for i in range... | true |
20f3d174bd91e304190dc7e704087bb9ba19eaac | Python | xorms8/pythonPractice | /pythonBasic/01.basic/Ex03_stringformat.py | UTF-8 | 1,845 | 4.40625 | 4 | [] | no_license |
# -----------------------------------------
# 문자열 포맷
# 0- 문자열 포맷팅
# print('내가 좋아하는 숫자는 ', 100 )
# 1- format() 이용
# print('내가 좋아하는 숫자는 {0:d} 이다'.format(100) )
# 2- % 사용
# print('내가 좋아하는 숫자는 %d 이다' % 100 )
# 성능(속도)는 %이 더 빠르다고는 하지만 코드가 깔끔하게 하는 것이 더 중요하다고 ... | true |
3a1172fc0b6beba62aa8f82778fc255666ad9b0a | Python | codexdelta/DSA | /hackerrank_python/strings/string_validators.py | UTF-8 | 678 | 3.6875 | 4 | [] | no_license | value = raw_input()
answer = {'alnum':False, 'alpha':False, 'digit':False, 'lower':False, 'upper':False}
for x in xrange(5):
for i in xrange(len(value)):
if answer['alnum']==False:
answer['alnum']=value[i].isalnum()
if answer['alpha']==False:
answer['alpha']=value[i].isalpha(... | true |
3e176c9c63ed4cb102f5125552511881e3ae81cd | Python | Kakuheiki/Python-Based-Repository | /Python/Python-TheHardWay-Example-Codes/ex47.py | UTF-8 | 278 | 2.78125 | 3 | [] | no_license | from nose.tools import *
from ex47_test import Room
def test_room():
gold = Room("GoldRoom")
assert_equal(gold.name, "GoldRoom")
assert_equal(gold.name, [])
def test_room_paths():
center = Room("Center", "Test room in the center.")
north = Room("North", )
| true |
7f39b9e37f05fd8d3381046cfcb1498e9034f07a | Python | mikylace/python | /1 | UTF-8 | 243 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
#.*. coding: utf-8 .*.
import os
import sys
if len(sys.argv) != 4:
print 'Argumentos equivocados!'
exit()
iniciales=sys.argv[1][0]+','+sys.argv[2][0]+','+sys.argv[3][0]
print "Tus iniciales son : "+iniciales.upper()
| true |
dc14f1d26db3bdd652ec884b381775eaa2b7c88b | Python | jedioli/aCOG_mindeye | /aCOG_src/pre-alpha_adapt/tetris_base_adapt.py | UTF-8 | 22,430 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | """
Tetris Tk - A tetris clone written in Python using the Tkinter GUI library.
Controls:
Left Arrow Move left
Right Arrow Move right
Down Arrow Soft drop
Up Arrow # Hard drop
'a' Rotate anti-clockwise (to the left)
's' Rotate clockwise (to ... | true |
f7f210515c5523ca9e88425fdd90a6b1e64b5615 | Python | Albert-Agung-G/python | /daftar_nilai.py | UTF-8 | 475 | 3.671875 | 4 | [] | no_license | def nilai (dictionary):
for key, val in dictionary.items():
print(f'hasil {key} {val}')
Nilai = {}
while True:
nama = input('nama:')
angka = int(input ('nilai:'))
if angka >= 90:
grade = 'A'
elif angka > 80:
grade = 'B'
elif angka > 70:
grade = 'C'
else:
... | true |
3c081f7b00566ad19508f5542d4c24f53b5a297e | Python | kellymhli/code-challenges | /meeting-rooms.py | UTF-8 | 336 | 3.359375 | 3 | [] | no_license | def can_attend_meetings(intervals):
intervals.sort(key = lambda x: x[0])
for i in range(len(intervals)-1):
if intervals[i][1] > intervals[i+1][0]:
return False
return True
print(can_attend_meetings([[7,10],[2,4]]))
print(can_attend_meetings([[0,30],[5,10],[15,20]]))
print(can_attend_me... | true |
b761a56d4f58b48c9d92163c02452e27548da5cb | Python | saby95/CrowdMentor | /features/steps/signup.py | UTF-8 | 937 | 2.75 | 3 | [] | no_license | from behave import given, when, then
from test.factories.user import UserFactory
@given('I am a new user who tries to access the site')
def step_impl(context):
pass
@when('I submit a valid signup page')
def step_impl(context):
br = context.browser
br.visit(context.base_url + '/signup/')
# Fill login ... | true |
248f5308062ddc2b896413a99dc9d5c3f3c29ac6 | Python | chenjyr/AlgorithmProblems | /HackerRank/Sorting/InsertionSort2.py | UTF-8 | 1,852 | 4.5625 | 5 | [] | no_license | """
In Insertion Sort Part 1, you sorted one element into an array.
Using the same approach repeatedly, can you sort an entire unsorted array?
Guideline: You already can place an element into a sorted array.
How can you use that code to build up a sorted array, one element at a time?
Note that in the first step, wh... | true |
08da612212399be8a50e3bcc62e896ce70c35030 | Python | andelgado53/dm_site | /dmsite/tweet_stream.py | UTF-8 | 7,206 | 2.578125 | 3 | [] | no_license | import tweepy
import pprint
import time
#from pymongo import MongoClient
access_token = '334499977-rEoZdUSkT97phwCqBP4u0WnX06BxfwBNV5mmt2Ll'
access_token_secret = 'Okp7bfZiDSXshy6oDiaUN48Cbd7vDjIU6CAebXcqFMlgY'
consumer_key = '8LgwCyEfLVdrOd0iGizbE5uAp'
consumer_secret = 'n9izWfr8ZHud9mm07zbdbzZEhq98DkfGRgor... | true |
7898e8ac7cbed909b30ec483a819915a16fd106d | Python | khuynh4/Project2 | /Zoo.py | UTF-8 | 6,604 | 3.484375 | 3 | [] | no_license | from abc import ABC, abstractmethod # a module that provides the base for defining Abstract Base Classes "ABC"
from Strategy import RandomCatBehavior
import abc
# Create RandomCatBehavior object to use it in Cat class
RandomBehavior = RandomCatBehavior()
# ------- Animals Abstract Class -------
class Animals(ABC):
... | true |
768a0d36ced71204a8af3ac3b40eb07efbe48a52 | Python | smilejakdu/programers_algorithm_study | /chulphan/week_3/K번째수.py | UTF-8 | 288 | 3.09375 | 3 | [] | no_license | def solution(array, commands):
answer = []
for i in commands:
c1, c2, c3 = i
if c1 == c2:
answer.append(array[c1-1])
else:
copied = array[c1-1:c2]
copied.sort()
answer.append(copied[c3-1])
return answer
| true |
3e1b7d046c0f7e1a0d0f17fee069d67e4799f519 | Python | angelmilici/CA268-Computer-Programming-3-Data-Struct.-Alg.- | /week10/triathlon_v1_111.py | UTF-8 | 977 | 3.515625 | 4 | [] | no_license | class Triathlon(object):
def __init__(self):
self.d = {}
def add(self, athlete):
self.d[athlete.tid] = athlete
def remove(self, tid):
del self.d[tid]
def lookup(self, tid):
if tid in self.d:
return self.d[tid]
return None
class Tri... | true |
5f576a0a65743b97de4a9d7d064ae65a695cd685 | Python | miyosuda/hvrnn | /hvrnn/cell.py | UTF-8 | 34,913 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
def sample_gauss(mu, log_sigma_sq):
eps_shape = tf.shape(mu)
eps = tf.random_normal(eps_shape, 0, 1, dtype=tf.float32)
# z = mu +... | true |
ce279f0fd76f9d86656a44945b2cf36473845341 | Python | fengli119/hello-world- | /calculator2.py | UTF-8 | 907 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import collections
taxdict=collections.OrderedDict()
try:
for arg in sys.argv[1:]:
num=int(arg.split(':')[0])
taxdict[num]=int(arg.split(':')[1])
except:
print("Parameter Error")
def tax_calculator(num,salary):
income=salary*(1-0.08-0.02-0.005-0.06)-3500
... | true |
19b4cd2157ebcf60c0b73494b2be620fa6003a84 | Python | surabanke/python_lane_coordinates | /road_interest.py | UTF-8 | 3,098 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
def grayscale(img):
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
def gaussian_blur(img, kernel_size):
return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)
def canny(img, low_threshold, high_threshold):
... | true |
8a81ec174918610233788e5b906121faf69dd698 | Python | JellyWX/SpaceInvaders | /enemy.py | UTF-8 | 580 | 3.109375 | 3 | [] | no_license | class Enemy(object):
def __init__(self,x,y,gui,im,dire=2):
self.alive = True
self.x = x
self.y = y
self.gui = gui
self.disx = 0
self.dir = dire
self.desc = False
self.im = im
def move(self):
if self.disx > 100 or self.desc:
self.desc = True
self.y += 4
self.dir... | true |
cf100bce8e4f907528b60a423dccfb053efea9a2 | Python | fff134/Unearthed | /corr_mat.py | UTF-8 | 888 | 2.75 | 3 | [] | no_license | from string import letters
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white")
pd.set_option('display.max_rows', 1000)
# Import data
d = pd.read_csv("all_wells_lim_20k.csv", low_memory=False)
# Compute the correlation matrix
corr = d.corr()
print corr
... | true |
e8b415996efed71030000bd13144321cc0853469 | Python | z21mwKYq/Learning | /2_5_2.py | UTF-8 | 359 | 3.125 | 3 | [] | no_license | ls = [int(i) for i in input().split()]
ls2 = []
end_of_list = len(ls)- 1
if len(ls) ==1:
print(ls[0])
else:
for i in range(len(ls)):
if i == 0:
ls2.append(int((ls[i+1] + ls[-1])))
elif i == end_of_list:
ls2.append(int(ls[i-1]+ls[0]))
else:
ls2.append(i... | true |
40bc8ae12ec725b5cac3d7acd3795c25eb5f8f5d | Python | Dew2118/snake_game | /src/display.py | UTF-8 | 851 | 2.65625 | 3 | [] | no_license | from curses import wrapper
import curses
import sys
class Display:
def __init__(self,stdscr) -> None:
self.stdscr = stdscr
self.stdscr.nodelay(1)
curses.cbreak()
curses.noecho()
curses.curs_set(0)
def display_char(self, char, cords):
try:
... | true |
7c1202619dbab73ac8f6428ff1281eff6c428827 | Python | miomao34/colorimetry | /logic.py | UTF-8 | 4,763 | 2.9375 | 3 | [] | no_license | import json
import csv
import colour
from colour.plotting import *
from typing import Dict, List, Union
from scipy.interpolate import interp1d
DEFAULT_CONFIG = 'default-config.json'
def read_config(filename: str = None) -> Dict:
# has to be flat; values not present in provided config will be substituted with valu... | true |
7d36c8fde0840fa186888482400aa32c04bb08b0 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_75/539.py | UTF-8 | 1,367 | 2.640625 | 3 | [] | no_license | import sys
def input():
args = sys.stdin.readline()[:-1].split(' ')
cursor = 0
combine = {}
if args[cursor] != '0':
cursor += 1
for i in range(0, len(args[cursor]), 3):
triplet = args[cursor][i:i+3]
combine[(triplet[0], triplet[1])] = triplet[2]
combine[(triplet[1], triplet[0])] = triplet[2]
... | true |
68329d6e814e3f1ae93b627392c51aa723a328df | Python | qtvspa/offer | /LeetCode/remove_duplicate_letters.py | UTF-8 | 1,357 | 4.03125 | 4 | [] | no_license | from collections import Counter
# 移除字符串中的重复字母
# https://leetcode-cn.com/problems/remove-duplicate-letters/
# 思路:单调栈 同时需要注意特殊情况
def remove_duplicate_letters(s: str) -> str:
result_stack = []
# 记录每个字母出现的次数
s_counter = Counter(s)
for ss in s:
# 如果该字母已经存在于栈 则不需要入栈
if ss in result_stack:... | true |
3c902691e3ef685120f44022772028a1405ebe38 | Python | deybvagm/CarND-Behavioral-Cloning-P3 | /model_v1.py | UTF-8 | 3,327 | 2.78125 | 3 | [
"MIT"
] | permissive | from scipy import ndimage
import csv
import numpy as np
import cv2
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers.core import Dense, Flatten, Activation
from keras.layers import Lambda, Cropping2D
from keras.layers.convolutional import Convolution2D
from keras.layers.pooling impo... | true |
e73b589dfe10c7d3c8ec22fcad2806f64a32f526 | Python | Ogawa1406/Ogawa1406 | /exercicio16.py | UTF-8 | 171 | 4.125 | 4 | [] | no_license | x=int(input("Digite um número inteiro: "))
x1=x/2
x2=x*2
x3=x**4
print("O valor de X é",x,",sua metade é",x1,",seu dobro é ",x2,"e seu valor elevado à 4 é ",x3) | true |
d6484fcdc206b1b5d41a42f8968bc3f656bd62c9 | Python | drc288/tusa-virus | /app.py | UTF-8 | 2,223 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
"""Init the application"""
from flask import Flask, jsonify, render_template, request
from firebase_admin import credentials, firestore, initialize_app
from models.str_to_number import str_to_num
app = Flask(__name__)
cities = [
"amazonas", "antioquia", "arauca", "atlantico", "bolivar",
"boy... | true |
40c96b10168f806793f51dad0df58ab6c7e4db46 | Python | OzRhodes/Hackerrank | /guessinggame.py | UTF-8 | 492 | 4.375 | 4 | [] | no_license | #guessinggame.py
import random
def guess(guessed_num, answer):
if guessed_num > answer:
response = 'The number is lower.\n'
else:
response = 'The number is higher.\n'
return response
answer = str(random.randint(1,20))
guessed_num = ''
while True:
guessed_num = input('Enter your Guess... | true |
933015569c6d5718bc0bdd6c894d58a4571e5316 | Python | eaniyom/python-challenge-solutions | /Aniyom Ebenezer/Phase 2/JSON/Day_38_Challenge_Solution/Question 8 Solution.py | UTF-8 | 516 | 3.671875 | 4 | [
"MIT"
] | permissive | """
Write a Python program to check whether a JSON string contains complex object or not.
"""
import json
def is_complex_num(object):
if '__complex__' in object:
return complex(object['real'], object['img'])
return object
complex_object = json.loads('{"__complex__": true, "real" : 4, "img" : 5}', object... | true |
d4d8d39bc52a82f0729dc1f97d58a3023aa0dec8 | Python | umd-huang-lab/poison-rl | /code/vpg_ppo/poison_rl/attackers/fgsm_attacker.py | UTF-8 | 2,332 | 2.8125 | 3 | [] | no_license | import sys
import torch
import numpy as np
import math
import random
from gym.spaces import Box, Discrete
def fgsm_attack(image, epsilon, data_grad):
# Collect the element-wise sign of the data gradient
sign_data_grad = data_grad.sign()
# Create the perturbed image by adjusting each pixel of the input ... | true |
26c9537bcb275db6f0ea1d300f540f33519aa01a | Python | jaakko13/Python | /OpenWebsite.py | UTF-8 | 148 | 2.96875 | 3 | [] | no_license | import webbrowser
url = ''
print('Which website would you like to go to?\n')
x = 'https://www.' + input()
webbrowser.open(x)
| true |
60388b49b2e571ce8a13b0974a1ed0b213ade031 | Python | liuweilin17/algorithm | /leetcode/963.py | UTF-8 | 2,515 | 3.5 | 4 | [] | no_license | ###########################################
# Let's Have Some Fun
# File Name: 963.py
# Author: Weilin Liu
# Mail: liuweilin17@qq.com
# Created Time: Sat Dec 29 12:10:38 2018
###########################################
#coding=utf-8
#!/usr/bin/python
import itertools
import collections
class Solution:
# this is fi... | true |
22f548fe5f1724827f542e2bac907d5bc04ebb5e | Python | DeadRigger/Sudoku | /menu.py | UTF-8 | 1,997 | 2.859375 | 3 | [] | no_license | from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.modalview import ModalView
from kivy.uix.label import Label
from kivy.clock import Clock
class Menu(BoxLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.popmen... | true |
79c8d2282c63dd0980efb9ab7400584eadc33e94 | Python | xuanxx/Impala | /tests/util/abfs_util.py | UTF-8 | 3,908 | 2.546875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"bzip2-1.0.6",
"LicenseRef-scancode-ssleay-windows",
"OpenSSL",
"PSF-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-mit-modification-obligations",
"LicenseRef-scancode-google-patent-license-webrtc",
"dtoa",... | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | true |
308e34a06b74be6c2a3677f182090b622c9cb8c5 | Python | candi955/PowerBall-main | /venv/PracticeExcel.py | UTF-8 | 1,997 | 3.390625 | 3 | [] | no_license | # Libraries
import tkinter as tk
from tkinter import *
from tkinter import messagebox as mbox
# Window Tabs Libraries
from tkinter import ttk
from tkinter.scrolledtext import *
from sklearn import svm
from sklearn.metrics import accuracy_score
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selec... | true |
ee9e7ca2ed44d670e3ac4fa1906f73dd9bee2a0d | Python | marco-zangari/code-katas | /src/love_v_friendship.py | UTF-8 | 442 | 3.484375 | 3 | [
"MIT"
] | permissive | """Kata: Love vs Friendship - Place values on alphabet and sum the words
#1 Best Practices Solution acaccia et al.
def words_to_marks(s):
return sum(ord(c)-96 for c in s)
."""
import string
def words_to_marks(s):
"""Turns words to values."""
num = 0
value = dict()
for index, letter in enumerate(st... | true |
7f51ee9e472c64952316d3ca44eab907c4387a87 | Python | r-rai/FSND-Project-Logs-Analysis | /logAnalysis.py | UTF-8 | 3,164 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python2.7
import psycopg2
DATABASE = "news"
# parent function which will call all question functions
def run():
""" Start the reporting tool """
print ""
answer_question_1()
print "\n"
answer_question_2()
print "\n"
answer_question_3()
# function fo... | true |
ad6ea68a36c88f39a407963950ac1ab9e3c820ee | Python | andrefcordeiro/Aprendendo-Python | /Uri/strings/1551.py | UTF-8 | 568 | 3.84375 | 4 | [] | no_license | # Frase Completa
n = int(input())
for i in range(0, n):
letras = []
for j in range(0, 26):
letras.append(False)
string = input()
for j in range(0, len(string)):
if 97 <= ord(string[j]) <= 122 and letras[ord(string[j]) - 97] is False:
letras[ord(string[j]) - 97] = True;
... | true |
ef0ef0578de7881ea7f6f56c4e2d605c12e14826 | Python | 920630yzx/machine-learning | /python数据分析/python数据分析课程/6.1 KNN近邻算法.py | UTF-8 | 2,912 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
对应jupyter:10.knn
"""
import numpy as np
import matplotlib.pyplot as plt
img = plt.imread('G:/数据分析--腾讯视频网络班/day10 KNN/066-KNN原理回归与分类/4.png')
plt.imshow(img)
'''1.近邻算法---用于分类KNeighborsClassifier'''
# 导入机器学习的包
from sklearn.neighbors import KNeighborsClassifier,KNeighborsRegressor
import panda... | true |