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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6f245d49ec4bf16f337ecdc6a7fcce05da953851 | Python | drgarcia1986/coding | /algorithms/search/string_pattern_matching/python/string_pattern_matching.py | UTF-8 | 401 | 3.203125 | 3 | [] | no_license | """
>>> matching('aababba', 'abba')
3
>>> matching('cormen', 'skiena')
-1
"""
def matching(t: str, p: str) -> int:
t_len = len(t)
p_len = len(p)
for i in range((t_len - p_len) + 1):
j = 0
while j < p_len and t[i+j] == p[j]:
j += 1
if j == p_len:
return i
... | true |
65d0a8394f7a5f8f6a3aa56c1c7fb80c821a718f | Python | naghamghanim/facodersPython | /Python/try2.py | UTF-8 | 184 | 3.640625 | 4 | [] | no_license | def add_to_list(list2,n):
L=len(list2)
x=0
while(x<L):
list2[x]+=2
x=x+1
return list2
list1 = [10, 5, 2, 6, 9, 11, 23]
print(add_to_list(list1,2))
| true |
4cea034974a96105e88416f56f36e576faafadc7 | Python | fandiarfa26/auto-summ | /app/models.py | UTF-8 | 1,049 | 2.65625 | 3 | [] | no_license | from datetime import datetime
from app import db
class Book(db.Model):
id = db.Column(db.Integer, primary_key=True)
code = db.Column(db.String(100))
title = db.Column(db.String(100))
chapters = db.relationship('Chapter')
def __repr__(self):
return '<Book ID:{}>'.format(self.id)
class Chap... | true |
be506c39c0a39961c1c17ad715895d651b169be8 | Python | Twosiders/University_Year_2 | /CE235-5-SP/15a4 Programming Assignment 3/Submissions/decryptor.py | UTF-8 | 2,870 | 3.203125 | 3 | [] | no_license | #****************************
#* Decryptor by Alex Mezodi *
#****************************
# Student Number: 1401665
def swap(s, i, j):
lst = list(s);
lst[i], lst[j] = lst[j], lst[i]
return ''.join(lst)
def swapChar(s,i,j):
lst = list(s);
lst[i] = j
return ''.join(lst)
def swapNib... | true |
c2aad504dc1969e82376cb85699b7b97f9e9a7ac | Python | MartinMa28/Algorithms_review | /concurrency/1117_building_H2O.py | UTF-8 | 787 | 2.78125 | 3 | [
"MIT"
] | permissive | from threading import Semaphore, Lock
class H2O:
def __init__(self):
self.hy_sema = Semaphore(value=2)
self.oxy_sema = Semaphore(value=0)
self.oxy_mutex = Lock()
def hydrogen(self, releaseHydrogen: 'Callable[[], None]') -> None:
self.hy_sema.acquire()
# releaseHydrogen... | true |
be7968728f3f02d545965f4739c2507c9414a28d | Python | shibinbshaji/card | /script.py | UTF-8 | 1,234 | 3 | 3 | [] | no_license | import sys
card_no = list(sys.argv[1])
######################################################
def double_it(dig):
if dig < 5:
dig = dig*2
else:
if dig == 5:
dig = 1
elif dig == 6:
dig = 3
elif dig == 7:
dig = 5
elif dig == 9:
dig = 9
return dig
##################################################... | true |
8224e68e7972f2352b1df4a88c382021b1cc51cc | Python | mtlynch/sia_load_tester | /sia_load_tester/progress.py | UTF-8 | 6,762 | 3.0625 | 3 | [
"MIT"
] | permissive | """Monitors upload progress to make sure Sia is still making real progress.
This offers a collection of classes meant to monitor Sia's upload progress to
ensure progress has not stalled.
"""
import collections
import datetime
import logging
import threading
import time
import sia_client as sc
logger = logging.getLo... | true |
66648749eb3c6031410e6ca212077b7274a2c023 | Python | flvSantos15/pythonExercicies | /Mundo1/Exercicios/ex015.py | UTF-8 | 118 | 3.734375 | 4 | [] | no_license | k = float(input('Kilometros? '))
d = int(input('Quantos dias? '))
vd = 60 * d
kr = 0.15 * k
print('Valor: ', vd + kr)
| true |
b4be77f7bc0ed0955d0b41bc9bc86e368cb4a6d7 | Python | siyulu14/12_web_scraping | /scrape_mars.py | UTF-8 | 3,830 | 2.90625 | 3 | [] | no_license | # dependency
from bs4 import BeautifulSoup
from splinter import Browser
import pandas as pd
import time
def init_browser():
executable_path = {"executable_path": "/usr/local/bin/chromedriver"}
return Browser("chrome", **executable_path, headless=False)
def scrape():
browser = init_browser()
# Create... | true |
a542c28168e1d849dfb3e5a94a62c3bf549828d5 | Python | leogemetric/cryptoctf-2016 | /MLG-Crypto_90/solution.py | UTF-8 | 874 | 2.640625 | 3 | [] | no_license | lines = open("mlg_crypto.txt", "r").readlines()[1:-1]
subs = {}
for line in lines:
line = line.strip()
for word in line.split("_"):
if word in subs:
subs[word] += 1
else:
subs[word] = 1
print len(subs)
print subs
space = max(subs, key=lambda x: subs[x])
del subs[space]
... | true |
b20f8d7cae859ee0ffe48e03dd4dee616c5c271b | Python | aarthisandhiya/codekata_player-py- | /pg79.py | UTF-8 | 195 | 2.78125 | 3 | [] | no_license | n=int(input())
l=[int(x) for x in input().split()]
tl=[]
t=0
if(n==len(l)):
for i in range(0,n):
for j in range(0,n):
t=abs(l[j]-l[i])
tl.append(t)
t=0
print(max(tl))
| true |
9f342be1d33fea3efa174e9c9fbf3b61529e9ab7 | Python | johshisha/selective_search | /program/selective.py | UTF-8 | 3,052 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import Image
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.image as mpimg
import selectivesearch,sys,os
sys.path.append('/home/dl-box/study/.package/python_util/')
import util,Feature
class Feature_from_array(Feature.Classify):
de... | true |
c8ea9af9e932587d62891d22607a76cd02b2596c | Python | Grant-W-Code92/E-Dice_Terminal_V.1 | /E-Dice.py | UTF-8 | 3,829 | 4.0625 | 4 | [] | no_license | import random
#This is my first ever project#
#Help Screen#
def help_screen():
print("""
~Help~
How to play: Once you have started the program,
you will choose a dice to roll from the provided
list, once selected the program will roll said... | true |
56b30ad77b0326ba6d867779985a38a5b27b31d1 | Python | aamini/chemprop | /chemprop/data/data.py | UTF-8 | 17,436 | 2.875 | 3 | [
"MIT"
] | permissive | from argparse import Namespace
import random
from typing import Callable, List, Union
import numpy as np
from torch.utils.data.dataset import Dataset
from rdkit import Chem
from .scaler import StandardScaler
from chemprop.features import get_features_generator
from schnetpack.datasets import QM9
class MoleculeData... | true |
2ec2c3d60141ea2d78fc08e37e4a86a51de4ecb4 | Python | Rymou/Projet-RI | /TransformationsMethodes.py | UTF-8 | 2,880 | 2.828125 | 3 | [] | no_license | from string import *
from math import *
import os
import collections,re
def fichierInverse():
k = 1
N = 4
freq = {}
ListCar = {".", ",", "!", '?', "'"}
stoplist = open('stopwords_fr.txt', 'r')
stoplist = stoplist.read()
stoplist = stoplist.lower()
stoplist = stoplist.split()
while ... | true |
3220ef99c1900071dad9464c8de85d5faa892d9c | Python | jeongyongwon/Algo_Coding | /swexpert/캐슬 디펜스.py | UTF-8 | 194 | 3.09375 | 3 | [] | no_license |
R,C,D = map(int,input().split())
mat = []
for i in range(R):
mat.append(list(map(int,input().split())))
### 궁수들이 서 있을 수 있는 방법은 5c3
print(permute([1,2,3,4]))
| true |
69d98c7405a923f267ffbaed102493259932febd | Python | aokellermann/fcrypt | /fcrypt.py | UTF-8 | 3,163 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# Copyright Antony Kellermann 2020
# Usage: fcrypt.py [--encrypt|--decrypt] [<receiver_public_key>|<receiver_private_key>] <plaintext_file> <encrypted_file>
import sys
import zlib
from Crypto.Random import get_random_bytes
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Cr... | true |
fa0cdaf5f8fc14cb3c633bf6736ad073391caa8f | Python | Aasthaengg/IBMdataset | /Python_codes/p03090/s085619297.py | UTF-8 | 861 | 3.3125 | 3 | [] | no_license | import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(20000000)
def main():
N = int(input())
answer = []
if N % 2 == 1:
for i in range(1, N):
answer.append((N, i))
for j in range(1, N):
for k in range(j + 1, N):
if... | true |
63ed008bb3d24e4e9be0945cac649965e98c006f | Python | ooscar2/Oscar | /holamundo.py | UTF-8 | 340 | 3.84375 | 4 | [] | no_license | #Se utiliza el "def" para definir una función, a la cual se le colocara un nombre, en este caso "imprimir"
def imprimir():
#al momento de definirla se le agregara la accion que debe realizar en este caso imprimir un mensaje
print("HOLA MUNDOOOOOO, ya se usar python!!:)")
#se imprime el mensaje con la funcion definida... | true |
99d3fca1e9935bc7108674a0d534d6a1d2a17cbe | Python | Aasthaengg/IBMdataset | /Python_codes/p02790/s446309454.py | UTF-8 | 63 | 2.578125 | 3 | [] | no_license | f = list(map(int, input().split()))
print(str(min(f)) * max(f)) | true |
5dff86391d03cfe79073cbf44619acf4cb2a9596 | Python | wtbsw/AnomalyDetection | /docs/graph_laplacian/test.py | UTF-8 | 601 | 2.921875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import numpy as np
from sklearn.utils.graph import graph_laplacian
def assign_undirected_weight(W, i, j, v):
W[i,j] = W[j,i] = v
n = 5
W = np.zeros((n,n))
assign_undirected_weight(W,0,1,0.08)
assign_undirected_weight(W,0,2,0.09)
assign_undirected_weight(W,1,2,0.45)
assign_undirected_weight... | true |
761ad083a5e5f80b958eaf96818964c869e18bf0 | Python | srinivasshingade/Custom-Object-detection-using-tensorflow | /Find_Phone/train_phone_finder.py | UTF-8 | 2,325 | 2.734375 | 3 | [] | no_license | import os
import cv2
import numpy as np
import tensorflow as tf
import sys
# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
# Import utilites
from utils import label_map_util
from utils import visualization_utils as vis_util
# Grab path to current working directory
... | true |
3fde1885933bb865a06754827be034bca5530ad2 | Python | prateek27/python-dev-march-18 | /Lecture-7/crawler.py | UTF-8 | 711 | 3.25 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def get_links(url):
r = requests.get(url)
soup = BeautifulSoup(r.content, "html5lib")
links = soup.findAll('a')
urls = [link['href'] for link in links if link.has_attr('href') and link['href'].startswith('http')]
return urls
def spider(url, limit=100):
pagesToVisit... | true |
877d24102590ae40cf5bcb4057be30bacd4d4615 | Python | davidjamesbeck/slexil | /LineDataFrame.py | UTF-8 | 6,848 | 2.625 | 3 | [
"MIT",
"GPL-3.0-or-later",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"GPL-3.0-only",
"AGPL-3.0-or-later"
] | permissive | import pandas as pd
from xml.etree import ElementTree as etree
pd.set_option('display.max_columns', 500)
class DataFrame:
def __init__(self, doc, allElements):
'''doc = .eaf file; allElements = line element and its children'''
self.doc = doc
self.allElements = allElements
self.tbl ... | true |
638c162e138950833fb3d155612e511ee5066df9 | Python | RaishavHanspal/PythonBeginner | /cat_talk.py | UTF-8 | 331 | 3.265625 | 3 | [] | no_license | def greeting(variable):
print('{}{}'.format(' '*len(' /'),'_'*len(variable)))
print('{} {}'.format(' '*len(' '),'< '+ variable +' >'))
print('{}{}'.format(' '*len(' /'),'-'*len(variable)))
print(' /')
print(' /\_/\ /')
print('( o.o )')
print(' > ^ <')
pr... | true |
a6cce496ea19f07ad7b0b9bb3cf7a3a56d18d116 | Python | eejd/course-content | /tutorials/W3D1_BayesianDecisions/solutions/W3D1_Tutorial2_Solution_797c061a.py | UTF-8 | 1,165 | 3.28125 | 3 | [
"CC-BY-4.0",
"BSD-3-Clause"
] | permissive |
# 1. The minimium of the different loss functions correspond to the mean, median,
#. and mode of the posterior (just as in Interactive Demo 3). If we have a bi-modal
#. prior, those properties of the posterior can be distinct.
#. 2. The posterior is just another probability distribution, so all the properies we
#... | true |
ef335f7cb7123886289b2c036a8a9101dbe16e9c | Python | Bipul-Harsh/Code-Chef-Solutions | /SIMPSTAT.py | UTF-8 | 195 | 2.84375 | 3 | [] | no_license | # cook your dish here
for _ in range(int(input())):
n, k = map(int, input().split())
a = sorted(map(int, input().split()))
ans = a[k:n-k]
print('{:.6f}'.format(sum(ans)/len(ans))) | true |
266ef6b3bf1a9c8dc8c7bf1e055a65ddb8ced58b | Python | murrutia/ngwallpaper | /modules/Displays.py | UTF-8 | 2,258 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import Script
from DatabaseActions import DatabaseActions
class Displays(object):
def __init__(self):
self.db = DatabaseActions()
spaces_display_configuration = Script.load_json_file("~/Library/Preferences/com.apple.spaces.plis... | true |
7705d3f7374eba3641e710c6c67e7318726d9367 | Python | 2016102050016/n_gram_graph | /datasets/prepare_muv.py | UTF-8 | 3,285 | 2.546875 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem, MolFromSmiles, MolFromMolBlock, MolToSmarts
from sklearn.model_selection import StratifiedKFold
from data_preprocess import *
import os
np.random.seed(123)
target_names = [
'MUV-466', 'MUV-5... | true |
4d2af918325de8763a1ce0bc3e1d3df9956cd72f | Python | kermitt/challenges | /py/Tester.py | UTF-8 | 220 | 3.15625 | 3 | [] | no_license | def log(s):
print("|{}|".format(s))
def verdict(actual, expected):
didPass = "FAIL"
if actual == expected:
didPass = "PASS"
print("{} |{}| ---> |{}|".format(didPass, actual, expected))
| true |
764a03e20c62c3ad42c858f508c949383aa8f4b3 | Python | vakisan/Python-Summer-2020 | /Python Syntax/Exponents.py | UTF-8 | 185 | 3.984375 | 4 | [] | no_license | # Calculation of squares for:
# 6x6 quilt
print(6**2);
# 7x7 quilt
print(7**2);
# 8x8 quilt
print(8**2);
# How many squares for 6 people to have 6 quilts each that are 6x6?
print(6**4); | true |
a8abb8042b0982f5ef76092dc2d2fec24b8cb6ce | Python | webclinic017/TraderSoftwareRP | /EXE_RP/PROJECT.programmingTools/PROJECT.DailyControls/copy_invoices_from_finance.py | UTF-8 | 770 | 2.6875 | 3 | [] | no_license | ######### VARIABLE TO CHANGE ###############
############################################
FinanceDrive = "C:/Work/test/" ############# <----- Amend this path only
############################################
############################################
FinanceDrive = 'Y:\FINANCE_ALL\INVOICING\\2011_InvoicesINC\Dec... | true |
3fc2c395f04cce3bad4254f7bce987ffa9301ee5 | Python | r-nulled/interview-questions | /numbers/combination_w_weights.py | UTF-8 | 1,993 | 3.859375 | 4 | [] | no_license | """
Given 4 separate lists of prices (A_1, A_2, A_3, A_4), each for a different product (eg hats, shoes, shirts, and pants), how many combinations (sets of clothing including 1 item from each product category) can one make
given a (budget) total price limitation of B?
example input:
hats: [1, 2, 3]
shoes: [2, 3, 4]
p... | true |
f75c32cca0de8f159dfadb2d3a8eb4bc15412b16 | Python | Teftelly/Cloude_service | /NeuroPlusPoop/Picture/OCR.py | UTF-8 | 1,409 | 2.6875 | 3 | [] | no_license | from PIL import Image
import pytesseract
import logging
import cv2
import os
import pathlib
class Picture_to_text():
def Get_text_from_picture(self, image):
logging.basicConfig(filename="Text_Graber.log", level=logging.INFO)
logging.debug("initializing...")
try:
logging.info("... | true |
21f5f6eda4c9f566a71fa6e0bf10ff275e2b5b3e | Python | RossMeikleham/DailyProgrammer | /Easy/Challenge227/Challenge227.py | UTF-8 | 3,145 | 3.96875 | 4 | [
"MIT"
] | permissive | import math
from decimal import Decimal
def getPoint(s, n) :
if n > (s**2) or n <= 0 or (s & 0x1 != 0x1):
print("Error expected n > 0 and n < s^2, and s to be odd")
else:
#Obtain co-ordinates for center of the spiral
center = (s + 1) / 2
#Next obtain the "level" that the gi... | true |
4929156dc836f9ea9e06decb44d15381620b7c67 | Python | jack8daniels2/bouncer | /bouncer/storage/__init__.py | UTF-8 | 2,194 | 2.734375 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod, abstractproperty
from tornado import gen
class VerdictBase(object):
__metaclass__ = ABCMeta
@abstractmethod
def generate_query_parameters(self, domain, path_parameters):
'''
Method to generates a dict of database query parameters from
domain ... | true |
d9a88bada67a8e966b34c7ff3a89780d01e929e4 | Python | gglue/Super-Dodger-Pygame | /pySprites.py | UTF-8 | 34,281 | 3.515625 | 4 | [] | no_license | '''
Name: Victor Li
Date: 5/5/2017
Description:
'''
import pygame, random
pygame.mixer.init()
# Sound effect when the player uses its pickaxe
pickAxeSound = pygame.mixer.Sound("sound/pickAxeHit.wav")
pickAxeSound.set_volume(0.5)
# Sound effect when the player uses its mop
mopSound = pygame.mixer.Sound("sound/mopHit.w... | true |
c8860457b5e16afde2b035aba761609bc0a77650 | Python | MuMuPatrick/4TB6 | /MachineLearning/take_training_pictures.py | UTF-8 | 806 | 2.796875 | 3 | [] | no_license | #in terminal do
#pip3 install opencv-python
#pip3 install
#then run the script
#press "space" to take a picture
#press "q" or "ctrl+z" to quit the program
import cv2
import imutils
import time
cam = cv2.VideoCapture(0)
#specify image resolution
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 352)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT... | true |
c2691f821d70a5d53ccc4e673503102f4f21084f | Python | JHaller27/star_trader | /ts/pyCommodities/commodityCsv2Json.py | UTF-8 | 2,070 | 3.0625 | 3 | [] | no_license | import csv
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('csv_path', type=str, help='Path to CSV to read from')
parser.add_argument('json_path', type=str, help='Path to JSON to write to')
parser.add_argument('--no-vice', '-v', dest='novice', action='store_true', help='Set this fla... | true |
5fc34133a06b1fc15fb65f04918e29fc706ff7ab | Python | V4p1d/Week3-Exercises | /Ex5.py | UTF-8 | 186 | 3.484375 | 3 | [] | no_license | # Write a program that, given an integer input, prints the prime numbers up to that integer.
# Hint, you might want to use two nested loops. Also, check how the modulo operation works.
| true |
7351c18a99723c59071410e75443502f9838bc5f | Python | TomekBarabasz/Game-AI | /python/tracer.py | UTF-8 | 6,292 | 2.8125 | 3 | [] | no_license | from subprocess import run
from itertools import count
def num2Suites(cards, separator=' '):
suits = '♥♠♣♦'
values=['9','10','W','D','K','A']
return separator.join([ values[x//10-9]+suits[x%10-1] for x in cards])
def move2str(move):
if move[0] == 'play':
return move[0] + ' ' + num2Suites(move[1])
elif move[0] ... | true |
5926b6b8cd315292cafd904e637234f7f60ea4b1 | Python | tatiana-kim/contest-algorithms | /contest5/A.py | UTF-8 | 1,958 | 3.609375 | 4 | [] | no_license | # n = t-shorts
# m = pents
def find_min_diff_btwn_shortspents(shorts, pents):
s = p = 0 # s = shorts; p = pents
n, m = len(shorts), len(pents)
minshorts = minpents = 0
minval = 10 ** 7 + 1
while s < n and p < m:
if abs(shorts[s] - pents[p]) < minval:
minval = abs(shorts[s] - pe... | true |
66fb3d74954fff394a57e8a8008190f42f3d74f2 | Python | nekapoor7/Python-and-Django | /PythonNEW/Practice/StringFormattedText.py | UTF-8 | 493 | 3.90625 | 4 | [] | no_license | """Write a Python program to display formatted text (width=50) as output."""
import textwrap
sample_text ='''
Python is a widely used high-level, general-purpose, interpreted,
dynamic programming language. Its design philosophy emphasizes
code readability, and its syntax allows programmers to express
co... | true |
bad6c82884f81b45aeb2082b1b5f00abbb0f50a4 | Python | SSaratKS/Python-Projects | /100 Python Exercises/exercise97.py | UTF-8 | 610 | 4.1875 | 4 | [] | no_license | #Question:
'''
Create a program that ask the user to submit text repeatedly. The program saves
the changes when User submits SAVE, but doesn't close the program. Program
saves the changes and closes when user sumbits CLOSE.
Hint: Like the previous exercise, but here you need more conditional lines.
'''
#Answer:
'''
fi... | true |
5f61bede1ee142a5aa30b959588188c566c8954e | Python | chenhaoenen/FCTest | /python/yield.py | UTF-8 | 639 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Author: chenhao
# Date: 2020/7/4
# Description:
#-------------------------------------------------------------------------------
def foo():
print("starting...")
while True:
res = yield 4
... | true |
bd958cfd2d4e662e5533256f73cd1db4ab24c9f7 | Python | farnswj1/ChromeDinosaurGameNEAT | /main.py | UTF-8 | 1,248 | 3.390625 | 3 | [
"MIT"
] | permissive | '''
Justin Farnsworth
Google Chrome Dinosaur Game (with NEAT)
November 12, 2020
This is a Python-based implementation of the dinosaur game featured on
Google Chrome. The user can choose to play the game manually or the user
can allow the NEAT algorithm to play the game. If the NEAT algorithm is
used, the AI will try t... | true |
568f44850730ebfbf2a7c368fc514e34656ba1ad | Python | LorinChen/lagom | /lagom/experiment/config.py | UTF-8 | 4,725 | 3.359375 | 3 | [
"MIT"
] | permissive | from itertools import product
class Grid(list):
r"""A grid search over a list of values. """
def __init__(self, values):
super().__init__(values)
class Sample(object):
def __init__(self, f):
self.f = f
def __call__(self):
return self.f()
class Condition(obj... | true |
15cac5bfa8a6e91b81ca1cbb84ace664701b090a | Python | daviz888/python_works | /city_country.py | UTF-8 | 207 | 3.984375 | 4 | [] | no_license | import screen
screen.clear()
# Prints city and country using function
# Exercise 8.6
def city_country(city, country):
print(f'{city.title()}, {country.title()}')
city_country('manila', 'philippines') | true |
d23926f9f6623fdddf41a4c547f74e6a458d3963 | Python | robertcalvertphd/Atomic_NN | /KerasExample.py | UTF-8 | 2,882 | 2.9375 | 3 | [] | no_license |
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
import random
class ExamplePlayer():
def __init__(self):
self.qbSkill = random.randint(1, 10)
self.qbSkill += random.randint(1, 10)
self.wrSkill = random.randint(1,10)
self.week1 = ... | true |
31788a0f65fe702c01bc4bd6e77c0907942b9cc2 | Python | evaneill/vae | /VAE/models/loss.py | UTF-8 | 5,175 | 2.59375 | 3 | [] | no_license |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.distributions.multinomial import Multinomial
import numpy as np
from torch import Tensor as T
import torch
import math
def VRBound(alpha,model,q_samples,q_mu, q_log_sigma,K=None,optimize_on='full_bound... | true |
d4fcd1a5c75aa42345a9f334d20f701200760f9d | Python | fpaissan/raman_spectrograms_analysis | /src/features/utils.py | UTF-8 | 468 | 2.625 | 3 | [] | no_license | # Written by Francesco Paissan
from progress.bar import ShadyBar
import pickle
import glob
def save_feat_files(feat, path):
with open(path, "wb") as f:
pickle.dump(feat, f)
def load_features(path):
file_list = glob.glob('{0}/*'.format(path))
with ShadyBar(f"Loading dataset...", max=len(file_lis... | true |
f52cd5e61ebb425f8107c7447f76bb5371ddfcf0 | Python | communitysnowobs/validation | /validation/Elevation.py | UTF-8 | 2,736 | 3.0625 | 3 | [] | no_license | import pandas as pd
import requests
import validation.utils as ut
import validation.creds as creds
BASE_ELEVATION_URL = 'https://maps.googleapis.com/maps/api/elevation/json'
def el_data(points=[]):
"""Retrieves elevation data from Google Elevation API.
Keyword arguments:
points -- List of coordinates to ... | true |
2c10d40dcf5ec98620e940cec63d72c255a4e1d3 | Python | haramrit09k/HappyEarth | /app.py | UTF-8 | 6,077 | 2.5625 | 3 | [] | no_license | import streamlit as st
from PIL import Image
from clf import predict2
import time
classes=['beer-bottle','book', 'can', 'cardboard', 'egg', 'flower', 'food-peels', 'fruit', 'jute', 'leaf', 'meat', 'newspaper', 'paper-plate', 'pizza-box', 'plant', 'plastic-bag', 'plastic-bottle', 'spoilt-food', 'steel-container', 'ther... | true |
cc1ff6f23f118545e18ebb999d01570117f146e7 | Python | lishuwen88/cython_stuff | /ksmith/ch05/python_particle.py | UTF-8 | 239 | 3.15625 | 3 | [] | no_license | class Particle(object):
"""Simple Particle type."""
def __init__(self, m, p, v):
self.mass = m
self.position = p
self.velocity = v
def get_momentum(self):
return self.mass * self.velocity
| true |
d825b37373c63f647f1c4a1397e37ee303b3197b | Python | jcartus/SCFInitialGuess | /butadien/scripts/aimd_runs.py | UTF-8 | 1,916 | 2.84375 | 3 | [
"MIT"
] | permissive | """This script will run md runs for all mol files in a folder.
Author:
Johannes Cartus, QCIEP, TU Graz
"""
from os import listdir
from os.path import join
from pyQChem import inputfile
from pyQChem.utilities import _readinput
from SCFInitialGuess.utilities.usermessages import Messenger as msg
from SCFInitialGues... | true |
6291d4b1c9dce136988a2e9f08fb48ab781f49f2 | Python | beidou9313/deeptest | /第一期/杭州-咫尺/Day1/dictiionary/func_Dic.py | UTF-8 | 331 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding:utf-8 -*-
__author__ = u'Heatherwyz'
if __name__ == "__main__":
dict = {u"DeepTest": u"开源优测", u"book": u"快学Python3"}
#len
print(len(dict))
#将字典转化为字符串
str_d = str(dict)
print(str_d)
print(dict)
#判断类型
print(type(dict))
print(type(str_d))
| true |
d53fbb3d279834cdc71351f834fc937e17f489b6 | Python | py503/win10_pycharm_project | /blog/views.py | UTF-8 | 6,603 | 2.796875 | 3 | [] | no_license | # 分页插件包
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
from .models import Article, Category, Banner, Tag, Link
def hello(request):
return HttpResponse('欢迎使用Django!')
def index_test(requ... | true |
1d880f24962104979be397dc45e6becdaf62307c | Python | agautam-git/HaikuJAM-spellChecker | /output.py | UTF-8 | 538 | 3.140625 | 3 | [] | no_license | import requests, argparse
from flask import Flask, request, jsonify
parser = argparse.ArgumentParser(description='Enter the word: ')
parser.add_argument('-WORD','--word', help='input word', required=True)
def main(args):
url = 'http://localhost:5000/spellCorrect/'
data = {'word': args.word}
output = requests.post... | true |
db5a7beaac205748d20bca165465b16ccc7b27b6 | Python | abhishekmishragithub/python2-basic-exercises | /reverse of a string.py | UTF-8 | 224 | 4.125 | 4 | [] | no_license | '''
To reverse a string without var[::-1]
'''
string = raw_input("Enter a value: ")
reversed_string = ''
for i in range(len(string)):
reversed_string += string[len(string) - i - 1]
print(reversed_string)
| true |
94a09b9653f0de7e1737bf146b14ecd6d16d732c | Python | yi-guo/coding-interview | /leetcode/python/150-evaluateReversePolishNotation.py | UTF-8 | 1,022 | 4.5625 | 5 | [] | no_license | #!/usr/bin/python
# Evaluate the value of an arithmetic expression in Reverse Polish Notation.
# Valid operators are +, -, *, /. Each operand may be an integer or another expression.
# Some examples:
# ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
# ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
def evalRP... | true |
2c375c40bdfc23679cccd96653ad254b13961d7c | Python | azedlee/fizz_buzz | /fizzbuzz_extra.py | UTF-8 | 328 | 4.1875 | 4 | [] | no_license | min_num = input("Please input min number: ")
max_num = input("Please input max number: ")
for i in range(min_num, max_num):
if i % 3 == 0 and i % 5 != 0:
print("Fizz")
elif i % 5 == 0 and i % 3 != 0:
print("Buzz")
elif i % 3 == 0 and i % 5 == 0:
print("FizzBuzz")
else:
p... | true |
ab3b4fd1e5d3beeec449c6f237f53af66646574b | Python | Roelio69/Workflow-course-11 | /GeneFilter1.py | UTF-8 | 548 | 2.734375 | 3 | [] | no_license | # filters genes containing numeric information
class class1():
def filterLPs(self, userInput, userOutput):
bestand = open(userInput, "r")
output = open(userOutput+".txt","w")
next(bestand)
next(bestand)
for line in bestand:
splitline = line.split("\t")
... | true |
2d429702cae39266d87834aa08c96efc679e40be | Python | Mittenss2010/PythonPractice | /tests/工具-计算bbox中心坐标--宽高--两点距离.py | UTF-8 | 887 | 3.296875 | 3 | [] | no_license |
import math
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
class BboxUtils():
def __init__(self):
pass
@staticmethod
def get_bbox_center(bbox):
'''
输入: bbox 信息
返回: bbox 中心坐标
'''
xmin, ymin, xmax, ymax = [int(x... | true |
9b793b79ed5c82b7b78e87fe35f1f0e95e425676 | Python | curly-bois/Chips | /chipSolver/scripts/wire.py | UTF-8 | 345 | 3.34375 | 3 | [] | no_license |
class Wire(object):
'''
A wire in the grid, nice to save some essentials
'''
def __init__(self, start, end, route):
self.start = start
self.end = end
self.route = route
self.length = len(route) - 1
self.min_len = (abs(start[0] - end[0]) +
... | true |
93d241d999b799aea678feb524c42b9060eead55 | Python | Jdporter2/rockPaperScissors | /rockPaperScissors.py | UTF-8 | 3,990 | 4.34375 | 4 | [] | no_license |
#set variable keepPlaying to true
keepPlaying = True
#While keepPlaying is true:
while keepPlaying == True:
print("Welcome to Rock, Paper, Scissors!")
print("The way you will play is you will choose 1 for rock, 2 for paper, 3 for scissors. Rock beats scissors, paper beats rock, and scissors beats paper. The... | true |
c17d080ddf962d3644c8cac27f06e11684867308 | Python | MMohan1/leaderboard-python | /test/leaderboard/reverse_competition_ranking_leaderboard_test.py | UTF-8 | 4,458 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from leaderboard.leaderboard import Leaderboard
from leaderboard.competition_ranking_leaderboard import CompetitionRankingLeaderboard
import unittest
import sure
class ReverseCompetitionRankingLeaderboardTest(unittest.TestCase):
def setUp(self):
self.leaderboard = CompetitionRankingLeaderboard(
... | true |
07f8d824c6a92db8433e85b8fc201b5dcc168369 | Python | EMilborn/earthquake | /utils/player.py | UTF-8 | 783 | 2.828125 | 3 | [] | no_license | from lagcomp import LagComp
from vector import Vector
from tick import TICKMULT
class PlayerInput:
def __init__(self):
self.up = False
self.down = False
self.right = False
self.left = False
self.mouse1 = False
self.mousePos = None
self.lockTime = 0 # used ... | true |
1b142464bec0d71d560c440d3513f959d3e2a93b | Python | Aasthaengg/IBMdataset | /Python_codes/p02381/s882620811.py | UTF-8 | 274 | 3.3125 | 3 | [] | no_license | import math
while True:
n = int(input())
if n == 0: break
s = [int(e) for e in input().split()]
average = sum(s) / n
total = 0
for e in s:
total += (e - average)**2 # 偏差の2乗の合計
print("{0: .4f}".format(math.sqrt(total/n)))
| true |
a148439f34b553e5923b01c64c065b54e6ece79c | Python | ChinaChenp/Knowledge | /interview/interview_python/mianshixinde/lesson4/4.5.1.py | UTF-8 | 1,230 | 4.375 | 4 | [] | no_license | # 局部最大(小)值
# 给定无序数组arr,已知arr中任意两个相邻的数都不相等。写一个函数,只需返回arr中任意一个局部最小出现的位置即可
# 解法
# 1)arr长度为1时,arr[0]是局部最小。
# 2)arr的长度为N(N>1)时,
# ①如果arr[0]<arr[1],那么arr[0]是局部最小;
# ②如果arr[N-1]<arr[N-2],那么arr[N-1]是局部最小;
# ③如果0<i<N-1,既有arr[i]<arr[i-1],又有arr[i]<arr[i+1],那么arr[i]是局部最小
#考虑找最小值
def getLessIndex(arr):
if len(arr) == 0:
... | true |
679ef64c347faf740397a81d5a96f93adcf77eaf | Python | fekocinas/EP | /Ex 3.py | UTF-8 | 2,367 | 3.53125 | 4 | [] | no_license | import json
with open("Estoque.json","r") as EstoqueFile:
estoque = json.loads(EstoqueFile.read())
print("Controle de estoque" "\n 0 - sair" "\n 1 - adicionar item" "\n 2 - remover item" "\n 3 - alterar quantidade do produto" "\n 4 - imprimir estoque \n 5 - alterar preço do produto")
a = int(input("Faça sua esco... | true |
63e976da11f045b635de6e38c0d0cdf15064db9c | Python | siamsalman/Imposter | /imposter.py | UTF-8 | 1,636 | 3.125 | 3 | [] | no_license | import turtle
body_color = 'red'
glass_color = '#9acedc'
screen = turtle.getscreen()
imp = turtle.Turtle()
def body():
imp.pensize(18)
imp.fillcolor(body_color)
imp.begin_fill()
imp.right(90)
imp.forward(50)
imp.right(180)
imp.circle(40, -180)
imp.right(180)
imp.f... | true |
3387867a6ae3e336d8d9ba3bd1facfb2e1a644cd | Python | Mohamed-y-ph/Python-scripts | /udacity.py | UTF-8 | 20,144 | 3.765625 | 4 | [] | no_license |
'''import the required libraries needed for running the program without errors'''
import pandas as pd
import time
import numpy as np
print('\nWelcome to this program which was designed by Mohamed Yaser to compute some statistics about bikeshare\n')
print("Which city do you want to deal with? Washington, New Yo... | true |
6370415adc38d844f702dcb00dbfe357add9aac4 | Python | rileyjmurray/RandomizedLS | /Haoyun/randomized_least_square_solver/Test/LSRN/LSRN_over_for_error_test.py | UTF-8 | 3,026 | 2.609375 | 3 | [] | no_license | from math import ceil, sqrt
import numpy as np
from scipy.sparse.linalg import LinearOperator
from numpy.linalg import svd
from Haoyun.randomized_least_square_solver.Iter_Solver.Scipy_LSQR import lsqr_copy
def LSRN_over_for_error_test(A, b, tol=1e-8, gamma=2, iter_lim=1000):
"""
LSRN computes the min-length s... | true |
fac70b5e9aa85da1e4ea508fd8f923ba654a46d3 | Python | omerfarballi/Python-Dersleri | /15.lists-methods.py | UTF-8 | 501 | 3.296875 | 3 | [] | no_license | number =[0,1,2,3,6,5,98,65,2,3,5]
letters = ["a","b","c","k","p","ü","k","a"]
values = min(number)
values = min(letters)
values = max(number)
values = max(letters)
values =number[:5]
number[5] = 9999
number.append(letters)
number.insert(0,963946556468)
number.pop()
number.pop(0)
number.remove(9999... | true |
ac727a2a3d1a35e06006d8636a24a8159a579d1a | Python | SabrinaMB/softdes-desafios | /src/interface_tests.py | UTF-8 | 1,624 | 2.53125 | 3 | [] | no_license | import os
from selenium import webdriver
address = os.getenv("ADDRESS")
def test_login_success(): # Aluno faz login com sucesso
driver = webdriver.Firefox()
try:
driver.get(f"http://admin:admin@{address}/")
assert True
except:
assert False
driver.close()
def test_wrong_pass... | true |
65f6077d88c17e2dd90c39adf869d54b09f995c4 | Python | ProtegerPW/Python-automatization | /ch_8_regex_search.py | UTF-8 | 1,097 | 3.59375 | 4 | [] | no_license | #! /usr/bin/python3
#Usage: Program to open any .txt in folder
# and searches for any line that matches a user-suplied regex.
# All results are then printed
# ./ch_8_regex_search.py <folder path> <regex>
import sys, re, os, glob
#TODO: validate input
if len(sys.argv) != 3:
print("Usage: ./ch_8_... | true |
e435c48dfaa50c6b7ef4fdebfaa3601c91912af4 | Python | andremartinon/pyCML | /cml/couplings.py | UTF-8 | 2,408 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
from abc import ABC, abstractmethod
from scipy.signal import convolve2d
from .lattice import Lattice
class Coupling(ABC):
def __init__(self, lattice: Lattice = None):
self._kernel = np.array([[0, 1, 0],
[1, 1, 1],
[0, 1,... | true |
3b47eb6b2ac40ee198a7e317fcc50dd22a081210 | Python | ethanwheatthin/COMP-262-final | /Flippy.py | UTF-8 | 1,881 | 3.421875 | 3 | [] | no_license | # coding=utf-8
# Math is being cited from this website:
# http://math.ucr.edu/home/baez/games/games_9.html
# and
# http://www.probabilityformula.org/empirical-probability-formula.html
# Could check out this also
# 3. If you repeat the experiment of flipping a coin ten times 10,000 times, (so 100,000 flips
# in all), ... | true |
1b4330aebd40bcbec542d9860785f8cacf0b96c9 | Python | answerth3question/backend | /web/app/blueprints/post.py | UTF-8 | 1,681 | 2.609375 | 3 | [] | no_license | '''
post_bp endpoints should be used to get and submit posts.
to get posts specific to a given user, use the user_bp endpoints
'''
from flask import Blueprint, request, jsonify, abort
from app.util.jwt_manager import with_permission, get_jwt_identity
from app.database.models import Post
post_bp = Blueprint('post_bp', ... | true |
183f97f0041f0bdcb496aca9a731a76da9ec108f | Python | OpenDSA/OpenDSA | /AV/Development/CommandLineBased/common/exercise-generator/generator.py | UTF-8 | 3,174 | 2.765625 | 3 | [
"MIT"
] | permissive | from pathlib import Path
def parseExercises(exercises):
return [(exerciseName, exerciseName.lower().replace("_", "-"), exerciseTitle) for exerciseName, exerciseTitle in exercises]
COMMAND_LINE_EXERCISES = parseExercises([
("PWD", "pwd 1"),
("PWD_2", "pwd 2"),
("PWD_3", "pwd 3"),
("LS", "ls"),
("CD", "cd 1... | true |
26c8798f8668bec457f67ce82a35da28582428a3 | Python | matthewdefranco94/FirstProjects | /Weapon/WOW/WeapSimBackend.py | UTF-8 | 3,148 | 2.875 | 3 | [] | no_license | #practice
import sys
sys.path.append ('../../../../../../Desktop/Projects')
import random
# import WeaponSimulation
import numpy as np
import random
import matplotlib
from dataclasses import dataclass
#Attacks have a 40% chance to glance for 30% less damage, weaponskill reduces the 30% damage penatly
#Weapon skil... | true |
714ce63f57678b557ea2bef8178298afb604762c | Python | Aravindandeva/Python-files | /string.py | UTF-8 | 41 | 2.875 | 3 | [] | no_license | stringrev=input()
print(stringrev[::-1])
| true |
7aeffb35f02b80d5c456d958e10c74776362d3dd | Python | Range0122/CapsNet_for_MusicTagging | /augmentation.py | UTF-8 | 3,223 | 2.625 | 3 | [] | no_license | import librosa
import librosa.display
import numpy as np
import matplotlib.pyplot as plt
import random
def compute_melspectrogram(audio_path, sr=22050, mels=96):
SR = sr
N_FFT = 512
N_MELS = mels
HOP_LEN = 256
DURA = 29.12
src, sr = librosa.load(audio_path, sr=SR)
n_sample = src.shape[0]
... | true |
bc542c6184734725a9c30d54ce21d7af94a14f51 | Python | srirachanaachyuthuni/Movie-Reviews-Analysis | /merge_datasets.py | UTF-8 | 5,850 | 2.609375 | 3 | [] | no_license | import sys
from os.path import isdir
import numpy as np
import pandas as pd
from pymongo import MongoClient
name_basics = "name.basics.tsv.gz"
title_basics = "title.basics.tsv.gz"
title_principals = "title.principals.tsv.gz"
ml_links = "links.csv"
ml_ratings = "ratings.csv"
def parse_argv(argv):
... | true |
58df67d974ab05cecf30badf904d390ebd56e947 | Python | regenalgrant/ROS_Py | /Topics/src/topic_publisher.py | UTF-8 | 437 | 2.71875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | #!/usr/bin/env python
import rospy
import Int32
from std_msgs.msg
# Setup: initialize node, register topic, set rate
rospy.init_node('topic_publisher')
# register ros /int at 32/ the que size at 3
pub = rospy.Publisher(
'counter',
Int32,
queue_size=3
)
#set rate two
rate = rospy.Rate(2)
# Loop: publ... | true |
100a030bb3f3be0bb04bc3720c2a9ca4490f961d | Python | IceIceRabbit/trajectory | /q_learning_agent.py | UTF-8 | 2,073 | 2.78125 | 3 | [] | no_license | import numpy as np
import random
from collections import defaultdict
import motion_model_reward as mmr
import matplotlib.pyplot as plt
import math
import matplotlib.pyplot as plt
import numpy.linalg as la
class QLearningAgent:
def __init__(self, actions):
self.actions = actions
self.learning_rate ... | true |
87ac14e860b1a8426b53df96d063246e8bc451aa | Python | seamustuohy/openThreads | /testSuite.py | UTF-8 | 2,211 | 2.6875 | 3 | [] | no_license | import unittest
import openthreads
class testFunctions(unittest.TestCase):
def setUp(self):
self.listSrv = openthreads.openThread("tests/testEmail")
def test_init(self):
#Test that messages and first messages are created upon class instatiation.
self.assertNotEqual(self.listSrv.messa... | true |
04521b718389ddb64c122eeb6d6fa8a0936f2f70 | Python | eddiegz/Personal-C | /DMOJ/CCC/escape room.py | UTF-8 | 683 | 2.875 | 3 | [
"MIT"
] | permissive | import collections
def cal(num):
i=1
f=factor[num]
while i*i<=num:
if num%i==0 and i<=max(n,m) and num//i<=max(n,m):
f.append(i)
i+=1
return num
def dfs(i,j):
if i==m-1 and j==n-1:
return True
if i>=m and j>=n or grid[i][j] in factor:
... | true |
1bf9f3e572261a9d8161bfd737d91730cff863b0 | Python | Ana-geek/Python_test_XML | /drivers.py | UTF-8 | 2,957 | 3.578125 | 4 | [] | no_license | from xml.dom import minidom
class XMLDriver(object):
def __init__(self, path):
self._doc = minidom.parse(path)
# Красивенький принт
def nice_print(self, value):
print('>' * 50)
print(value)
# Метод вывода навания теста
def get_name(self):
root = self._doc.getElementsByTag... | true |
f370dfc5bee0167c369010d78097a622cba838ab | Python | mokamotosan/extr_actions_jp | /src/create_crosstable.py | UTF-8 | 1,537 | 2.828125 | 3 | [
"MIT"
] | permissive | import sqlite3
import pandas as pd
def __extract_crosstable(fullpath_to_db):
"""[summary]
Args:
fullpath_to_db ([type]): [description]
Returns:
[type]: [description]
"""
conn = sqlite3.connect(fullpath_to_db)
dpnd_df = pd.read_sql_query("SELECT * FROM dpnd_dat... | true |
d733e9fff056a6c5a03b7d21035a745ac51162f9 | Python | tttienthinh/AlgoTrade | /Tests/test.py | UTF-8 | 1,592 | 2.921875 | 3 | [] | no_license | from IaObject import Ia
from PriceObject import Price
from random import randint
from time import time
from datetime import datetime
import matplotlib.pyplot as plt
def single_test():
my_ia = Ia()
my_ia.load('7')
my_price = Price(180)
start = randint(1, my_price.born)
print(start)
data = my_p... | true |
964464061757a83d2658424f180fda713bb39c22 | Python | averagehuman/mezzanine-invites | /invites/tests/conftest.py | UTF-8 | 966 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive |
import os
from django.test.client import Client, RequestFactory
from django.core.urlresolvers import reverse
import pytest
@pytest.fixture()
def user(db):
"""A non-admin User"""
from django.contrib.auth.models import User
try:
User.objects.get(username='test')
except User.DoesNotExist:
... | true |
870e5b0d2e790af35775ca4f0e264218f8fab919 | Python | artslob/cyberbox | /cyberbox/config.py | UTF-8 | 1,929 | 2.75 | 3 | [
"MIT"
] | permissive | import os
from pathlib import Path
from typing import Callable
import yaml
from pydantic import BaseModel, DirectoryPath, Field, PostgresDsn, root_validator
from cyberbox.const import CONFIG_ENV_NAME
from cyberbox.env import Env
class DatabaseConfig(BaseModel):
url: PostgresDsn
force_rollback: bool = False
... | true |
a58f69863d93d7602952c27db401a7858f27c531 | Python | Hana-Luong/practiceFeb2021 | /frequencyCounter.py | UTF-8 | 2,684 | 3.734375 | 4 | [] | no_license | #FREQUENCY COUNTER
#All solutions here are not the right solution
# An anagram is a word or phrase formed by rearranging the letters of a different word or phrase,
# typically using all the original letters exactly once.
# Is there a quick way to determine if they aren't an anagram before spending more time?
... | true |
d29c21e80f81498926e42165adcc1e4da4992fa4 | Python | Diderikdm/Advent-of-Code-2018 | /day 12 - part 1 & 2.py | UTF-8 | 958 | 2.828125 | 3 | [] | no_license | from collections import defaultdict
with open("2018day12.txt", 'r') as file:
data = [x for x in file.read().splitlines()]
states = defaultdict(lambda: '.', {e : x for e,x in enumerate(data[0].split(': ')[1])})
keys = {x.split(' => ')[0] : x.split(' => ')[1] for x in data[2:]}
sums = []
i = 0
wh... | true |
8421d36bd2cc50fa0e77478a76bd4264ab0c237e | Python | micka-sudo/cours | /udemy/formation_python/formation_complete_python/exr-007_nombre-mystere-comparaison/01-sources/devine_un_nombre_02.py | UTF-8 | 229 | 3.578125 | 4 | [] | no_license | nombre_mystere = 7
nombre_utilisateur = input("Quel est le nombre mystère ? ")
# Afficher à l'aide d'une structure conditionnelle si le nombre entré par l'utilisateur est plus grand,
# plus petit ou égal au nombre mystère.
| true |
22c11d0a9ffbcde6d9f7d03e3958bb0165b9fa2e | Python | cduck/qutrits | /cirq/google/decompositions.py | UTF-8 | 4,438 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | true |
64ff32b95a946935ea8459f405e44dfc459cc4bd | Python | gomba66/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/12-roman_to_int.py | UTF-8 | 1,068 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python3
def roman_to_int(roman_string):
if roman_string is None or type(roman_string) is not str:
return 0
M, D, C, L, X, V, I = 1000, 500, 100, 50, 10, 5, 1
total2 = 0
new_list = []
for i in range(len(roman_string)):
if roman_string[i] == 'M':
new_list.append(... | true |
f476b9121386cf278745b6e55cd15dd9f4ec2efb | Python | cmdbdu/little | /countcodelines.py | UTF-8 | 958 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf8
# By:dub
import os
import pprint
def get_file_list(code_dir):
codefile_list = os.listdir(code_dir)
for i in range(len(codefile_list)):
codefile_list[i] = os.path.join(code_dir,codefile_list[i])
return codefile_list
def countcodelines(filename):
content = ... | true |
286fdc1c4495d3be91bb15e879425f7d6888abb3 | Python | PCS1000/login_system | /project_1.py | UTF-8 | 1,442 | 3.78125 | 4 | [] | no_license | import random
import requests
url = 'http://localhost:3000/users'
def login_system():
name_input = input('Enter your name: ')
response = requests.get(url = url)
data = response.json()
for name in data['users']:
#print('input_name =', name_input, 'user_name', name)
if(name_input == nam... | true |