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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
93c8beaa191bbfb21d83fd7e74109cb3688efe7b | Python | CDenecke/KarateHealthCapstone | /patteret/classifier/resize.py | UTF-8 | 666 | 2.859375 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import os
# Grayscale an resize the image.
def pre_process():
# If path DNE make the path.
if not os.path.exists('pos'):
os.makedirs('pos')
# If path DNE make the path.
if not os.path.exists('pos2'):
os.makedirs('pos2')
# Open file 'pos' alias file_type.
for file_type in ['po... | true |
531541a85076bc6858e881bb75095e4a38972707 | Python | nirmalnishant645/Python-Programming | /Data-Structures-and-Algorithms/Deque.py | UTF-8 | 1,355 | 4.21875 | 4 | [] | no_license | '''
DEQUE - DOUBLE ENDED QUEUE
New items can be added at either the front or the rear.
Existing items can be removed from either end.
Provides capabilities of stack and queue.
'''
# Deque() creates a new deque that is empty.
# It needs no parameters and returns an empty deque.
class Deque(object):
def __init_... | true |
da00e4dbf689d1d034493067e73e7fdd99c7c006 | Python | Mangata1/federatedReinforcementLearningOnTheEdge | /fedQlearning/federated/env.py | UTF-8 | 12,741 | 2.5625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from collections import defaultdict
import copy
import json
import random
with open('EXPECTED_BALANCES.json') as json_data:
expected_balance = json.load(json_data)
# https://github.com/ianxxiao/reinforcement_learning_project/blob/master/code/env.py
class env():
def __ini... | true |
f6c324189376b53431f5d26f66ded19f3f042839 | Python | zhenyulin/mlcoursework | /ex2/predict.py | UTF-8 | 776 | 3.203125 | 3 | [] | no_license | import numpy as np
from sigmoid import sigmoid
def predict(theta, X):
""" computes the predictions for X using a threshold at 0.5
(i.e., if sigmoid(theta'*x) >= 0.5, predict 1)
"""
m = X.shape[0]
def label(n):
if n < 0.5:
return 0
else:
return 1
p = n... | true |
e98c0ad958d63bed3aba5fc083bce0c66bb44dc2 | Python | chomd90/prunhild | /examples/mnist/experiment.py | UTF-8 | 7,637 | 2.578125 | 3 | [
"MIT"
] | permissive | """
Disclaimer:
This code is based on the basic MNIST example from Pytorch examples repository
See: https://github.com/pytorch/examples/tree/master/mnist
"""
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import d... | true |
a5f58a299462e6c91dfb32e05d77b4c719031f4b | Python | mistermask/diary | /diary.py | UTF-8 | 306 | 3.140625 | 3 | [] | no_license | from datetime import date
today = date.today()
date_str = today.strftime('%B %d %Y')
entry = input('what\'s on your mind today dude?\r')
diary_file = open('diary.txt','a')
diary_file.write(date_str + '\n' + entry + '\n')
diary_file.close()
input('\nalright, this program will now terminate') | true |
9e47e7967e318355ceeb0d18b2ae3aa9bbace92a | Python | kchro/plato | /platopy/dialog.py | UTF-8 | 2,835 | 3.59375 | 4 | [
"MIT"
] | permissive | import random
from time import sleep
class Dialog(object):
def __init__(self, role='', messages=None, condition=None):
self.role = role
self.messages = messages
self.condition = condition
def choice(self):
message = random.choice(self.messages)
while True:
s... | true |
21406ef6223d88eb92590354f2e9299088da3081 | Python | gin2010/python_study | /data_and_ai/data_analysis/sigmiod_demo.py | UTF-8 | 397 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Date : 2020-01-22
# @Author : water
# @Version : v1.0
# @Desc :
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
def sigmoid(z):
return 1/(1+np.exp(-z))
def main():
nums = np.arange(-10,10,step=1)
fig ,ax = plt.subplots(figsize=(10,6))
ax.plot(nu... | true |
7c1a6a3ff934f704ed79dc8db9c232922481f919 | Python | Bobain/bigquery-conductor | /bq_conductor/dashboard/data2html.py | UTF-8 | 2,685 | 2.84375 | 3 | [
"MIT"
] | permissive | import time
DEBUG = False
def get_interpreter_options(interpreter_list):
return "\n".join(['<option value="%s" %s>%s</option>'
% (interpreter, 'selected="true"' if i == 0 else '', interpreter)
for i, interpreter in enumerate(interpreter_list)])
def get_html_for_search... | true |
8cb2862670b1c64a170aac6abbaba40d8e5ba745 | Python | k906506/2020-Algorithm | /7주차_연습 (dfs)/asdf.py | UTF-8 | 138 | 3.078125 | 3 | [] | no_license | input_list = []
num = int(input())
for i in range(num):
a = list(map(int, input().split()))
input_list.append(a)
print(input_list) | true |
f78f18291328d8a24625c6dfc49cfd24aba3182b | Python | midraed/landsat-extract-gee | /geextract/scripts/gee_extract_batch.py | UTF-8 | 4,563 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import argparse
from datetime import datetime
import csv
from geextract import ts_extract, dictlist2sqlite, relabel, date_append
def main(file, sensor, begin, end, radius, stats, db, table, tiers):
# Parse time string into datetime object
begin = dat... | true |
2f53f58b08e12099fdcffec5fa422882bffc5069 | Python | messi10hitu/Product_data_WebScraping | /test3.py | UTF-8 | 2,121 | 2.90625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pandas as pd
import json
import csv
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
url = "https://www.westwingnow.de/moebel/"
# STEP 1. get the HTML.
r = requests.g... | true |
561500fac854b7fb67c5c149b951618b3d379e8c | Python | novigit/learn_ete3 | /17_node_styles.py | UTF-8 | 1,403 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
from ete3 import Tree, NodeStyle, TreeStyle
t = Tree( "((a,b),c);" )
# basic tree style
ts = TreeStyle()
ts.show_leaf_name = True
# draw nodes as small red spheres, diameter 10 px
## create NodeStyle() dictionary
nstyle = NodeStyle()
## define nodestyle
nstyle["shape"] = "sphere"
nstyle["size"... | true |
0ff10a09ac5d9ef4e1ba93c4938a1195cee1235f | Python | grow/grow | /grow/pods/env.py | UTF-8 | 1,689 | 2.625 | 3 | [
"MIT"
] | permissive | """An Env holds the environment context that a pod is running in."""
import time
from protorpc import messages
from grow.common import urls
class Name:
DEV = 'dev'
class EnvConfig(messages.Message):
host = messages.StringField(1)
scheme = messages.StringField(2)
port = messages.IntegerField(3)
... | true |
29f621a2d3df61f9b55e18489adc6eb410b9f725 | Python | daniel-reich/ubiquitous-fiesta | /htpi99zeTsvjWNujz_6.py | UTF-8 | 105 | 3 | 3 | [] | no_license |
def halve_count(a, b, c = 0):
a = a / 2
if a <= b :
return c
return halve_count(a, b, c + 1)
| true |
1059383e7eadde234ad4019ef59960a27f29cb04 | Python | deepak123cse/python-prog | /ex04.py | UTF-8 | 567 | 3.390625 | 3 | [] | no_license | cars = 100
space_in_a_car = 4.0
drivers = 30
passangers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passenger_per_car = passangers/cars_driven
print ("There are ",cars,"cars available")
print ("There are only",drivers,"drivers available"... | true |
528023e4d3cf4f89370331b33a5dedbd36592e4a | Python | arinanda/Twitter-Mining | /example/example_tokenize.py | UTF-8 | 421 | 3.5 | 4 | [] | no_license | from nltk import word_tokenize, sent_tokenize
text = "The quick brown fox jumped! Where? over the lazy dog."
#Misahin perkata, dipisahin spasi
words = word_tokenize(text)
print(words)
#Misahin perkalimat, dipisahin tanda baca
sentences = sent_tokenize(text)
print(sentences)
#Misahin perkata dari kalimat yang didapat... | true |
5009c0efac0cee13bab31946d4942f6c7f7b85e4 | Python | anshumankmr/ACM-ICPC-Algorithms | /Sorting/SelectionSort/python/SelectionSort.py | UTF-8 | 473 | 4.5625 | 5 | [] | no_license | # Selection Sort: Find the minimum value at each pass and move it
# to the beginning
def SelectionSort(arr):
for i in range(len(arr)):
minValueIndex = i
for j in range(i, len(arr)):
if arr[j] < arr[minValueIndex]:
minValueIndex = j
arr[i], arr[minValueIndex] =... | true |
c16877122af2faa3217e835b3c68c8a50fbb0968 | Python | FdezAriasSara/NumericalComputation | /EX2-Session03-UO265946.py | UTF-8 | 2,121 | 3.421875 | 3 | [] | no_license | """
Created on Thu Mar 4 19:25:11 2021
EXERCISES 2
@author: Sara fernández arias UO269546
"""
import numpy as np
import matplotlib.pyplot as plt
np.set_printoptions(precision = 2) # only two decimals
np.set_printoptions(suppress = True) # do not use exponential format
#%%triangular function from ex 1
def ... | true |
0bd56e55e96a713b60a1d9ff8eb43134cb41c54e | Python | beef-erikson/ProgramArcadeGamesPycharm | /Chapter7/Problem10.py | UTF-8 | 235 | 3.984375 | 4 | [] | no_license | """
Write nested loop that prints multiplication table from 1 to 9
Beef Erikson Studios - 2019
"""
for i in range(1, 10):
for j in range(1, 10):
if i * j < 10:
print(" ", end='')
print(i * j, end=' ')
print()
| true |
131d98e68539609080bf102e40b09ae161c70c21 | Python | mayuripatkar/Python-Mini-Projects | /Word Guessing Game.py | UTF-8 | 719 | 4 | 4 | [] | no_license | import random
name = input("What's your name:")
companies = ['Facebook','Apple','Netflix','Google','Amazon','Microsoft','Adobe']
company = random.choice(companies)
print("Hey",name,"guess a tech company!")
guesses = ''
attempts = 10
while attempts > 0:
fail = 0
for char in company:
if char in guesses... | true |
516c96cff7f577c86f3842e1ea4dffaf3b0d01b8 | Python | takaaki-pp/Test_For_Schedule | /utils/visualizer.py | UTF-8 | 5,995 | 2.546875 | 3 | [] | no_license | import matplotlib.patches as patches
import matplotlib.pylab as plt
import mpl_toolkits.mplot3d.axes3d as axes3d
# import plotly.plotly as py
# import plotly.tools as tls
# from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
from matplotlib import cm
import tensorflow as tf
from configs i... | true |
271ca6af1de020b5ae35bd6cf2723453d092cc50 | Python | miguelm9/steg | /steg.py | UTF-8 | 4,201 | 3.140625 | 3 | [] | no_license | #Bitcoin steganography library, inserts a private key, wif by default into a named file by altering the LSB of the r
#in the rgb palette of the pixel.
#Hex bitcoin private key is 64 bytes (512 bits to hide)
#WIF bitcoin private key is 51 bytes (408 bits to hide) and easily importable into a wallet for sweeping..
__aut... | true |
1b213ba43ad827b9759beebfdd65ae2cd61d2cbf | Python | czp13/BigNumber | /BigNumber/BigNumber.py | UTF-8 | 7,597 | 3.5625 | 4 | [
"MIT"
] | permissive | """
This file contains code for the arbitrary precision number library "BigNumber".
Author: GlobalCreativeCommunityFounder
"""
# Importing necessary libraries
from mpmath import *
mp.pretty = True
# Creating BigNumber class
class BigNumber:
"""
This class represents a BigNumber object.
... | true |
a5a47fc1c8062e4dc3feece23229ddee8c3db240 | Python | choumin/MathModel2017_E | /problem_4/get_increasing.py | UTF-8 | 472 | 3.296875 | 3 | [] | no_license | #!/bin/python
def main():
finc = "./increasing.dat"
fp = open(finc)
line = fp.readline()
tmp = []
while line:
line = line.strip()
tmp.append(line.split(" "))
line = fp.readline()
fp.close()
#print tmp
tmp.sort(key=lambda elem:float(elem[1]), reverse=True)
... | true |
55e20ab77000a567097cccd644d8c58812d055ad | Python | Researchnix/stocks | /trader.py | UTF-8 | 1,529 | 3.46875 | 3 | [
"MIT"
] | permissive | # trader
# all algorithms that handle the portfolio
from abbreviations import *
import webScraper as ws
# initialize a stock and add it with zero shares to the portfolio
def initialize(ticker):
print('adding ', ticker, 'to the portfolio')
asset = {}
asset[tkr] = ticker
asset['industry'] = ws.getInd... | true |
acb2c5ebda5dc825010d461c56a6a57a4c3cc1de | Python | rosarioValero/Programacion | /Ejercicios-Pr7/ejercicio3.py | UTF-8 | 355 | 4 | 4 | [] | no_license | """ROSARIO VALERO MIRANDA - 1º DAW - PRACTICA7 - EJERCICIO 3
Escribe un programa que lea una frase, y la pase como parámetro a un
procedimiento, y éste debe mostrar la frase con un carácter en cada línea. """
print("Introduce una frase")
texto=input()
def espacio(texto):
for i in range(0, len(texto)):
... | true |
7b5c5a84e116ea57165b628582507e446bd12e03 | Python | jianzonggaoshou/UITest | /ZNYW2/BS/LoginPage.py | UTF-8 | 1,097 | 2.6875 | 3 | [] | no_license | # coding:utf-8
from selenium.webdriver.common.by import By
from time import sleep
class LoginPage:
"""定位元素"""
# 测试网址
testUrl = "http://39.107.121.205:8080/"
# 用户名输入定位
userInputLocation = By.CLASS_NAME
# 用户名输入
userInput = "userName"
# 密码输入定位
passwordInputLocation = By.CLASS_NAME
... | true |
6ccc0c7d901239a9c097d2a39a5139dc8eb6e342 | Python | Mehboob96/Pandas | /2.py | UTF-8 | 1,297 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 13 13:59:26 2018
@author: codept
"""
import pandas as pd
import numpy as np
data = {
'A' : [1,2,np.nan],
'B' : [5,np.nan,2],
'C' : [1,2,3]
}
data
df = pd.DataFrame(data)
df.dropna(axis=1)
df.fillna(df.min(),axis=... | true |
0d2b146314ebd53fe438686fc0b8e555ff8269f3 | Python | Athreyan/guvi_python | /max.py | UTF-8 | 204 | 3 | 3 | [] | no_license |
num=int(input())
dd=list(map(int,input().split()[:num]))
maxval=dd[0]
for i in dd:
if(maxval<i):
maxval=i
print(maxval)
#sor=sorted(dd,reverse=False)
#print(sor[num-1])
| true |
2bc649cf94ce162b15ba4d8125a18b9217f1161f | Python | lunarwar/test | /read_oracle_db.py | UTF-8 | 405 | 2.578125 | 3 | [] | no_license | import cx_Oracle
def dbconnect():
con = cx_Oracle.connect('dbusername/dbpassword@dbserver/dbservicename')
return con
def read_table():
con = dbconnect()
corsor = con.cursor()
query = """select * from mtmmmn_sdt_hourly"""
c = corsor.execute(query)
for row in c:
print(row[0], "-", r... | true |
ec1f9e274e8049e830c51777b31ad792648fd996 | Python | gistable/gistable | /all-gists/8099723/snippet.py | UTF-8 | 7,225 | 2.6875 | 3 | [
"MIT"
] | permissive | # An example of how to use AWS SNS with Python's boto
# By Stuart Myles @smyles
# http://aws.amazon.com/sns/
# https://github.com/boto/boto
#
# Inspired by parts of the Ruby SWF SNS tutorial http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-sns-tutorial-implementing-activities-poller.html
# And the Python ... | true |
e0d3ca6a509d3e3e3d6e42d9b36eb86d74ed236f | Python | NagoDede/MarkSpecs | /vendors/schemdraw/schemdraw/elements/intcircuits.py | UTF-8 | 11,706 | 2.96875 | 3 | [
"MIT",
"BSD-2-Clause",
"CC0-1.0"
] | permissive | ''' Integrated Circuit Element '''
import numpy as np
from ..segments import Segment, SegmentText, SegmentCircle
from ..elements import Element
from .lines import Line
from ..adddocs import adddocs
class IcPin(dict):
''' Integrated Circuit Pin
Keyword Arguments
-----------------
name : ... | true |
da0df4fd279a0716c427f9696a372fd9381026b1 | Python | ywCN/SSW-567 | /hw02/TestTriangle.py | UTF-8 | 1,841 | 3.890625 | 4 | [] | no_license | import unittest
from Triangle import classify_triangle
# This code implements the unit test functionality
# https://docs.python.org/3/library/unittest.html has a nice description of the framework
class TestTriangles(unittest.TestCase):
def testInvalidInput(self):
"""
T1
2. Verify the In... | true |
83e7f0b3a3c2cf472f8796f04f56d263093006da | Python | irenepeggy/python_course | /task3/spiral_digits.py | UTF-8 | 925 | 3.0625 | 3 | [] | no_license | from collections import deque
m, n = eval(input())
matrix = [[0 for i in range(m)] for j in range(n)]
deq = deque([i for i in range(0, 10)])
up, bottom, left, right = 0, n, 0, m
i, j = 0, 0
while(left < right and up <= bottom):
for j in range(left, right):
matrix[up][j] = deq[0]
deq.rotate(-1)
... | true |
f11d48c31c4369ba2b2fd82a48574c3a2ab1126f | Python | SimplyNate/AutomatedDefense | /autodefense.py | UTF-8 | 9,421 | 3.40625 | 3 | [
"MIT"
] | permissive | """
MIT License
Copyright (c) 2019 Nathan Horiuchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | true |
01a4da8c26e4df9576d4dd352f13b907eeccdfd2 | Python | bakamoridesu/dog_breed_classifier | /views.py | UTF-8 | 643 | 2.625 | 3 | [] | no_license | from werkzeug.utils import secure_filename
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
from flask import render_template, request
import classifier
from app import app
@app.route('/')
def index():
return render_template('index.html')
@app.route('/_upload/', methods=['GET', 'POST'])
def u... | true |
ce88654930ff3b00bebca522f7f4f2696ba95f5a | Python | Mak2006/hacker-rank-projects | /30daysofcode/day6.py | UTF-8 | 868 | 3.703125 | 4 | [] | no_license | # Given a number of strings, print the odd chars space even cars
def candyprint(givenstrings):
for i in range(0, len(givenstrings)):
acandy = givenstrings[i]
even = ""
odd = ""
for j in range(0, len(acandy)):
if(j%2 ==0):
even += acandy[j]
els... | true |
4a19b0f1f54cda2fffb8cf650817791b9cc32491 | Python | brandoneng000/LeetCode | /medium/853.py | UTF-8 | 895 | 3.625 | 4 | [] | no_license | from typing import List
class Solution:
def carFleet(self, target: int, position: List[int], speed: List[int]) -> int:
stack = []
res = 0
cur = 0
for p, s in zip(position, speed):
stack.append((p, s))
stack.sort()
time = []
for p, s in s... | true |
3a597af4ebf25864f4922aa1be655860b2e41f92 | Python | hse-ling-python/hackathon-2020 | /Stonks/office.py | UTF-8 | 14,317 | 2.609375 | 3 | [] | no_license | import telebot
import csv
import pandas as pd
import csv
from tqdm.auto import tqdm
from collections import Counter
from nltk.corpus import stopwords
stop = set(stopwords.words('english'))
with open('office_corpus.csv', 'r', encoding='utf-8', newline='', errors='ignore') as f:
reader = csv.DictReader(f)... | true |
269f9910ae64fb96ce710c2bc0f1f51379cbecf8 | Python | ElMehdiBen/keywords | /keys.py | UTF-8 | 1,635 | 2.796875 | 3 | [] | no_license | # frontend/main.py
import json, re
import streamlit as st
from elasticsearch import Elasticsearch
from keybert import KeyBERT
# you can use RFC-1738 to specify the url
elastic = Elasticsearch(['http://206.81.23.137:9200'])
def pre_process(text):
# XYZ
# lowercase
text=text.lower()
#remove tags
... | true |
9bdee933d0a37dadde19a8c807c4f6ae5f6baaed | Python | rgiordan/paragami | /paragami/tests/test_utils.py | UTF-8 | 1,736 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | from autograd import numpy as np
from contextlib import contextmanager # For testing stdout
import paragami
from io import StringIO
import sys # For testing stdout
# For testing stdout
# https://gist.github.com/mogproject/fc7c4e94ba505e95fa03
@contextmanager
def captured_output():
new_out, new_err = StringIO(), St... | true |
a860d304d2d172f7b522e9c4d9191a7096870d59 | Python | abstractlyZach/CardGames | /holdem/game_runner.py | UTF-8 | 1,540 | 2.671875 | 3 | [] | no_license | from cards import deck
from . import bet_collector
from . import board
from . import dealer
from . import exceptions
from . import player
class GameRunner(object):
def __init__(self):
self._starting_chips = 1000
self._bet_collector = None
self._deck = deck.StandardPlayingCardDeck()
... | true |
f6402eb6e8b668e891cd7984eda2e07d998c2563 | Python | dogancantorun8/python-application | /Python_Socket_İslemleri/udp_client.py | UTF-8 | 621 | 2.90625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 7 18:47:33 2021
@author: Asus
"""
import socket
SERVER_NAME = '127.0.0.1'
SERVER_PORT = 50050
try:
with socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) as client_sock:
while True:
msg = input('Bir yazı giriniz:')
if ms... | true |
0582819b337bf01f58a3a14b5e20023679d3c861 | Python | AngeloLiwanag/ninja_gold_django | /apps/ninja_app/views.py | UTF-8 | 1,997 | 2.625 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse, redirect
import random
def index(request):
if (request.session.get('gold') == None):
request.session['gold'] = 0
if (request.session.get('activities_list') == None):
request.session['activities_list'] = []
if (request.session.get('dict... | true |
3a0a1ff3a76ec3dbd9d2ed229a6008032f0c1a85 | Python | GrosQuildu/TourismSimulation | /src/poilabel.py | UTF-8 | 1,021 | 3 | 3 | [] | no_license | import pyglet
class PoiLabel:
def __init__(self, name, position_x, position_y):
self.name = name
self.label = pyglet.text.Label(
self.name, font_name='Calibri',
font_size=9, x=position_x+7,
y=position_y, anchor_x='left', anchor_y='top')
self.labelShadow... | true |
016db8c92c46fed70d34f16c6672105712008996 | Python | ksm0207/Algorithm | /Part #1/example5.py | UTF-8 | 655 | 4.34375 | 4 | [] | no_license | # 문제
# 시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D,
# 나머지 점수는 F를 출력하는 프로그램을 작성하시오.
# 입력
# 첫째 줄에 시험 점수가 주어진다. 시험 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다.
while True:
student = int(input("성적입력 : "))
if student >= 90:
print("A")
elif student >= 80 or student >= 89:
... | true |
dab816d824e0adcd94a518beda4d9d11654c53c3 | Python | hth225/Ghost_identity | /Single_person.py | UTF-8 | 434 | 2.71875 | 3 | [] | no_license | from faker import Factory
fake = Factory.create('en-us')
def file_write(sorted_iden):
file = open("identities.txt", 'a')
file.write(sorted_iden)
file.close()
def sort(iden):
file = open("identities.txt", 'r')
unsorted = file.read()
file.close()
unsorted.replace(', ', '\n')
sorted_iden ... | true |
9458ad84369eb88c6ee450c7aaa493de8359877a | Python | ziyenl/python | /script/easy_decorator.py | UTF-8 | 286 | 3.515625 | 4 | [] | no_license | def decorator_func(func):
def helper(data):
data = data + ' b. come before print_data '
return func(data)
return helper
@decorator_func
def print_data(data):
data = data + ' c. come after decorator_func'
return data
print(print_data('a. I am data '))
| true |
f1730b60739b734332aaf18107fd0d04188ac947 | Python | chastep/python_practice | /python_racer/runner.py | UTF-8 | 535 | 3.4375 | 3 | [] | no_license | import subprocess
import time
from die import Die
from python_racer import PythonRacer
from reset_screen import reset_screen
sides = eval(input("How big of a die to you want? "))
die = Die(sides)
length = eval(input("How far are we going? "))
players = ['a', 'b']
game = PythonRacer(players, die, length)
reset_screen()... | true |
9767fe7047830d1dfffef19b9340d2328c7858ba | Python | jacquerie/leetcode | /leetcode/1974_minimum_time_to_type_word_using_special_typewriter.py | UTF-8 | 638 | 3.5625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
class Solution:
def minTimeToType(self, word: str) -> int:
current_char, result = "a", 0
for char in word:
current_char, result = (
char,
result + self.timeToMove(current_char, char) + 1,
)
return result
d... | true |
ba491d1f45305cc945d03657dc44e097aa547f6c | Python | WiLGYSeF/smstoxml | /contactlistfilter.py | UTF-8 | 1,358 | 3.140625 | 3 | [] | no_license | import re
class ContactListFilter:
def __init__(self):
self.filterNumbers = set()
self.filterContacts = set()
self.filterNumbersRegex = []
self.filterContactsRegex = []
def addNumber(self, number):
self.filterNumbers.add(number)
def addNumberExpr(self, expr):
... | true |
435e0679c11a2b6c73d27fa29db34246ce932fe8 | Python | WFP-VAM/modape | /modape/scripts/csv_smooth.py | UTF-8 | 6,087 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""csv_smooth.py: Smooth timeseries in a CSV file."""
# pylint: disable=E0401,C0103
from array import array
from pathlib import Path
import sys
from typing import Tuple
import click
from modape.whittaker import ws2d, ws2doptv, ws2doptvp # pylint: disable=E0611
import numpy as np
import pandas as ... | true |
cdddc0bf945a743413ac35bf66e2d0583b846bdb | Python | sankaranvp/git-first | /Python-Works/3__file-operations/file-read.py | UTF-8 | 301 | 3.921875 | 4 | [] | no_license | # File operations
f = open("data.txt", "r") # Read mode
print(f.read())
#print(f.read(2)) # Read first two characters of first line
#print(f.readline()) # Line by line
#print(f.readline()) # Line by line
# File reading by loop
for x in f:
print(x)
#print(x.strip()) # Remove extra spsces
| true |
9d30a87fba03809aea31cfb110eb79762bd230b3 | Python | tiagovizoto/xDownload_public | /CJsonFile.py | UTF-8 | 993 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from pprint import pprint
import json
import io
class JsonFile:
def __init__(self, _json_file_name):
self.file_name = _json_file_name
def json_details_write(self, _list_size, _current_number, _current_link):
percent = (_current_number/_list_size)*100 # percent calc
... | true |
8826bcb6492b642a3cbf90c78a7edcb8d987ca7d | Python | zaoyuaner/Learning-materials | /python1812/python_1/2_变量_运算符_if/代码/01_ramdom.py | UTF-8 | 585 | 4.375 | 4 | [] | no_license | # 随机抽取一位同学的作业
import random # 倒入产生随机数的模块(就是一个py文件,里面可以有很多函数和变量)
stu_list = ["易志康","张译文","曹茂新","徐明林","陈观明","胡才豪","肖誉","易云林","范益宏"]
string = random.choice(stu_list) #随机返回列表中的一个元素
# print(string)
# 重复做相同的事情,可以用循环结构
# rang(3)--> 0 1 2,这个循环执行三次
for i in range(4):
string = random.choice(stu_list)
print(string)
# 将... | true |
f78ad188c896fd35722bc127f8a46c878402a2a8 | Python | akdor1154/networktablet-indicator | /networktablet_indicator/menus.py | UTF-8 | 5,934 | 2.578125 | 3 | [] | no_license | from functools import partial
import subprocess
from gi.repository import Gtk as gtk
class ManualToggle:
def __init__(self):
self._lock = False
def __enter__(self):
self._lock = True
def __exit__(self, *args):
self._lock = False
@property
def is_active(self) -> bool:
... | true |
a62b9bf941d68aa80b0a0a1299d355858b77d7c2 | Python | skyyi1126/leetcode | /130.surrounded-regions.py | UTF-8 | 1,156 | 2.90625 | 3 | [] | no_license | #
# @lc app=leetcode id=130 lang=python3
#
# [130] Surrounded Regions
#
# @lc code=start
class Solution:
def solve(self, board: List[List[str]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
if not board:
return
m = len(board)
n ... | true |
b7890157edfb2daebda507d2c25146c520769715 | Python | Yradio/phishbuckets | /pbcreatecampaign | UTF-8 | 1,942 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | #!/usr/bin/env python3
#
"""This will be called by the "at" jobs setup by the 'create-plan' script
- creates and runs the 'gophish' campaigns *immediately*
- trusts "pbcreateplan" to have checked stuff - so does no more checking...
"""
import sys
def main():
import json
from email.mime.multipart i... | true |
177c8ca8470580d6ab864d2cb96ff6bf8e0682d1 | Python | waspart/python | /runoob/test2.py | UTF-8 | 290 | 3.125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
i = int(raw_input('liry:'))
arr = [1000000, 600000, 400000, 200000, 100000, 0]
rate = [0.01, 0.015, 0.03, 0.05, 0.075, 0.1]
r = 0.0
for ind in xrange(1,6):
if i > arr[ind]:
r += (i - arr[ind]) * rate[ind]
print (i - arr[ind]) * rate[ind]
i = arr[ind]
print r | true |
503e1c09e6a76d555ecc814e18a11c72e01f6d9b | Python | shoheifate/tom_thon | /src/near_k.py | UTF-8 | 3,227 | 2.671875 | 3 | [] | no_license | import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn import datasets
import pandas as pd
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
df = pd.read_csv('../data/isigaki_miyako_iriomote_wavedata/isigaki_2006_2018.csv', header=None)
import numpy as np
from skl... | true |
0a9ab74a62232ad9af875b419f463df8e4d0a254 | Python | 0xSeb/scapy-three-way-handshake | /main.py | UTF-8 | 1,288 | 2.671875 | 3 | [] | no_license | from scapy.layers.inet import *
if __name__ == '__main__':
print("Loading ...\n")
# THEORY
#
# Client and server variable names:
#
# c_ip = IP, c_port = port, c_seq = seq # , c_ack = ack #
# s_ip = IP, s_port = port, s_seq = seq # , s_ack = ack #
#
# Handshake:
# c_ip: c_por... | true |
b5850783771dfea3490a5e658629784f4b58fdcc | Python | kgaughan/bukkit | /bukkit/bucket.py | UTF-8 | 7,235 | 3.234375 | 3 | [
"MIT"
] | permissive | """
Keyed collections of token buckets.
"""
import time
class TokenBucket(object):
"""
A token bucket.
"""
__slots__ = (
'clock',
'ts',
'rate',
'limit',
'_available',
)
def __init__(self, rate, limit, clock=time.time):
self.clock = clock
... | true |
f00996e8c998c704b0dea9645479dd737ccd8f38 | Python | ariyanmorshed/bitmixer | /bitmixer.py | UTF-8 | 4,510 | 2.75 | 3 | [] | no_license | import os
import random
import string
import time
from flask import Flask, render_template, request
from celery import Celery
import requests
JOBCOIN_BASE_API = 'http://jobcoin.projecticeland.net/anopsia/api/'
RESERVE_CHAIN_ADDRESS = 'BitMixerReserveChain'
app = Flask(__name__)
app.config['CELERY_BROKER_URL'] = os.e... | true |
d77df2ac16c39d4df7cba2e030dbc0de9d27c6f3 | Python | swatkatz/coding | /examples/num_of_islands.py | UTF-8 | 3,639 | 3.328125 | 3 | [] | no_license | from typing import List
class Solution:
def dfs(self, a, v, m, n, i, j):
# outside the matrix
if i < 0 or j < 0 or i == m or j == n:
return
# current cell is a 1, hence continue doing dfs
if a[i][j] == 1 and v[i][j] != 1:
v[i][j] = 1
self.dfs(a, ... | true |
12827f237a1e12722873c449945197e463a551be | Python | pganjhu/Python-Practice-Progms | /prog90.py | UTF-8 | 1,031 | 3.96875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 25 21:59:55 2020
@author: Pawan
"""
"""
Let's dive into decorators! You are given mobile numbers. Sort them in ascending order then print them in the standard format shown below:
+91 xxxxx xxxxx
The given mobile numbers may have , or written before the... | true |
7dffbfbb2b9127d551b63f4e7cee0aecbcfb35ab | Python | thesmartrobot/ambigym | /ambigym/e_maze/objects/mouse.py | UTF-8 | 3,936 | 2.703125 | 3 | [] | no_license | import numpy as np
import cv2
from . import Movable
from . import Cheese
from ambigym.e_maze.utils import line_segment_line_segment_intersection
GREY = (192, 192, 192)
class Mouse(Movable):
"""Mouse object for use in the shadow world environment."""
def __init__(
self, position, angle=np.pi / 2.0,... | true |
58f480a02a1f8b466a35afe01431357dca36e182 | Python | iraleviant/Language_Model | /data.py | UTF-8 | 4,628 | 2.921875 | 3 | [] | no_license | import os
import torch
import sys
import re
Min_Freq=100
class Dictionary(object):
"""Build word2idx and idx2word from Corpus(train/val/test)"""
def __init__(self):
self.word2idx = {} # word: index
self.idx2word = ['<unk>'] # position(index): word
self.word2idx['<unk>']=0
#self... | true |
8384c2eabd5fe9102a8dff625f60e6cd5dc050b2 | Python | Nienschanz-Automatica/benchmark | /src/cpu_info_utils.py | UTF-8 | 2,757 | 2.578125 | 3 | [
"MIT"
] | permissive | import psutil
from time import sleep, time
from datetime import datetime
import logging
import os
def get_memory_str(memory_data):
total = memory_data.total // (1024 ** 2)
available = memory_data.available // (1024 ** 2)
used = memory_data.used // (1024 ** 2)
percent = memory_data.percent
return "... | true |
cfa5afbd7d8a207a9675cbea1d2f81e0f14d7d39 | Python | SinForest/iaml-project | /toy/rosatoy.py | UTF-8 | 1,299 | 2.5625 | 3 | [] | no_license | import librosa
import librosa.display
import matplotlib.pyplot as plt
import numpy as np
from chrono import Timer
dur = 31 # 168 # hardcoded: should be d[2]["track"]["duration"]
offs = float(np.random.choice(dur - 30))
with Timer() as timed:
y, sr = librosa.load("/home/cobalt/datasets/fma/fma_small/000/000002.mp3"... | true |
48fbe3d19a873ef6d142e7c14fc1fbc77d5ec8b4 | Python | romg974/CardsAgainstCentrale | /PlayScreen.py | UTF-8 | 4,288 | 2.796875 | 3 | [] | no_license | from kivy.uix.screenmanager import Screen
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.uix.image import Image
class PlayScreen(Screen):
cards = []
sentence = ... | true |
cc85b21d3b57d4d15627f8bae9857e48f88d544d | Python | PipaOp/RTR105 | /Loops 9.py | UTF-8 | 277 | 3.671875 | 4 | [] | no_license | """
print("Before")
for value in [9,41,12,3,74,15]:
if value > 20:
print("Large number",value)
print("After")
"""
found = False
print("Before",found)
for value in [9,41,12,3,74,15]:
if value==3:
found = True
print(found, value)
print("After",found)
| true |
1eb6de7b6445e657f9dde952ea6fd79589e3c76e | Python | lllyyyggg/python-numpy-pandas-matplot-demo | /numpy/test.py | UTF-8 | 3,872 | 3.09375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# np_array = np.array([
# [1, 2, 3],
# [3, 4, 5]
# ])
# print(np_array)
# print(np_array.reshape((3, 2)))
# np_array2 = np.linspace(1, 10, 6)
# print(np_array2)
# print(np_array2.reshape((6, 1)))
# X = np.arange(2, 14).reshape(3, 4)
#... | true |
58710893bba34ad8cf23302c60d8984b858f141e | Python | Drea1989/Odie_robo_assistant | /odie/core/ConfigurationManager/BrainLoader.py | UTF-8 | 9,073 | 2.65625 | 3 | [] | no_license | import inspect
import logging
import os
from six import with_metaclass
import six
from odie.core.Models.Cue import Cue
from .YAMLLoader import YAMLLoader
from odie.core.Utils import Utils
from odie.core.ConfigurationManager import SettingLoader
from odie.core.ConfigurationManager.ConfigurationChecker import Configurat... | true |
3350c0736ca714e5aedb0ad7818a8c7a9fe55da1 | Python | tolgaakkapulu/Data-export-with-phpIPAM-API | /phpIPAM_with_user_token.py | UTF-8 | 1,133 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import requests
import json
import sys
import csv
server = "http://SERVER_ADDRESS"
appid = "APP_ID"
username = "USERNAME"
password = "PASSWORD"
url = sys.argv[1]
url_split = url.split("/")
url_length = len(url_split)
url_for_file_name = ''
if url_length > 1:
i = 1
... | true |
3fe7de4a7446be11c6327310989180c66fb70f5d | Python | ggm1207/Algorithms | /3.others/naver_songpyun.py | UTF-8 | 1,479 | 3 | 3 | [] | no_license | import sys
from copy import deepcopy
from collections import defaultdict
def return_depth(re_arr, next_list, prev_list):
depth = 0
start = [n for n in re_arr if not prev_list[n] and n in re_arr]
dd = defaultdict(list)
while(start):
nexts = []
for s in start:
for n in next_list[s]:
if n in... | true |
8e1d5262fd0be9cf4be9a67e60b175ce8253aaf3 | Python | toyanne/100-Python-exercises | /5.py | UTF-8 | 180 | 3.796875 | 4 | [] | no_license | #题目:输入三个整数x,y,z,请把这三个数由小到大输出。
n=input()
l=list(n)
#m=l.remove(',')
l.sort()
for i in range(2,5):
print(l[i],' ',sep='',end='')
| true |
5efbcf68851aa660b9a6fbcf04f12acbecdac8bd | Python | GyxChen/AmusingPythonCodes | /CifarMnistClassification/mnist_ffn.py | UTF-8 | 3,454 | 2.546875 | 3 | [
"MIT"
] | permissive | from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import warnings
import os
# suppress warnings
warnings.filterwarnings('ignore')
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
mnist = input_data.read_data_sets('./data/MNIST_data', one_hot=... | true |
07b77cd3186ef03b0d147d9638d31bd8dab29df4 | Python | n8henrie/icw | /src/icw/converter.py | UTF-8 | 10,225 | 3.03125 | 3 | [
"MIT"
] | permissive | """Converts csv files to ics files."""
import codecs
import csv
import typing as t
import uuid
from collections import Counter
from datetime import datetime, timedelta
import chardet
from icalendar import Calendar, Event, LocalTimezone
from werkzeug.datastructures import FileStorage
from icw import app
app.logger.d... | true |
68e5bd7741c8e379e7bb5a5967949536c2598bb0 | Python | ppd0705/10-week-algorithm-excercise | /Week_04/102/binary_tree_level_order_traversal.py | UTF-8 | 828 | 3.0625 | 3 | [] | no_license | from typing import List
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
res = []
if root is None:
return res
queue = [root]
le... | true |
1014e973c4ddc45968d3122217838b0f6f867cd1 | Python | ottter/discord-bot | /cogs/commands/people.py | UTF-8 | 5,412 | 2.875 | 3 | [
"MIT"
] | permissive | """Module that collects and shows memorable quotes from special people"""
import random
import urllib
from discord.ext import commands
from config import ACCEPTED_HOSTS, ACCEPTED_MEDIA_TYPES, db
from config import timestamp as TIME
BANNED_USERS = [
'635226170698235925', # jebbers
'941144178136600647', # ... | true |
a11bb65845f76eefc2835ecef043b3a60ebf4619 | Python | rob-smallshire/eseries | /test/test_eseries.py | UTF-8 | 7,530 | 2.765625 | 3 | [
"MIT"
] | permissive | import math
from hypothesis import given, assume
from hypothesis.strategies import sampled_from, floats, data, integers
from pytest import raises
from eseries import (ESeries, series, erange, find_less_than_or_equal, find_greater_than_or_equal, find_nearest,
find_less_than, find_greater_than, find... | true |
98c1a9bcfa1223fff241b17d390849b218d8b43e | Python | galid1/Algorithm | /python/exams/20.10.10(devmatching)/3.py | UTF-8 | 733 | 3.1875 | 3 | [] | no_license | def solution(n, groups):
answer = 0
# 켤수 있는 크기 순으로 정렬
groups.sort(key=lambda item : item[1] - item[0], reverse=True)
v = [0 for i in range(0, n+1)]
for g in groups:
cnt = 0
for j in range(g[0], g[1]+1):
if not v[j]:
cnt += 1
# 그룹을 사용하기로 결정
... | true |
be41a6f6b36c1972800814c271e8af5cf10a8629 | Python | nyucusp/gx5003-fall2013 | /agb344/Assignment_1/Problem3.py | UTF-8 | 3,933 | 3.5625 | 4 | [] | no_license | #!/usr/bin/python
import sys
fieldList = []
countedFieldList = []
def getField (rows, columns): #creates a field from user input - assumes correct input
field = []
for i in xrange(0, rows):
row = list(raw_input(""))
field.append(row)
return field
def getPair():
pairText = raw_input(... | true |
03147e1fc7ef02224e11decaa59df3e308c0bbbd | Python | fresky/ProjectEulerSolution | /016.py | UTF-8 | 257 | 3.203125 | 3 | [
"MIT"
] | permissive | __author__ = 'Dawei'
import math
answer = int(math.pow(2,1000))
strAnswer = str(answer)
result = 0
for i in list(strAnswer):
result += int(i)
print(result)
result = 0
while answer > 0:
result += answer%10
answer = answer//10
print(result)
| true |
739a8473119d64d531023eacc45373b068ba3dc0 | Python | li-s/Handwriting-recognition | /main/CNN/datasets.py | UTF-8 | 5,062 | 2.765625 | 3 | [] | no_license | import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
from skimage.transform import resize, rotate
from keras.utils import np_utils
import pickle
from pprint import pprint
import random
random.seed(171)
# Function copied from internet
def elastic... | true |
dac1daf8c1c14d435b76c0245fa3d89ec351f7ec | Python | ShiJingChao/Python- | /PythonStart/0722Python/0805Python/day08/demo06_包.py | UTF-8 | 1,212 | 3.640625 | 4 | [] | no_license | """
包:
特点:
python包文件中必须有一个__init__.py文件
一个文件夹,在这个文件夹中可能存在多个.py文件;
一个包里可以有很多模块;
导入包中的模块(如果包在当前路径下):
1. import 包名.模块名
[使用]: 包名.模块名.函数名()
2. from 包名 import 模块名
from 包名.模块名 import 函数名
3. from 包名 import... | true |
05dcc3a8645b629e9896269a56fe4bf0fa2a651f | Python | temkakb/TPNwebsite | /services/demtrang.py | UTF-8 | 292 | 2.625 | 3 | [] | no_license | def demtrang(count):
trang=""
a=int(count/12)
for i in range(1,a+1):
trang +=str(i)
if count %2!=0:
trang +=str(a+1)
return trang
def numtrang(numpage):
staticnum=12
end=numpage*staticnum
start=numpage*staticnum-staticnum
return [start,end] | true |
562d1a9b5190949c18155619bcd18e241a23a3da | Python | matt-advent-of-code/advent-of-code-2020 | /day1/expense_report.py | UTF-8 | 484 | 3.5625 | 4 | [] | no_license | def calculate(expenses: list, magic_number: int) -> int:
for i, first in enumerate(expenses):
for j, second in enumerate(expenses[i + 1:]):
for third in expenses[j + 1:]:
if first + second + third == magic_number:
return first * second * third
if __name__ ==... | true |
bef9a4909a68a5a9b5b6f1a9a26aa47ceb4e8821 | Python | dicodoci/numerosity_estimation | /temp.py | UTF-8 | 293 | 3.8125 | 4 | [] | no_license | for a in range(10):
print("a:", a)
for b in range(20):
print("b:", b)
if a==5:
# Break the inner loop...
break
else:
# Continue if the inner loop wasn't broken.
continue
# Inner loop was broken, break the outer.
break | true |
520858cae049df1879bf9fbf1843ef0125ff69b9 | Python | zarkaltair/Telegram-bot-with-webhook | /Parse site/parse_kakoysegodnyaprazdnik.py | UTF-8 | 456 | 2.9375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def get_html(url):
respons = requests.get(url)
return respons.text
def parse(html):
xml = BeautifulSoup(html, 'lxml')
celebrations = xml.find(class_="listing_wr")
celebration = []
for row in celebrations.find_all(itemprop="text"):
celebration.append(row.text)
re... | true |
4bb05fba00fcc9cab029c8b7a062931548429084 | Python | alejandromdnsls/Compiladores | /src/prac3/CONV/Convertir.py | UTF-8 | 3,823 | 2.609375 | 3 | [] | no_license | from CONV.AFNE_AFD import *
from CONV.AFNE import *
class AFD:
allC_E = []
tabla_info = []
sinonimos = []
def __init__(self, content):
self.algoritmo = Algoritmo(content)
self.quintupla = Quintupla(content)
def convertir(self):
self.algoritmo.inicializar_ce(self.algoritm... | true |
b379e19a3a8a3fbe4c2edf2d5d5c6481951360ce | Python | AndrewSigorskih/ROSALIND_problems | /Bioinformatics Stronghold/23_pdst.py | UTF-8 | 463 | 2.515625 | 3 | [] | no_license | import numpy as np
from Bio import SeqIO
def hamming_dist(s1, s2):
if (len(s1) != len(s2)):
return -1
return sum(c1 != c2 for c1, c2 in zip(s1, s2)) / len(s1)
records = list(SeqIO.parse("rosalind_pdst.txt", format="fasta"))
n = len(records)
arr = np.zeros((n,n))
for i in range(n):
for j in ran... | true |
ecffaa14a470994e2649ba17732bef1e9aa4d51a | Python | darrencheng0817/AlgorithmLearning | /Python/leetcode/DistinctSubsequences.py | UTF-8 | 1,278 | 3.84375 | 4 | [
"MIT"
] | permissive | '''
Created on 1.12.2016
@author: Darren
''''''
from Python.interview.KnightGame import solution
Given a string S and a string T, count the number of distinct subsequences of T in S
A subsequence of a string is a new string which is formed from the original string by deleting some (can be none)
of the charact... | true |
1cb893bb49e45b03ee206f500176748fb1f879cd | Python | amjadtaleb/PyTrinamic | /PyTrinamic/examples/evalboards/TMC2225/TMC2225_rotateDemo.py | UTF-8 | 871 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
'''
Move a motor back and forth using velocity and position mode of the TMC2225
Created on 17.10.2019
@author: JM
'''
import time
import PyTrinamic
from PyTrinamic.connections.ConnectionManager import ConnectionManager
from PyTrinamic.evalboards.TMC2225_eval import TMC2225_eval
connectionMan... | true |
4e78c90951a662cb539acfc788bd08bc552e8d08 | Python | ashi1994/AutomationLearn_Python | /Utility/Actionschain.py | UTF-8 | 789 | 2.890625 | 3 | [] | no_license | '''
Created on May 18, 2018
@author: aranjan
'''
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome()
element=driver.find_element_by_class_name("name")
element1=driver.find_element_by_class_name("namem"... | true |
e24d23bd8f3886be719d26572ea1d9e80ad59a7a | Python | kristiansantos11/datastructure-and-algorithms | /algorithms part 1/randomized queues and deque/Deque.py | UTF-8 | 2,881 | 3.765625 | 4 | [] | no_license | class Deque:
def __init__(self):
self.size = 0
self.head = None
self.tail = None
def __repr__(self):
node = self.head
nodes = []
while node is not None:
nodes.append(node.data)
node = node.next
nodes.append("None")
... | true |
719257956ec706ac785bab03fa29870bf8f4e1fa | Python | tarasovnm/titanic | /code/utils/cleaner.py | UTF-8 | 1,042 | 3.515625 | 4 | [] | no_license | import pandas as pd
def load_data(index_col=None):
print('Loading data =================================================================')
train_data = pd.read_csv("../data/input/train.csv", index_col=index_col)
test_data = pd.read_csv("../data/input/test.csv", index_col=index_col)
print('Data loaded')
prin... | true |
87b69a9e0ca0f859c1657e1242d17c173b25c516 | Python | SoushiAnzai/atcoder | /python/kyopro_educational_90/066.py | UTF-8 | 660 | 3.03125 | 3 | [] | no_license | # 数列屋の高橋くんは長さ N の数列 A を作っています。数列 A の i 番目の要素 A[i] の値は、L[i] ≦ A[i] ≦ R[i] を満たす整数から一様ランダムに選ぶことで決定されます。
# このようにしてできた数列 A の転倒数の期待値を求めてください。
# なお、長さが M である数列 X の「転倒数」とは、i < j かつ X[i] > X[j] であるような (i, j) (1 ≦ i, j ≦ M) の個数を指します。
# 【制約】
# - 1 ≦ N ≦ 100
# - 1 ≦ L[i] ≦ R[i] ≦ 100
# - 入力は全て整数で与えられる
# ※絶対誤差または相対誤差 10^{-7} 以下... | true |
af66c51f5766ec93d5f75adb6f8f477e5f2fbca5 | Python | Azazyro/Metodos-Numericos- | /Funciones con Matrices/Codigo de Funciones con Matrices.py | UTF-8 | 845 | 3.671875 | 4 | [] | no_license | def suma (A,B):
if len(A) != len(B):
print ("No se puede realizar la suma, el número de renglones no es igual")
return
if len(A[0]) != len(B[0]):
print ("No se puede realizar la suma, el número de columnas no es igual")
return
C = A
for i in range(len(A)):
for j i... | true |