blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
6744e3465fbf64adb56c6f9009df2f21b5a06ea8 | ppfoerts/MovieTheater | /customer.py | UTF-8 | 6,010 | 2.53125 | 3 | [] | no_license | from flask import Blueprint, render_template, request
import mysql.connector
#by Peter Pfoertsch,250741344
#for CS3319 Assignment 3
customer_api = Blueprint('customer_api',__name__)
#Customer View
#customer index page, will show a table of all customers
@customer_api.route("/customer")
def customer():
cnx = mysql... | true |
c40d8bee479c400d61653d11045333961a6ef5b2 | manisha-jaiswal/tuple-list-dictionary-enum | /using_block_to_use_file.py | UTF-8 | 133 | 2.875 | 3 | [] | no_license | with open("manu.txt") as f:
a=f.readlines()
print(a)
#there is no need for closing
#f.open("manu.txt","rt")
#f.close()
| true |
403c67a3b14f5ab5db8c898351e30863f21285dd | zhangfangzheng/python3 | /learn python3 the hard way/ex18.py | UTF-8 | 683 | 4.21875 | 4 | [] | no_license | #This one is like your script with argv
# 这个就像你的argv脚本,argv是就像是线性链接,args是串行链接
def print_two(*args):
arg1,arg2=args
print(f"arg1:{arg1},arg2:{arg2}")
#Ok,that *argv is actually pointless,we can just do this
#ok,* args实际上毫无意义,我们可以做到这一点
def print_two_again(arg1,arg2):
print(f"arg1:{arg1},arg2:{arg2}")
#This ... | true |
1a0cb40f746f0171a5df6c0a13c398314b1f5215 | macarenapazos/Python | /ejercicio2.py | UTF-8 | 266 | 3.046875 | 3 | [] | no_license | picture = [
[0,0,0,1,0,0,0],
[0,0,1,1,1,0,0],
[0,1,1,1,1,1,0],
[1,1,1,1,1,1,1],
[0,0,0,1,0,0,0],
[0,0,0,1,0,0,0]
]
for image in picture:
for x in image:
if x == 0:
print(' ',end='')
elif x == 1:
print('*', end='')
print(end='\n') | true |
ed0684cf9dd6f175537271b239645f6f7ce2c798 | stevenhdz/Python_test | /Number.py | UTF-8 | 449 | 3.75 | 4 | [
"MIT"
] | permissive | """
https://docs.python.org/3.9/
pip = python = 2.x.x python --version
pip3 = python3 = 3.8.x python3 --version
Numbers: https://docs.python.org/3.9/tutorial/introduction.html#numbers
"""
#include<stdio.h>
def sumando(): #funcion
x=433.8889
y=723.8833
sumandos = x + y
print('La suma es: ' )
pri... | true |
71ebfc212db3041ee55a4cce0d7e487f0ac6ab5f | Benjaminlal77/Sudoku-Solver | /game_functions/events.py | UTF-8 | 5,073 | 2.984375 | 3 | [] | no_license | import pygame
import sys
from game_objects.strikes import Strike
def check_mouse_click(screen, game_objects, stats):
def check_for_button_click():
randomize_button = game_objects['randomize_button']
solve_button = game_objects['solve_button']
create_board_button = game_objects['create_boar... | true |
50441114ee8e1ce44283d2bdc518c970ec819c10 | prayagkhurana999/Python_mini_Projects | /Making_http_request_N_creatingQuotes_Gui.py | UTF-8 | 661 | 3.34375 | 3 | [] | no_license | import requests
from tkinter import *
from tkinter import messagebox
response=requests.get("enter the url here ") #get is the inbult method of requests
data=response.json()
## here type(data) is list
##if we write data[0]["key"] it will give value
master=Tk()
button1=button(master,text="Generate",command=fetch()).g... | true |
6500fbfa92572837c26753552e58ae163b053e21 | ruclion/kaggle | /chapter2.py | UTF-8 | 1,463 | 2.890625 | 3 | [] | no_license | #
#
'data pre for breast-cancer-winsconsin'
__author__ = 'hjkruclion'
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import SGDClassifier
from s... | true |
1b49453f73b99378c6f02d9392a1fab7230e2439 | psj8532/problem_solving | /Programmers/2019_BLIND_KAKAO/실패율.py | UTF-8 | 665 | 3.015625 | 3 | [] | no_license | def solution(N, stages):
answer = []
matrix = [[0]*2 for _ in range(N+2)]
rate = [[0,i] for i in range(N+1)]
for stage in stages:
matrix[stage][0] += 1
matrix[N+1][1] = matrix[N+1][0]
for i in range(N,0,-1):
matrix[i][1] = matrix[i+1][1] + matrix[i][0]
if matrix[i][1] == ... | true |
aa459dfe01aaa6a8aa7e7aad0da8f9b91c7f6ef6 | LoveRL/BAEKJOON-online-judge | /Solutions_Part2/10102번_개표.py | UTF-8 | 213 | 3.421875 | 3 | [] | no_license | n=int(input())
dic={'A':0, 'B':0}
voting=list(input())
for i in range(len(voting)):
dic[voting[i]]+=1
if dic['A'] > dic['B'] : print('A')
elif dic['A'] == dic['B'] : print('Tie')
else : print('B')
| true |
305c5ddb30d1efad4765115fed81b88017f29481 | javedmughal-058/python_basic | /Take Input from user in python.py | UTF-8 | 429 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 15 18:03:45 2021
@author: Muhammad Javed
"""
# if else statement in Python
# Take values from users.
tm=int(input("Enter Total marks: "))
om=int(input("Enter Obtained marks: "))
per=(om*100)/tm
if per>=33:
print("Congratulation..! You have passed the E... | true |
6207a3d9762216b4ea2d900d00ae748c5af336b2 | edusala/python | /poker/poker.py | UTF-8 | 495 | 2.890625 | 3 | [] | no_license |
import random
v1 = random.randrange(6) + 1
v2 = random.randrange(6) + 1
v3 = random.randrange(6) + 1
v4 = random.randrange(6) + 1
v5 = random.randrange(6) + 1
print(
"| %6s" % "Ember:",
"%d" % v1,
"%d" % v2,
"%d" % v3,
"%d" % v4,
"%d |" % v5,
)
r1 = random.randrange(6) + 1
r2 = random.randrange(6) + 1
r3 = r... | true |
6386a699eaad397ccab69a4803917422f431f070 | mohsseha/DSI-BOS-students | /karthik-33/Week-8/temperature.py | UTF-8 | 133 | 3.546875 | 4 | [] | no_license | def celsius_to_farenheit(x):
f = (9*x/5) + 32
return(f)
def farenheit_to_celsius(x):
c = (x - 32) * (5/9)
return(c)
| true |
a36047767f6df4288b120b78ff9aadc9148bcac4 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2/Aethanyc/pancakes.py | UTF-8 | 377 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
def solve(pancakes):
curr = pancakes[-1]
num = 0 if curr == '+' else 1
for p in reversed(pancakes[:-1]):
if p != curr:
num += 1
curr = p
return num
if __name__ == '__main__':
for idx in range(1, int(input()) + 1):
pancakes = input()
... | true |
c1fad56bee947977a575f76a4ad61526cbbf7ced | khmelyukovsd/Python_algorithms | /Lesson 1/Lesson1, task 5.py | UTF-8 | 313 | 3.75 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Урок 1. Задача 5. Пользователь вводит номер буквы в алфавите. Определить, какая это буква.
# In[8]:
a = int(input('Введите номер буквы: '))
print ('Это буква -', chr(a+64))
| true |
cb2b48a377bb025f0008bec71642bd17ddd6866b | Tolu-Orina/Bincom-Developer-Test | /Interview.py | UTF-8 | 4,681 | 3.203125 | 3 | [] | no_license | from psycopg2 import Error
import psycopg2
import re # import regular expression module
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# create a list for the baby names
mylist = []
# iterate line by line in the file
for line in open('python_class_question.html', 'rt'):
line = lin... | true |
c004d0411e56e8b952693ff2302702b1717c6dde | asrabon/Python-Workspace | /pandas/panda.py | UTF-8 | 447 | 2.71875 | 3 | [] | no_license | import pandas
from geopy.geocoders import Nominatim
df = pandas.read_csv("supermarkets.csv")
df["Addres"] = df["Address"] + "," + df["City"] + "," + df["State"]
df
nom = Nominatim()
df["coordinates"] = df["Address"].apply(nom.geocode)
df["Longitude"] = df["coordinates"].apply(lambda x: x.longitude if x != None else N... | true |
b2c126d2c02019a01aaf7f844cb8631e5e3692dd | kanik9/Plotly-and-Dash | /upfdating_graph.py | UTF-8 | 7,449 | 3.34375 | 3 | [] | no_license | """
1. In this section we are going to use 'hoverData','clickData','selectedData' on a graph to grab or to extract information of a specific part of
graph.
- 'hoverData' : it i a property of graph which is use to see the information on a particular point when a user hover over the points
- 'clickData' : it's... | true |
fb8ccfd1cd27794632c1ce7e73e17926edd528d1 | anselmo-2010/decorators | /exmp_1.py | UTF-8 | 295 | 3.28125 | 3 | [] | no_license | passw = input("Введите пароль")
def test_passw(p):
def deco(f):
if p == "10":
return f
else:
return lambda: "Доступ закрыт"
return deco
@test_passw(passw)
def func():
return "Доступ открыт"
print(func()) | true |
ea938f93f0a49ec109d2ba8eefc2481f36dcd1f1 | Fatou1993/interviews-preparation | /graphs/edmonkarp.py | UTF-8 | 2,764 | 3.328125 | 3 | [] | no_license | from collections import defaultdict, deque
from sets import Set
def initialize_residual_graph(graph):
"""
Creates edge (v,u) if not already present and add a capacity 0 to it
:param graph: dictionary of dict : graph[u][v] = capacity edge (u,v) ex.
:return:
"""
rgraph = dict(graph)
for u in ... | true |
862bf78d2cab6e4426ebf784a34bf9dc041adaea | sashaspala/Alexa_Immigration | /src/user_intent/move_object.py | UTF-8 | 607 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
from intent_object import IntentObject
from intents import Intent
from slots import Slots
class MoveObject(IntentObject):
def __init__(self, country=None, city=None):
super(MoveObject, self).__init__(Intent.MOVE, country)
self.setSlot(Slots.CITY, city)
#def isComplete(sel... | true |
710cbb085ef00122b5fe04667ec0ea658fadf5bd | nikita2697/python_practice | /tut_8.py | UTF-8 | 747 | 4.03125 | 4 | [] | no_license | mystr="nikita is good girl. what about you?"
mystr1="1254"
print(mystr)
print(mystr[0])
print(mystr[0:4])#string slicing 0 include 4 exclude
print(len(mystr))
print(mystr[0:19])
print(mystr[0:19:2])#advanced slicing
print(mystr[0::2])
print(mystr[::])
#negative indices read string reverse from -1
print(mystr[-1])
pri... | true |
4c84f449d2d30057d52fe79fc4c0f12e9b1f2bae | paulotokimatu/python_rosalind | /017_PERM.py | UTF-8 | 297 | 3.1875 | 3 | [] | no_license | import itertools
rosalind = open("rosalind_perm.txt", "r")
number = rosalind.read().strip()
list_numbers = range(1,int(number)+1)
result = list(itertools.permutations(list_numbers))
print len(result)
for i in range(len(result)):
for x in result[i]:
print x,
print ""
| true |
96aa76374853b008d8cbbfb4492e4b63be0c4380 | pivotal-energy-solutions/django-states2 | /django_states/machine.py | UTF-8 | 13,130 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""State Machine"""
__all__ = ("StateMachine", "StateDefinition", "StateTransition")
from collections import defaultdict
import logging
import six
from django.contrib import messages
from django_states.exceptions import (
TransitionNotFound,
TransitionValidationError,
UnknownState,... | true |
ad3fce17ce0afbd62c64d23a70a1377d86e44d25 | maratismailov/forest_python | /inventory/insertTimberCounting.py | UTF-8 | 2,083 | 2.53125 | 3 | [] | no_license | import psycopg2
from credentials import cr_dbname, cr_host, cr_password, cr_user
def insert_timber_counting(timber_counting, newId, modified, timber_counting_counter):
""" delete values from the timber_counting table"""
delete_timber_counting_query = """DELETE FROM inv.timbercounting WHERE inventor_id = {}""... | true |
9322d3ddd676406d1411cfd3f7b6505d1514f2a3 | kamyu104/LeetCode-Solutions | /Python/delete-tree-nodes.py | UTF-8 | 1,204 | 3.1875 | 3 | [
"MIT"
] | permissive | # Time: O(n)
# Space: O(n)
import collections
class Solution(object):
def deleteTreeNodes(self, nodes, parent, value):
"""
:type nodes: int
:type parent: List[int]
:type value: List[int]
:rtype: int
"""
def dfs(value, children, x):
total, count... | true |
c83d6ca3f583bee5262218c5dcd832ba609886e1 | jorjuato/IORstats | /pystats/plot_settings.py | UTF-8 | 2,403 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
# Module: plot_settings.py
# Author: Varun Hiremath <vh63@cornell.edu>
# Created: Thu, 2 Apr 2009 05:06:31 -0400
import pylab, math
# Symbols
symbols = ['-','--','-.',':','.',',','o','^','v','<','>','s','+','x','D','d','1','2','3','4','h','H','p']
# Symbols + line
lps = [k+'-' for k in [',','.','... | true |
0688577e66322c1407db7a9f0933f6db982a3aed | yangyq-github/hgwz_course | /Chapter_Python/test_python_allure.py | UTF-8 | 3,561 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python3
# coding : utf-8
# @Time : 2021/3/17 10:40
# @File : test_python_allure.py
__author__ = 'yangyanqin'
# Allure 测试框架
import pytest
import allure
TEST_CASE_LINK = "https://www.baidu.com"
@allure.title("链接测试")
@allure.story("link")
@allure.testcase(TEST_CASE_LINK, "Test case title")
def test_link()... | true |
7ecfceb8028a5f9583410a030fc61cd2374a0a5f | ly061/learn | /POC/proj01_poc/data/marketmatrix_utils.py | UTF-8 | 3,358 | 2.796875 | 3 | [] | no_license | import json
import openpyxl
from bs4 import BeautifulSoup
from requests.adapters import HTTPAdapter
from selenium import webdriver
import requests
import json
__matrix_file_name__ = "proj01_poc/data/V5.xlsx"
# __matrix_file_name__ = "V5.xlsx"
def get_social_matrix():
"""
Get all soical link matrix
locale ... | true |
30fa66d541c597703b0bf8de6b48dceaaaf7d1ca | sebastiendemortain/neural-coding-of-probabilities | /plot_hrf.py | UTF-8 | 2,006 | 2.921875 | 3 | [] | no_license | """
Example of hemodynamic reponse functions.
=========================================
We consider the hrf model in SPM together with the hrf shape proposed by
G.Glover, as well as their time and dispersion derivatives.
Requires matplotlib
Author : Bertrand Thirion: 2009-2015
"""
import numpy as np
import matplotli... | true |
df5cdd24d981134ed75e1b1c103ebb4a3db4cd2d | NahHyun-Kim/PythonProject | /CodeitPython/파이썬_1/aliasing.py | UTF-8 | 1,655 | 4.46875 | 4 | [] | no_license | # Aliasing
x = [2, 3, 5, 7, 11]
y = x # y=x라는 명령에 의해, 같은 리스트에 y라는 이름표를 달음
# y는 x의 가명, Alias : 이름은 다르지만 같은 값이라는 뜻(같은 메모리 주소에 있는 값을 가리킴)
y[2] = 4
print(x)
print(y) # 둘 다 2,3,4,7,11 출력 : 2,3,4,7,11 의 리스트가 x,y의 이름표를 갖고 있기 때문에 둘다 같은 리스트를 출력
# y의 값은 바꾸면서, x의 값은 바꾸지 않으려면?
# list 함수 : 원본을 복사해 새로운 공간에 붙여넣고, 새로운 공간의 리스트를 리턴
y =... | true |
433dbd82ee3732d69913520b4ddbb7e5e8222d36 | serge-m/kolasimagestorage | /kolasimagestorage/file_service.py | UTF-8 | 1,607 | 2.5625 | 3 | [] | no_license | import datetime
import uuid
import libcloud.storage.providers
from libcloud.storage.types import ContainerAlreadyExistsError
from six import BytesIO
from kolasimagestorage import StorageParameters
class FileServiceException(Exception):
pass
class FileService:
def __init__(self, storage_parameters: Stora... | true |
ef16ad8833a7d9d25a09a2fa80441420aed23cfa | ahmedmed/Bike-Lock | /bike-rack-master/server_listener.py | UTF-8 | 1,652 | 2.671875 | 3 | [] | no_license | import urllib.request
import json
import time
import paho.mqtt.client as mqtt
TOPIC = 'bike/'
MQTT_BROKER = '10.24.23.140'
MQTT_PORT = 1883
# MQTT setup
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
def on_message(client, userdata, msg):
print(msg.topic+" "+str(m... | true |
3d2e9d5d0a5d911f603c78f34b7cb4fb49f3810a | rabelais88/pyscrape-mac | /src/error_handling.py | UTF-8 | 1,163 | 3.359375 | 3 | [] | no_license | import time
import requests
"""
this code separates temporary errors from permanent errors(such as 404)
permanent errors or success would finish the program but temporary errors will keep the program running
create error handling module in this fashion or use 'retrying' library
"""
TEMPORARY_ERROR_CODES = (408, 500, 5... | true |
e1459b5a368b11b750de9870e2050bfccc79e183 | dark5plder/python | /4.py | UTF-8 | 336 | 3.109375 | 3 | [] | no_license | time = "12:40:22AM"
data = time.split(":")
if (data[2].find("AM") ==2):
if(data[0]=="12"):
data[0]="00"
else:
pass
elif(data[2].find("PM") ==2):
if(data[0]=="12"):
pass
else:
data[0]=int(data[0])+12
d=data[2]
data[2]=d[0:2]
myList = ':'.join(map(str, data)... | true |
8cf6f7037b903bbf4aa65c7b3bfcfcd6154db026 | felkamp/ETL | /postgres_to_es/utils.py | UTF-8 | 1,565 | 2.6875 | 3 | [] | no_license | import time
from datetime import datetime
from functools import wraps
from operator import itemgetter
from loggers import logger
def expo(base: float, factor: int, max_value: float):
count = 0
while True:
res = factor * base ** count
if res < max_value:
yield res
count... | true |
815dadac57f2581256100c3be6340ac25d077b26 | lazopm/advent2020 | /4/part1.py | UTF-8 | 454 | 3.15625 | 3 | [] | no_license | import re
passports = open("input.txt","r").read().split('\n\n')
codes = [
'byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid',
#'cid',
]
def is_valid(passport):
for code in codes:
regex = rf"{code}:\S+"
match = re.search(regex, passport)
if match == None:
return False... | true |
2e269adf095bb4e8956171336898352d1fc3d1c9 | bits2018wilp/python-lab | /src/main/prep/move_all_zero_to_end.py | UTF-8 | 181 | 3.265625 | 3 | [] | no_license |
arr = [ 6, 0, 8, 2, 0, 0, 4, 0, 1 ]
c = 0
for i in range(len(arr)):
if arr[i] != 0:
arr[c] = arr[i]
c+=1
if i > c:
arr[i] = 0
print(arr) | true |
b2f980979694a8c2cb32132729c1f93e1a748d36 | Thiagobc23/BRICS-EDA | /docs/archive/api/db_handler.py | UTF-8 | 319 | 2.75 | 3 | [] | no_license | import pandas as pd
import sqlite3
def to_json(table):
# Read sqlite query, get data frame, and close the connection
conn = sqlite3.connect(r"c:/py/BRICS-EDA/data/brics.db")
df = pd.read_sql_query("SELECT * from {}".format(table), conn)
conn.close()
#print(df.head())
return df.to_json()
| true |
57c9390948ef0120b6421d69c1ca3cffab960436 | Rdatasets/tools | /copy_data.py | UTF-8 | 645 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
import pandas as pd
pd.set_option('max_rows', 10)
import click
import os
import glob
@click.command()
@click.argument('source')
@click.argument('package')
@click.argument('destination')
def main(source, package, destination):
#print("Copy from '%s' to '... | true |
4b66ebc2923be86f85a02942aab631fe054ff1c0 | AlexandrZhytenko/solve_tasks | /find_words.py | UTF-8 | 637 | 4.3125 | 4 | [] | no_license | # You are given a string with words and numbers
# separated by whitespaces (one space).
# You should check if the string contains three words in succession.
def find_words(input_string):
count = 0
inp_str = input_string.lower()
for i in str.rsplit(inp_str):
if i.isalpha():
count += 1
... | true |
e2f88b927e437d6fef7018bdd5b8bf84b4f50af2 | Chocomunk/atrw | /clustering/clustering.py | UTF-8 | 8,194 | 2.515625 | 3 | [] | no_license | # Based on the blog post "How to cluster images based on visual similarity"
# written by Gabe Flomo.
import os
import sys
import argparse
import contextlib
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from distutils.util import strtobool
from keras.preprocessing.image import load_img
fr... | true |
25e140e2bd5a6c0964f94478a36a73667c637fef | hegerdes/IT-Sec-Lecture | /P2/dos.py | UTF-8 | 4,450 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
dos.py, Crashes a vulnerable mosqsuitto broker
@author: tzimmermann @ AG Verteilte Systeme, Uni Osnabrueck
@date: 19.03.2018
"""
import paho.mqtt.client as mqtt
import time
MAX_CLIENTS = 500
class MQTT_DoS:
def __init__(self, hostname, port, credentials):
"""Constructor sets u... | true |
5ca818029e58446e99496adb9396d38be3e41c96 | withinfinitedegreesoffreedom/datastructures-algorithms | /misc/mergesortedarrays.py | UTF-8 | 358 | 3.34375 | 3 | [] | no_license | def merge_sorted(A, B):
i = 0
j = 0
while i < len(A) and j < len(B):
if A[i] < B[j]:
i+=1
else:
A.insert(i, B[j])
i+=1
j+=1
while j < len(B):
A.insert(i,B[j])
i+=1
j+=1
return A
B=[10,15,20,25,100]
A=[17,23... | true |
8ee2ede4bd2686b1717bf5b76d90faa98e7676ef | SunnySunny93/MINF | /Aufgabe 5/Aufgabe 5.py | UTF-8 | 9,236 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 7 17:44:46 2016
@author: Anni
"""
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from scipy.signal import convolve2d
#matrix1 = [[1], [4], [3], [2]]
#matrix2 = [[1], [2], [3], [4]]
#matrix1 = [[2], [1, 2], [1, 1], ... | true |
2dd198c7d3e422cecacc2ced905601bf706345cf | MiltonCastilloG/gplsiScrapper | /questions_xml_generator.py | UTF-8 | 2,472 | 2.75 | 3 | [] | no_license | import os
from lxml import etree
def generate_xml_from_dictionary(parsed_content, title):
root = etree.Element('test')
language = etree.Element('language')
language.text = title
root.append(language)
all_questions_xml = etree.Element('questions')
for question_index, question_answers in enumerat... | true |
5c30fcab2a8ab516ab0295584ad9bf656f369774 | l327253678/JavascriptExample | /aiohttp协程深度爬取案例/协程.py | UTF-8 | 2,237 | 2.859375 | 3 | [
"MIT"
] | permissive | import asyncio
import aiohttp
import time
from lxml import etree
url = "http://www.mengniu.com.cn/news/zbxx/p/{}.html"
headers = {
"referer": "http://www.mengniu.com.cn/news/zbxx/p/2.html",
"x-requested-with": "XMLHttpRequest",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"user-... | true |
3e54aed0b6ea84f1822fb2745aec456ac607edf4 | Jarrod95/Divers | /cours recursivité.py | UTF-8 | 567 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
def u(t):
E=5
tau = 0.05
T=20*tau
if t>=0 and t<=T/2:
return E*(1-np.exp(-t/tau))
elif t>=T/2 and t<=T:
return E*np.exp(-(t-T/2)/tau)
else:
if t>0:
return u(t-(t//T)*T)
else:
... | true |
1917143240e8ecaef73cda521b8688ea3c65f781 | JimmyHHua/opencv_tutorials | /python/code_007/opencv_007.py | UTF-8 | 689 | 2.859375 | 3 | [] | no_license | import cv2 as cv
import numpy as np
# create image one
src1 = np.zeros(shape=[400, 400, 3], dtype=np.uint8)
src1[100:200, 100:200, 1] = 255
src1[100:200, 100:200, 2] = 255
cv.imshow("input1", src1)
# create image two
src2 = np.zeros(shape=[400, 400, 3], dtype=np.uint8)
src2[150:250, 150:250, 2] = 255
cv.imshow("input2... | true |
9541c5c4056cb8a11b18b9fb4f636c33614e56c6 | samdis/DividendCalendar_ETL | /scrapeFinance.py | UTF-8 | 1,240 | 2.5625 | 3 | [] | no_license | # Data load job
from datetime import timedelta, date
import requests
import time
import json
from pymongo import MongoClient
client = MongoClient() # get client
db = client.development # get db
collection = db.finance # get collection
def daterange(start_date, end_date):
for n in range(int((end_date - star... | true |
a32a99a765b69a54630c5377c73f8a764efb1b8b | Edox93/ACA | /Homeworks/hw_1_ex_2.py | UTF-8 | 318 | 4.34375 | 4 | [] | no_license | while True:
char = input('enter a letter:').lower()
vowel = ['a', 'e', 'i', 'o', 'u']
if len(char) == 1 and char.isalpha():
if char in vowel:
print("the letter is vowel")
else:
print("the letter isn't vowel")
else:
print('The', char, "is invalid input")
| true |
a979dfc0d57ebd187c63cf1ef0c2fa653c0da6ee | maxfischer2781/aoc2020_py3 | /aoc2020/day3.py | UTF-8 | 945 | 3.453125 | 3 | [] | no_license | from math import prod
FORMAT = """
Hits 3:1 {}
Hits all {}
"""
def solve(in_stream):
data = [MapLine.from_str(line) for line in in_stream]
simple_hits = sum_slope(data, 3, 1)
slopes = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
slope_hits = [sum_slope(data, *slope) for slope in slopes]
return simple... | true |
3c10287c308cc5104bd7303202f66946f04c6e14 | alemiaschi/PythonForBeginners | /Exercises/lezione_2/for_while/es_5_cicli.py | UTF-8 | 281 | 4 | 4 | [] | no_license | stringa = input("Inserisci stringa: ")
nuova_stringa = ""
lunghezza = len(stringa)-1
while lunghezza >= 0:
nuova_stringa+=stringa[lunghezza]
lunghezza-=1
if stringa == nuova_stringa:
print("La stringa è palindroma!")
else:
print("La stringa NON è palindroma")
| true |
b35245413270666994ecedfad0848c387026dad6 | BIG-S2/PSC | /Scilpy/scripts/scil_substract_streamlines.py | UTF-8 | 3,149 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import itertools
import logging
import os
import tractconverter
from scilpy.utils.streamlines import substract_streamlines
def build_args_parser():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
desc... | true |
90da1752f775606f4b380b67ec76cd9115ee3016 | davidwonghk/android-sticker | /scripts/stickers.py | UTF-8 | 2,671 | 2.6875 | 3 | [] | no_license | #!/bin/python
import sys
import os
import math
import logging
from PIL import Image, ImageDraw
SIZE = (256,256)
ICON_SIZE = 64,64
MARGIN = 15
WIDTH = 4
TYPE = 'jpeg'
def create_if_empty(directory):
if not os.path.exists(directory):
os.makedirs(directory)
def create_thumbnail(old_path, new_path, size):... | true |
0d2e4b5d0ac15e3f7d9a9b10c57ed3a1ca464508 | jllaneras/aoc-2019 | /aoc/day4/star8.py | UTF-8 | 861 | 3.421875 | 3 | [] | no_license | # https://adventofcode.com/2019/day/4#part2
from aoc.day4.star7 import has_increasing_digits
def valid_password(password):
return has_increasing_digits(password) and has_double_digit(password)
def has_double_digit(password):
result = False
last_char = None
num_repetitions = None
for char in pa... | true |
73a5f9fc0dfc961cdeaa854c1a7fb3fb9dcb9b78 | Aasthaengg/IBMdataset | /Python_codes/p02952/s108588445.py | UTF-8 | 211 | 2.96875 | 3 | [] | no_license | N=int(input())
count=0
for i in range(1,N+1):
for j in range(0,6):
if 10**j <=i <10**(j+1):
ans=j+1
if (j+1)%2!=0:
count+=1
print(count) | true |
d7482ddcc64856becae05c4aecbb9cdf731c8e50 | DileshworiJ/Flappy-Bird | /flappy.py | UTF-8 | 4,267 | 3 | 3 | [] | no_license | import pygame, sys, random
def draw_base():
screen.blit(base_surface, (base_x_pos,450))
screen.blit(base_surface, (base_x_pos +288,450))
def create_pipe():
random_pipe_pos = random.choice(pipe_height)
bottom_pipe =pipe_surface.get_rect(midtop= (350,random_pipe_pos))
top_pipe =pipe_surface.get_rect... | true |
d65447877ba709476f65fdd081bdb03f492c835b | thenriquedb/grafo-em-python | /trabalho-01/src/grafo/DFS.py | UTF-8 | 725 | 3.234375 | 3 | [] | no_license | from grafo import Grafo
class DFS:
def __init__(self, grafo: Grafo):
self.grafo = grafo
def buscar(self, v1: int, v2: int):
v1 = v1 - 1
v2 = v2 - 1
pilha = [v1]
vertices_adjacentes = self.grafo.GAAdjacencias(v1)
vistados = set([v1])
caminho = []
... | true |
e7bb0af32fdefbb611bbc6f0844602f51edf8051 | Kimuksung/bigdata | /tensorflow/C02_Tensorflow_handle/lecture/step05_transform02_squeeze.py | UTF-8 | 540 | 3.8125 | 4 | [] | no_license | '''
squeeze
- 차원의 size가 1인 경우 제거
'''
import numpy as np
a = np.zeros( (1,2) ) # 2차:행/열
print()
print(a)
print(np.squeeze(a)) # 1개 차원 삭제
print()
b = np.zeros( (1,2,1) ) # 3차:면/행/열
print(b)
print(np.squeeze(b)) # 2개 차원 삭제
print()
c = np.zeros( (1,2,1,3) ) # 4차원
print(c)
print(np.squeeze(c)) # 2개 차원 삭제
print()
import... | true |
af421569899ddd56430711b90637229f84d88cae | krisio/programming_0 | /week7/Coolest-Palindrome/is_string_palindrom.py | UTF-8 | 585 | 3.703125 | 4 | [] | no_license |
def str_reverse(string):
result = ""
for ch in string:
result = ch + result
return result
def is_string_palindrom(string):
string = string.lower()
clean_string = ""
for ch in string:
if not ch.isspace() and ch.isalnum():
clean_string += ch
i... | true |
39b0b5a0f79bddcd6b21c82c570c6ee76af90631 | liuzhipeng17/python3-cookbook | /unittest工作原理.py | UTF-8 | 1,672 | 3.546875 | 4 | [] | no_license | import sys
def main(out=sys.stderr, verbosity=2):
loader = unittest.TestLoader()
suite = loader.loadTestsFromModule(sys.modules[__name__])
unittest.TextTestRunner(out,verbosity=verbosity).run(suite)
if __name__ == '__main__':
with open('testing.out', 'w') as f:
main(f)
'''
un... | true |
6ffbb8791c88a4ee73e9da2ad4067e204b798547 | Thiago-de-Melo/caixasupermercado | /efetua_compra.py | UTF-8 | 854 | 3.640625 | 4 | [] | no_license | print("BEM VINDO AO SUPERMERCADO BEM BOM")
compra = {}
def efetuacompra():
## Função que define os produtos e os valores dos mesmos a serem comprados
fimcompra = 0
while fimcompra != 'sim':
compraproduto = input('Digite o nome do produto: ')
try:
valorproduto = float(input('Qual... | true |
3dbad8d60c44cc324bed1f5b0be6890528fa9bf0 | karanrampal/ctr_events | /code/main.py | UTF-8 | 2,793 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
"""Extract events from PM file"""
import argparse
import sys
import os
import pandas as pd
import utils
def args_parser():
"""Parse command line arguments
"""
parser = argparse.ArgumentParser(description="Extract PM events from CTR file and save\
... | true |
f4c8ef32100d01ddccae7e891bdbfa5785ed7b85 | MiKTeX/miktex-packaging | /python/miktex/packaging/info/inifile.py | UTF-8 | 5,381 | 2.5625 | 3 | [
"MIT"
] | permissive | # Licensed to you under the MIT license. See the LICENSE file in the
# project root for more information.
import io
import os
from miktex.packaging.info import texcatalogue
from miktex.packaging.settings import paths
def get_ini_filename(package: str) -> str:
return os.path.normpath(os.path.join(pat... | true |
5913404105314ff41c6059f55ee9525227651fe3 | keepmwsh/PythonBase | /Code/CheckPySocks.py | UTF-8 | 1,274 | 2.796875 | 3 | [] | no_license | from urllib import request
import socks
import socket
import requests
# 不支持链路上存在IPV6的连接
def relyConnect(url):
s = socks.socksocket()
# 设置Socks中继
s.set_proxy(socks.SOCKS5, addr="127.0.0.1", port=1080)
s.connect(url, 80)
s.sendall("GET / HTTP/1.1 ...")
print(s.recv(1024))
# 关闭Socks中继打开的句柄
... | true |
4fedc635c73f32a2cdb19a3438cd34edea4205f6 | Hugh88888/Self-taught | /Self-taught/Self01.py | UTF-8 | 664 | 4.28125 | 4 | [] | no_license | def a():
i = int(input("数字を入れろ:"))
return i ** 2
"""
2乗する
"""
print(a())
def b(s):
print(s)
"""
おはよう関数
"""
b("おはよう東京")
def c(aa, ab, ac, ba = 4, bb = 5):
print(aa, ab, ac, ba, bb)
"""
意味わからん関数
"""
c(1, 2, 3,)
def d(i):
return i / 2
def e(i):
return i *... | true |
0487d9b410fd49c82d451917bf02d3dff7c2c7b2 | premputtegowda/Graphs | /projects/graph/min_array.py | UTF-8 | 1,223 | 4.28125 | 4 | [] | no_license | # Add up and print the sum of the all of the minimum elements of each inner array:
data = [[8, 4], [90, -1, 3], [9, 62], [-7, -1, -56, -6], [201], [76, 18]]
# The expected output is given by:
# 4 + -1 + 9 + -56 + 201 + 18 = 175
# You may use whatever programming language you'd like.
# Verbalize your thought process as ... | true |
fdc9f1e120e3d1f271a0098bf8603427e1a3878c | Ruaman/PatternFlow | /algorithms/metrics/Exposure_metrics/histogram_metrics_driver_script.py | UTF-8 | 1,211 | 2.609375 | 3 | [] | no_license | from histogram_metrics import histogram_mertics
import tensorflow as tf
from tensorflow.keras.datasets import cifar10, mnist
import matplotlib.pyplot as plt
if __name__== "__main__" :
#load some sample data and take a subset so computation isn't too long
(x_train, y_train), (x_eval, y_eval) = cifar10.load_da... | true |
4d2290cb4755dff292ae1402b75a201dbb1c409e | aayushmansingh/Programming | /word_manipulation_codeofgeeks.py | UTF-8 | 344 | 3.453125 | 3 | [] | no_license | ans=[]
s=input()
uc=sorted(set(s.upper()))
for i in range(len(uc)):
news=''
for j in s:
if uc[i]==j.upper():
news+=j
ans.append(news)
answer=''
i=0
j=len(ans)-1
while(i<=j):
if ans[i]==ans[j]:
answer+=ans[i]
else:
answer+=ans[i]+ans[j]
i+=1
... | true |
9869a1333e0204cd35fea29a4b91e943f0233082 | alphamod/python-practice-programs | /practice.py | UTF-8 | 484 | 3.328125 | 3 | [] | no_license | '''file=open("previous week.csv", 'r')
a=file.read()
b=a.split('\n')
#print(b)
d={}
ab=b[0].split(',')
for i in ab:
d[i]=''
print(d)
max_cod_score=[]
for i in b[1:]:
for j in i:
'''
'''a=input("Enter the number: ")
a=list(a)
c=[]
d=[]
for i in a:
if int(i)%2==0:
c.append(i)
elif int(i)%2!=0:
... | true |
075a8a0c14624a07c3a8e11efa2e056eea63463a | felipeoriani/euler | /025.py | UTF-8 | 654 | 4.3125 | 4 | [] | no_license | # ----------------------------------
# Project Euler - projecteuler.net
# ----------------------------------
# Developed by Felipe B Oriani
# 002 - 1000-digit Fibonacci number
# What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
# ----------------------------------
def fibonacci():
... | true |
0f613eb74d43eb695f7faf79f4a5cc16f82ba92c | pavlaspb/python_pavla | /fixture_contact/contact.py | UTF-8 | 934 | 2.875 | 3 | [] | no_license | class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
# init new contact creation
wd.find_element_by_link_text("add new").click()
# fill new contact form
self.contact_filling(contact)
# submit creation
... | true |
43cd1cbfc488e66a84c7f0b2253cd2bb01ee2316 | EMS-TU-Ilmenau/PURReaderControl | /purreader/message.py | UTF-8 | 7,565 | 2.859375 | 3 | [] | no_license | class PURPacket:
'''
Reader host protocol message packet
'''
def __init__(self, cmdBytes=b'', pldBytes=b'', msgBytes=b''):
'''
Converts either command and payload bytes to message bytes
or vice versa, depending which has content
:param cmdBytes: byte array of first comm... | true |
b68f3b2baeb76494e6b11b44e43459d199d71f76 | cule/poledetection | /cellular_automaton.py | UTF-8 | 3,100 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by You Li on 2014-12-11 0011
import random
class Cell:
def __init__(self, neighbors, normal, currstate=0, prestate=0):
self.prev_state = prestate
self.state = currstate
self.neighbors_indices = neighbors
self.normal = normal
... | true |
5cd6aa4a34ee4f100dd6b2e4e7c06f9c7e32e6c5 | Gedanke/StudyNote | /Math/codes/module_2/l_8_1.py | UTF-8 | 267 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
def main():
m = 0
n = 1000
for _ in range(n):
x = random.random()
y = random.random()
if x * x + y * y < 1:
m += 1
print(1.0 * m / n)
if __name__ == '__main__':
main()
| true |
c3df3820a6ae0ca3a863ac1788841685d0c2ad60 | ghaed/Fun-With-Algorithms | /DP-ShortestPathAllPairs/scrap01.py | UTF-8 | 130 | 2.890625 | 3 | [] | no_license | n = 2
a = [[float("inf") for x in range(n + 1)] for y in range(n + 1)]
a[0][0] = 1
a[0][1] = 2
a[1][1] = -1
print min(min(a)) | true |
f0e2d515d0eaabbcc09607ec7e6c65bc145da211 | YashBansod/DockWorkerRobot | /output_functions.py | UTF-8 | 5,536 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
"""
File Description: File defining the various outputs functions used by the simulator.
"""
# ****************************************** Libraries to be imported ****************************************** #
from __future__ import print_function, division
from matplotlib import pyplot as pl... | true |
0b58018b13b04938d44c228f71f2b32bd55d8649 | mr-fcharles/SIReNNet | /Microdynamics/SIReNet/experimental.py | UTF-8 | 1,848 | 2.765625 | 3 | [] | no_license | from numba.experimental import jitclass
from numba import int64, float64
import numpy as np
#Non working functions that need to be revised
spec4 = [
('size', int64),
('pdist', float64[:]),
('randomization', float64)
]
@jitclass(spec4)
class Multinomial_with_randomization(object):
def __init__(s... | true |
a8472ef616c9b2780527584b06cb8d18d27c4a07 | wiki-e/wikitree | /wt_init_parse.py | UTF-8 | 982 | 2.984375 | 3 | [] | no_license | '''
========
Aim of this file is to understand the input query,
take steps for fetching and computing and output.
1. Find the tokens and tag parts of speech
2. Type of query:
3. wt_finder for each token as a separate process and store wiki_data in temp
4. ...
========
'''
import sys
import nltk
arguments = sys.a... | true |
2863e3299834df4f92f87ebc89d209d7ce6066c0 | GeekGray-Code/python | /PythonWork/work/w3/LowerCaseToUpperCase.py | UTF-8 | 59 | 3.296875 | 3 | [] | no_license | lowerStr=input()
upperStr=lowerStr.upper()
print(upperStr) | true |
49bd42624be636b9e146fe9183cb4db20b9725b8 | dragon0/practical-python-talk | /examples/unittest-examples/tests.py | UTF-8 | 1,047 | 3.234375 | 3 | [] | no_license | import unittest
from geometry import Vector2
class TestVector2Arithmetic(unittest.TestCase):
def setUp(self):
self.v1 = Vector2(3, 4)
self.v2 = Vector2(5, 6)
def test_add(self):
v3 = self.v1 + self.v2
self.assertEqual(v3, Vector2(8, 10))
def test_sub(self):
v3 = s... | true |
5611e47defd202c1e78ee8fc6c3bca42567b34d6 | aaronjolson/Simple_Python_Animations | /wx_python_basics/collect input.py | UTF-8 | 512 | 2.875 | 3 | [] | no_license | import wx
class aaron(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'window frame',size=(300,200))
panel=wx.Panel(self)
accept = wx.TextEntryDialog(None,'What is your name?','Ttile','enter your name')
if accept.ShowModal()==wx.ID_OK:
apples=... | true |
20f48e94144c9d59b43ec7d9db98b4ee78a832f2 | swails/wanda | /wanda | UTF-8 | 3,055 | 3.078125 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python2
from Tkinter import *
try:
from ttk import Button, Scrollbar
except ImportError:
# If we don't have Themed Tk widgets, just fall back on the ones from
# Tkinter itself... won't be as pretty, but oh well.
pass
from subprocess import Popen, PIPE
class TextWindow(Frame):
""" A b... | true |
b601c9c17b6dbe7136d439d067c899c85ed19450 | RahulSundar/pymor | /src/pymor/reductors/interpolation.py | UTF-8 | 14,747 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.algorithms.krylov import rational_arnoldi
from pymor.algorithms.gra... | true |
d263a5417d700b49adc35613296fc82e06994ca4 | kmert10/Capital-One-SFPD-Challenge | /mertkarakas-sfpd_optimization.py | UTF-8 | 3,013 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Capital One Challenge: Can you optimize and predict emergency calls?
Mert Karakas
UVA 2020
"""
import pandas as pd
import numpy as np
from matplotlib import pyplot
import seaborn
import plotly.plotly as py
import plotly.graph_objs as go
from datetime import datetime
seaborn.set(style='tic... | true |
24c612f375648a022a87a00cf8c60a22c2e05ce9 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2844/60796/252461.py | UTF-8 | 331 | 3.015625 | 3 | [] | no_license | s=input().split(" ")
n=int(s[0])
t=int(s[1])
ls=input().split(" ")
ls=[int(x) for x in ls]
result=[]
for i in range(n):
if ls[i]<=t:
time=ls[i]
j=i+1
while j<n:
time=ls[j]+time
if time>t:
break
j=j+1
result.append(j-i)
print(max(res... | true |
68737e1d075c200014286fd7006e248bbbdd40d8 | kevinsa5/KOTH | /control/world-1/bots/mouse.py | UTF-8 | 1,393 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python -u
import sys
sys.path.append('./lib')
from libbot import *
from math import sqrt
from random import random
init_bot("mouse")
target = [100,200]
t = 0
chirality = 1
while True:
world_info = get_world()
me = world_info["me"]
x = me["pos"]["x"]
y = me["pos"]["y"]
hx = me["heading"]["x"]
hy = me[... | true |
434811e0a7f2a885e89958b171552ba6ac7c74c5 | Arya07/iCubWorld | /tools/annotations_tools/translate_annotations_txt.py | UTF-8 | 3,532 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
#
# The script has been used to translate the annotations files given by the robot to more
# standard formats like the [Imagenet](http://www.image-net.org/)'s or the
# [KITTI](http://www.cvlibs.net/datasets/kitti/)'s.
#
# author: Elisa Maiettini
# date: 06/03/2017
#
import os
import numpy as np
impor... | true |
61262d2110bdd298a77926af1055904762d7f884 | qwerty0981/advent-of-code | /day1_COMPLETE/day1_part2.py | UTF-8 | 258 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
test = open("input", 'r')
lines = [int(line) for line in test]
total = 0
i = 0
ilen = len(lines)
seen = set()
while True:
total += lines[i % ilen]
if total in seen:
break
else:
seen.add(total)
i += 1
print("Total is :", total)
| true |
59ce1a9f37d362147c1bd80c7e2011b4ecc507f7 | hanchangjie429/algorithm010 | /Week03/70.爬楼梯.py | UTF-8 | 1,434 | 3.609375 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=70 lang=python3
#
# [70] 爬楼梯
#
# @lc code=start
class Solution:
def climbStairs(self, n):
# Method 1: 递归方法 (会超时) 时间复杂度O(2^n) 空间复杂度O(1)
'''
if n <= 1:
return 1
elif n < 3:
return n
else:
return self.climbStairs(n-... | true |
363d8fbc4d5317d2bfe44f415566d35d5e3df360 | vladn90/Algorithms | /Linked_Lists/linked_list_cycle.py | UTF-8 | 1,249 | 3.921875 | 4 | [] | no_license | """ Problem statement:
https://leetcode.com/problems/linked-list-cycle/description/
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def hasCycle(self, head):
""" Returns True if there's a cy... | true |
b9f53a9eaf938ed0de6725fb0f5f546876fd6e71 | katecpp/PythonExercises | /18_cows_and_bulls.py | UTF-8 | 1,411 | 4.40625 | 4 | [] | no_license | #! python3
import random
def readIntegerAsString(length):
value = ""
accepted = False
while accepted == False:
value = input(">>>> ")
if value.isdigit() == False:
print("This is not a number!")
elif len(value) != length or len(set(value)) != length:
print("Nu... | true |
b57b0a21d6399eec1c340cb73be58f1b3730bbfe | kalilsn/toast-time | /retweet.py | UTF-8 | 1,542 | 2.59375 | 3 | [] | no_license | # toast time twitter bot
# Kalil Smith-Nuevelle
# 7/31/2015
import tweepy
import sys
import os
import re
import time
import secrets # Various api keys and other private information
from pushbullet import Pushbullet
# initialize api and authenticate via o-auth. returns tweepy API() object
def tweepy_setup():
# k... | true |
39c86dc7afdee2f3657f5b404b0c960871efbad9 | AdityaNarayan001/Learning_Python_Basics | /Python Basics/car_game.py | UTF-8 | 893 | 3.734375 | 4 | [] | no_license | # car game while loop aplication**************GREAT EXAMPLE****************
print("Type HELP to learn more")
started = False
while True:
user_cmd = input("Type here :- ")
comp_cmd = user_cmd.upper()
if comp_cmd == 'HELP':
print('START --> To start the car')
print('STOP --> To stop th... | true |
3f9f707e9b06c2ce9f984778a04375b052aead07 | Lee-Fingerhut/MachineLearningFinalProject-Mnist | /mlp.py | UTF-8 | 1,489 | 3.171875 | 3 | [] | no_license | import numpy as np
from sklearn.neural_network import MLPClassifier
def mlp_clf(
X_train: np.ndarray,
X_test: np.ndarray,
y_train: np.ndarray,
y_test: np.ndarray,
hidden_layer_sizes: tuple = (64, 64, 64),
activation: str = 'relu',
solver: str = 'adam',
alpha: float = 1e-4,
batch_s... | true |
6b3ccd380252c282ab7959fbbec3f90e4bd8e2bc | nelliesnoodles/StatsClass | /normal_dist.py | UTF-8 | 5,319 | 4.09375 | 4 | [
"MIT"
] | permissive | # Normal Distribution AKA Gaussian probability
import math
from scipy.stats import norm
#Note: z-score is the distance from the mean and it's standard deviation? *clarify*
def normal_deviation(a, b):
"""
What is the standard deviation of the data point distribution?
I need clarification on wher... | true |
8deb20f29c83d5d2b8b5d923eb68eb44cdd0f036 | tristan/project-euler-code | /0032.py | UTF-8 | 1,004 | 3.46875 | 3 | [] | no_license | def fact(k, n):
f = []
for j in range(1, n + 1):
f.append((k % j) + 1)
k /= j
return f[::-1]
def get_permutation(k,n):
tmp = map(lambda x: x+1, fact(k,n))
for i in range(len(tmp) - 1, -1, -1):
for j in range(i + 1, len(tmp)):
if (tmp[j] >= tmp[i]):
... | true |
59e5751cefda87b7fd3918ddf5eeac6f9f0d6820 | ccc013/DataStructe-Algorithms_Study | /Python/Leetcodes/string/jianzhi_offer_48_lengthOfLongestSubstring.py | UTF-8 | 1,706 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2021/1/25 7:34 上午
@Author : luocai
@file : jianzhi_offer_48_lengthOfLongestSubstring.py
@concat : 429546420@qq.com
@site :
@software: PyCharm Community Edition
@desc :
https://leetcode-cn.com/problems/zui-chang-bu-han-zhong-fu-zi-fu-de-zi-zi-fu-... | true |
ba203119995942cdd08c37db0a1598c938c8a029 | rohanmatt/Kae-Says | /main.py | UTF-8 | 774 | 3.125 | 3 | [] | no_license | from tkinter import *
import requests
def get_quotes():
response=requests.get(url="https://api.kanye.rest")
response.raise_for_status()
data=response.json()
quote=data["quote"]
canvas.itemconfig(quote_text,text=quote)
window=Tk()
window.title("Kae says")
window.config(padx=50,pady=50)
canvas =Can... | true |