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 |
|---|---|---|---|---|---|---|---|---|---|---|
a078e05addee51bf3a744639c7b7c91b2e1e7758 | nielsonnp/Exercicios_Sala | /Variaveis/questao_03.py | UTF-8 | 214 | 4.25 | 4 | [] | no_license | # 3. Faça um programa que converta metros para centímetros (1m=100cm).
metros = float(input('Digite a quantiade de metros: '))
resultado = (metros * 100)
print('{} m é = {:.2f} cm' .format(metros, resultado)) | true |
197960051eaf8c542d332707492cb4dab528dbbe | mai20-meet/y2s19-mainstream-python-review | /part2.py | UTF-8 | 656 | 3.671875 | 4 | [] | no_license | def encode(x, y):
if 1<y and y<250 and x>500 and x<1000:
return(x*y)
print("Invalid input: Outside range.")
return None
encode(2,2)
def is_prime(x,y):
while x%2==1:
x+=1
while y%2==1:
y+=1
if 1<y and y<250 and x>500 and x<1000:
return(x*y)
print("Invalid input: Outside range.")
return None
is_prime(3,3... | true |
8c7abe5784363cedfe5b1f2242ba75641ea753dd | hh28928/Movie_Review_Sentiment | /Movie_Review_Sentiments.py | UTF-8 | 5,416 | 3.5625 | 4 | [] | no_license | from nltk.corpus import stopwords
from nltk.stem import LancasterStemmer
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import TfidfVectorizer
import string
import re
#Loading test and train files into an array.
def load_file(filename):
line_list = []
fi... | true |
820e975aeea530915f349e2cd280e3665226ccf2 | kartikjagdale/PartTimePythonScripts | /Python PGM/worms.py | UTF-8 | 700 | 2.546875 | 3 | [] | no_license | import threading,random,sys,pygame
#Constants
NUM_WORMS = 5
FPS =15
CELL_SIZE = 20
CELLS_WIDE = 32
CELLS_HIGH =24
GRID = []
for x in range(CELLS_WIDE):
GRID.append([None]*CELLS_HIGH)
GRID_LOCK = threading.Lock()
WORMS_RUNNING = True
""" Constant Values for Different Colors """
WHITE = (255, 255, 255)
BLACK = (0,... | true |
3a6c75c7ea9c8877142f48e100f4dd1add30dff7 | startling/aesc | /aesc | UTF-8 | 2,520 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- Coding: utf-8 -*-
import os
import json
import argent
from twisted.internet import reactor
from twisted.web.wsgi import WSGIResource
from twisted.web.vhost import NameVirtualHost
from twisted.web.server import Site
from twisted.web.static import File
class NotIndexed(File):
"A subclas... | true |
68867fa5daa598c982bd74e7bb95b5b55882a85e | madisontg/Card-Games | /Card_class.py | UTF-8 | 809 | 3.921875 | 4 | [] | no_license | class Card(object):
suit_options = ["Hearts","Diamonds","Clubs","Spades"]
value_options = [2,3,4,5,6,7,8,9,10,"Jack","Queen","King","Ace"]
def __init__(self,int_value,suit):
self.suit = suit
self.value = int_value
def __str__(self):
card = [self.suit,self.value]
#s... | true |
add8a62594c6022d50bb86340bc2a10d4d2ee4bc | tengznaim/selenium-twitter-bot | /main.py | UTF-8 | 1,516 | 2.546875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import settings
import os
PATH = "C:\Program Files (x86)\chromedriver.exe"
... | true |
d9921c50076b9cc8769d54d3dd7c4772452e89db | nguyentuc/chatbot_v3_7_10 | /intent_detection/detection.py | UTF-8 | 5,013 | 2.53125 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
import os
import utils
from sklearn.externals import joblib
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegressionCV
from sklearn.svm import SVC
from sklearn.metrics import f1_score, confusion_matrix
from preprocessing import preprocess... | true |
a626dc0838427bfd978daed50420210bfc676a31 | jxulie/ExtractInfoboxFromWikiText | /test/foranything.py | UTF-8 | 1,685 | 3.125 | 3 | [] | no_license | #-*- coding:UTF-8 -*-
'''
Created on 2013-12-3
@author: Bo Xu <mailto:bolang1988@gmail.com>
@version: 1.0
@summary: test file
'''
# import os.path
#
# SCHEMA = "D:\\ASDF\\"
# if not os.path.exists(SCHEMA):
# os.makedirs(SCHEMA)
#
# TESTFILE = open(SCHEMA+"sdfd.txt",'w')
# TESTFILE.write("hello word")
# impo... | true |
e2c90828d2b3678fbed62a2b9bd5f5c2ceaa51aa | yuuee-www/Python-Learning | /Codes/coin_tester.py | UTF-8 | 370 | 3.28125 | 3 | [] | no_license | from coin import Coin
def main():
for i in range(99) :
coin = Coin()
print(coin, end=", ")
coin = Coin()
print(coin, end="." )
print("\n\nHeads so far: ", Coin.get_heads_so_far())
print("Tails so far: ", Coin.get_tails_so_far())
print("\nBye, Bye!\n")... | true |
b4bc17d3b28c30cbf316bac6c995db70165e98be | smohapatra1/scripting | /python/practice/start_again/2020/12292020/fibo_practice.py | UTF-8 | 180 | 3.109375 | 3 | [] | no_license | #Fibonancci Series
def main():
i = []
a = 1
b = 1
for x in range(10):
i.append(a)
a,b = b, a+b
print (i)
if __name__ == '__main__':
main() | true |
2bbbae56730a21c1b58c00f4a42239a6f6ed96c7 | zykgithub1/pythonClass | /pyCharm/Tank/tank06.py | UTF-8 | 4,439 | 3.453125 | 3 | [] | no_license | import pygame
"""
1,新增坦克speed属性,用来控制坦克移动快慢
2,事件处理:
(1)改变坦克方向
(2)修改坦克的位置(left,top)
"""
_display = pygame.display
class MainGame():
# 游戏主窗口
window = None
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 500
COLOR_BLACK = pygame.Color(0, 0, 0)
COLOR_RED = pygame.Color(255, 0, 0)
TANK_P1 = None
def ... | true |
01a8e8c0616ff6f30210007965fd3a5eeeda34bc | dtyj/subdomain_availability | /verify_url.py | UTF-8 | 1,166 | 2.78125 | 3 | [] | no_license | import sys
import requests
import re
from requests.exceptions import ConnectionError
print "Subdomain Availability Tool"
print "Author: Dennis T"
print "https://github.com/dtyj/subdomain_availability"
print ""
output_stream = sys.stdout
py_regex = "(http|https)://[\w\-]+(\.[\w\-]+)+\S*"
prepend_list = ["https://", "h... | true |
b2ec437bcc865eb4246a18ba7eab061f71b674da | zoopss/python_cr | /codes/code1.py | UTF-8 | 410 | 4 | 4 | [] | no_license | class Animal(object):
"""Makes cute animals."""
is_alive = True
health = "Good"
def __init__(self, name, age):
self.name = name
self.age = age
def description(self):
print self.name
print self.age
print self.is_alive
print self.health
hippo = Animal("Mary", 02)
sloth = Animal("Larry", 03)
o... | true |
7e89b199a8c06765b3738220fe4e7eba5aca1777 | structuralbioinformatics/SPServer | /collision_detection_program/SBI/external/DSSP/DSSPExe.py | UTF-8 | 5,101 | 2.671875 | 3 | [
"MIT"
] | permissive | '''
@file: DSSPExe.py
@author: Jaume Bonet
@mail: jaume.bonet@gmail.com
@date: 2013
@ [oliva's lab](http://sbi.imim.es)
@class: DSSPExe
'''
import os
import sys
from SBI.external import ExternalExe
from DSSP import DSSP
from SBI import SBIglobals as SBIg
from SBI.beans import File
class DS... | true |
155dddbc4d445f00011275a58d5281e3e8f4fa0d | alis70929/01_Lucky_Unicorn | /LU_Component3_PayoutCalc.py | UTF-8 | 741 | 3.5625 | 4 | [] | no_license | #Lucky Unicorn Component 3
#Generate a random token
import random
HOW_MUCH = 100
tokens =["horse","zebra","donkey","unicorn"]
unicorn_count = 0
zebhor_count = 0
donkey_count = 0
for item in range(0,HOW_MUCH):
chosen = random.choice(tokens)
if chosen == "unicorn":
unicorn_count += 1
elif chosen =... | true |
7bdbb5a012d4277b1ae9f55354a1bbc0826f19f4 | James-Do9/Python-Loop-Exercises | /exercises/12.6-Transformers/app.py | UTF-8 | 529 | 3.25 | 3 | [] | no_license | incomingAJAXData = [
{ "name": 'Mario', "lastName": 'Montes' },
{ "name": 'Joe', "lastName": 'Biden' },
{ "name": 'Bill', "lastName": 'Clon' },
{ "name": 'Hilary', "lastName": 'Mccafee' },
{ "name": 'Bobby', "lastName": 'Mc birth' }
]
#Your code go here:
first_name = []
last_name = []
for content in incomingAJAX... | true |
6ce88af825c307a68af5efe6df2963ec81bcae54 | YukiNGSM/PythonStudy | /Hello World.py | UTF-8 | 154 | 3.59375 | 4 | [] | no_license | print('Hello World')
print('こんにちは',end='')
print('はじめまして')
print('風\n林\n火\n山')
name = input('名前を入力:')
print(name) | true |
55f950e63f37ce01b27946cb667dd528b3874ac6 | darrenlee01/BreadBoardSchematicsProject | /BreadBoard/ResistorBread.py | UTF-8 | 1,184 | 2.875 | 3 | [] | no_license | #Sub class of DeviceBread, defines a new Breadboard Resistor
from DeviceBread import *
import sys # Following code from sys
#learned to use sys from Stack Overflow
#https://stackoverflow.com/questions/4383571/importing-files-from-different-folder
sys.path.append("Devices")
from Resistor import *
class Resist... | true |
3be83994d4fcd30f409b1e906072cc0b264ef442 | xiaodi-nie/docker-containerization-on-cloud9 | /app.py | UTF-8 | 1,251 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
from flask import Flask
from flask import jsonify
from pandas import pandas as pd
# If `entrypoint` is not defined in app.yaml, App Engine will look for an app
# called `app` in `main.py`.
app = Flask(__name__)
@app.route('/greeting')
def hello():
"""Return a friendly HTTP greeting."""
... | true |
f2d1267ee1cc8cd4d12a49e45af036cc14085e8a | istepanov/Udacity-CarND-P3-Behavioral-Cloning | /relative_paths.py | UTF-8 | 1,132 | 3.265625 | 3 | [] | no_license | # This is a helper script that converts absolute paths in the driving log file
# into paths relative to the driving log parent folder,
# so the training data can be easily moved between different machines.
import argparse
import csv
import os
def main():
parser = argparse.ArgumentParser()
parser.add_argument... | true |
16af2bdf7658b76c3a70daea6b083f6ed392ef6b | young508/pythonLearn | /main/高级语法/timetest.py | UTF-8 | 731 | 3.71875 | 4 | [] | no_license | import time
# 时间戳
# UTC事件
# 夏令时
# 时间元组
# 1. timezone:当前时区和UTC事件相差的秒数,没有夏令时
# 2. altzine 当前时区和UTC事件相差的秒数,有夏令时
# 3. daylight:测试当前是否是夏令时状态,0表示否
# 4.time事件戳
print(time.timezone)
# 5. localtime,得到当前时间的时间结构,可以通过点号获取属性内容
t=time.localtime()
# 格式化事件sactime
tt=time.asctime(t)
print(tt)
# 6 ctime:获取字符串化的当前时间
# 7 mktime 使用... | true |
0e24b16d58dc3c21c0bc6e81947c2be1ab02014f | severinkrystyan/CIS2348-Fall-2020 | /Homework 2/Coding Problem 2_Krystyan Severin_CIS2348.py | UTF-8 | 1,416 | 3.671875 | 4 | [] | no_license | """Name: Krystyan Severin
PSID: 1916594"""
months = {'January': '1', 'February': '2', 'March': '3', 'April': '4', 'May': '5', 'June': '6', 'July': '7',
'August': '8', 'September': '9', 'October': '10', 'November': '11', 'December': '12'}
parsed_date = []
with open("inputDates.txt", "r") as f:
file = f... | true |
7b5278d5dbd4bbde193e968d1e78d2eceb160b1a | EruDev/Python-Practice | /菜鸟教程Python3实例/21.py | UTF-8 | 195 | 3.90625 | 4 | [] | no_license | # Python ASCII码与字符相互转换
ch = input('请输入一个字符:')
n = int(input('请输入一个ASCII码:'))
print(ch + '的ASCII码', ord(ch))
print(n, '对应的字符为', chr(n)) | true |
e2a31ecb13597606e8f0477588b7023c48e43f10 | multinucliated/SkillateSolutions | /Skillate.py | UTF-8 | 1,671 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[6]:
"""
Getting the input from the user
first_Val will contain the actual strnig
and
second value will get the NER for the previous string
"""
first_Val = input("Enter your 1st string :")
second_Val = input("Enter your 2nd string :")
"""
Replacing the characters B- & I... | true |
60538725e9244fe519878c2c5b47dd86ed6cba5a | Cerelise/Project_Python | /baojie/test.py | UTF-8 | 213 | 2.6875 | 3 | [] | no_license | l = list(range(5))
l1 = list(range(6,11))
l5 = []
l4 = zip(l,l1)
for i,j in l4:
l5.append([i,j])
print(l5[i])
l2 = []
for i in range(len(l)):
l3 = tuple([l[i],l1[i]])
l2.append(l3)
print(l2)
| true |
3920a40755ff75bca79220023054288c6a83494e | shubham2704/competetive_coding | /codechef/cardGame.py | UTF-8 | 646 | 3.140625 | 3 | [] | permissive | for _ in range(int(input())):
n = int(input())
a,b = [],[]
chef,morty = 0,0
for _ in range(n):
c,m = map(int,input().split())
def getSum(num):
s = 0
while num>0:
s += int(num%10)
num = int(num/10)
return s
a.app... | true |
658b8d988cd5f5e729768c43e3ade2c1533a719c | hyeal35/kit-midexam | /app.py | UTF-8 | 1,362 | 3.3125 | 3 | [] | no_license | from flask import Flask,render_template
app = Flask(__name__)
@app.route('/')
def hello():
return render_template('index.html')
@app.route('/ride')
def ride():
return render_template('ride.html')
@app.route('/ride/<int:num>')
def ride_num(num):
if num ==1:
return '''
<script>alert('돈이 많이 ... | true |
9050aa302ae5e6a82b57f6ccc6a1b7ae00c62cad | faheemPakistani/ml-face-verification | /app.py | UTF-8 | 3,022 | 2.515625 | 3 | [] | no_license | from flask import Flask, render_template, request
import numpy as np
import cv2
import keras
from keras.models import model_from_json
from keras.models import load_model
import tensorflow as tf
keras.backend.set_image_data_format('channels_first')
# ===============
app = Flask(__name__)
def triplet_lo... | true |
c33a3403b87f422da7f7257cd6bf32bdc3cbf0e7 | Archibald-300/Lab-4 | /2.py | UTF-8 | 6,850 | 2.703125 | 3 | [] | no_license | import pygame, sys
import numpy as np
from pygame.draw import *
pygame.init()
FPS = 30
screen = pygame.display.set_mode((550, 707))
surface = pygame.Surface((320, 240), pygame.SRCALPHA, 32)
surface.convert_alpha()
surf1 = pygame.Surface((500, 500), pygame.SRCALPHA, 32)
surf2 = pygame.Surface((500, 500), py... | true |
4741a46a99d4fc96a6151c33ec93a4dafaa218ee | HyominJeong/TAx4_Analysis | /comp_histo.py | UTF-8 | 2,964 | 2.8125 | 3 | [] | no_license | import numpy
import matplotlib.pyplot as plt
import os, sys
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
infile = open(sys.argv[1])
infile2 = open(sys.argv[2])
energies = []
energies2 = []
thetas = []
thetas2 = []
# Data from input file 1
for line in infile:
if len(l... | true |
3880a97fcd9d60a205eb4b43c0ce21abca38bbbc | realfan-1s/LeetCode_Easy | /GetMinimumDifference.py | UTF-8 | 920 | 3.828125 | 4 | [] | no_license | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# 中序遍历,特点:二叉搜索树中序遍历得到的值序列是递增有序的
# 不管是先序中序还是后序,查找流程都是从上到下,先左后右。只是输出的时机不同。
class Solution:
def InorderTraversal(self, root: TreeNode):
# pre记录的是前驱节点
self.pre = -1
# ans记录的是差值的最小... | true |
fb6f6979015c90ec35b7770cabd7af8d9f11032b | thwowu/musicwhipster | /render_example.py | UTF-8 | 758 | 3.25 | 3 | [] | no_license | import time
from flask import Flask, Response, render_template_string
from flask import stream_with_context
app = Flask(__name__)
@app.route("/")
def server_1():
def generate_output():
age = 0
template = '<p>{{ name }} is {{ age }} seconds old.</p>'
context = {'name': 'bob'}
while ... | true |
43de02eea270fd41ce9be430f63bab1fec6bcca9 | aravindanath/TeslaEV | /PycharmProjects/PythonSeleniumAutoAugSep/ExceptionHandling/ExampleException.py | UTF-8 | 180 | 3.453125 | 3 | [] | no_license |
print("Good morning")
try:
i = 10
j = 0
print(i / j)
except ZeroDivisionError:
print("Num cant div by zero")
finally:
print("Closing file")
print("Bye") | true |
e08b4c9874578defa6bc48d46cbc9ccb80c8075f | wagolemusa/python_Exercises- | /dict2.py | UTF-8 | 93 | 2.921875 | 3 | [] | no_license | d1 = {'a' : 100, 'b' : 200}
d2 = {'x' : 300, 'y' : 200}
d = d1.copy()
d.update(d2)
print(d)
| true |
621aa0a6f2aab101cd143ca1acfeffd9c22600c5 | brucembakara/smsArtificialIntelligence | /processing/functions/salutations.py | UTF-8 | 490 | 3.125 | 3 | [] | no_license | import random
class Salutations():
def run(salutations,data):
data['greetings']=Salutations.process_salutes(salutations)
def process_salutes(salutations):
salutation_one="Hello human, how can i help you"
salutation_two="Hi there how can i be of service"
salutation_three="Thank you for using our service, how c... | true |
d0cab295207054eabe724301cc1bba124b2ff874 | Elik0010/hachshara | /sec3/morphology.py | UTF-8 | 2,603 | 2.890625 | 3 | [] | no_license | import numpy as np
import cv2
def erosion_binary(space, struc):
mid = struc.shape[0] // 2
rows, cols = space.shape
#pad the space for scanning purposes
space = np.pad(space, mid, 'constant', constant_values=0)
res = np.zeros(space.shape)
struc_l, struc_h = struc.shape
for i in range(rows):... | true |
f0d8e1a00f2f8d4a0c725fcf1b8f9d8f14ff7e57 | Coola4kov/algorothms | /lesson3/array_indexes.py | UTF-8 | 453 | 3.46875 | 3 | [] | no_license | import random
n = 30
rand_array = [random.randrange(1, 1000) for _ in range(n)]
even_ind_array = []
for i, number in enumerate(rand_array):
if not number % 2:
even_ind_array.append(i)
print('В массиве {}\nпо следующим индексам '
'{} стоят чётные числа'.format(rand_array, even_ind_array))
# n = 24
# r... | true |
dc5aeb47453ccedcc4c942d43eb99edd2b5e0700 | kirroi-senko123/ML-Project | /src/CNN.py | UTF-8 | 2,476 | 2.703125 | 3 | [] | no_license | from constants import BATCH_SIZE, EPOCHS, IMG_COLS, IMG_ROWS, INPUT_SHAPE, NUM_CLASSES
from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten
from keras.models import load_model, Sequential
from keras.optimizers import Adam
import cv2
import datetime
import numpy as np
class CNN:
def __init__(sel... | true |
97935007e2c5ab7984071464eb08660f78bc674f | Rahul-CS19/Python | /Assignment1 Day2/Sum.py | UTF-8 | 366 | 4.125 | 4 | [] | no_license | # Python program to calculate the sim of n Natural Numbers
# take input from user
num = int(input("Enter the value of n: "))
hold = num
sum = 0
if num < 0:
print("Enter a whole positive number!")
else:
while num > 0:
sum = sum + num
num = num - 1
# displaying output
print("Sum... | true |
fef3eaa14bdc620f2eea74bfeabee3c0453f7e51 | Artem1591/forfun | /sql_select.py | UTF-8 | 1,276 | 2.984375 | 3 | [] | no_license | import mysql.connector
from mysql.connector import errorcode
query_dict = {
"select_all" : "SELECT * FROM table1",
"select_by_id" : "SELECT * FROM table1 WHERE idtable1 = {0}",
"select_by_name" : "SELECT name FROM table1 WHERE name LIKE '{0}'"
}
def commonSelect (query):
returnvalue = None
try:
... | true |
a15ce26e23abcb4a600497da71c379a9e8e0fad5 | tomkooij/AdventOfCode | /aoc2016/day3.py | UTF-8 | 266 | 3.546875 | 4 | [] | no_license | def check_triangle(x, y, z):
return x + y > z and x + z > y and y + z > x
with open('input/input3.txt') as f:
n = 0
for line in f.readlines():
x, y, z = map(int, line.split())
if check_triangle(x, y, z):
n += 1
print(n)
| true |
e811b3eb36e32ca591edb921f44fcfea7dc3f8fc | VitalR/TeleBot | /scrap/price_euro.py | UTF-8 | 615 | 2.59375 | 3 | [] | no_license | import logging
import requests
from bs4 import BeautifulSoup as BS
from echo_bot.config import URL_EURO
logger = logging.getLogger('telebot.scraping_euro')
def get_exchange_rate_euro():
logger.debug('Scraping exchange rate of EURO with BeautifulSoup HTML parser.')
page = requests.get(URL_EURO)
soup = BS(... | true |
f77a917d014fa9d078bc10d2e9b9fb36695b2a38 | katyamineeva/speech-datasets-toolkit | /filter.py | UTF-8 | 2,499 | 2.859375 | 3 | [] | no_license | import os
import soundfile
import config as cfg
from utils import load_json, dump_json, get_wavs_duration, count_filelist_duration
def filter_filelist(filelist_json, wavs_duration, filtered_filelist_json=None, print_long_wavnames=False):
print("\n" + "=" * 10 + " Removing too long and too short wavnames from fil... | true |
dfb1042f05076516c3813df6858ef226ddba08ad | Zhurp2020/PAT-BASIC-python | /1001 害死人不偿命的(3n+1)猜想/1001.py | UTF-8 | 179 | 3.296875 | 3 | [] | no_license | n = int(input())
count = 0
def calc(a):
if a % 2 == 1 :
return (3 * a + 1) / 2
else :
return a/2
while n != 1 :
n = calc(n)
count += + 1
print (count)
| true |
3fb8dae05b3c6e109c8af9ac5d8aa173455d5631 | andrensegura/projects | /python/chat/client.py_backup | UTF-8 | 756 | 3.078125 | 3 | [] | no_license | #! /usr/bin/python # This is client.py file
import socket # Import socket module
import thread
print 'CONNECTING TO SERVER.'
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12346 # Reserve a port for your service.
... | true |
8f93e1ff0ebd16ff0f370cd1309d958caca16327 | quanyou/Note_Python | /Python简介/python简介.py | UTF-8 | 1,966 | 3.890625 | 4 | [] | no_license | # coding=utf-8
"""
Python 是“龟叔”Guido van Rossum
Python就为我们提供了非常完善的基础代码库,覆盖了网络、文件、GUI、数据库、文本等大量内容,被形象地称作“内置电池(batteries included)”。用Python开发,许多功能不必从零编写,直接使用现成的即可。
除了内置的库外,Python还有大量的第三方库,也就是别人开发的,供你直接使用的东西。当然,如果你开发的代码通过很好的封装,也可以作为第三方库给别人使用。
许多大型网站就是用Python开发的,例如YouTube、Instagram,还有国内的豆瓣。很多大公司,包括Google、Yahoo等,甚至NA... | true |
cd7cefd2c04aebeb040c1bf99b7e260a077288c3 | broesler/endgame-research | /src/dev_setups/flask_tutorial/flaskexample/views.py | UTF-8 | 3,875 | 2.84375 | 3 | [] | no_license | #!/Users/bernardroesler/anaconda3/envs/insight/bin/python3
#==============================================================================
# File: views.py
# Created: 06/18/2018, 20:42
# Author: Bernie Roesler
#
"""
Description: View #1
"""
#=====================================================================... | true |
26dbb9f923a7a4e8ef8af4b9659bf6082c33e1d6 | cooper-plath/Practicals | /Prac_02/randoms.py | UTF-8 | 185 | 3.3125 | 3 | [] | no_license | import random
print(random.randint(5, 20)) # line 1
print(random.randrange(3, 10, 2)) # line 2
print(random.uniform(2.5, 5.5)) # line 3
# 1. 6 and 19
# 2. 5 and 8
# 3. 2.51 and 5.49 | true |
d9bf9c04b831daf28c0723e73998a730b3891b81 | sakusss/leetcode | /39. Combination Sum.py | UTF-8 | 1,021 | 3.125 | 3 | [] | no_license | class Solution:
def dfs(self,candidates,target,start,temp):
if target == 0:
Solution.res.append(temp)
else:
for i in range(start,len(candidates)):
if target >= candidates[i]:
... | true |
badd855125eda362917ebe3b0a0ffb15ed855024 | Roychenlei/Leetcode | /array/canPlaceFlowers.py | UTF-8 | 991 | 3.109375 | 3 | [] | no_license | class Solution(object):
def canPlaceFlower(self, flowerbed, n):
"""
:type flowerbed: List[int]
:type n: int
:rtype: bool
"""
for i,c in enumerate(flowerbed):
if (not c and (i==0 or not flowerbed[i-1])) and (i==len(flowerbed)-1 or not flowerbed[i+1]):
... | true |
ef0f0be04916304464fa17aaa8120c1591af4241 | batmit/Introducao-a-Python | /exceções/#1.py | UTF-8 | 704 | 4.03125 | 4 | [] | no_license | # agora veremos exeções
# são situações não previstas no código
# IndexError é um tipo de exeção, quando o valor da lista é menor que o procurado
# o ValueError é um erro que acontece quando trocamos int for str e assim por diante
# veja o exemplo:
nomes = ['Ana', 'Carlos', 'Maria']
for tentativa in range(3):
try: ... | true |
f010c82d1759a5d3d4828dbf57421bde081e593c | SemenovSY/Solutions | /LettersCombinations.py | UTF-8 | 474 | 3.53125 | 4 | [] | no_license | def letterCombinations(digits):
letters = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs',
'8': 'tuv', '9': 'wxyz'}
if digits:
arr = ['']
for digit in digits:
string = []
for val in arr:
... | true |
7c7e77d7b67f675218ea3872a99cbc5bf269bd5d | jrmaciel-zx/design_patterns | /mvc/web/app.py | UTF-8 | 1,987 | 2.578125 | 3 | [] | no_license | import tornado
import tornado.web
import tornado.ioloop
import tornado.httpserver
import sqlite3
def _execute(query):
connection = sqlite3.connect('dbtask.db')
cursor = connection.cursor()
cursor.execute(query)
connection.commit()
resultset = cursor.fetchall()
connection.close()
return resu... | true |
182a35d1b9b483d223337b261bf7367b0247c090 | SiddhiPevekar/Python-Programming-MHM | /prog24.py | UTF-8 | 293 | 3.984375 | 4 | [] | no_license | #leap year(number divisible by 4 and 400 is leap year and year divisible by 4 and 100 is not a leap year)
year=int(input("enter any leap:\n"))
if(year%4==0 and year%100!=0 or year%400==0):
print("{} is a leap year".format(year))
else:
print("{} is not a leap year".format(year))
| true |
382c50ad0e5c149f6ac47552d8bc360ddac70cc6 | gtcooke94/advent-of-code | /2018/3/soln.py | UTF-8 | 2,756 | 2.8125 | 3 | [] | no_license | from aocd.models import Puzzle
import inputs
import sys
from collections import defaultdict
import personal_aoc_helpers as pah
def soln_a(data):
data = parse(data)
grid = defaultdict(int)
for left_edge, top_edge, width, height in data:
widths = range(left_edge, left_edge + width)
heights =... | true |
a3496da0e5986d4fa4cbe0a227078b834c490e63 | BramWarrick/Movie_Database | /entertainment_center.py | UTF-8 | 2,110 | 3.546875 | 4 | [] | no_license | # Lesson 3.4: Make Classes
# Mini-Project: Movies Website
# In this file, you will define instances of the class Movie defined
# in media.py. After you follow along with Kunal, make some instances
# of your own!
# After you run this code, open the file fresh_tomatoes.html to
# see your webpage!
import media
import f... | true |
d36f532b5737a38034072082637d1dc5db574a3b | Kaliszando/chase-simulation | /sheep.py | UTF-8 | 1,267 | 3.40625 | 3 | [] | no_license | import random
import functions
import logging
from animal import Animal
from directions import Directions
class Sheep(Animal):
def __init__(self, sheep_move_dist, sheep_id, init_pos_limit):
self._pos = [
random.uniform(-init_pos_limit, init_pos_limit),
random.uniform(-init_pos_li... | true |
666c6c1b6a4572ea523fcefa2db9bc36d3fc33a2 | TungPhung/AdventOfCode2019 | /Day3/daythreept2.py | UTF-8 | 4,519 | 3.5625 | 4 | [] | no_license | # Day Three of Advent of Code
# Author - Tung Phung
# Date 12/3/2019
# Imports
import os, sys
# Read in input
List = open("daythreeinput.txt").readlines()
path_one = List[0].strip().split(",")
path_two = List[1].strip().split(",")
# Returns set of all unique points a single cable goes through in x, y coordinate plan... | true |
24e274ee6424559a901316cc5b9630ddcb4034d9 | jareturing/tfrecord | /tfrecord/writer.py | UTF-8 | 2,698 | 2.875 | 3 | [
"MIT"
] | permissive | """Writer utils."""
import io
import struct
import typing
import numpy as np
try:
import crc32c
except ImportError:
crc32c = None
from tfrecord import example_pb2
class TFRecordWriter:
"""Opens a TFRecord file for writing.
Params:
-------
data_path: str
Path to the tfrecord file.
... | true |
bc0e6624f51015a829d5da3bbcd998a7c25f9255 | Alexander-Andrade/opengl_sun_system | /Sprite.py | UTF-8 | 926 | 3.359375 | 3 | [] | no_license | from Texture import Texture
from Shapes.Point import Point
from Shapes.Rect import Rect
class Sprite:
def __init__(self, image_name, n_rows, n_cols):
self.texture = Texture(image_name)
self.n_rows = n_rows
self.n_cols = n_cols
self.width = 1/self.n_cols
self.height = 1/sel... | true |
d090811c713ff9170e33713d784a042530980d02 | np-overflow/ycep | /prg/find-the-flag/solution/solution.py | UTF-8 | 94 | 2.734375 | 3 | [] | no_license | inp = open('../participants/problem.txt', 'r')
mess = inp.read()
print(mess.replace("!", "")) | true |
43f4d97835c87a6b095ed7eb3e5db1d3d763a8c9 | ngzhaoming/Kattis | /Difficulty 3.3/Candy Division/CandyDivision.py | UTF-8 | 411 | 3.390625 | 3 | [] | no_license | n = int(input())
temp = n
factors = []
factors.append(0)
factors.append(n - 1)
i = 2
while (i < temp):
if (n % i == 0):
val = (i - 1)
val1 = (n / i - 1)
if (val != val1):
factors.append(val1)
factors.append(val)
temp = (n / i)
i += 1
factors.sort()
result =... | true |
93f5f8df018ec82b0d7774262a89f48276a76091 | DataScientist1000/100_Python_Exercise | /Basic Execise/14. Removing_Duplicates.py | UTF-8 | 1,682 | 4.53125 | 5 | [] | no_license | # Question: Complete the script so that it removes duplicate items from list a.
# a = ["1", 1, "1", 2]
# Expected output: ['1', 2, 1]
# ------------
from collections import OrderedDict
a = ["1", 1, "1", 2]
print(list(set(a)))
# Hint 1: Sets are datatypes where duplicates are not allowed.
# Hint 2: You can use a set ... | true |
b3c2b307ba9e2ea41befb8f690a6890559b35d99 | tej-prash/GeneExpression | /symnet.py | UTF-8 | 2,679 | 2.9375 | 3 | [
"MIT"
] | permissive | import argparse
from symnet.numeric import NumericModel
from symnet.image import ResNet
from symnet.regression import RegressionModel
parser = argparse.ArgumentParser(
description='Train a deep learning model on your dataset.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('--ta... | true |
598d190443d174747e88b6653d564425218bb1a3 | AllanXiang/news-media-promoted | /cluster.py | UTF-8 | 2,751 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from gensim import corpora, models, similarities
def news_cluster(news, threshold, now):
docs, scores = zip(*news)
clusters = train(docs, threshold)
selected = []
len_clusters = len(clusters)
# fp = open('log/'+ now +'/news_cluster', 'w')
for i in range(len_clusters... | true |
ddea3b84b1e2765dfae6f57c9bd6c10b3d7407b1 | CoderCarrot/Practice | /interview_cake/breakfast_drone.py | UTF-8 | 3,358 | 3.5625 | 4 | [] | no_license |
# Your company delivers breakfast via autonomous quadcopter drones. And something mysterious has happened.
# Each breakfast delivery is assigned a unique ID, a positive integer.
# When one of the company's 100 drones takes off with a delivery, the delivery's ID is added to a list, delivery_id_confirmations.
# ... | true |
3e79bbbb1ff58899b501da1f878474764e466f60 | AK-1121/code_extraction | /python/python_25363.py | UTF-8 | 157 | 3.078125 | 3 | [] | no_license | # python - read file lines and place it in array
with open('screennames.txt') as namefile:
screennames = ','.join(map(str.rstrip, namefile.readlines()))
| true |
3ae03e7eaa736681719e6e4ddb37b846dc813a9a | afguerrerogu/Computational_physics | /Forier_Spectrum_of_Signals.py | UTF-8 | 1,306 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 18 10:46:46 2021
@author: andres
"""
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
sns.set()
c1 = 1j
N = 30
# Funcion
a = 1;
n = int(N/2)
def function(x):
return np.exp(a*x*c1/N)
#Definimos los nodos
x_j ... | true |
69dd6970a4981d41f722646fd49635278e96e61b | Senniinn/Robot | /Reine.py | UTF-8 | 1,705 | 2.84375 | 3 | [] | no_license | from Pion import Pion
class Reine(Pion):
def __init__(self, x, y, color, canvas):
Reine.__init__(self, x, y, color, canvas)
self.oval = self.canvas.create_oval(self.x + 5, self.y + 5, self.x + 55, self.y + 55, fill=self.color)
# def possibilities(self, pionsBlancs, pionsNoirs, pion):
# ... | true |
1f3c6a078f24f9c209542352838951334e027f92 | ShrublandsAssociates/scratch | /basics/beta.py | UTF-8 | 1,199 | 2.8125 | 3 | [] | no_license | # A beta of 1 indicates that the security's price moves with the market. A beta
# of less than 1 means that the security is theoretically less volatile than the
# market. A beta of greater than 1 indicates that the security's price is
# theoretically more volatile than the market. For example, if a stock's beta is
# 1.... | true |
e78a47f7d270ddb05009b4d036c03329c484415e | zhangquanliang/python | /flask项目/demo2/mysql_增删改查.py | UTF-8 | 1,210 | 2.78125 | 3 | [] | no_license | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import config
app = Flask(__name__)
app.config.from_object(config)
db = SQLAlchemy(app)
class User(db.Model):
__table_name__ = 'User'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_name = db.Column(db.String(255), nullab... | true |
13a551f596eb024b004e347e0c9072ca15a44bf5 | Jamppa93/budjetointityokaly | /python/DBMS.py | UTF-8 | 643 | 2.5625 | 3 | [] | no_license | import sqlite3
import sys
import pathlib # https://docs.python.org/3/library/pathlib.html#module-pathlib
class DBMS():
Connections = None
path = pathlib.Path(pathlib.Path(__file__).parents[1].absolute(),'dbFile/harkka.sql')
#def __init__(self):
def connectToDatabase(self):
try:
... | true |
19fc97f3e0f202b155b2b2d65d95ed7882a8e74a | elderdk/youtube_creator | /config/scraper/subtitles.py | UTF-8 | 4,471 | 2.578125 | 3 | [] | no_license | import io
import textwrap
from pathlib import Path
import requests
from django.core.files.temp import NamedTemporaryFile
from PIL import Image, ImageDraw, ImageFont
from .zipper import get_zip
BASE_DIR = Path(__file__).parent
FONT_BASE = Path(__file__).parent.joinpath('library/fonts/')
FONT_FILE = FONT_B... | true |
701c93759cc15bb4018041643aeed4aa43b2c118 | jag426/euler | /018.py | UTF-8 | 435 | 3.0625 | 3 | [] | no_license | lines = open('p018.txt').readlines()
rows = list(map(lambda line: list(map(int, line.split())), lines))
# iterate over the rows in reverse order, starting with the second to last
for i in range(len(rows)-2, -1, -1):
row = rows[i]
# replace each member of the row with the value of the max path from there
# ... | true |
4e8386dd43a4423ea431fd00365638b7acfce47b | lvah/201903python | /day34/01_Flask第一个网站.py | UTF-8 | 697 | 2.90625 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
# 实现首页: http://172.25.254.197:9999/
@app.route('/') # 路由
def index(): # 视图函数, 一定不能重复;
return '这是网站的首页'
@app.route('/login/')
def login():
return "正在登录......"
@app.route('/logout/')
def logout():
return "正在登出......"
if __name__ == '__main__':
# 运... | true |
faf75a19920417699a4a5cc605e4e31ee905d701 | matthewnay/Research | /correlation_by_clase.py | UTF-8 | 2,912 | 2.625 | 3 | [] | no_license | import csv
import pandas as pd
data = {}
with open('/nfs/sloanlab001/projects/dapa2_proj/Tabasco/Data/October/historical_prices.csv', newline='') as file:
prices = csv.DictReader(file)
for row in prices:
data[row['sku']] = ([], [], [])
with open('/nfs/sloanlab001/projects/dapa2_proj/Tabasco... | true |
2952dd4bd130eb18f260654e49eff7b69f12b723 | parvathys0311/mockWiz | /templates/test.py | UTF-8 | 138 | 2.640625 | 3 | [] | no_license | from uuid import uuid4
def f():
d = uuid4()
str = d.hex
WORD = "C" + str[0:16]
return WORD
default = f()
print(default) | true |
e283bd989962e0e5934fd198d30ec8460703e0cc | alex-epp/deep-learning | /8.5/utils.py | UTF-8 | 1,013 | 3.359375 | 3 | [] | no_license | import numpy.matlib as np
def generate_data(xmin, xmax, npoints, estddev, esize, f):
'''Generates random (x, y) ordered pairs that approximately follow a given
function.
Arguments:
xmin -- Minimum generated x value
xmax -- Maximum generated x value
npoints -- Number of points to return
est... | true |
e5dc809e15db9fc204e5e0b7040cb9192c1f65a2 | Bukurov/all | /Монетки.py | UTF-8 | 111 | 3.15625 | 3 | [] | no_license | k = int(input())
d = 0
for i in range(k):
f = int(input())
if f == 0:
d += 1
print(min(d,k-d))
| true |
aa9e1de5fc347cd3b5f8cd2efc9b263719785842 | Guruscode/getting-started-with-python | /oop/class.py | UTF-8 | 9,674 | 4.40625 | 4 | [] | no_license | # python supports OOP paradigm
# we use `class` keyword to create a class
# we can use `pass` keyword to define an empty class
class MyClassA:
"""
Optional docstring explaining MyClassA
"""
pass
print( 'MyClassA.__doc__ => ', MyClassA.__doc__ )
# in python class, we have attributes and methods
# att... | true |
7ffca7e56d2654c63978c7bd828eede47928b280 | silviomm/tep | /lessons/tuane_shuffle.py | UTF-8 | 438 | 3.609375 | 4 | [
"MIT"
] | permissive | from random import randint
def sortear(n, k):
tabela = {}
sorteados = []
for i in range(k):
pos = randint(1, n-i)
sorteado = tabela.get(pos, pos)
sorteados.append(sorteado)
elemento_da_ultima_pos = tabela.get(n-i, n-i)
tabela[pos] = elemento_da_ultima_pos # "swap"
... | true |
2bb1792d9902d46570f898275df21213a6000215 | allenmrazek/super-mario | /entities/characters/behaviors/smart_enemy_ground_movement.py | UTF-8 | 1,316 | 2.875 | 3 | [] | no_license | import math
from .enemy_ground_movement import EnemyGroundMovement
from entities.collider import Collider
import constants
from util import make_vector
class SmartEnemyGroundMovement(EnemyGroundMovement):
"""Patrols for a certain range and doesn't suicide off of ledges"""
def __init__(self, entity, collider_m... | true |
e55f3c014af548d82c0075921eaae7ceba9ae2a7 | kritika-code/personal-assistant | /assist.py | UTF-8 | 8,328 | 2.90625 | 3 | [] | no_license | import pyttsx3
import datetime
import speech_recognition as sr
import time
import pyjokes
import subprocess
import json
import requests
import os
import wikipedia
import webbrowser
import cv2
import wolframalpha
import winshell
engine = pyttsx3.init()
voices=engine.getProperty('voices')
engine.setProp... | true |
cb6e0b36ffe570bc4caf426f85a6935861efdd6c | ppiazi/deviation_report_generator | /deviation_test.py | UTF-8 | 484 | 2.8125 | 3 | [] | no_license | import unittest
import deviation_db
class deviation_DeviationComment(unittest.TestCase):
def test_comment(self):
test_comment = " /* DR#MISRA C:2012#Rule 10.6#A1#필요한 내용을 적습니다. */ "
c = deviation_db.DeviationComment(test_comment)
self.assertEqual("MISRA C:2012", c.getStandard())
... | true |
cfbf225547242e583e3e844b3d7ff9d417544378 | Ajoo/lbd-neurips2021 | /ROBO/dynamics.py | UTF-8 | 5,377 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from numpy.linalg import svd
import jax.numpy as jnp
from jax import jit
g = 9.81
def remove_nullspace(u, num_dims):
'''
Finds an orthogonal basis of dimension num_dims for the input by keeping
only the first num_dims vector of a singular value decomposition.
... | true |
3208c193f45e7d86e64273f33d0b1fbebd97fee1 | PEQUI-MEC/PY-VSSS-INF | /test/testControl/testZeus.py | UTF-8 | 2,734 | 2.78125 | 3 | [] | no_license | from control.zeus import Zeus
from math import pi
import unittest
class TestZeus(unittest.TestCase):
zeus = Zeus()
zeus = zeus.setup(3)
info = [
{
'command': 'goTo',
'data': {
'pose': {
'position': (644, 1199), 'orientation': 0.5
... | true |
4241bad4c8833bf1e02fa3ca8bab1d3e55c1c323 | Nazdorovye/VeAPython | /2020_lecture_07_tasks/task04.py | UTF-8 | 1,394 | 4.28125 | 4 | [] | no_license | # Enter a four-digit number with at least two different digits in the variable.
# The program must arrange the digits of this number in ascending and descending order. Then
# subtract the smallest from the largest number. Then repeat the previous steps until a fixed
# number is reached: 6174.
# By performing ... | true |
8b1a1698db92b80af4153e7b6adb287f0c3c40a2 | 353388947/seed | /seed/lib/mcm/utils.py | UTF-8 | 717 | 2.921875 | 3 | [] | no_license | # !/usr/bin/env python
# encoding: utf-8
"""
:copyright (c) 2014 - 2018, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. # NOQA
:author
"""
from itertools ... | true |
c499be963254a29a1a3bf4cfcda396ecae8fcdcf | Naman-12911/HackerRank-30-days-code | /8 day of HackerRank.py | UTF-8 | 1,549 | 3.75 | 4 | [] | no_license | #Given names and phone numbers, assemble a phone book that maps friends'
#names to their respective phone numbers. You will then be given an
#unknown number of names to query your phone book for.
#For each queried, print the associated entry from your phone book on a new line
#in the form name=phoneNumber; if an ... | true |
c207c51dbe1bf9c7ce0ef6b87325aca5c3bf258e | dsol0115/safeproject | /map.py | UTF-8 | 2,232 | 2.796875 | 3 | [] | no_license | import folium
import csv
import json
# Create map object
m = folium.Map(location=[37.533157, 127.075434], zoom_start=16)
data = open('gis_data.csv', 'r', encoding='utf-8')
rdr = csv.reader(data)
next(rdr)
for line in rdr:
location_tmp_list = []
location_tmp_list.append(line)
folium.Ci... | true |
4be7aab4f99a0eb711f139eab9d0c7c718fa674a | ashok-arora/HashCode | /basicGreedy.py | UTF-8 | 1,320 | 3.125 | 3 | [
"MIT"
] | permissive | def car_start(start, cars, time, class_adj_list):
cars_data = []
for car in range(cars):
cars_data.append([start])
current_pos = start
time_left = time
# next_pos = []
while time_left > 0:
next_pos = findGreedyNode(current_pos, time_left, class_adj_list) #... | true |
e8377b2f0fd9d306786914f17a12a2d58ea138e1 | omuen/Muen-In-Python | /history/Muen-20200425.py | UTF-8 | 56 | 3.25 | 3 | [] | no_license | p=3
for b in range(50):
print(p,p*2,p*2+1)
p=p*2+1
| true |
3a35b663fa2f03c25dd6de8cba2f9f80cc58e0c4 | halleydeme/py_unit_four | /bonus.py | UTF-8 | 310 | 3.75 | 4 | [] | no_license | def bonus(l,s):
if l > 5:
b =1.05*s
if l <= 5:
b = s
return b
def main():
l = int(input("How long have you been working at your current company?"))
s = int(input("What is your salary?"))
print("Your total salary is :",bonus(l,s))
if __name__ == '__main__':
main()
| true |
39983db71ebc9d9e747c8b1c852aece0e1c521af | chao-tan/CMWNet | /datasets/__init__.py | UTF-8 | 2,050 | 3 | 3 | [
"MIT"
] | permissive | import importlib
import torch.utils.data
from datasets.cdataset import cdataset
def find_dataset_using_name(dataset_name):
dataset_filename = "datasets." + dataset_name + "_dataset"
datasetlib = importlib.import_module(dataset_filename)
dataset = None
target_dataset_name = dataset_name.replace('_', '... | true |
f246b3f7363d6f665522509f61585253b2169816 | epedzich/python4beginners_warsztaty | /warsztat_1/zadania_domowe_1/zadanie1.py | UTF-8 | 545 | 3.71875 | 4 | [] | no_license | # Stwórz listę liczb od 0 do 999.
# Liczby podzielne przez 3 zastąp słowem 'trzy'.
# Liczby podzielne przez 5 zastąp słowem 'pięć'.
# Liczby podzielne jednocześnie przez 3 i 5 zastąp słowem 'trzypięć'.
# Wynikową listę przypisz zmiennej result.
lista = list(range(1000))
result = lista
for i in lista:
if i == 0:
... | true |
867ecae8578c87bae4f2a54658a850147b7ec962 | ykmc/contest | /atcoder-old/2016/1218_abc050/d.py | UTF-8 | 2,153 | 3.03125 | 3 | [] | no_license | # PyPy3 (2.4.0)
import sys
input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# ---------------------------------------------------... | true |
39c1ff36e62e7af35ea3e2bf6956457d4d149f21 | LucyJimenez/uncertainty-toolbox | /uncertainty_toolbox/viz.py | UTF-8 | 14,705 | 2.546875 | 3 | [
"MIT"
] | permissive | """
Visualizations for predictive uncertainties and metrics.
"""
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import (
mean_absolute_error,
mean_squared_error,
r2_score,
median_absolute_error,
)
from shapely.geometry import Polygo... | true |
10e2485b460ddee11b8e26e394310ad0962819a9 | wykdavid/Semester-Project-for-CIS667-AI | /game.py | UTF-8 | 3,040 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 15:58:14 2019
@author: kk
"""
import tensorflow as tf
from expectminimaxAgent import ExpectMinMaxAgent
import function
from board import board
from randomAgent import baselineOpponent
import matplotlib.pyplot as plt
def Play(b,player,agent,gam... | true |
38354c353135669a093c225dc10f7de4725c8b3f | chinmay6497/Al-and-DS | /smallest_pos_miss.py | UTF-8 | 857 | 3.421875 | 3 | [] | no_license | #User function Template for python3
##Complete this function
def missingNumber(arr,n):
a=max(arr)
if a<0:
return 1
if n==1:
return 2 if arr[0]==1 else 1
l=[0]*a
for i in range(n):
if arr[i] > 0:
if l[arr[i]-1] != 1:
... | true |