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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
135fb5dedb384679ae8a1fa30f16f328bfd211a5 | Python | pangfeiyo/PythonLearn | /Python从入门到项目实践/第3章 Python输入与输出/3.1 基本输入和输出/输出当前年月日.py | UTF-8 | 217 | 3.234375 | 3 | [] | no_license | import datetime
print("当前年份:" + str(datetime.datetime.now().year)) # 输出当前年份
# 输出当前日期和时间
print("当前日期时间:" + datetime.datetime.now().
strftime('%y-%m-%d %H:%M:%S')) | true |
fa89607c243cac60fd502af8cb9ef40e5febe8af | Python | mdelcambre/py-geothmetic-meandian | /src/geothmetic_meandian/__init__.py | UTF-8 | 1,900 | 4.125 | 4 | [
"Apache-2.0"
] | permissive | """Geothmetic meandian for when you don't know which average you want.
Provides the geothmetic meandian as described in XKCD #2435
https://xkcd.com/2435/.
"""
from numbers import Number
from statistics import mean, median
from typing import Iterable, Tuple
try:
from statistics import geometric_mean
except Impor... | true |
726b98f982e91c582236e7f18810f05344918d43 | Python | cypecial/Python-Paint | /Paint Prep/drawing Images1.py | UTF-8 | 274 | 3.015625 | 3 | [] | no_license | from pygame import *
screen = display.set_mode((800,600))
forestPic = image.load("images/forest.jpg")
screen.blit(forestPic,(0,0))
running =True
while running:
for e in event.get():
if e.type == QUIT:
running = False
display.flip()
quit()
| true |
a6e3bc5c2235a78c86ab92f3aa78ad59ba749b72 | Python | EricTyrrell18/NFL_Crawler | /nfl_crawler/spiders/teambot.py | UTF-8 | 1,133 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import itertools
from nfl_crawler.items import NflPlayerURLItem
class TeambotSpider(scrapy.Spider):
name = 'teambot'
allowed_domains = ['nfl.com']
team_profiles = ["NE", "NYG", "MIN", "PHI", "NYJ", "DAL", "GB", "OAK", "KC", "ATL",
"LA", "HOU", "JAX", "CLE", ... | true |
667750542ea6b7c9048b5232633d1c29ff49d902 | Python | DayaneMoises/CursoEmVideoPython | /ex056-RespostaProf.py | UTF-8 | 837 | 3.578125 | 4 | [] | no_license | somaIdade = 0
médiaIdade = 0
maiorIdadeDeHomem = 0
nomeVelho = ''
totalMulher20 = 0
for p in range(1, 5):
print('=*=*=*=*=* ª{} pessoa *=*=*=*=*='.format(p))
nome = str(input('Nome: ')).capitalize()
idade = int(input('Idade: '))
sexo = str(input('Sexo [F ou M]: '))
somaIdade += idade
if p == 1 a... | true |
f14e2c7363a7e2b75c1bd459683c49a1a185a6ad | Python | realkris/traffic-accident-detection | /script/Central_offset.py | UTF-8 | 1,512 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from ctypes import *
import numpy as np
import time
import math
class Point(object):
x = 0
y = 0
def __init__(self, x=0, y=0):
self.x = x
self.y = y
#判断每个目标的停留时间,每判断一次消耗1us
def Central_offset(p1,p2,img_width):
'''
:param p1: 当前帧轨迹点
:pa... | true |
9a27ae70f566135da9d1d25faede47d7c5ef1cd9 | Python | 0xd0ug/shonetsurfcom | /loaders.py | UTF-8 | 464 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | def loadnmapservices():
fileName = '/usr/local/share/nmap/nmap-services' # Replace with path on your system
with open(fileName) as f:
lines = f.readlines()
f.close()
servicelist = {}
for line in lines:
if line[0] != '#':
servname = line.split('\t')[0]
if ... | true |
ba7a2c74d2ede218f44307fabc191f694cb040c6 | Python | Mubroc/python_rep | /python/Udemy/objinh.py | UTF-8 | 556 | 3.421875 | 3 | [] | no_license | class user:
def __init__(self, fname, lname):
self.__fname = fname
self.__lname = lname
def get_full_name(self):
return self.__fname + " " + self.__lname
def user_login(self, username):
print("Access Granted")
def user_work(self):
print(self.__fname + " is work... | true |
a6795e2bf3b66cb97dc1abe666a36e7fef17ce42 | Python | MMPavia/Micromegas | /Micromegas/ParticleCounter/particle_counter_plotter.py | UTF-8 | 2,982 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
import os
import math
from ROOT import *
import datetime
now = datetime.datetime.now()
data = []
finish = []
class DataInfo:
def __init__(self, PathFile):
File = open(PathFile,"r")
lines = File.readlines()
File.close()
finish.append(len(data))
for i in... | true |
74671a065cf86ca34c8ac6d62471b1d1729cfd0c | Python | d00914065/Data-analysis-on-Taobao-users | /淘宝用户行为分析.py | UTF-8 | 5,748 | 3.21875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import re
data=pd.read_csv('tianchi.csv')
#data.isnull().sum()
#拆分数据集,将时间分开
data['date']=data['time'].map(lambda s: re.compile(' ').split(s)[0])
data['hour']=data['time'].map(lambda s: re.compile(' ').split(s)[1])
... | true |
9806b4e41c7eb1211200bfdce3b7e87aadda5382 | Python | fagan2888/ML-Sandbox | /wine/1_wine_ml.py | UTF-8 | 954 | 2.84375 | 3 | [
"MIT"
] | permissive | import numpy as np
from sklearn import preprocessing, cross_validation, neighbors
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df = pd.read_csv('wine.csv')
print(df.shape)
X=np.array(df.drop(['Class'], 1))
y=np.array(df['Class'])
i... | true |
3eb63022404a11f4c7e4d567f7d0dd4b8e70050a | Python | avirois/Knowledge4S | /modules/selection.py | UTF-8 | 12,955 | 3.234375 | 3 | [
"WTFPL"
] | permissive | """Seclection module to handle search page selection options."""
import sqlite3
from typing import Any
DEFAULT = ("all", "select")
class Option:
"""Option hold data about this connection and its connection."""
def __init__(self, name: str, selection_type: str):
"""Seclection_type can be {institution... | true |
c3c209e021676f764f04a3fdeadc61dcf7d8755d | Python | dwdjsy89/cc_tools | /part_2_read_test_json.py | UTF-8 | 2,114 | 3.71875 | 4 | [
"MIT"
] | permissive | import test_data
import json
# Creates and returns a GameLibrary object(defined in test_data) from loaded json_data
def make_game_library_from_json(json_data):
# Initialize a new GameLibrary
game_library = []
#game_library = test_data.GameLibrary()
### Begin Add Code Here ###
class platfor... | true |
143d8a47a1309b5c846f6e8be97e64c811753778 | Python | Evil2S/telegram-youtube-notifier | /src/bot/requester.py | UTF-8 | 1,106 | 2.765625 | 3 | [
"MIT"
] | permissive | import requests
from src.settings import CALLBACK_URL
from src.bot import logger
def subscribe_in_pubsubhubbub(channel_id: str) -> int:
"""The subscription request to find out when a new video arrives on a
specific channel is made from this function. Basically here the
necessary data for this activity is ... | true |
174f2aecfa8bc4b75470ff70243f525317fd3cb8 | Python | HandyCodeJob/django-shopify-sync | /shopify_sync/tests/test_product_tags.py | UTF-8 | 3,978 | 2.859375 | 3 | [] | no_license | from unittest import TestCase
from ..models import Product
class ProductTagBaseCase(TestCase):
def setUp(self):
self.single_tag = "Car"
self.multi_tag = ["Boat", "Duck"]
self.multi_tag_str = ", ".join(self.multi_tag)
self.prod_tags = "New, Old"
self.prod_tag = "Green"
... | true |
2c868c403e6679e29fb122d6d84f9b3e43b87bc1 | Python | cyhap/ENPM809T_GrandChallenge | /hw6/gripperTimeLapse.py | UTF-8 | 1,092 | 2.71875 | 3 | [] | no_license | # HW 6 Gripper Time Lapse Video
import time
import os
import sys
import cv2
import glob
sys.path.insert(0, '/home/pi/enpm809T/gripper_toolbox/')
import gripper as grip
# create a unique folder to store images in
today = time.strftime("%Y%m%d-%H%M%S")
print(today)
os.system("sudo mkdir " + today)
# define the codec an... | true |
3d1ccf4c153defe2c863f80a5904240b38387a09 | Python | pi408637535/Study_TF2.0 | /com/study/tf/demo/back_propagation.py | UTF-8 | 1,279 | 2.609375 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras import datasets
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = '2'
(x,y),_ = datasets.mnist.load_data()
x = tf.convert_to_tensor(x, dtype=tf.float32)
y = tf.convert_to_tensor(y, dtype=tf.int32)
train_db = tf.data.Dataset.from_tensor_slices((x,y) ).batch(32)
w1 = tf.Vari... | true |
79be399ab186a41973dde2199b02313f7b229e4b | Python | FireFeathers06/BasicDiscordBot | /Basic Functions.py | UTF-8 | 1,252 | 2.84375 | 3 | [] | no_license | import discord
from discord.ext import commands
# Set bot prefix (! here)
client = commands.Bot(command_prefix="!")
# Will work when !repeat is followed by a sentence
@client.command(aliases=['repeat'])
async def repeat(ctx, *, sentence):
await ctx.send(f"\"{sentence}\"")
# Will kick the member and give a reason if... | true |
203769dc9fa935f473e365d2194b5fbdf89037c2 | Python | BWH-Lichterfeld-Lab/Intactness-Pipeline | /intactness/blast.py | UTF-8 | 11,120 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Various alignment utilities
"""
import logging
import sys
from math import inf
from .utils import run_cmd
# pylint: disable=C0103
# Invalid constant name
logger = logging.getLogger('pipe.blast')
class BlastHit:
"""Blast Hit.
Attributes
----------
qlen: int
query... | true |
822461491850b06f26ef013919f218b4121c3de8 | Python | Tikotik/MarriageBot | /external_website/oauth.py | UTF-8 | 2,703 | 2.640625 | 3 | [] | no_license | import requests
from urllib.parse import urlencode
from user import User
from discord import Permissions
from guild import Guild
class Oauth(object):
def __init__(self, *, client_id:str=None, client_secret:str=None):
self.redirect_uri = "http://mb.callumb.co.uk:5000/login"
self.scopes = "identify... | true |
292f4b42daf8fe267d1a926fc7332c080b93b18b | Python | dorajam/Algorithmic-problems | /Metaclasses/superExample.py | UTF-8 | 1,052 | 4 | 4 | [] | no_license | # Dora Jambor
# Multiple inheritence and super()
print '-------------------------- SINGLE INHERITENCE -----------------------------'
#
class A(object):
def __init__(self):
print "We are in A"
self.x = 5
print self.x
class B(A):
def __init__(self):
print "We are in B"
self.x = 6
print self.x
super(B... | true |
f66ef0987f914dfae6b89f16be7a46e199432fed | Python | deepakdashcode/myPy | /own_linspace.py | UTF-8 | 251 | 3.34375 | 3 | [] | no_license | def lin(start,end,noOfValues):
noOfValues=noOfValues-2
diff=(end-start)/(noOfValues+1)
newList=[start]
for i in range(1,noOfValues+1):
newList.append(start+(i*diff))
newList.append(end)
return newList
print(lin(1,8,5)) | true |
09dfa9c69432705ba2680ea64b77cd899263f3f8 | Python | eiennohito/lang-model-tensorflow | /language_model.py | UTF-8 | 14,824 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import argparse
import os, sys
import time
class Vocabulary(object):
def __init__(self, args):
self.filename = args.vocab_file
with open(self.filename, encoding='utf-8') as fin:
header = fin.readline() # ignore header
self.lines =... | true |
933a79f3073b8d37d7d6140ccbd8c78cf4e30956 | Python | astraldawn/pylps | /pylps_helper/command_line.py | UTF-8 | 1,004 | 2.703125 | 3 | [
"MIT"
] | permissive | import argparse
import os
import subprocess
from tempfile import NamedTemporaryFile
from pylps_helper.parser import PARSER
def main():
parser = argparse.ArgumentParser()
parser.add_argument("files", nargs="*", help='pylps files')
args = parser.parse_args()
for file in args.files:
program = ... | true |
6cb2723f5b4aa4ca453daf980ba5b5a46f300fa0 | Python | shiva-marupakula/Student-Management-System | /src/main/webapp/python/unit2/sets/myset2.py | UTF-8 | 280 | 2.90625 | 3 | [] | no_license | myset={1,'shiva',1,2,3,4}
.add('shivamarupakula')
b.update([1,2,3,4,511,22,33,4,4,3],('shivasai','rgukt'))
print(myset)
a={11,22,33,223,511}
print(a|b,'is a union b')
print(a&b,'intersection of a and b')
print(a-b,'is difference of a and b')
print(a^b,'is symmetric difference')
| true |
5d221912e6d4bec87739b685110aa3c746fc59d9 | Python | arjunkavungal/hello-world | /milanesepneumonia.py | UTF-8 | 353 | 2.8125 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('/kaggle/input/covid19-patient-precondition-dataset/covid.csv')
df.loc[df['date_died'] == '9999-99-99', 'death'] = 'False'
df.loc[df['date_died'] != '9999-99-99', 'death'] = 'True'
from sklearn.cluster import KMeans
X = df[['age','obesity']]
y = df['death']
kmeans = KMeans(n_clus... | true |
bbed937adc4c3c7c4619694af93ae09aea54c65e | Python | Yashwardhankaul/Young-MCbot | /youngMc.py | UTF-8 | 403 | 2.859375 | 3 | [
"MIT"
] | permissive | from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
chatbot = ChatBot("Ron Obvious")
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"You're welcome."
]
trainer = ListTrainer(chatbot)
trainer.tr... | true |
8fe28884609f1cd95401053f75ed6003569df8ab | Python | nikhiilll/Algorithms-using-Python | /Dynamic Programming/LeetCode/MinimumCostForTickets_983.py | UTF-8 | 445 | 3.4375 | 3 | [] | no_license | def minimumCostForTickets(days, costs):
costArray = [0 for i in range(days[-1] + 1)]
for i in range(1, days[-1] + 1):
if i not in days:
costArray[i] = costArray[i - 1]
else:
costArray[i] = min(costArray[max(0, i - 1)] + costs[0], costArray[max(0, i - 7)] + costs[1], co... | true |
6e961f8fd51570b6ef99b5fe66c1c82e61ae8864 | Python | leonhard-s/auraxium | /auraxium/models/_character.py | UTF-8 | 9,860 | 2.65625 | 3 | [
"MIT"
] | permissive | """Data classes for :mod:`auraxium.ps2._character`."""
from typing import Optional
from .base import RESTPayload
from ..types import LocaleData
from .._support import deprecated
__all__ = [
'CharacterAchievement',
'CharacterData',
'CharacterDirective',
'TitleData'
]
class CharacterAchievement(RESTP... | true |
23d8286f3135e8bf2229da58974e5c924306024f | Python | viniciusbarros/commandLineGamePython | /main.py | UTF-8 | 1,377 | 3.40625 | 3 | [] | no_license | from char import Char
from tinydb import TinyDB, Query
from useful import ColourPrint
from useful import GenericMenu
import os
import json
class Game:
logged_in = False
menu_options = {
'login': 'Do login',
'quit': 'Quit game'
}
char = None
def __init__(self):
self.db = Ti... | true |
4c142553a011db61d1b09ebed4b1613916ccff68 | Python | bharding512/airglowrsss | /Python/modules/GEONET.py | UTF-8 | 11,339 | 2.65625 | 3 | [] | no_license | import pandas as pd
import MySQLdb as mdb
import pandas.io.sql as psql
import calendar
from datetime import datetime, timedelta
from matplotlib import dates
hostname = 'airglow.ece.illinois.edu'
def get_rx_data(rxID, tstart, tstop):
'''
Query the GEONET database for data from a receiver in a certain time span... | true |
2608fb2fba3cba68b2250a1934990dc126d9655b | Python | RahimBangla/ISCPC-2019 | /Solutions/Group/istiak-and-rabit.py | UTF-8 | 184 | 3.15625 | 3 | [] | no_license | t = int(input())
i = 0
z = 0
while t > i:
g = input()
a, r, n = map(int, g.split())
i += 1
while n > 0:
z += (a*r**(n-1))
n -= 1
print(z)
z = 0
| true |
bb97d8a3e319cfa4f775f5934306bf3607928885 | Python | pradyumnac26/Geeks-For-Geeks | /missing number in array.py | UTF-8 | 189 | 2.546875 | 3 | [] | no_license | n= int(input())
a =list(map(int, input().split()))
m = len(a)+1
sum= (m*(m+1))//2
s=0
for i in a:
s=s+i
mn=sum-s
print(mn)
t=t-1
| true |
d6cb8a522aa524f9f56e63df3da42dbca11a9682 | Python | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/edabit/_Edabit-Solutions-master/Count Palindrome Numbers in a Range/solution.py | UTF-8 | 270 | 3.96875 | 4 | [] | no_license | def ispalindrome(num):
str1 = str(num)
rev_str = str1[::-1]
return str1 == rev_str
def count_palindromes(num1, num2):
output = 0
while num1 <= num2:
if ispalindrome(num1) == True:
output += 1
num1 += 1
return output
| true |
7091283b080ee43537c03187194c01c0e3598bbb | Python | awani216/VoiceRecognition | /Codes/dataCleaning.py | UTF-8 | 513 | 2.765625 | 3 | [] | no_license | # Removed few unwanted columns and replaced NaN with column mean
import pandas as pd
import numpy as np
import csv
from six.moves import cPickle as pickle
path = r"../DataSet/voice"
dest_path = r"../DataSet/Clean DataSet/voice"
data = pd.read_csv(path+".csv")
data.fillna(data.mean())
data.to_csv(dest_path +".csv", ... | true |
e221142769c52553c5f65da807e59cea2214b120 | Python | Kito-vini/curso-python | /Meus projetos/Calculadora de média/calc-media.py | UTF-8 | 1,933 | 3.375 | 3 | [] | no_license | import PySimpleGUI as sg
# Criando as janelas e layouts
def janelaApresentacao():
sg.theme('BlueMono')
layout = [
[sg.Text('Calculadora de média escolar'), sg.Text(' '), sg.Text('Program by Kito-Vini')],
[sg.Text('Digite seu nome:')],
[sg.Input(key='nome')],
[sg.Button('Co... | true |
6f4a4423b5f7b9c8ee11357ec553f97bd67a2bc6 | Python | pombreda/tangled | /protocols/base.py | UTF-8 | 1,012 | 2.578125 | 3 | [
"MIT"
] | permissive | class ProtocolBase(object):
def __init__(self, transport):
self.transport = transport
self.reactor = self.transport.reactor
class StreamProtocol(ProtocolBase):
def send(self, data):
self.transport.write(data)
def close(self):
self.transport.close()
# events
def err... | true |
4433cf8a997f2aa58ff0583e106754c6b689f500 | Python | sbsreedh/Trees-2 | /sumNumbers.py | UTF-8 | 1,557 | 3.671875 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
#Time Complexity:O(N)
#Space Complexity:O(h),h is the height of the binary tree
#Did it run successfully on Leetcode:Yes
#Here I... | true |
08c82d53741e2fcd1d2cf2877c934b173c309ccb | Python | bsloan/gol | /gol.py | UTF-8 | 3,197 | 3.484375 | 3 | [] | no_license | import curses
from collections import defaultdict
class Game:
def __init__(self, screen):
self.screen = screen
self.h, self.w = self.screen.getmaxyx()
self.h -= 1 # -1 accounts for the border column/row
self.w -= 1
self.state = defaultdict(int)
def render(self):
... | true |
66beb8124f5272aa7b5a16f909fddaf8473fa044 | Python | albcab/optiver | /data.py | UTF-8 | 5,411 | 2.921875 | 3 | [] | no_license | """Data processing and preprocessing"""
import pandas as pd
import numpy as np
from itertools import combinations
from .utils import log_return, realized_volatility
def build_log_return(book_file, unique_times, tot_sec=600):
"""Build train for Gaussian processes on log returns"""
stock_id = book_file.split(... | true |
c00f60aab666a834e3965fb841274ce223b452bd | Python | nanakjaswani/Codewayy_Python_Series | /Python-Task3/task3_prg3.py | UTF-8 | 271 | 3.78125 | 4 | [] | no_license | #using for loop
for num in range(1,11):
if(num == 3 or num == 7):
continue
print(num)
print("\n")
#using while loop
num = 1
while(num!=11):
if(num==3 or num==7):
num=num+1
else:
print(num)
num=num+1
| true |
14941424509f70126df5219b90237daa52cfcbc6 | Python | migcanedo/Avanzometro | /apps/carga/views.py | UTF-8 | 11,665 | 2.609375 | 3 | [] | no_license | import csv
from django.shortcuts import render, redirect
from apps.registro.models import *
from apps.carga.models import *
from .forms import DocumentForm
from django.contrib.auth.decorators import login_required
from django.contrib import messages
def comprobar_entero(dato):
try:
if int(dato) >= 0:
... | true |
1c72a6e9a388907d97bf3f1a215156d5bb77fecc | Python | tiansiyuan/misc | /thinkpython/exer4.3.py | UTF-8 | 1,031 | 3.15625 | 3 | [] | no_license | from swampy.TurtleWorld import *
import math
world = TurtleWorld()
n = 60
def square(t, length):
for i in range(4):
fd(t, length)
lt(t)
def polygon(t, length, n):
for i in range(n):
fd(t, length)
lt(t, 360/n)
def circle(t, r):
n = 60
circumference = math.pi * 2 * r
... | true |
48dccbeebc97c71242d096113170601a37991450 | Python | alexryndin/algrorithms_and_data_structures_stepik | /5.py | UTF-8 | 570 | 2.9375 | 3 | [] | no_license | #!/bin/python
import sys
from collections import deque
def main():
input()
data = list(map(int, input().split(" ")))
m = int(input())
q = deque()
q.append(data[0])
for i in range(1, m):
while q and data[i] > q[0]:
q.popleft()
q.appendleft(data[i])
print(q[-1])
... | true |
b4f1402bff7cb373160e708ceadefef5b63d0547 | Python | JCSDA/saber | /tools/saber_code_history.py | UTF-8 | 1,081 | 3 | 3 | [
"Apache-2.0",
"CECILL-2.0",
"CECILL-C"
] | permissive | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from matplotlib import dates as mpl_dates
# Read data
data = np.loadtxt("history.txt", dtype=int)
# Split columns
date = []
for i in range(0, data.shape[0]):
date.append(datetime(data[i,0], data[i,1], data[i,2]... | true |
17b1f8d1b7048937fa06608a0cb42557d516c639 | Python | realdyarr/progress | /progress.py | UTF-8 | 168 | 2.984375 | 3 | [] | no_license | from tqdm import tqdm
import time
prog_list = [1,2,3,4] #---> the progress will be longer or shorter by the number of list
for pro in tqdm(prog_list):
time.sleep(1)
| true |
3769f15dccdc42fc2aba6d9c0e87ff87afaaa239 | Python | norashipp/ugali | /ugali/utils/stats.py | UTF-8 | 5,266 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import numpy
import numpy as np
import scipy.special
_alpha = 0.32
def interval(best,lo=np.nan,hi=np.nan):
"""
Pythonized interval for easy output to yaml
"""
return [float(best),[float(lo),float(hi)]]
def mean_interval(data, alpha=_alpha):
"""
Interval assuming gaussia... | true |
140faa740f9a491c35b78e915857b50f23331f36 | Python | glennneiger/magicmirror | /python scripts/motion_sensor_updated.py | UTF-8 | 2,121 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
import os
import glob
import serial
import subprocess
from subprocess import Popen, PIPE, STDOUT
GPIO.setmode(GPIO.BOARD)
LED_OUT = 10
MOTION_IN = 8
device_file = ""
def initialize_all():
#ser = serial.Serial('/dev/ttyACM0',... | true |
071ddd23aff5d428a12078a0d92441a1783ff31f | Python | bbjoony/python_game | /theater_module.py | UTF-8 | 333 | 3.609375 | 4 | [] | no_license | def price(people):
print("{0}명 가격은 {1}원 입니다.".format(people, people *10000))
def price_morning(people):
print("{0}명 조조할인 가격은 {1}원 입니다.".format(people, people *6000))
def price_soldier(people):
print("{0}명 군인할인 가격은 {1}원 입니다.".format(people, people *4000))
| true |
4fef41a76e8c8093fb900da348ab99cab7848dc5 | Python | akladiev/testrepo | /.github/actions/get_affected_components_action/get_merged_component_config.py | UTF-8 | 2,723 | 2.765625 | 3 | [] | no_license | import argparse
import logging
import os
import yaml
import json
def init_logger():
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)s %(levelname)s %(message)s',
datefmt='%m-%d-%Y %H:%M:%S')
def make_parser() -> argparse.ArgumentParser:
pars... | true |
f49694dd48727530c5bdda0482d9e63558015aa5 | Python | charlesfeng/euler.py | /002.py | UTF-8 | 361 | 3.234375 | 3 | [
"MIT"
] | permissive | # project euler: problem 2 (http://projecteuler.net/problem=2)
# (c) 2013 charles feng (https://github.com/charlesfeng)
# shared under the mit license (http://www.opensource.org/licenses/mit)
i, j, n = 1, 2, 0
while i < 4000000:
n += (0 if i % 2 else i) + (0 if j > 4000000 or j % 2 else j)
i, j = i + j, i + 2 * ... | true |
170ce81adf7af2beac3f2ca1c8c8ac5b5a3b4938 | Python | tamaramansi/python-homeworks-solution | /HW code/HW6.py | UTF-8 | 1,657 | 4 | 4 | [] | no_license | #HW1 Grade
def grade(mark):
if(mark<50):
return"F"
if (mark>=50 and mark <65):
return"D"
if (mark>=65 and mark <80):
return"C"
if (mark>=80 and mark <90):
return"B"
if (mark>=90):
return"A"
Grade= grade(87)
Grade1= grade(60)
Grade2= grade(95)
Grade3= grade(40... | true |
692a532e07ff1a219186bc0013179b3514c60533 | Python | callmeliuchu/codeGitBook | /kaggle/bagofwords/bagofwords2.py | UTF-8 | 1,944 | 2.796875 | 3 | [] | no_license | import pandas as pd
from bs4 import BeautifulSoup
import nltk.data
import re
import logging
from gensim.models import word2vec
path = "F:/codeGitBook/kaggle/bagofwords/"
train = pd.read_csv(path+"labeledTrainData.tsv",
header=0,delimiter="\t",quoting=3)
test = pd.read_csv(path+"testData.tsv",
header=0,delimi... | true |
c5ee305f53e9a94b18451173771405c95ca71502 | Python | dmbjzhh/python | /book_DataStructureAndAlgorithms/chap6_5_tree.py | UTF-8 | 928 | 3.515625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
class SubtreeIndexError(ValueError):
pass
def Tree(data, *subtrees):
l = [data]
l.extend(subtrees)
return l
def is_empty_Tree(tree):
return tree is None
def root(tree):
return tree[0]
def subtree(treem, i):
if i < 1 or i > len(tree):
raise SubtreeIndexErro... | true |
cd46a104253d43e93c8d6f4a05debfde8747a18a | Python | Larionov0/GroupA_Lessons | /Files/WRITE/1.py | UTF-8 | 138 | 2.75 | 3 | [] | no_license | file = open('file1.txt', 'wt', encoding='utf-8')
file.write('Привіт, світ!\n')
file.write('Пока, світ!')
file.close()
| true |
981b8e9141946aff0757931fb25e5d5ab1fe9933 | Python | Santiago367/Pia-Jose-Santiago-Pena-Dimas-GPO23 | /curso_tema_video.py | UTF-8 | 1,200 | 2.875 | 3 | [] | no_license | class Tema_video:
def __init__(self, id_CTV = 1, id_CT = 1, id_video = 1):
self.__id_CTV = id_CTV
self.__id_CT = id_CT
self.__id_video = id_video
@property
def id_CTV(self):
return self.__id_CTV
@property
def id_CT(self):
return self.__id_CT
... | true |
04830fd8331e38ccae4ed329d30dc3dd5b1d3e3b | Python | nacii/python_spider | /fetch-data copy.py | UTF-8 | 2,746 | 2.9375 | 3 | [] | no_license | # -*-coding:utf-8 -*-
import re
import urllib
from urllib import request as urllib2
import requests
from bs4 import BeautifulSoup
import pandas
# 读取excel表格
# filepath = 'C:/Users/xia.yan/Desktop/Chemical/k02.xlsx'
# sheet1 = "Sheet1"
# data = pandas.read_excel(filepath,sheet_name = sheet1)
#print(data)
... | true |
e95064ec87ed8ce0cc5253edc04c5b1cb5df8d06 | Python | prantostic/HackerRank | /Regex/Applications/Split Number/Solution.py | UTF-8 | 267 | 3.09375 | 3 | [] | no_license | import re
regex = r'(\d{1,3})(-| )(\d{1,3})(-| )(\d{4,10})'
pattern = re.compile(regex)
n = int(input())
for i in range(n):
m = pattern.match(input())
if m:
print('CountryCode='+m.group(1), 'LocalAreaCode='+m.group(3), 'Number='+m.group(5), sep=',')
| true |
5f489e219d5b00a176b401830693bc7cdc8ad790 | Python | olegprotsailo/olegprotsailo | /alien.py | UTF-8 | 779 | 2.828125 | 3 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Alien(Sprite):
def __init__(self,game_settings,screen):
super().__init__()
self.screen=screen
self.game_settings=game_settings
self.image=pygame.image.load("images/alien.png")
self.image = pygame.transform.scale(self.image,... | true |
8350297eb03e5e1fb1ed5a6091c0be0a9e94be7d | Python | Sindi1982/glue-jupyter | /glue_jupyter/bqplot/image/state.py | UTF-8 | 3,486 | 2.71875 | 3 | [] | no_license | import numpy as np
from echo import CallbackProperty
from glue.viewers.matplotlib.state import (DeferredDrawCallbackProperty as DDCProperty,
DeferredDrawSelectionCallbackProperty as DDSCProperty)
from glue.viewers.image.state import ImageLayerState
from glue.core.state_objec... | true |
7545f35d048b7dcc905fa9930e691e52e6f95270 | Python | baronabramowitz/python_code | /tests/bond_class_tests.py | UTF-8 | 3,568 | 2.8125 | 3 | [] | no_license | __author__ = 'Baron Abramowitz'
__maintainer__ = 'Baron Abramowitz'
__email__ = 'baron.abramowitz@yahoo.com'
__date__ = '06/10/2016'
import unittest
import sys
sys.path.append('/Users/baronabramowitz/Desktop/python_code/bond_functions')
from bond_class import Bond
class TestSuiteBondCode(unittest.TestCase):
"""L... | true |
50800c4f0bb0d5cab8908ad390ad68748b7bf73d | Python | jbenito/Dragonfire | /dragonfire/learn.py | UTF-8 | 3,729 | 2.609375 | 3 | [
"MIT"
] | permissive | import sys
import contextlib
import cStringIO
from random import randint
import collections
import pkg_resources
from lxml import etree
import re
from tinydb import TinyDB, Query
from os.path import expanduser
class Aiml():
def __init__(self):
self.replacements = collections.OrderedDict()
self.replacements["I'M"... | true |
200d4b9ec2c90deea0799c1b2dddc1848bbea2ac | Python | yjqiang/bili_utils | /fetch_roomids/refresh_rooms_hub/printer.py | UTF-8 | 2,248 | 2.859375 | 3 | [] | no_license | import sys
import time
from typing import Optional
class BiliLogger:
# 格式化数据
@staticmethod
def format(
*objects,
extra_info: Optional[str] = None,
need_timestamp: bool = True):
timestamp = time.strftime("[%Y-%m-%d %H:%M:%S]", time.localtime()... | true |
ba6d4d284788877286b807ca7a86e41a41da0693 | Python | myhaa/leetcode | /leetcodeTemp/leetcode/editor/cn/[22]括号生成.py | UTF-8 | 1,278 | 3.515625 | 4 | [] | no_license | # date: 2021-03-17 23:08:09
# 数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合。
#
#
#
# 示例 1:
#
#
# 输入:n = 3
# 输出:["((()))","(()())","(())()","()(())","()()()"]
#
#
# 示例 2:
#
#
# 输入:n = 1
# 输出:["()"]
#
#
#
#
# 提示:
#
#
# 1 <= n <= 8
#
# Related Topics 字符串 回溯算法
# 👍 1639 👎 0
# leetcode submit region begin(Prohibi... | true |
f8b39ed9832f761e7a7af5ceb44be31cee79b96e | Python | Jake-LJH/pythonflask | /flask-firstApp/model/furniture.py | UTF-8 | 495 | 2.65625 | 3 | [] | no_license | from model.DatabasePool import DatabasePool
class Furniture:
@classmethod
def getFurnitureByCat(cls,catid):
dbConn=DatabasePool.getConnection()
cursor = dbConn.cursor(dictionary=True)
sql="SELECT c.cat_id, cat_name, f.description, dimension, images, it_id, item_code, name, price, quant... | true |
7008347193660d298276c8979878f8ab8874ffb5 | Python | janfreyberg/superintendent | /src/superintendent/__init__.py | UTF-8 | 15,653 | 2.703125 | 3 | [
"MIT"
] | permissive | """Interactive machine learning supervision."""
import time
import warnings
from collections import OrderedDict, defaultdict
from contextlib import contextmanager
from typing import Any, Callable, Dict, Optional
import codetiming
import ipywidgets as widgets
import numpy as np
import sklearn.model_selection
from sklea... | true |
5454acfcff14796fee6b37228cd456941ec89718 | Python | redabna/TOFA7A_THEGAME | /comet_event.py | UTF-8 | 883 | 3.1875 | 3 | [] | no_license | import pygame
from comet import Comet
# creer classe pour gerer cet evenement
class CometFallEvent:
# lores du chargement -> créer un compteur
def __init__(self, game):
self.percent = 0
self.percentspeed = 10
self.game = game
# groupe de sprite
self.al... | true |
dc91fcf00445a5206f1a14dc80de37b55c201309 | Python | AndreasKappus/Djikstra_and_max-flow | /Djikstra.py | UTF-8 | 11,478 | 3.25 | 3 | [] | no_license | infinity = 100000
invalid_node = -1
class Node:
previous = invalid_node
distfromsource = infinity
visited = False
class Dijkstra:
def __init__(self):
'''initialise the class'''
self.startnode = 0
self.endnode = 0
self.network = []
self.network_po... | true |
95cf3f900e147e88aafceb5de442fa427ce1af9d | Python | kategerasimenko/hse-ling-algorithms | /students/Zelenkova_Lera/02/8_lru.py | UTF-8 | 1,889 | 3.296875 | 3 | [] | no_license | class LRUCache(object):
def __init__(self, capacity):
self.diction = dict()
head = Node('head', 'head')
tail = Node('tail', 'tail', prev=head)
head.next = tail
self.linklist = LinkedList(head, tail)
self.capacity = capacity
def get(self, key):
if key in s... | true |
9d8e14c9e1f257f9e3d65247b5306dfa6983bb30 | Python | jbuoni/MosaicPython | /mosaic.py | UTF-8 | 11,533 | 2.984375 | 3 | [] | no_license | # mosaic.py
# Jason Buoni
# jason.buoni@gatech.edu
import image_utils as utils
import math
import cv2
import sys
import numpy as np
import json
"""
Make these global to allow for repeating with more of a range.
If these were not global, we would see more repeated images.
"""
patchimages = []
patchimages_copy =... | true |
8ff8911c99c0978ceb9b4aa5f90f9e438de4f90e | Python | alexandraback/datacollection | /solutions_5686275109552128_0/Python/hero777/test_2s.py | UTF-8 | 638 | 2.921875 | 3 | [] | no_license | import math
f = open('a.txt','r')
f0 = open('output2.txt','w')
a0 = [int(x) for x in f.readline().split()]
for index in range (0,a0[0]):
print(str(index)+'yahoo')
x = [int(x) for x in f.readline().split()]
y = [int(y) for y in f.readline().split()]
y1 = list(y)
z = int(math.ceil(math.sqrt(float(sum(y)))))
count =... | true |
916b5b8d4213792b0de8b4fe9896ab9d65d29253 | Python | tobycrisford/forestrygrantclaim | /optimize.py | UTF-8 | 3,493 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 16:48:11 2019
@author: Toby
"""
import scipy.optimize
import scipy.linalg
def constraints(species, percentage, minimum):
r = [percentage for i in range(0, totalspecies)]
for tree in species:
r[speciesdict[tree]] = percentage - 1
if not minim... | true |
2adb2d27ffe5491effb80e1186c6d5d2e790b38e | Python | shenyong1/chandao_test | /test_case/ttest.py | UTF-8 | 189 | 3 | 3 | [] | no_license | # -*- coding:utf-8 -*-
iterable = [1,2,33,'dfssa','呵呵',324]
# [print(iter_var) for iter_var in iterable]
def add(x):
return x*x
res = list(map(add,map(add,[10,2])))
print(res)
| true |
51c3c1c7249a9421d706137363ce94ad59b63861 | Python | pyp2019/appium_Android_python | /appium--登录模块/pages/register_page.py | UTF-8 | 487 | 2.796875 | 3 | [] | no_license | """
页面层/元素层
/注册页面元素定位
"""
from pages.base_page import BasePage
class RegisterPage():
def __init__(self, driver):
self.driver = driver
self.base = BasePage(self.driver)
def get_login_element(self):
"""获取跳转登陆页面的element"""
return self.base.get_element("login_butt... | true |
49f14b0a3770d15bd173c16974cf2295c7a3e83e | Python | Tapiola/Information-Theory-Assignments | /Assignment_2/Elias.py | UTF-8 | 307 | 2.859375 | 3 | [] | no_license | import sys
import math
def elias (N):
res = ''
N_len = math.ceil (math.log2 (N))
res += ''.join (['0' for i in range (N_len-1)])
res += format (N, '08b')
return res
def de_elias (bin_str):
count = 0
while not bin_str[count] == '1':
count += 1
return int (bin_str[count:2*count+1], 2), 2*count+1 | true |
e37f5d828c890f7bd9fd49c97c46fada61803794 | Python | MCarlomagno/frro-soporte-g9 | /tp1/ej_12.py | UTF-8 | 302 | 3.953125 | 4 | [] | no_license | def sumatoria(n):
acum = 0
cont = 1
while True:
if cont <= n:
acum = acum + cont
cont = cont + 1
else:
break
return acum
print("Ingrese un número.")
nro = int(input())
print (sumatoria(nro))
assert sumatoria(4) == 10
| true |
c6469a0e869dfeb7a5f4bd716586ae188fb07d00 | Python | Meaha7/dsa | /binary-search/leetcode/range/capacity-to-ship-packages-within-d-days-1011.py | UTF-8 | 595 | 3.296875 | 3 | [] | no_license | # T=nlog(sum),S=1
def x(nums, m):
def count(mid):
sum, count = 0, 1
for i in range(len(nums)):
sum += nums[i]
if sum > mid:
sum, count = nums[i], count + 1
return count
low, high = max(nums), sum(nums)
while low <= high:
mid = low + (h... | true |
2ab85aba93ff2805e000fadfd55b93618bbd143a | Python | RocketMirror/AtCoder_Practice | /prep.py | UTF-8 | 50 | 2.609375 | 3 | [] | no_license | a = list(map (int, input().split()))
print(min(a)) | true |
689a0580596f75d721707112965ac1b4a75b4680 | Python | amiraHag/python-basic-course2 | /strings/string3.py | UTF-8 | 1,610 | 4.8125 | 5 | [] | no_license | #------------------------------------
#----------String Methods------------
#------------------------------------
# Len(Object) return Number of elements in this Object
# Len() Built in function return Number of element in the container given to it as parameter
a= "Hello World"
b= " Hello World "
print(len(... | true |
30af1369486b6eb028f3576f9867cafba030a606 | Python | Positronic-IO/air-hockey-training-environment | /environment/puck.py | UTF-8 | 4,398 | 3.3125 | 3 | [] | no_license | """ Puck object """
import json
from typing import Any, Tuple, Union
import numpy as np
from environment.table import Table
from environment import config
from environment.goal import Goal
from environment.mallet import Mallet
class Puck:
""" Puck object """
def __init__(self, x: int, y: int, dx: int = -3,... | true |
8105a47a079601c9c1c8ad6170221d05bae0b441 | Python | airmelt/work_templates | /file_type.py | UTF-8 | 2,009 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@description: 使用魔数(magic number)检查文件类型
@file_name: file_type.py
@project: work
@version: 1.0
@date: 2018/11/21 13:45
@author: air
"""
import struct
def bytes2hex(b):
"""
字节码转16进制字符串
:param b: 传入字节码
:return:
"""
num = len(b)
hexstr = u""
... | true |
bc6f452d5a4dee605819c0a3c79ee1d479e8c04e | Python | hvzzzz/First_steps_in_python | /Codeforces/5 A. String Task.py | UTF-8 | 325 | 2.953125 | 3 | [] | no_license | a= input()
a=list(a)#
b=''
for i in range(len(a)):
if(ord(a[i])>=ord('A')and ord(a[i])<=ord('Z')):
a[i]=chr(ord(a[i])+32)
if(a[i]=='a' or a[i]=='o' or a[i]=='y' or a[i]=='e' or a[i]=='u' or a[i]=='i'):
a[i]=''
if(a[i]!=''):
b=b+'.'+a[i]
print(b)
... | true |
ecee1d2d478f9209e52eb9d79eb768caee12978c | Python | SarahGarda/CSTwitterAnalysis | /twitter_collect/__main__.py | UTF-8 | 1,409 | 2.515625 | 3 | [] | no_license | from twitter_collect.tweet_candidate_actuality_tweets import *
from twitter_collect.tweet_collect_whole import *
from twitter_collect.tweet_candidate_tweet_activity import *
from twitter_collect.twitter_connexion_setup import *
import time
def collection(num_candidate,time_limit):
'''
:param num_candidate: the... | true |
5880059d21b8099db3f8a9cae6884ea82ffae980 | Python | Gustavokmp/URI | /1164.py | UTF-8 | 372 | 3.390625 | 3 | [] | no_license | num = int(input())
cont = 1
soma = 0
cont2 = 0
while cont2 < num:
n1 = int(input())
while cont<n1:
if n1%cont==0:
soma = soma + cont
cont = cont + 1
else:
cont = cont + 1
if soma==n1:
print(n1,"eh perfeito")
else:
print(n1,"nao eh ... | true |
5908f189d407e0f6f53d49d7daf26e233172853d | Python | DongjinS/ProblemSolving | /29_2750.py | UTF-8 | 2,113 | 3.890625 | 4 | [] | no_license | # 29 2750 하 정렬 수 정렬하기 6-1 ~ 6-4
# -- 버블, 단순 선택, 단순 삽입까지
#bubble sorting
#방법 1
def bubble_1(input_list: list):
print("bubble_1")
L = len(input_list)
#print(input_list)
cnt=0
for i in range(L - 1):
exchange = 0
for j in range(L - 1, i, -1):
#print(f'i = {i}, j = {j}')
... | true |
75b97f0ea5ba79657081346b37926fb799c11e3a | Python | JAreina/python | /4_py_libro_1_pydroid/venv/4_py_libro_1_pydroid/print/print_format.py | UTF-8 | 280 | 3.671875 | 4 | [] | no_license | numero = int(input('Dame un número:'))
print( "{} elevado a {} es {}" , numero, 2, numero ** 2)
print ('{} elevado a {} es {}', numero, 3, numero ** 3)
print( '{} elevado a {} es {}' , numero, 4, numero ** 4)
print( '{} elevado a {} es {}' , numero, 5, numero ** 5)
| true |
7b5483d7c451c8a84065c8571051d0ecfb3b4035 | Python | MmahdiM79/AUT-DS-fall99-solutions | /3nd series/question3_(جدول دشوار)/s3.py | UTF-8 | 1,362 | 3.21875 | 3 | [] | no_license |
def is_in_range(x, y):
global m, n
if x < 0 or y < 0:
return False
if x >= n or y >= n:
return False
if x >= m or y >= m:
return False
return True
def dfs(i, j):
global matrix, visited, l, length, flag
l += 1
visited[i][j] = True
for x in range(-1, 2... | true |
c9a0801c5cc5725794e0cb6eebf6af98a93ceea5 | Python | zhangliwen1112/HoliEBR-UI | /DataApp/KuquData.py | UTF-8 | 1,860 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/10/14 15:11
# @Author : 张丽雯
# @File : kuquData.py
# @中文描述 : 库区管理
# -------------------------------------------正常场景测试数据----------------------------------------------
kuwei_code = 'kwc01'
kuwei_name = 'kwn01'
kuqu_code = 'kq01'
kuqu_name = 'xinzengnamekq'
add_code = 'kq02'
add_... | true |
c6b234045fe55ff46a127df3ec315e1ec71b52f4 | Python | mohanalearncoding/Leetcodepython | /checkpossibility.py | UTF-8 | 640 | 3 | 3 | [] | no_license | from typing import List
def checkPossibility(nums: List[int]) -> bool:
i=1
while i< len(nums):
if nums[i-1]<nums[i]:
if all(nums[j] < nums[j + 1] for j in range(i, len(nums) - i)):
i+=1
print("a,")
else:
print("k")
... | true |
e08b1cb7f82eca01045392a35f6dd3e193bb2e26 | Python | OlegErmolaev/AltIMUv5Library | /testAltIMUv5.py | UTF-8 | 347 | 2.5625 | 3 | [] | no_license | import AltIMUv5
import time
controller = AltIMUv5.AltIMU10v5()
#controller.start()
run = True
try:
while run:
data = controller.getAngles()
if data is not None:
print(data)
else:
pass
#print('None')
time.sleep(0.1)
except KeyboardInterrupt:
run... | true |
af305963023dda0d8174ff7c1ebcaff9fb98c5ae | Python | johnbukaixin/python-demo | /base/specialMethods/__call__.py | UTF-8 | 495 | 3.515625 | 4 | [] | no_license | # Author:panta
# CreateDate:2019/10/30
# FileName:__Call__
# IDE:PyCharm
class Fib(object):
def __call__(self, num):
if num == 1 or num == 2:
return 1
else:
return self.__call__(num - 1) + self.__call__(num - 2)
f = Fib()
print(f(20))
class Fib1(object):
L = []
d... | true |
ab3cdece0bacceeacd7aa332a69f8b057957e2ec | Python | lizhenggan/TwentyFour | /01_Language/05_Python/algorithm/quicksort.py | UTF-8 | 1,462 | 4.03125 | 4 | [
"MIT"
] | permissive | # coding: utf-8
"""
基本思想:
任取待排序序列中的某个元素作为标准(也称为支点、界点,一般取第一个元素),
通过一次划分,将待排元素分为左右两个子序列,左子序列元素的排序码均小于基准元素的排序码,
右子序列的排序码则大于或等于基准元素的排序码,然后分别对两个子序列继续进行划分,
直至每一个序列只有一个元素为止。
"""
def quicksort(l, start, end):
"""
快速排序算法
:type l: list 待排序的列表
:type start: int 列表开始索引值
:type end: int 列表结束索引值
"""
if st... | true |
30dbccb2dc2cd5508027621dfdd406103db25d05 | Python | arianafm/Python | /Básico/Clase4/POO/solucionEjercicio.py | UTF-8 | 1,351 | 3.9375 | 4 | [] | no_license | class Alumno:
def __init__(self,nombre,apellido,cuenta,materias,calificaciones):
self. nombre = nombre
self. apellido = apellido
self. cuenta = cuenta
self. materias = materias
self. calificaciones = calificaciones
self. promedio = sum(self.calificaciones)/5
#Los métodos (self) irán a la altura del ... | true |
e91f784f7abf55fea6126f2944ca97fe0d163435 | Python | Chandrahas-Soman/Data_Structures_and_Algorithms | /Python/Arrays/Compute_the_spiral_ordering.py | UTF-8 | 1,827 | 4.15625 | 4 | [] | no_license | # Compute_the_spiral_ordering
'''
1,2,3 Clockwise spiral ordering is
4,5,6 --> 1,2,3,6,9,8,7,4,5
7,8,9
write a program that takes n*n 2D array and returns spiral ordering of the array
hint: use case analysis and divide and conquer
'''
'''
uniformly addd boundary.
add n-1 elements of first row.
then a... | true |
3781513ed69061417a8a55402525d9f2440034fc | Python | xenron/sandbox-da-python | /book/packt/Mastering.Natural.Language.Processing.with.Python/Chapter 1/ch1_8.py | UTF-8 | 141 | 2.5625 | 3 | [] | no_license | from nltk.tokenize import WordPunctTokenizer
tokenizer=WordPunctTokenizer()
print(tokenizer.tokenize(" Don't hesitate to ask questions"))
| true |
ed789c3b9e6077759770fb6807988d79e24df3f0 | Python | LeeJaeMoonND/2DGP | /Labs/dril#10/dril#10.py | UTF-8 | 2,058 | 3.1875 | 3 | [] | no_license | from pico2d import *
import random
class Grass:
def __init__(self):
self.image = load_image('grass.png')
def draw(self):
self.image.draw(400,30)
class bigBall:
def __init__(self):
self.image = load_image('ball41x41.png')
self.x = random.randint(0,800)
self.y = 599
... | true |
83decad8e8f0e4e67bb1f266698f71186584e70f | Python | ndeore/python-learn | /pract.py | UTF-8 | 530 | 3.28125 | 3 | [] | no_license | GRAND_TOTAL =1000
def get_receieved_marks():
return int(input(
'Enter Received Marks: '
))
def calculate_percentage(recieved_marks):
if recieved_marks <= 0:
return None
else:
return (recieved_marks / GRAND_TOTAL ) * 100
if __name__ == '__main__':
# Changes in B branch
... | true |
0981ca189d13dec4e249774ebfee1caf39020b5d | Python | TungThai155/BS-AI-Card-Game | /GameHuman.py | UTF-8 | 37,274 | 2.6875 | 3 | [] | no_license | # This game is a modified version from Pythonic cheat game by Mitchell Kember in 2009
# This modified version include the AI created by Tung Thai, Aparna Penmetcha, and Avi Block
# Copyright (c) 2020. All rights reserved.
"""
Created on 24-4-2020
AI cheat MTCS based game
written in python 3.6.5.
Classes:
... | true |
a31f711e42bac33cc6b898a3de08d02079417965 | Python | Khrystynka/LeetCodeProblems | /496_next-greater-element-i.py | UTF-8 | 547 | 3.40625 | 3 | [] | no_license | # Problem Title: Next Greater Element I
from collections import defaultdict
class Solution(object):
def nextGreaterElement(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
d = defaultdict(lambda: -1)
for i in range... | true |
d9ee4ecaf332d0138a2683d95c8f3a6a8c483654 | Python | cheche1210/python_practice- | /python_ex/practice_8.py | UTF-8 | 154 | 2.953125 | 3 | [] | no_license | # Read an integer .
# For all non-negative integers , print .
# See the sample for details.
# Sample Input 0
# 5
# Sample Output 0
# 0
# 1
# 4
# 9
# 16
| true |