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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
701651504cac9f502d94c0fbc8b99063904d0a5b | Python | maikiperin/estudo-python | /pythonbasico/aula11-tratamento-de-erros.py | UTF-8 | 725 | 3.140625 | 3 | [] | no_license | import time
try:
a = 1200 / 0
except:
print('Erro! Divisão por zero.')
print('o programa continua...')
try:
a = 1200 / 0
except ZeroDivisionError:
print('Erro! Divisão por zero.')
try:
funcaoquenaoexiste()
except ZeroDivisionError:
print('Erro! Divisão por zero.')
except NameError:
print... | true |
a20c737d917077761e80bea51b455f116e3f7010 | Python | UW-COSMOS/Cosmos | /cosmos/api/cosmos/embeddings.py | UTF-8 | 663 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | from flask import (
Blueprint, request, current_app, abort, jsonify
)
bp = Blueprint('embeddings', __name__, url_prefix='')
@bp.route('/api/v1/word2vec', endpoint='word2vec', methods=['GET'])
def word2vec():
query_word= request.values.get('word')
n_responses= int(request.values.get('n', '10'))
if not... | true |
6eaabd402b768616dc005a67fa7d575e7985261c | Python | Krzyzaku21/Git_Folder | /_python_base_code/plotly/data.py | UTF-8 | 6,756 | 3.125 | 3 | [] | no_license | # %%
# ? making line graph
from plotly.graph_objs import Scatter
from plotly import offline
#define the data
x_values = list(range(11))
squares = [x**2 for x in x_values]
#pass the data to a graph object, and store it in a list
data = [Scatter(x=x_values, y=squares)]
# data = [Scatter(x=x_values, y=squares, mode='marke... | true |
18b3dc5150fd3d2cec2e74693f7492739634b775 | Python | chenxu0602/LeetCode | /1282.group-the-people-given-the-group-size-they-belong-to.py | UTF-8 | 1,522 | 3.140625 | 3 | [] | no_license | #
# @lc app=leetcode id=1282 lang=python3
#
# [1282] Group the People Given the Group Size They Belong To
#
# https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to/description/
#
# algorithms
# Medium (83.78%)
# Likes: 125
# Dislikes: 71
# Total Accepted: 14K
# Total Submissions: 16.7... | true |
41809b5ec9adbf77d1344c04a965a22812694e80 | Python | trallala9/curly_potato | /excersize_four.py | UTF-8 | 462 | 2.984375 | 3 | [] | no_license | # shapes and texts
import cv2
import numpy as np
img = np.zeros((512, 512, 3), np.uint8)
#print(img)
#img[200:300, 100:200] = 255,0,0
cv2.line(img,(0, 0),(300,300),(0, 255, 255),3)
cv2.line(img,(0, 0),(img.shape[1], img.shape[0]),(0, 255, 255),3)
cv2.rectangle(img,(0,0),(250,350),(0,0, 255),2)
cv2.circle(img,(400,5... | true |
8c94286359b851dc619a70ac707d63229ab56489 | Python | jepebe/aoc2018 | /aoc2020/day7/day7.py | UTF-8 | 2,663 | 3.203125 | 3 | [] | no_license | import intcode as ic
tester = ic.Tester('Handy Haversacks')
def read_file():
with open('input') as f:
lines = f.read()
return lines.split('\n')
def parse_lines(lines):
bags = {}
for line in lines:
line = line.replace('.', '')
name, content = line.split(' bags contain ')
... | true |
36546074b6ecd7c57b4ebbb859ee15c19146cc37 | Python | jeepcambo/ctf | /projecteuler/problem20.py | UTF-8 | 671 | 4.03125 | 4 | [] | no_license | # PROBLEM 20
# and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
#
# Find the sum of the digits in the number 100!
import sys
def factorial(num):
x = int(num)
if x < 0:
print 'Invalid Input!'
if x == 0:
return 1
elif x == 1:
return 1
else:
... | true |
9ec4fe1d83b579b0d7707aff924b3773230c3d5d | Python | Aasthaengg/IBMdataset | /Python_codes/p02708/s188360411.py | UTF-8 | 184 | 2.515625 | 3 | [] | no_license | N, K = map(int, input().split())
kMod = 10**9+7
ans = 0
for k in range(K, N+2):
lb = (k-1) * k // 2
ub = (N+1-k + N) * k // 2
ans += (ub-lb+1)
ans %= kMod
print(ans) | true |
d9a5ef866cd90eca9d6492f3847e8bddf717f2df | Python | Jihong-Tang/computational-genomics | /genome-assembly-mapping/infection_investigator.py | UTF-8 | 6,094 | 2.734375 | 3 | [] | no_license | #coding:utf-8
from bwt_structures import *
from read_aligner import *
from compsci260lib import *
def reverse_complement(seq):
"""
Returns the reverse complement of the input string.
"""
comp_bases = {'A': 'T',
'C': 'G',
'G': 'C',
'T': '... | true |
8cdd2a2454bd78842d07c5395e5e662e9e40d95d | Python | ZRiddle/SantaK2015 | /Fine_Tuning_v2.py | UTF-8 | 27,936 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: zach.riddle
"""
import pandas as pd
import numpy as np
import time
from matplotlib import pyplot as plt
from matplotlib.pylab import cm
import seaborn
from sklearn.cluster import KMeans
import pickle
from util import *
lat_long = ['Latitude','Longitude']
# Read in Data
# Save fi... | true |
17973f995008cfb1d909ce8b76f9a7f305c970b4 | Python | sjcoope/drdb-base | /src/function-check-emr-status/function.py | UTF-8 | 1,915 | 2.546875 | 3 | [] | no_license | import sys
import traceback
import boto3
import logging
import json
# Setup logging for lambda and local development
logger = logging.getLogger()
if len(logging.getLogger().handlers) > 0:
logging.getLogger().setLevel(logging.INFO)
else:
logging.basicConfig(level=logging.INFO)
def handler(event, context):
... | true |
05bd14811cc17775e18efcbaa6dc1b4bb69af3d4 | Python | dominik31415/GenotypeTable2Fasta | /GenotypeTable2Fasta.py | UTF-8 | 3,514 | 2.90625 | 3 | [] | no_license | # GenotypeTable2Fasta.py
# version 1.0
#
# July 23, 2016
#
# Authors: Dominik Geissler & Hai D.T. Nguyen
# Correspondence: geissler_dominik@hotmail.com, hai.nguyen.1984@gmail.com
# Acknowledgements: Benjamin Furman for inspiration
#
# This script will read in an SNP (single nucleotide polymorphism) genotype table call... | true |
7566669aa3edc5e80e30db8e2cfe811cd6b730af | Python | papibenjie/TaskQueue | /taskQueue/queue/queue_creator.py | UTF-8 | 836 | 3.28125 | 3 | [] | no_license | from .func_node import FuncNode
from .base_node import BaseNode
from .base_queue import BaseQueue
def queue_from_list(funcs):
_validate_func_list(funcs)
if len(funcs) == 0:
return BaseQueue(BaseNode())
elif len(funcs) == 1:
return BaseQueue(FuncNode(funcs[0]))
else:
root = FuncN... | true |
305af71177c0e78c565cfb06dd54ab051f115b2c | Python | techiemilin/SeleniumWithPython | /com/seleniumpython/Cookies.py | UTF-8 | 482 | 2.875 | 3 | [] | no_license | '''
Created on Apr. 11, 2019
@author: milinpatel
'''
from selenium import webdriver
driver = webdriver.Chrome("/Users/milinpatel/Documents/workspace/SeleniumWithPython/drivers/chromedriver ")
driver.get("https://www.amazon.ca/")
cookies = driver.get_cookies()
print(cookies)
print(len(cookies))
# adding cookie
co... | true |
d89dd567f9008ff1a89c101306f58124860b6af5 | Python | limz10/NLP | /pset4/pset4.py | UTF-8 | 10,069 | 3.09375 | 3 | [] | no_license | import sys, re
import nltk
from nltk.corpus import treebank
from collections import defaultdict
from nltk import induce_pcfg
from nltk.grammar import Nonterminal
from nltk.tree import Tree
from math import exp, pow
unknown_token = "<UNK>" # unknown word token.
""" Removes all function tags e.g., turns NP-SBJ into NP... | true |
92bc0cf87413578bb46db54da29e3a6787b2f380 | Python | rjkviegas/fruit-machine | /lib/Player.py | UTF-8 | 611 | 3.1875 | 3 | [] | no_license | class Player:
def __init__(self, balance):
self.balance = balance
def get_balance(self):
return self.balance
def play(self, game_machine):
self.pay_fee_for(game_machine)
game_machine.play(self)
def pay_fee_for(self, game_machine):
if self.get_bala... | true |
93652bf93884a5448ea39ebe70e86780403b1fc8 | Python | jeaninebeckle/raterproject-server | /raterprojectreports/views/ratings/bottomgamesbyrating.py | UTF-8 | 1,658 | 2.921875 | 3 | [] | no_license | """Module for generating games by user report"""
import sqlite3
from django.shortcuts import render
from raterprojectapi.models import Game
from raterprojectreports.views import Connection
def bottomgamerating_list(request):
"""Function to build an HTML report of games by rating"""
if request.method == 'GET':... | true |
2259528e78ea92e3b074f54438e62b0ca30c4b97 | Python | rodrigojgrande/python-mundo | /desafios/desafio-037.py | UTF-8 | 1,020 | 4.625 | 5 | [] | no_license | #Exercício Python 37: Escreva um programa em Python que leia um número inteiro qualquer e peça para o usuário escolher qual será a base de conversão: 1 para binário, 2 para octal e 3 para hexadecimal.
numero = int(input('Digite um número inteiro:'))
print('Escolha uma das bases para conversão:')
print('[ \033[1;33m1... | true |
ebca65502675702e552840eaf4f3603670a3ac93 | Python | Cuadernin/BotESFM | /MaestrosESFM.py | UTF-8 | 775 | 3.3125 | 3 | [] | no_license | import pandas as pd
def buscador(texto):
""">>>>>>>>>>>>>>>>>> BUSCADOR QUE ENCUENTRA EL NOMBRE COMPLETO USANDO UN NOMBRE Y APELLIDO <<<<<<<<<<<<<<<<<<<"""
nombres=texto.split(" ")
nombre=nombres[0].lower()
apellido=nombres[1].lower()
df=pd.read_excel("ProfesoresESFMV2.xlsx")
df=df["PROFESOR"... | true |
8dab6ad2e3debe83cd540bac5aa029c6514ca979 | Python | dpawlows/enrollment | /plot_enrolled.py | UTF-8 | 2,035 | 2.765625 | 3 | [] | no_license | from matplotlib import pyplot as pp
from matplotlib import gridspec
from enrolled import *
plotsdir = 'plots/'
def plotMajorHist(students):
data = DataLoader()
terms = data.getUnique(students,'termID')
terms.sort()
numbers = []
fig, ax = pp.subplots()
width = 0.2
ind = arange(len(terms))
... | true |
9f79f49c56af4f99a747d168928163d302d67c1e | Python | tushar-rishav/Algorithms | /Archive/Contests/HackerEarth/May_Hem/baseline.py | UTF-8 | 449 | 2.734375 | 3 | [] | no_license | from sys import stdin,exit
def med(x):
m,r= divmod(len(x),2)
if r:
return sorted(x)[m]
return sum(sorted(x)[m-1:m+1])/2
def main():
t=input()
while t:
n,k=map(int,raw_input().split())
c=n
s=list()
while c:
s.append(map(ord,stdin.readline()[:-1]))
c-=1
s=zip(*s)
for i in range(len(s)):
s[i]... | true |
292dbfe01663d001049426479d4ac029dbe5122f | Python | shivaallani7/BFS-1 | /LevelOrdertraversal.py | UTF-8 | 1,165 | 3.5625 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# 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(2power(h)) or O(n)
// Did it run on Leet Code: Yes
// loop untill th... | true |
e404b4bd91345ad0a4e37c0604dbb4ed0f6ad8cc | Python | pythongenuis/SMT_project | /SMT_Project/test_plot.py | UTF-8 | 355 | 3.453125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
# t = np.arange(0.0, 2.0, 0.01)
# print(t)
# s = 1 + np.sin(2*np.pi*t)
#print(s)
t=[1,2,3,4,5,6,7,8,9]
s=[10,100,10,110,120,130,140,150,170]
plt.plot(t, s)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)... | true |
b64f9025bdc24b84a8e886a5f6c339b6d39bd731 | Python | franklinshe/youtube-analytics | /src/utils/charts.py | UTF-8 | 1,032 | 2.671875 | 3 | [] | no_license | import pandas as pd
import plotly.graph_objects as go
import matplotlib.pyplot as plt
# from io import BytesIO
# import base64
# def get_image():
# buffer = BytesIO()
# plt.savefig(buffer, format='png')
# buffer.seek(0)
# image_png = buffer.getvalue()
# graph = base64.b64encode(image_png)
# gra... | true |
e8c624db981d2b9d0d4cccfc7c30bbd0e66ba4b3 | Python | munQueen/trans-twitter-classification | /code/retrieve_tweets.py | UTF-8 | 912 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 00:08:41 2019
@author: jwulz
"""
from twitterscraper import query_tweets
import pandas as pd
import datetime
import os
# set the search term here:
query_term = 'cisgender'
tweets = query_tweets(query="cisgender", begindate=datetime.date(2019, 6, 1), end... | true |
6188091d9028d8bf0e146736a497653244d15f6c | Python | yiboyang/LDA | /LDA/slda.py | UTF-8 | 10,027 | 2.84375 | 3 | [] | no_license | """
supervised LDA
Based on the sLDA paper http://www.cs.columbia.edu/~blei/papers/BleiMcAuliffe2007.pdf
For more details see https://arxiv.org/pdf/1003.0783.pdf
'eta' denote the vector of weights in the exp linear component of GLM
'var' means the dispersion parameter of GLM; sigma squared for Gaussian
Here we use a n... | true |
6e5813cc1c19911b7594a02887a29cf20b4a404a | Python | statsonice/statsonice-public | /scripts/old/combine_skaters.py | UTF-8 | 2,253 | 2.90625 | 3 | [] | no_license | """
This script combines skaters and skater pairs into a single skater
"""
import os
import sys
parent_path = os.path.dirname(os.path.realpath(__file__))+'/../../util/'
sys.path.append(parent_path)
from get_settings import load_settings
load_settings(sys.argv)
from statsonice.models import *
def combine_skaters(skat... | true |
36c4429a336cf9d7d9166a3c1aea634fca6d406e | Python | abelloma/project-2 | /working folders/database.py | UTF-8 | 699 | 2.546875 | 3 | [] | no_license | import pymongo
import os
import pandas as pd
import csv
from sqlalchemy import create_engine
combined_data = 'data/combined_data.csv'
conn = 'mongodb://localhost:27017'
client = pymongo.MongoClient(conn)
db = client.beer_db
collection = db.states
# def csv_to_dict():
# reader = csv.DictReader(open(combined_dat... | true |
6da82372bc21f82f28e1e5c783895ee5d220ed27 | Python | hafrei/advent | /day3/run5.py | UTF-8 | 1,075 | 2.796875 | 3 | [] | no_license | # elf: ?, x:y, top_left: top_right, bottom_left: bottom_right
def get_specs(deets):
elf = deets[deets.find("#")+1 : deets.find("@")].strip()
x_axis = deets[deets.find("@")+1 : deets.find(",")].strip()
y_axis = deets[deets.find(",")+1 : deets.find(":")].strip()
length = deets[deets.find(":")+1 : deets.find("x")]... | true |
6f983c0c9cbc6c5446384d42979a68fe9e832e48 | Python | ViiSkor/ML-From-Scratch | /utils/clusterization.py | UTF-8 | 1,387 | 3.265625 | 3 | [] | no_license | import numpy as np
def init_centroids(data, n_centroids, mode="random_sample"):
""" Initialize the centroids.
Has two mode: take n random samples of data as the centroids and
random sharing.
Read about random sharing:
https://www.kdnuggets.com/2017/03/naive-sharding-ce... | true |
f4c78f6be6839bf4a6a3fa74c91a18cc0bb24879 | Python | battyone/qtrio | /qtrio/_core.py | UTF-8 | 24,109 | 2.703125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | """The module holding the core features of QTrio.
Attributes:
_reenter_event_type: The event type enumerator for our reenter events.
"""
import contextlib
import functools
import math
import sys
import traceback
import typing
import typing_extensions
import async_generator
import attr
import outcome
from qtpy imp... | true |
af6330da7f286211f309b5e7eaddc41f1ae09b55 | Python | mcrobertw/python | /usandosimplejson.py | UTF-8 | 355 | 3.921875 | 4 | [] | no_license | #Formar un json de un diccionario en python
import json
person = '{"name": "Bob", "languages": ["English", "Fench"]}'
person_dict = json.loads(person)
# Output: {'name': 'Bob', 'languages': ['English', 'Fench']}
print( person_dict)
# Output: ['English', 'French']
print(person_dict['languages'])
#fuente: https://www.pr... | true |
65c67d58280b06ece76f3020a127dd6a92e5bc19 | Python | thanhtranna/python-algo | /39_back_track/regex.py | UTF-8 | 1,134 | 3.40625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
is_match = False
def rmatch(r_idx: int, m_idx: int, regex: str, main: str):
global is_match
if is_match:
return
if r_idx >= len(regex): # The regular strings are all matched
is_match = True
return
# The regular string has not bee... | true |
9916a1de554ce818a1709f89bc488028fc2eb98a | Python | Cristiantorre/Python-TorrentsCristian | /M14UF1E03.py | UTF-8 | 133 | 2.546875 | 3 | [] | no_license | si,no=True,False
edat=input("Ets major d’edat?' (True/False):")
if:Si=input("es major de edat")
if:No=input("no es major de edat")
| true |
1780f64ae5e5f98fa8335fb056a4ddd61a9934c2 | Python | Coderu2058/Yet_Another_Algorithms_Repository | /Algorithms/binary_search/python-binary_search-O(log(n)).py | UTF-8 | 960 | 4 | 4 | [
"MIT"
] | permissive | def binary_search(list_, val, asc=1):
'''
list_: sorted list with unique values
val: value to search
asc: asc==1 list is sorted in ascending order
Searches for a given element in a list sorted in ascending order. For searching in a list sorted in descending order, pass the argument value for asc as '0'.
'''
... | true |
a47a717b66b07a12aa5a2d771834b5cd3cd8cb6c | Python | JadoBleu/Adventure-Game-Project | /equipment.py | UTF-8 | 12,770 | 3.796875 | 4 | [] | no_license | '''Generates new weapons, armor, ring, and relevant functions '''
# Imports
import random
import math
from housekeeping import rng
def new_rarity(common=80, uncommon=15, rare=5):
'''Returns a rarity value based off the chances. Default to 80:15:5'''
if rng(common):
rarity = "common"
elif rng(uncom... | true |
007876f653dbd0314e93352dcbd204824e977e42 | Python | wiktorm3n/Data-Visualization | /Chapter 17/TryIt17_1.py | UTF-8 | 5,493 | 3.328125 | 3 | [] | no_license | import requests
'''Make an API call and store the response'''
urlhaskell = 'https://api.github.com/search/repositories?q=language:haskell&sort=stars'
url_javascript = 'https://api.github.com/search/repositories?q=language:javascript&sort=stars'
url_ruby = 'https://api.github.com/search/repositories?q=language:rub... | true |
6e928b91364c3f7ad75b63f12f81fd235c0c493d | Python | BoLu2019/luB | /10_occupy_flask_st/utils/reader.py | UTF-8 | 1,368 | 3.609375 | 4 | [] | no_license | import csv
from csv import reader
occDict = {}
occList = []
#returns a dictionary of jobs/percentage pairs (occDict)
def readcsv():
#opens csv file, reads it as dictionary
#separates by commas not contained in double quotes
with open('data/occupations.csv', 'r') as infile:
reader = csv.DictReader(... | true |
daed5f54f4902d90c7562db580416a65cbda47c2 | Python | iam-abbas/cs-algorithms | /Sorting Algorithm/Selection Sort/Python/selection_sort.py | UTF-8 | 559 | 4.03125 | 4 | [
"MIT"
] | permissive | # Function for selection sort
def selection_sort(array):
for i in range(0, len(array) - 1):
min_index = i
for j in range(i + 1, len(array)):
if array[j] < array[min_index]:
min_index = j
array[i], array[min_index] = array[min_index], array[i]
# Function to prin... | true |
1a3333e774134085f11cc6d07d4d689bc9d5635e | Python | mehrdadn/ray | /python/ray/serve/metric/client.py | UTF-8 | 5,181 | 2.625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import asyncio
from typing import Dict, Optional, Tuple, List
from ray.serve.metric.types import (MetricType, convert_event_type_to_class,
MetricMetadata, MetricRecord)
from ray.serve.utils import _get_logger
from ray.serve.constants import METRIC_PUSH_INTERVAL_S
logger = _get_logg... | true |
9f648d114d3ace475e6f7d53e6d8a4475b9b36dc | Python | kothamanideep/iprimedpython | /day9tasks/decarators.py | UTF-8 | 589 | 3.734375 | 4 | [] | no_license | # def simple(a,b):
# return a+b
# # print(simple(2,3))
# x=simple
# print(x(2,3))
# class decarator:
# def __init__(self,a,b):
# self.a=a
# self.b=b
# print("decarator is working")
# obj=decarator
# obj(1,2)
# def sum(a,b):
# return a+b
# def difference(a,b):
# return a-b
# ... | true |
a61fd5a1d0c2318afa5631233499397305c05c6f | Python | DeniseIvy/DiegoTheVoiceAssistant | /main.py | UTF-8 | 2,524 | 2.84375 | 3 | [] | no_license | import speech_recognition as sr
import pywhatkit as kit
import datetime
import webbrowser
import pyttsx3
import time
import subprocess
r = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices',)
def talk(text):
engine.say(text)
engine.runAndWait()
def record_audio(ask = False):
wit... | true |
1b1458c3ca4de9418e3cb068ba674919e7d10be2 | Python | jeongleo/Cansat_Terminal | /python_terminal2.py | UTF-8 | 821 | 2.8125 | 3 | [] | no_license | import decoder
import plot
import numpy as np
import matplotlib.pyplot as plt
input_file_name = "./입력파일/output_static_home.txt"
with open(input_file_name, 'r') as f: # 입력 파일 읽기
input_stream = f.read()
a = []
for i in input_stream:
a.append(int(i, 16)) # 16진수 표기를 10진수 정수로 바꾸기
length = len(a)
input_stream = ... | true |
b1f00ef4a9f1dd97c4d03ed35440f766146c3fa9 | Python | shmilee/gdpy3 | /src/cores/converter.py | UTF-8 | 3,322 | 2.515625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2019-2020 shmilee
'''
Contains Converter core class.
'''
import re
from .base import BaseCore, AppendDocstringMeta
from ..glogger import getGLogger
__all__ = ['Converter']
clog = getGLogger('C')
class Converter(BaseCore, metaclass=AppendDocstringMeta):
'''
Convert ... | true |
280af3a32eb7b533c7e8457c9cc2a0c70b85b9a4 | Python | okisker/g_voice_its | /excel.py | UTF-8 | 2,129 | 2.71875 | 3 | [] | no_license | import xlrd
book = xlrd.open_workbook(raw_input("File name: ")) #test.xls
myname = raw_input('Your name: ')
sh = book.sheet_by_index(0)
#print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3)))
#for rx in range(sh.nrows):
#print(sh.row(rx))
# Print all values, iterating through rows and columns
#
num_cols ... | true |
aad4c800c9f2043d315d794480230b87874ca3df | Python | joose1983/answer-for-python-crush-course-2ndE | /Chapter 10/10-11-1.py | UTF-8 | 246 | 3.28125 | 3 | [] | no_license | import json
filename= 'favorite_number.txt'
try:
with open(filename) as f:
favorite_num=json.load(f)
except FileNotFoundError:
print(f"{filename} not found.")
else:
print(f"I know your favorite number, it is {favorite_num}")
| true |
3213f9038f3e39e43df26abb72cafa96cff62e2f | Python | stecd/Frequencies-Gradients | /gradient.py | UTF-8 | 1,203 | 2.625 | 3 | [] | no_license | import numpy as np
from scipy import sparse
import cv2 as cv
import matplotlib.pyplot as plt
from utils import Profiler
def computeGradient(im):
im2var = np.arange(im.shape[0] * im.shape[1]).reshape(*im.shape[0:2])
numPx = im.shape[0] * im.shape[1]
numEq = 2 * numPx + 1
A = sparse.csr_matrix((numEq,... | true |
1eaadaf9ef53037bc275ce356f4a20187bb2bddd | Python | danmandel/CodeWars | /7kyu/numerical-palindrome/solution.py | UTF-8 | 112 | 3.21875 | 3 | [] | no_license | def palindrome(num):
return str(num)[::-1] == str(num) if isinstance(num, int) and num > 0 else 'Not valid'
| true |
340d148714dec03c93db467dca072afdcf0cc805 | Python | Margarita-Sergienko/codewars-python | /5 kyu/Simple Pig Latin.py | UTF-8 | 450 | 4.21875 | 4 | [] | no_license | # 5 kyu
# Simple Pig Latin
# https://www.codewars.com/kata/520b9d2ad5c005041100000f
# Move the first letter of each word to the end of it, then add "ay" to the end of the word. Leave punctuation marks untouched.
# Examples
# pig_it('Pig latin is cool') # igPay atinlay siay oolcay
# pig_it('Hello world !') # e... | true |
2f68a10442f622d3a174487c7b41901162d24648 | Python | MansourM61/Blodiator | /blodiator/etc/cntsheetcanavs.py | UTF-8 | 12,923 | 3.046875 | 3 | [
"MIT"
] | permissive | '''
********************************************************************************
Python Script: cntsheetcanvas Module
Writter: Mojtaba Mansour Abadi
Date: 20 Januarry 2019
This Python script is compatible with Python 3.x.
The script is used to define CntSheetCanvas class the container
Blodiator. This module provi... | true |
f98b90c091d3e73c6a6b53ac79fc51a8cd046fb9 | Python | ashwani608/pythonScripts | /SampleFileInputScrapper/scrapper.py | UTF-8 | 719 | 3.234375 | 3 | [] | no_license | import requests
from BeautifulSoup import BeautifulSoup
def myfun (arg):
url = arg
response = requests.get(url.strip())
#add .strip() to remove \n from begining and end
html = response.content
soup = BeautifulSoup(html)
table = soup.find('table', attrs={'class': 'tbldata14 bdrtpg'})
for row... | true |
179c555c607a3cdb0722408c44469ac50828b54f | Python | dhenriquedba/code-combat | /Masmorra-Kithgard/ingredient-identification.py | UTF-8 | 501 | 4.0625 | 4 | [] | no_license | #Variables are like labeled bottles that hold data.
# A variable is a container with a label that holds data.
# This variable is named `someVariableName`
# It contains the value `"a string"`
someVariableName = "a string"
# This variable is named `lolol`
# It contains the number `42`
lolol = 42
# Create 2 more vari... | true |
a966ab32671627d2fca0d9bbb3dd939eb1fc53b6 | Python | thom974/the-green-reaper | /data/scripts/effects.py | UTF-8 | 3,862 | 2.921875 | 3 | [] | no_license | import pygame
import random
#
pygame.init()
# screen = pygame.display.set_mode((500,500))
# char = pygame.image.load('char.png').convert()
# char.set_colorkey((255,255,255))
# char = pygame.transform.scale(char,(100,100))
def create_glitch_effect(size_len,**kwargs):
glitch_colours = [(16, 26, 86), (22, 45, 118), ... | true |
c4d5020ee3bb6ad4d07b323f1118d158af830316 | Python | hihiworld/pymoo | /pymoo/operators/survival/fitness_survival.py | UTF-8 | 928 | 2.84375 | 3 | [
"MIT"
] | permissive | import numpy as np
from pymoo.model.survival import Survival
from pymop.problem import Problem
class FitnessSurvival(Survival):
"""
This survival method is just for single-objective algorithm.
Simply sort by first constraint violation and then fitness value and truncate the worst individuals.
"""
... | true |
7a6ba8c53ba23bd30c9e5ca61695b921aa0d3070 | Python | plutoese/mars | /application/DataWarehouse/database/class_admindatabase.py | UTF-8 | 2,429 | 3.046875 | 3 | [] | no_license | # coding=UTF-8
# -----------------------------------------------------------------------------------------
# @author: plutoese
# @date: 2015.10.10
# @class: AdminDatabase
# @introduction: 类AdminDatabase表示行政区划数据库。
# @property:
# - period: 数据库覆盖的年份
# @method:
# - find(self,**conds):查询数据,参数conds是一系列参数。返回值是pymongo.cursor。... | true |
5f7addf07ee791a3b5d2919473f705edb5f4ecae | Python | shreykuntal/My-other-Python-Programs | /programs/2 greatest 10 digit(1).py | UTF-8 | 520 | 3.640625 | 4 | [] | no_license | for_odds =[1,2,3,4,5,6,7,8,9,10] #your list here #random.sample(range(150), 100) # 100 random numbers b/w 0,150
biggest_odd=float('-inf')
for i in for_odds:
if i%2!=0:
if i>biggest_odd:
biggest_odd=i
print("The greatest odd number is ", biggest_odd)
del for_odds[for_odds.index(biggest_odd)]
biggest_od... | true |
ccd836a98fe7914c0bb4d1e9e17f8a2ce928326b | Python | xiangpengm/algorithm | /dynamic/leetcode_121_easy.py | UTF-8 | 1,381 | 4.15625 | 4 | [
"MIT"
] | permissive | """
给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。
如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计
一个算法来计算你所能获取的最大利润。
注意你不能在买入股票前卖出股票。
示例 1:
输入: [7,1,5,3,6,4]
输出: 5
解释: 在第 2 天(股票价格 = 1)的时候买入,在第 5 天(股票价格 = 6)的时候卖出,最大利润 = 6-1 = 5 。
注意利润不能是 7-1 = 6, 因为卖出价格需要大于买入价格。
示例 2:
输入: [7,6,4,3,1]
输出: 0
解释: 在这种情况下, 没有交易完成, 所以最大利润为 0。
"""
from typing impo... | true |
229d0295c262c82efdcd04d1ee39b3ddc2ac974c | Python | zch0803/mooc | /Python/numtri.py | UTF-8 | 917 | 2.984375 | 3 | [] | no_license | import numpy as np
def main():
n = int(raw_input())
the_max = n * (n+1) / 2
a = np.zeros((n, n), dtype=int)
length = 0
number = 1
while number <= the_max :
if number == the_max:
a[length*2][length] = number
break
for i in range(0, n-1-length*3):
... | true |
6abb95e9b028cec43b2473fa63a04d5dfc24431d | Python | anthonyz15/MCRSS-Final | /OdinAPI/handler/dao/event_dao.py | UTF-8 | 14,461 | 3.046875 | 3 | [] | no_license | from .config.sqlconfig import db_config
from flask import jsonify
import psycopg2
from datetime import datetime
class EventDAO:
def __init__(self):
connection_url = "dbname={} user={} password={} host ={} ".format(
db_config['database'],
db_config['username'],
db_config['password'... | true |
bbf7f7018c4ba3dcac5f68b164606225903df87c | Python | vrlambert/project_euler | /45_triangle_pentagonal_hexagonal.py | UTF-8 | 486 | 4.15625 | 4 | [] | no_license | # Find the next number after 40755 that is triangular, hexagonal, and pentagonal
# Turns out all hexagonal numbers are triangular, so just check those
def main():
n_hex = 144 # 144
n_pent = 165 # 165
pentag = 1
while n_hex < 100000:
hexag = n_hex * (2 * n_hex - 1)
while pentag < hexag... | true |
989389fee9b6ad75ae78e3fffbb4da9e66bb9bd9 | Python | InkaTriss/InkaTriss | /wizzair.py | UTF-8 | 3,825 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
from selenium import webdriver
import unittest
from time import sleep
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
name='Paulina'
s... | true |
dc145d3e6a42f86b1711a49b3d5bf25b2de1631b | Python | void-trinity/Calorie-Counter-Flask | /routes/users.py | UTF-8 | 1,972 | 2.75 | 3 | [] | no_license | from flask_restful import Resource, reqparse
from models.users import UserModel
class Users(Resource):
def get(self):
parser = reqparse.RequestParser()
parser.add_argument('username', type=str, help='This field cannot be blank', required=True)
parser.add_argument('password', type=str, help... | true |
6af6e27b2c70acb1a64458aa705fd515f5374043 | Python | mdberkey/chess-loser | /agent.py | UTF-8 | 2,146 | 3.140625 | 3 | [
"MIT"
] | permissive | # Lichess chess bot designed to lose above all.
import threading
import berserk as bsk
""" Agent of chess game in Lichess"""
class Agent:
def __init__(self):
with open('./lichess.token') as tf:
self.token = tf.read()
self.session = bsk.TokenSession(self.token)
self.client = b... | true |
ee55e430504c7a7f2a39ad4799be44a6c1aa0af6 | Python | cunghaw/Elements-Of-Programming | /17.1 Compute an optimum assignment of tasks/main.py | UTF-8 | 522 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Compute an optimum assignment of tasks
@author: Ronny
"""
def computeOptimumTasks( tasks ):
result = []
len_half_tasks = len( tasks ) / 2
tasks = sorted( tasks )
for max_task, min_task in zip( reversed( tasks[ len_half_tasks: ] ), tasks[ :len_half_tasks ] ):
result.append( ... | true |
d28ba77e6bfce422f0162281346f46c0f7da0087 | Python | qbzysa/test | /classify/search_data_by_keyword.py | UTF-8 | 1,248 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# __author__:'Administrator'
# @Time : 2018/12/3 19:21
# -*- coding: utf-8 -*-
# __author__:'Administrator'
# @Time : 2018/11/22 17:38
import os
def classify_file(file, keyword):
"""
根据关键词分类文件内容到指定的list中
:param file:
:return:
"""
infos = []
yd ... | true |
729e64dfe3df28804381fe23b1396538d1a85474 | Python | E-Sakhno/lab3 | /individual3.py | UTF-8 | 338 | 3.5 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 17. Составьте программу, которая печатает таблицу сложения натуральных чисел в десятичной
# системе счисления.
for i in range(1, 10):
for j in range(1, 10):
print(i, '+', j, '=', i+j)
| true |
3254d48a3d0633f317d5b3357e446033425ce3cb | Python | wallnerryan/floodlight | /apps/qos/qospath.py~ | UTF-8 | 7,517 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/python
"""
QoSPath.py ---------------------------------------------------------------------------------------------------
Developed By: Ryan Wallner (ryan.wallner1@marist.edu)
Add QoS to a specific path in the network. Utilized circuit pusher developed by KC Wang
[Note]
*circuitpusher.py is needed in the s... | true |
f32d23a9bd98eceb9400eddd4d114982aa8e29ef | Python | gitgeorgez/Python-Exercises-Oct-2016 | /4.py | UTF-8 | 639 | 3.03125 | 3 | [] | no_license | """
P15040 GEORGE ZERVOLEAS
1/10/2016
THEMA 4
PROGRAMMA TO OPOIO ALLAZEI pairnei apo ton xristi Onoma tainias kai epistrefei
a. tin vathmologia
b. ta braveia
"""
import json
import urllib,urllib2
url = "http://omdbapi.com/?t=" #only submitting the title parameter
movieTitle = raw_input('Dwse ta... | true |
6dfa8e60fb1db436559efe0a811a23a4cf91b7a4 | Python | twosigma/Cook | /executor/cook/io_helper.py | UTF-8 | 2,095 | 3.9375 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | #!/usr/bin/env python3
"""This module ensures atomic writes to stdout."""
import logging
import sys
from threading import Lock
import os
__stdout_lock__ = Lock()
def print_to_buffer(lock, buffer, data, flush=False, newline=True):
"""Helper function that prints data to the specified buffer in a thread-safe man... | true |
6886ad8ccd3750b4690fc3e7a7162bb4c0b32edf | Python | sobriquette/interview-practice-problems | /Code Challenges/hackbright.py | UTF-8 | 4,546 | 4.75 | 5 | [] | no_license | """
CODING CHALLENGE:
Write a function that, when given a string as input, can output the indices of the farthest apart matching characters. Here are some example scenarios.
Input: 'yabcdey'
Output: [0, 6]
Explanation: Since the only matching characters are 'y', and 'y', we return the two places where 'y' appears in... | true |
488e782f7e4b0b26f10af48ed52f3c2d26b280f5 | Python | IgorMiyamoto/IA-ep02-csp | /src/satisfacao_restricoes.py | UTF-8 | 7,459 | 3.015625 | 3 | [] | no_license | from UI import bcolors
class Restricao():
def __init__(self, variaveis):
self.variaveis = variaveis
def esta_satisfeita(self, atribuicao):
return True
class SatisfacaoRestricoes():
def __init__(self, variaveis, dominios):
self.variaveis = variaveis # Variáveis para serem restringidas
... | true |
20b24f09ead64a17493b21acd5da21a928f12b2d | Python | edemaine/pegen | /tests/test_grammar_visitor.py | UTF-8 | 1,996 | 2.75 | 3 | [
"MIT"
] | permissive | from typing import Any
from pegen.grammar import GrammarVisitor
from pegen.grammar_parser import GeneratedParser as GrammarParser
from tests.utils import parse_string
class Visitor(GrammarVisitor):
def __init__(self) -> None:
self.n_nodes = 0
def visit(self, node: Any, *args: Any, **kwargs: Any) -> ... | true |
43dafb47fdafc264cf0fcb4908ff92afc770b2e6 | Python | isyoung/PE | /PE_P60.py | UTF-8 | 1,186 | 3.421875 | 3 | [] | no_license |
UPPER_BOUND = 10 ** 4
NB_TO_CHOOSE = 5
def is_prime(n):
factor = 2
while factor * factor <= n:
if n % factor == 0:
return False
factor += 1
return True
def is_valid_pair(n, m):
return is_prime(int(str(n) + str(m))) and is_prime(int(str(m) + str(n)))
prime_l... | true |
4c7fab682453f8604a96932b4dc9406ac90bb3aa | Python | Shreeasish/pledgerize-reboot | /hoisting/investigations/libc/symbols/compare.py | UTF-8 | 310 | 2.6875 | 3 | [] | no_license | with open("found_functions") as found_functionsf:
ffunctions = found_functionsf.read().splitlines()
ffunctions= set(ffunctions)
with open("Symbols.list") as symbolsf:
Symbols = symbolsf.read().splitlines()
Symbols = set(Symbols)
len(Symbols)
len(ffunctions)
rem = Symbols.difference(ffunctions)
| true |
80d0c718919d40592a09f14420257f15aa0885aa | Python | heitorchang/learn-code | /checkio/forum/all_the_same.py | UTF-8 | 320 | 3.34375 | 3 | [
"MIT"
] | permissive | """
In this mission you should check if all elements in the given list are equal.
Input: List.
Output: Bool.
The idea for this mission was found on Python Tricks series by Dan Bader
"""
def all_the_same(elements):
"""Works if elements are immutable. If elements is [], len is 0"""
return len(set(elements)) <... | true |
55fbc6f3140a9150bbe305af8522b7b80604681a | Python | MichaelKipp/MovieModeling | /DataChunking.py | UTF-8 | 2,337 | 2.78125 | 3 | [] | no_license | import timeit, sys, io
start_time = timeit.default_timer()
lines = [[] for x in range (670000)]
movies = {}
conjs = {}
# Create conjunction lookup
with open('conjunctions.csv') as conjunctions:
for line in conjunctions:
line = line.split(",")
conjs[str(line[0])] = line[1].strip()
# Create movie ... | true |
1d30a1cbb8b604e1284eb8df2f0fbbb58d653e46 | Python | Adisudirta/Project-Pelatihan-Data-Analytic | /main.py | UTF-8 | 476 | 3.46875 | 3 | [] | no_license | # import file vData.py
import vData
# tampilan menu navigasi program
print("Tugas Akhir Pelatihan")
print("======================\n")
print("Menu:")
print("1. Visualisasi data GDP per kapita")
print("2. Visualisasi data HDI (Human Development Index)")
answer = int(input('Option: '))
if answer == 1:
pr... | true |
4ab165eb4dcfe6a4a37fe2b92930bdc234fbe3a9 | Python | francislinker/simple_chat_room | /qqClient.py | UTF-8 | 1,897 | 3 | 3 | [] | no_license | import socket
import os
import sys
def main():
#从命令行输入IP地址和端口号
if len(sys.argv)<3:
print('参数错误!')
return
address = (sys.argv[1],int(sys.argv[2]))
#创建 UDP 套接字
client = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#接收用户输入,包装后发送给服务器
while True:
name = input('请输入姓名:... | true |
dd61a6aaa46ffac7476f0e4db14dcd7e2c2919b4 | Python | sankalpsagar/mai | /searchanime.py | UTF-8 | 2,908 | 3 | 3 | [] | no_license | from jikanpy import Jikan
import urllib
import subprocess
import textwrap
wrapper=textwrap.TextWrapper(initial_indent='', subsequent_indent='\t'*2, width=50)
# Color Escape Characters
CEND = '\33[0m'
CRED = '\33[31m'
CGREEN = '\33[32m'
def query_helper(s):
s = s.lower()
if (s[0:3] != 'mai'):
print(CGREEN + "[M... | true |
c44fd718d29e1c0032f2a66bb9e9f02317f914fe | Python | jarvisteach/appJar | /examples/issues/issue144.py | UTF-8 | 547 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import sys
sys.path.append("../../")
from appJar import gui
def press(btn):
if btn == "Grouped":
app.showSubWindow("Grouped")
elif btn == "Not-grouped":
app.showSubWindow("Not Grouped")
app=gui("Main Window")
app.addLabel("l1", "Main Window")
app.addButtons(["Grouped", "Not-grouped"], press)
... | true |
e5fc5357011e47dde99bd13aaa70a609ead17dba | Python | Tigercoll/FTP_socket | /socket/socket_client.py | UTF-8 | 3,048 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
#_*_coding:utf-8_*_
__author__ = "Tiger"
import socket
import configparser
import json
import os
class FtpClient(object):
def __init__(self):
#引入configparser模块,加载配置文件
conf=configparser.ConfigParser()
conf.read('conf.ini',encoding='utf-8')
self.ip=conf.get('ipco... | true |
a56f6b60faaa4fe675c885818fc91c45b7694d5a | Python | keyofdeath/Tp-conceprion-objet | /model/banque.py | UTF-8 | 4,835 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging.handlers
import os
PYTHON_LOGGER = logging.getLogger(__name__)
if not os.path.exists("log"):
os.mkdir("log")
HDLR = logging.handlers.TimedRotatingFileHandler("log/Banque.log",
... | true |
2847f587757b5238446e676c447442aedf7e8aca | Python | MattFrankowski/algorithms | /graph/dijkstra.py | UTF-8 | 2,026 | 3.46875 | 3 | [] | no_license | from graph import Graph, Node
from math import inf
class Dijkstra:
def __init__(self):
self.graph = Graph()
self.coveredGraph = []
self.graph_start = 0
def loadGraph(self, path):
self.graph.loadNodes(path)
def findStartingNode(self):
for i in range(len(self.graph.... | true |
14a7aac2d33ccf01df2116f1a390b3e0bef186b9 | Python | blacktruth513/KCCIST | /[5] 빅데이터 처리시스템 개발/pythonProject Ver10.12/SHOPPING MALL 2020-10-11/MemberJoin.py | UTF-8 | 3,561 | 2.984375 | 3 | [] | no_license | import pymysql
from tkinter import *
from tkinter import messagebox
import tkinter as tk
def memberManagement(conn,cur):
##====================================================================================
## 함수 선언부
## Data삽입 함수
def insertMemberData() :
# global conn, cur
p... | true |
c52cb5a68a09805ae9b507ea317ee7af05e0f53a | Python | AusCommsteam/Algorithm-and-Data-Structures-and-Coding-Challenges | /Challenges/handOfStraights.py | UTF-8 | 1,467 | 4 | 4 | [] | no_license | """
Hand of Straights
Alice has a hand of cards, given as an array of integers.
Now she wants to rearrange the cards into groups so that each group is size W, and consists of W consecutive cards.
Return true if and only if she can.
Example 1:
Input: hand = [1,2,3,6,2,3,4,7,8], W = 3
Output: true
Explanation: Al... | true |
98a02b27cd7c97b509a710493f586b95130b8930 | Python | yogesh-kamble/Budget_Planner_Django | /Budget_Monitor/Transcation/views.py | UTF-8 | 1,870 | 2.53125 | 3 | [] | no_license | from models import Amount,Expense,Category
from django.http import HttpResponse
from django.shortcuts import render_to_response
# Create your views here.
def enter_transcation(request):
'''
Method which render to add_transcation.html page.
'''
expense_obj_list=Expense.objects.all()
expense_nam... | true |
49aa5996fa84c5d3655dbae0192003ca717ab34c | Python | russot/ADS | /refer_entry.py | UTF-8 | 2,814 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#!python
import glob
import string
class Refer_Entry(object):
# __slots__ = {"Xvalue":float,"Xprecision":float,"Yvalue":float,"Yprecision":float,"Yoffset":float,"Ymin":float,"Ymax":float}
def __init__(self,Xvalue=0,Xprecision=0,Yvalue=0,Yprecision=0,Yoffset=0,Ymin=0,Ymax=0,valid_status=None)... | true |
af48c9513e20fe6c618d730d861383e8e8f1e898 | Python | ColdMatter/PhotonBEC | /Scripts/calibrate_grating/calibrate_energy_position.py | UTF-8 | 6,855 | 2.90625 | 3 | [
"MIT"
] | permissive | #coded by JM in 10/2014
import sys
sys.path.append("D:\\Control\\PythonPackages\\")
import scipy.misc
from scipy.optimize import leastsq
import numpy as np
import pbec_analysis
#TODO this queue is made for use of threads, it has mutex stuff inside
# which will make it slow, replace it with a faster alternative
impo... | true |
e00a16cf25f272c3cf01eeb415d1cab845b77345 | Python | mrmleonard/pyxel_examples | /pyxel/presentation_examples/animated_circle.py | UTF-8 | 412 | 3.625 | 4 | [
"MIT"
] | permissive |
# import Pyxel module
import pyxel
# set variables for animation
x = 0
# initialize the window with the init(width, height) command
pyxel.init(160, 120)
# game loop
while True:
# update variables and call any drawing commands
x += 2
if x >= pyxel.width + 20:
x = -20
pyxel.cls(0)
pyxel.ci... | true |
08d2276e80ec16adad294cdb28e0572fdef4a35f | Python | bigtone1284/hackerRank | /is_fibo.py | UTF-8 | 1,706 | 4.625 | 5 | [] | no_license | """========================================================================================================================
You are given an integer, N. Find out if the number is an element of fibonacci series.
The first few elements of fibonacci series are 0,1,1,2,3,5,8,13.... A fibonacci series is one where every e... | true |
ff6171c84b16314790de31d81f210685968ec20f | Python | tztex/self_taught2 | /self_taught1/Data_Structures.py | UTF-8 | 2,127 | 4.4375 | 4 | [] | no_license | # list tuples dictionaries
# stacks and queues
# putting item on stack is pushing
# add and remove from stack, only add remove last item
# removing from stack is popping
# called a LIFO data structure, last in first out
# a queue is a data structure and is FIFO
# ex line of people first person gets ticket
class Stac... | true |
a6fb8c47bd65ab402a98021f2e9b9110a50f82f0 | Python | rocalabern/pygame_love_runner | /levels/tutorial_levels/tutorial_01.py | UTF-8 | 1,208 | 2.859375 | 3 | [] | no_license | import pygame
from pygame import *
from game_screen.game_screen import GameScreen
from lib import *
from levels import *
def show_image(screen, game_screen: GameScreen, width, height):
image_file = "images/thumbs-up/julia_y_mar_muy_bien.png"
temp = pygame.image.load(image_file)
x = temp.get_rect().size[0... | true |
d8a04b44bdb55b59bc3de17d9c09721b81fae476 | Python | Rwik2000/CarRacingv0-PPO-pytorch | /agentFile.py | UTF-8 | 4,032 | 2.6875 | 3 | [] | no_license | from neuralnet import Net
import torch
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Beta
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
class Agent():
"""
Agent for training
"""
# max_grad_norm = 0.5
de... | true |
20224f8244b753a52a7e3ba69f3027dffd911cb0 | Python | jslee6091/SW_Algorithm | /sw expert academy/Intermediate/String/2_회문1/회문1.py | UTF-8 | 515 | 3.296875 | 3 | [] | no_license | import sys
sys.stdin = open("회문1_inputs.txt", 'r')
def palindrome(array):
count = 0
for k in range(8-N+1):
if array[k:k+N] == list(reversed(array[k:k+N])):
count += 1
return count
for test_case in range(1, 11):
N = int(input())
num_array = [list(map(str, list(input()))) for _... | true |
21edef833c056cc6ff5b3d607d5bdce4d76ccc76 | Python | jbuseck697/SenseHat-Minecraft | /minecraftmap.py | UTF-8 | 649 | 2.703125 | 3 | [] | no_license | from sense_hat import SenseHat
from mcpi.minecraft import Minecraft
from time import sleep
sense = SenseHat()
mc = Minecraft.create()
#blocks
grass = 2
diamond = 57
gold = 41
iron = 42
#colors
cyan = (0, 255, 255)
yellow = (255, 255, 0)
white = (255, 255, 255)
black = (0, 0, 0)
#block clors
colors... | true |
3a18d22e5c16d4dc110c341700f2b118bcda4d43 | Python | trambelus/plounge-db | /Local_scripts/plmatrix.py | UTF-8 | 2,479 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import sqlite3
import matplotlib as mp
import matplotlib.pyplot as plt
import sys
QUERY = '''SELECT
100*CAST(a.N AS FLOAT)/T sun,
100*CAST(b.N AS FLOAT)/T mon,
100*CAST(c.N AS FLOAT)/T tue,
100*CAST(d.N AS FLOAT)/T wed,
100*CAST(e.N AS FLOAT)/T thu,
100*CAST(f.N AS FLOAT)/T fri,... | true |
472838e715745d175234e6e363d2baa48da45729 | Python | zaid-kamil/python_script_1130_2020 | /visualizer.py | UTF-8 | 418 | 3 | 3 | [] | no_license | from reader import read_file,count_vowels
import matplotlib.pyplot as plt
def vowel_visualizer(file):
vowels_data = count_vowels(file)
x = list(vowels_data.keys())
h = list(vowels_data.values())
color = ['#89f8ff','#ff8833']
plt.bar(x,h,color=color)
plt.savefig('images/vowel_counter.png',bbox_i... | true |
410008c2c6ce67889a7a9ba3e011af4c8344f607 | Python | thomasjeu/project_ik15 | /helpers.py | UTF-8 | 5,150 | 2.71875 | 3 | [] | no_license | import requests
import urllib.parse
import os
from cs50 import SQL
from werkzeug.security import check_password_hash, generate_password_hash
from flask import redirect, render_template, request, session
from flask_session import Session
from functools import wraps
# Configure CS50 Library to use SQLite database
db = ... | true |
779fe44780b66a0b2daa0e1f5e0c6d1bc6115ae6 | Python | thelmuth/cs110-spring-2020 | /Class39/hey_thats_my_fish.py | UTF-8 | 11,768 | 3.828125 | 4 | [] | no_license | """
hey_thats_my_fish.py
Graphical implementation of the board game Hey, That's My Fish!
Written in class
April 2019
"""
from cs110graphics import *
import random, math
WIN_WIDTH = 800
WIN_HEIGHT = 900
HEX_WIDTH = WIN_WIDTH // 8
HALF_HEX_WIDTH = HEX_WIDTH // 2
HEX_HEIGHT = int(2 * HALF_HEX_WIDTH / math.sqrt(3)) * 2... | true |
70c9933ac606f1be26493ededbdf6e848a4f6635 | Python | HangJie720/Tensorflow_basic | /examples/tutorials/mnist/deeplayer_cnn_mnistprediction.py | UTF-8 | 4,856 | 2.859375 | 3 | [] | no_license | import argparse
import sys
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
FLAGS = None
# Parameters
learning_rate = 0.001
training_iters = 200000
batch_size = 128
display_step = 10
def deepnn(x):
# Reshape to use within a convolutional neural net.
# Last dimension is for ... | true |