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 |
|---|---|---|---|---|---|---|---|---|---|---|
c566846eeead31423ac3e659c46f17cdb4fbcacd | jbold569/advent-code | /2020/day-3/script.py | UTF-8 | 442 | 3.15625 | 3 | [] | no_license | with open("input.dat", 'r') as f:
right = 3
down = 1
pos_x = 0
pos_y = 0
counter = 0
geo_map = [ l for l in f ]
while True:
pos_x = (pos_x + right) % (len(geo_map[0])-1)
pos_y += down
if pos_y == len(geo_map): break
print(f'pos_x: {pos_x}, pos_y: {pos_y}, char... | true |
49d63f764769b2fb7b83c8add78c9f3ef73ef258 | KaterinaKovalenko/lesson4 | /lesson4_5.py | UTF-8 | 787 | 3.96875 | 4 | [] | no_license | # Есть список со словам “rock”, “scissors”, “paper”.
# Создайте прототип игры камень-ножницы-бумага с компьютером,
# в основе которой будет находится функции random.choice и input()
import random
def rand():
list = ["rock", "scissors", "paper"]
lis = random.choice(list)
return lis
def win(lt, us):
... | true |
88c3f0c6664003b7955997fbee1ef49b3ce5fa28 | adorsk/jobman | /jobman/utils/debug_utils.py | UTF-8 | 497 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import inspect
import logging
import pprint
def debug_locals(frames_back=1, logger=logging):
current_frame = inspect.currentframe()
frame = current_frame
try:
for i in range(frames_back):
frame = frame.f_back
fn = inspect.stack()[1 + frames_back][3]
msg = "fn: {fn}, loc... | true |
5b1ad77a8a015db2eee098e511655200627db7e5 | achaudhri/PythonClass-2015 | /HW4Times.py | UTF-8 | 1,426 | 3.546875 | 4 | [] | no_license | # Ambreen Chaudhri
# HW 4 Sorting Algorithm Times for Graphs
import csv
import random
import math
import time
import HW4sort
# recorded time will be average of 100 trials on 90 random lists
# number of elements in each list to range from 10 to 100
nlo = 10
nhi = 100
sort_n = range(nlo, nhi)
# draw 100 random sample... | true |
06c49719c06ea4b458efd63d25a66a86337b55d1 | borntofrappe/python-scripts | /arithmetic-formatter/arithmetic_arranger_previous.py | UTF-8 | 1,916 | 3.671875 | 4 | [] | no_license | def arithmetic_arranger(problems):
if len(problems) > 5:
return 'Error: Too many problems.'
else:
# list in which to store the different operations, through nested list describing the lines
arrangements = []
for problem in problems:
# the numbers and the operator are ... | true |
49589f69b4d1235e94dca13c2f317f571588e0b1 | Joselu21/WSPM | /old/classes/SeleniumController.py | UTF-8 | 3,624 | 2.515625 | 3 | [] | no_license | from re import search
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.remote.webelement import WebElement
import configparser as ConfigParser
import time
class Selenium:
driver = None
search_page = ""
product_xpath = ""
cookies_xp... | true |
83d03d698ba5ca48e08fc1f1c7bc0047ae05562e | BhaveshSGupta/Facebook-HackerCup-2017 | /Qualification Round/zombie 45/fighting_zombie.py | UTF-8 | 2,028 | 3.03125 | 3 | [] | no_license | import sys
import re
def inputs(file_name):
with open(file_name, 'r') as f:
# Remove first line
nb_zombies = int(f.readline().rstrip('\n'))
cases = list()
for day in xrange(nb_zombies):
damage, nb_spells = map(int, f.readline().rstrip('\n').split(' '))
spe... | true |
59698514313e494993797a5fef52b0ee274d31ca | rajat19/Pyscience | /mlrecipes/3.py | UTF-8 | 293 | 2.671875 | 3 | [] | no_license | # pylint: disable=E1101
import numpy as np
import matplotlib.pyplot as plt
greyhounds = 500
labs = 500
grey_heigth = 28 + 4 * np.random.randn(greyhounds)
lab_height = 24 + 4 * np.random.randn(labs)
plt.hist(
[grey_heigth, lab_height],
stacked=True,
color=['r', 'b']
)
plt.show() | true |
b5d08ca9e5b8e999f21349d3df02a21c1a324c55 | modestbiirr/template_v1 | /scripts/example_sub.py | UTF-8 | 583 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from template_v1.msg import Temp1 #import customized message
#define callback function
def callback(data):
g_voltage_sub = data.volt1;
#define interface to voltage_sub()
def voltage_sub():
#initialize a node with node name
rospy.init_node('example_sub_py',anonymous=True)
#crea... | true |
d6b12dcfe46eb495328f316c13171ea3f488ceaf | BrijBhushan1/Salsa20-and-Grain128-Cipher | /Salsa20.py | UTF-8 | 2,235 | 3.09375 | 3 | [] | no_license | **************** Python program of Salsa20 cipher:*********************
list1 = [211,159,13,115,76,55,82,183,3,117,222,37,191,187,234,136,49,237,179,48,1,106,178,219,175,199,166,48,86,16,179,207,
31,240,32,63,15,83,93,161,116,147,48,113,238,55,204,36,
79,201,235,79,3,81,156,47,203,26,244,243,88,118,104,54];
list... | true |
6abd8389a495a44cdae1279d4c1645563b507978 | RaulBurian/LFTC | /Lab1/Operator.py | UTF-8 | 576 | 2.96875 | 3 | [] | no_license |
class Operator:
EQUAL='='
D_EQUAL='=='
PLUS='+'
MINUS='-'
MULT='*'
DIVIDE='/'
SMALL='<'
SMALL_EQUAL='<='
BIG='>'
BIG_EQUAL='>='
INSERT='>>'
EXTRACT='<<'
@staticmethod
def isOperator(c):
if c==Operator.EQUAL or c==Operator.PLUS or c==Operator.MINUS or c=... | true |
721397cb3d75ad894a37b3dc1a2bfa07c3a12b99 | Chaser/DesignPatternPractice | /Python/Strategy/ducks/strategy/decoy_duck.py | UTF-8 | 360 | 2.734375 | 3 | [] | no_license | from duck import *
from quack_behaviour import *
from fly_behaviour import *
class DecoyDuck(Duck):
def __init__(self):
fly_no_way_instance = FlyNoWay()
self.set_fly_behaviour(fly_no_way_instance)
mute_instance = MuteQuack()
self.set_quack_behaviour(mute_instance)
def display(... | true |
aafdf78b1ef9ff008f2288a2dfd92a4437c9ae2a | jrezzende/observer-pattern-es | /pattern.py | UTF-8 | 2,022 | 4.125 | 4 | [] | no_license | import random
# Arquivo python para demonstração rápida de como o pattern é aplicado
#Classe Subscriber, que conterá apenas um nome para identificar e um método update, dizendo que recebeu a mensagem
class Subscriber:
def __init__(self, name):
self.name = name
def update(self, message):
prin... | true |
b0a92806d250515b1f8c08c8175f43b87b0a2a39 | TalatWaheed/100-days-code | /code/python/Day-45/Dict.py | UTF-8 | 133 | 2.984375 | 3 | [] | no_license | numbers = dict(x=5, y=0)
print('numbers = ',numbers)
print(type(numbers))
empty = dict()
print('empty = ',empty)
print(type(empty))
| true |
9205c717948bbef5ab903c641a49ccdb2cf52010 | 821-Final-RuiqiZhang-MingxuanWang/Image-web-with-memory-game | /server.py | UTF-8 | 3,427 | 2.671875 | 3 | [] | no_license | """The web server."""
import base64
import sqlite3
import SQL
import random
from starlette.requests import Request
from fastapi import FastAPI, Form, UploadFile, File
from starlette.templating import Jinja2Templates
APP = FastAPI()
templates = Jinja2Templates(directory="./web_html")
num_1 = 0
num_2 = 0
@APP.get("/"... | true |
e653ef9fcf18d6e3b244b7d3996ee1c967cb849a | darechkin/Basics_Of_Python_HSE | /venv/53.py | UTF-8 | 174 | 3.296875 | 3 | [] | no_license | n = int(input())
i = 0
p = 0
while i < n:
if i < n:
i += 1
p += (1 / (i ** 2))
elif i == n:
i = i
p += (1 / (i ** 2))
print(float(p))
| true |
1145af9f403a3b81877cffe0fff3c1f60a75418c | wwwwodddd/Zukunft | /PE/110.py | UTF-8 | 351 | 3.265625 | 3 | [] | no_license | p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]
z = 1
for i in p:
z *= i
def dfs(c, n, y, d):
global z
if z <= n:
return
if d == len(p):
if c / 2 + 1 >= 4 * 10 ** 6:
z = n
return
t = 1
for i in range(y + 1):
dfs(c * (2 * i + 1), t * n, i, d + 1)
t *= p[d]
if t * n > z:
ret... | true |
95d1f5d8279e053d6465cb9b5441682fe4e29007 | hermanschaaf/advent-of-code-2017 | /day4.py | UTF-8 | 312 | 2.671875 | 3 | [] | no_license | #!/bin/python
from __future__ import print_function, unicode_literals
from collections import defaultdict
if __name__ == "__main__":
t = 0
while True:
try:
s = input().strip().split(" ")
except:
break
t += 1 if len(set(s)) == len(s) else 0
print(t)
| true |
e7e50e3aa065f89446904ab6f840edc3d9c9ffeb | Aasthaengg/IBMdataset | /Python_codes/p03618/s220457335.py | UTF-8 | 195 | 3 | 3 | [] | no_license | A = input()
n = len(A)
alpha_dic = {}
for a in A:
alpha_dic[a] = 1 + alpha_dic.get(a, 0)
ans = n * (n-1) //2
for key, num in alpha_dic.items():
ans -= (num * (num-1) // 2)
print(ans+1)
| true |
7a4ed8ed7a3a74817fcf8569118c5ca5c415f9dd | HarshPatel270698/PFetch | /fetch.py | UTF-8 | 1,680 | 2.84375 | 3 | [] | no_license | import requests
import smtplib
import time
from re import sub
from decimal import Decimal
from bs4 import BeautifulSoup
import pandas as pd
from datetime import datetime
prices=[]
dates=[]
times=[]
headers = {
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0'
}
URL =... | true |
3c58a54dd9c7424892110c6a953e8b66de7d9325 | MitchAguilar/PythonCourse | /2.- PYTHON MEDIO/4.- CONCEPTOS AVANZADOS EN PYTHON/4.3 CLOSURES.py | UTF-8 | 195 | 3.609375 | 4 | [] | no_license | def funcionA(x):
def funcionB(y):
return x+y
return funcionB
funcion=funcionA(5)#el primer valor es de la primera variable
print(funcion(3))#el segundo es de la segunda variable
| true |
1dd136c874a077d4c60d865c5ff6ec21876016ca | wiks/fakturkowo_DjangoSymfony5 | /py/iai_invoice/myfirm/utils/lookfor_items.py | UTF-8 | 533 | 2.734375 | 3 | [] | no_license | # -*- coding: utf8 -*-
import logging
from items.models import Items
logger = logging.getLogger('debug')
class LookforItems:
"""
"""
def lookfor_items(self, lookfor):
"""
:param lookfor:
:return:
"""
result = []
if len(lookfor) >= 3:
items_o... | true |
5ed4e66b4f22f2e7bc163ff904a4b8df60c62561 | ewels/nf-core-dualrnaseq | /bin/check_replicates.py | UTF-8 | 997 | 3.203125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 21 14:55:44 2020
Modified 3rd Dec 2020
@author: B.Mika-Gospodorz and R. Hayward
Input file: list of sample names from input files
Output: 'true' or 'false'
Description: Used to identify if there are replicates in the input files
"""
import argpar... | true |
357ee12f6505839125a501a5b897bd23a9ab8527 | monarin/psana-nersc | /psana2/make_custom_xtc.py | UTF-8 | 1,395 | 2.53125 | 3 | [] | no_license | from psana.dgram import Dgram
import os
import time
import shutil
import sys
buffering = 0
def open_file(fname):
fd = os.open(fname, os.O_RDONLY)
f_size = os.path.getsize(fname)
return fd, f_size
def get_config(fd_in):
config = Dgram(file_descriptor=fd_in)
offset = memoryview(config).nbytes
r... | true |
2ef131eb84b63c6266c1b237f1d129e8f2d1bf84 | paudom/iNNterpret | /innterpret/signal/deconv.py | UTF-8 | 4,985 | 2.71875 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import
# -- EXTERN IMPORT -- #
import PIL.Image as pilImage
import numpy as np
import keras.backend as K
# -- IMPORT -- #
from .. import __verbose__ as vrb
from ..utils.data import load_image,visualize_heatmap
from ..utils.bases.layers import DConv2D,DInput,DFlatten,DActivation,DPoolin... | true |
bef8c046b430abe3e265ce5fea45db1c69b836fb | idzharbae/Py-2048 | /game_test.py | UTF-8 | 7,137 | 3.34375 | 3 | [] | no_license | import game
import traceback
def test_initialize_board():
board_size = 4
board = game.initialize_board(4)
assert(len(board) == 4)
assert(len(board[0]) == 4)
def test_move():
def check_result(board, score, expected_board, expected_score, f):
print(f.__name__)
result_board, result_score = f(board, score)
pr... | true |
3e52c694e4dbb500a482eba7d173afdc5b1bd227 | jimgong92/philotes-app | /server/utils/dataStructures.py | UTF-8 | 306 | 3.21875 | 3 | [] | no_license | class LinkedListNode():
def __init__(self, value=None):
self.value = value
self.prev = None
self.next = None
def setPrev(self, node):
self.prev = node
def setNext(self, node):
self.next = node
def getPrev(self):
return self.prev
def getNext(self):
return self.next | true |
b4e87a3e47e6c449e6544fae4c78707bbf9bab80 | KonradMnich/CVT-measurements | /2-exemplary_measurement_treatment/reusable.py | UTF-8 | 4,349 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 21 08:55:51 2020
@author: konrad
"""
import pandas as pd
import numpy as np
class DataConditioner:
def __init__(self, path_in, path_out):
self.path_in = path_in
self.path_out = path_out
self.F_raw_ni = np.array([])
... | true |
697f0bc320e5821a612d26ff240d113929255f0a | KodaiEzaki/Kodai | /ABC143A.py | UTF-8 | 183 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 19:39:09 2020
@author: Kodai
"""
A, B = map(int, input().split())
if A <= 2*B:
print(0)
else:
print(A - 2*B) | true |
117f68554018ae0654e4a8c8e326e639f651134d | ibrahim-akrab/simple-mathematical-expression-calculator | /modelSelection.py | UTF-8 | 1,217 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
# load the dataset
digits = np.load('dataset/digits.npy').T... | true |
a6f9b97143c22a6b26cdc58901b02b9b62537f90 | ChekeGT/Platzigram-Api | /platzigram_api/users/models/profiles.py | UTF-8 | 1,420 | 2.796875 | 3 | [
"MIT"
] | permissive | """Profile model."""
# Django
from django.db import models
# Models
from .users import User
from platzigram_api.utils.models import PlatzigramBaseAbstractModel
class Profile(PlatzigramBaseAbstractModel):
"""Profile model.
Proxy model that contains public data of an user.
the public data it contains is:... | true |
99a3850170c85fef2f8f05241c9b792d2c6159a2 | ZhangYajun12138/buxianxian | /BuXianXian/buxianxian3.py | UTF-8 | 624 | 3.765625 | 4 | [] | no_license | # coding:utf-8
'''
输入月薪和五险一金计算个人所得税
version:0.1
author:buxianxian
date:2019-5-30
rate:税率
1.起征5000
2.8000以内,0.1 105
3.12000以内,0.2,555
4.30000以内,0.3.1005
5.50000以内,0.4,2755
6.以上,0.5,5055
'''
salary = float(input("月薪:"))
insurance = float(input("五险一金:"))
diff = salary - insurance -5000
if salary <= 5000:
rate = 0... | true |
8be445e157605d3c7d6a7ea4b75e4f933c7c93d4 | mahatmaWM/leetcode | /leetcode/editor/cn/336.回文对.py | UTF-8 | 2,910 | 3.84375 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=336 lang=python3
#
# [336] 回文对
#
# https://leetcode-cn.com/problems/palindrome-pairs/description/
#
# algorithms
# Hard (33.31%)
# Likes: 69
# Dislikes: 0
# Total Accepted: 4.1K
# Total Submissions: 12.4K
# Testcase Example: '["abcd","dcba","lls","s","sssll"]'
#
# 给定一组唯一的单词, 找出所有不同 的索引... | true |
0d49b82d69bba6e4d1247a4782e9ef34135cc3b9 | amsenthilkumar/ZenClass | /python programs/array.py | UTF-8 | 168 | 3.171875 | 3 | [] | no_license | n=[1,4,2,8,5,11]
j=0
for i in range(0,len(n)-2,2):
if(n[i]<n[i+1] and n[i+1]>n[i+2]):
j+=1
if(j==len(n)//3):
print(True)
else:
print(False) | true |
78d0f69b46b032b84cb6ba7b6eed6f04db9c740e | Aasthaengg/IBMdataset | /Python_codes/p02765/s548348320.py | UTF-8 | 142 | 2.59375 | 3 | [] | no_license | def solve():
if n>=10:
return r
else:
return r+100*(10-n)
n, r = [int(i) for i in input().split(" ")]
print(solve()) | true |
1f8cd080f77c520d8d8afcdb7617df35f7cd8c00 | Kcheung42/Leet_Code | /Algorithms/String/043_Multiply_Strings.py | UTF-8 | 2,195 | 3.75 | 4 | [] | no_license | #------------------------------------------------------------------------------
# Question: 043_Multiply_Strings.py
#------------------------------------------------------------------------------
# tags:
'''
Given two non-negative integers num1 and num2 represented as strings, return
the product of num1 and num2.
Note... | true |
80dd4d7d389b57e542a44b5ca3cda6f84d7aeb01 | degterenko/Zadanie-1 | /14.py | UTF-8 | 49 | 2.84375 | 3 | [] | no_license | s = 'udacity'
t = 'bodacious'
print s[:4] + t[5:] | true |
49132425563c9b42cb5819529ef544d471c2728c | srimani-programmer/Hands-On-Metaprogramming-with-Python3 | /Chapter05/product.py | UTF-8 | 249 | 3.171875 | 3 | [
"MIT"
] | permissive | class Product:
_productID = 100902
_productName = 'Iphone X'
_productCategory = 'Electronics'
_unitPrice = 700
def getProduct(self):
return self._productID, self._productName, self._productCategory, self._unitPrice
| true |
b5e15bd0a66b79e84e90259a114287d49906cd7d | ijustloveses/sae_local | /marked/MysqlObj.py | UTF-8 | 6,042 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# view.encoding()=utf-8 with BOM
"""
Mysql Wrapper Object for MySQLdb
Methods:
getOne() - get a single row
getAll() - get all rows
insert() - insert a row
insertOrUpdate() - insert a row or udate it if exists
update() - udpate rows
... | true |
b944fed9019c11d47cf054a99218e7dfcbf5f7d1 | FedesMM/python_morsels | /uniques.py | UTF-8 | 951 | 3.515625 | 4 | [] | no_license | from collections.abc import Hashable
def uniques_only_v_1_0(iterable):
seen=set()
new_iterable = []
for item in iterable:
if item not in seen:
seen.add(item)
new_iterable.append(item)
return new_iterable
def uniques_only_v_2_0(iterable):
seen=set()
for item in... | true |
6d5b89ff22f1a342d5c8cf93637ec09bf2348c23 | hlkaka/imager | /preprocessing_scripts/calculate_ds_mean.py | UTF-8 | 1,587 | 2.515625 | 3 | [] | no_license | from torch.utils.data.dataloader import DataLoader
from torchvision import transforms
import sys
import numpy as np
import tqdm
import torch
sys.path.append('data/')
sys.path.append('.')
from CTDataSet import CTDicomSlicesMaskless
from CustomTransforms import Window
from CustomTransforms import Imagify
from constants... | true |
acec85a6bc735cb95a6e7c97b1d277bd74a80c8b | Curlykonda/RL_reproducibility_lab | /replay_memories/HindsightExperienceReplay.py | UTF-8 | 1,007 | 2.984375 | 3 | [] | no_license | import random
from copy import deepcopy
class HindsightExperienceReplayMemory:
def __init__(self, capacity):
self.capacity = capacity
self.buffer = []
self.memory = []
def __push(self, transition):
if len(self.memory) == self.capacity:
del self.memory[0]
se... | true |
3daa173dd5f9de669d51f2b1303950f8084da88f | Suraj-Rajesh/BMSTreebasedSecureSearch | /search_client.py | UTF-8 | 1,962 | 3.015625 | 3 | [] | no_license | from bmssearch.communication_objects import Client_Request
from bmssearch.network_interface import send_object, receive_object
import socket
class Search_Client(object):
def __init__(self, server_ip, server_port):
self.server_connection_parameters = (server_ip, int(server_port))
def present_response(... | true |
5b9f9fa6be1dc0f9d36eeef7e5b8b3937fe7f8ee | jerickleandro/uri_online_python | /1011 - Esfera.py | UTF-8 | 100 | 2.84375 | 3 | [] | no_license | R = float(input())
pi = 3.14159;
VOLUME = (4.0/3)*pi*(R*R*R)
print('VOLUME = {:.3f}'.format(VOLUME)) | true |
9fcf67ea48e4495aabaf8a3e8e135794d73922f3 | HussakMichael/Machine-Learning-in-Crowd-Modeling-and-Simulation | /Exercise_4/Task_1/task_1.py | UTF-8 | 7,165 | 3.421875 | 3 | [] | no_license | # General imports
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy.misc
from skimage.transform import resize
# Local imports
from pca import energy_pca, pca
# Typing imports
from typing import Union
def draw_pc(df: pd.DataFrame, vt, s):
"""
This function is used to draw the ... | true |
11ccde039c42024658d06435acb5395cc196a2d6 | mwdchang/tensor-mlb-batting | /mlb.py | UTF-8 | 3,047 | 2.59375 | 3 | [] | no_license | import parser as parser
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
import numpy as np
import sys
import collections
Dataset = collections.namedtuple('Dataset', ['data', 'target'])
from flask import Flask, request, jsonify
def dict2List(batter):
return [
batter["H"],
batter["... | true |
caa514767f74432d743e90a15384b591b63138a1 | id-gue/PyLadiesWorkshop | /task_4_optional.py | UTF-8 | 946 | 4.5625 | 5 | [] | no_license | print()
print("What is your name?")
name = input("> ")
print("Hello %s, welcome the the dungeon!" % (name))
print("Do you go through door 1 or door 2?")
def wrong_input():
print("You are not so good with numbers, are you?")
# create function with an argument
def dead(death_message):
print("You are dead.", d... | true |
682d55354ff566ffdd5448b75041abc001024167 | prettywork2021/autoslide | /src/ignition2021/util.py | UTF-8 | 342 | 3.234375 | 3 | [] | no_license | import os
def get_all_paths(directory):
file_paths = []
for root, directories, files in os.walk(directory):
for filename in files:
# join the two strings in order to form the full filepath.
filepath = os.path.join(root, filename)
file_paths.append(filepath)
... | true |
5b5f0b8fdb05f8b76003c4d97c314c34ddc43aae | khimacademy/c101 | /ex02/7_4.py | UTF-8 | 104 | 2.859375 | 3 | [] | no_license | alice = {'성별': '여', '나이': 13, '혈액형': 'AB'}
alice['나이'] = 14
print(alice['나이'])
| true |
d45dbe106a78788d2394cab70d47d01beb4a8c3d | AbinashCIS/CryptoTwitter | /processor/extractor.py | UTF-8 | 6,620 | 3.109375 | 3 | [
"MIT"
] | permissive | '''
Author: Abinash Sinha
Email: abinash.s@cisinlabs.com
Organisation: CIS India
'''
import os
from time import sleep
from twython import Twython
import pandas as pd
from tqdm import tqdm
import re
class TweetExtractor():
'''
This aims to retrieve tweets, clean them in order to observe a correlation between ... | true |
7d125b8bb7d8dac4006cfa2939892b265c57515e | 07ATUL/PythonProjects | /Number game.py | UTF-8 | 709 | 4.3125 | 4 | [] | no_license | #This is a number guessing game which I made while learning python#
import random
num=random.randint(1,20)
print("Welcome to number guessing game you have 6 choices to win this game, All the best")
print("Enter a number between 1-20")
user_input=int(input())
print("The number you entered is ",user_input)
for i i... | true |
2de32e53a5172edf532b1ca2689ad9a4a6e3b18d | nathanielanozie/anozie_tools | /py/na_shelfToMenu.py | UTF-8 | 2,197 | 2.78125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | """
# na_shelfToMenu.py
#
#By
#
#Nathaniel O. Anozie
#www.nathananozie.blogspot.com
#
#
#Inspired by
#Brian Ewert (http://ewertb.soundlinker.com) learning about working with shelves from his online tutorials
#David Keegan (http://davidkeegan.com) learning about working with shelves from his online tutorials
#Markus ... | true |
a8c0f154150c7f9a491537bf343f9a3c5fc0d08b | TanishkDev/Spammer-in-Python | /spam.py | UTF-8 | 168 | 2.71875 | 3 | [
"MIT"
] | permissive | import pyautogui,time
text = input()
time.sleep(5)
for i in range(5):
pyautogui.typewrite(text)#your text that would be a spam message
pyautogui.press('enter')
| true |
6f0ec0d7d7c6367043293f4066cc145ffd5f3b0c | Eroica-cpp/LeetCode | /002-Add-Two-Numbers/solution01.py | UTF-8 | 2,292 | 3.84375 | 4 | [
"CC-BY-3.0",
"MIT"
] | permissive | #!/usr/bin/python
# ==============================================================================
# Author: Tao Li (taoli@ucsd.edu)
# Date: May 11, 2015
# Question: 002-Add-Two-Numbers
# Link: https://leetcode.com/problems/add-two-numbers/
# ===================================================================... | true |
b289049c70eceee5f7ecced363e453095144005c | alokojjwal/Adython | /cipher_code.py | UTF-8 | 444 | 3.328125 | 3 | [] | no_license | import string
alok={}
data=""
file=open("alok_write.txt","w")
for i in range(len(string.ascii_letters)):
alok[string.ascii_letters[i]]=string.ascii_letters[i-1]
with open("alok_txt.txt") as f:
while True:
a=f.read(1)
if not a:
print("End of Letter")
break
... | true |
b3b2494cfd79e1efb1ad3f17ddc9ba4955744df8 | pascoej/Arcadia | /termproject/packetsender.py | UTF-8 | 593 | 3.0625 | 3 | [] | no_license | import queue
from util import *
class PacketSender(object):
def __init__(self):
self.packetQueue = queue.Queue()
self.queueLoop()
@run_async
def queueLoop(self):
while True:
packetAndSender = self.packetQueue.get()
message = packetAndSender[0]
se... | true |
19d3372f15e06c8d9862bb998880d7934b0e4eaf | gabriellaec/desoft-analise-exercicios | /backup/user_057/ch84_2020_06_21_04_24_52_712327.py | UTF-8 | 267 | 3.140625 | 3 | [] | no_license | def inverte_dicionario(dic):
nomes = dic.keys()
idades = dic.values()
dic2 = {}
for i in nomes:
if idades in dic2:
dic2[idades] = [dic2[idades], nomes]
else:
dic2[idades] = nomes
return dic2
| true |
42c729e02745f9cdce6a98a60dd9651366f93852 | chiggs/cocotb | /examples/mixed_language/tests/test_mixed_language.py | UTF-8 | 817 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | import cocotb
from cocotb.triggers import Timer
from cocotb.result import TestFailure
@cocotb.test()
def mixed_language_test(dut):
"""
Try accessing handles and setting values in a mixed language environment
"""
yield Timer(100)
verilog = dut.i_swapper_sv
dut.log.info("Got: %s" % repr(verilog... | true |
ee859db8e756b6affd85943e441a96e532503b33 | GaryGoh/Assignments | /Lab3/dice.py | UTF-8 | 488 | 3.859375 | 4 | [] | no_license | import random
def play():
diceList = [-1]
while True:
diceList = diceList + [random.randint(1,6)]
if (diceList[-1] == 6) and (diceList[-2] == diceList[-1]):
for i in range(1, len(diceList)):
print("{} ".format(diceList[i]), end="")
return len(diceList) - ... | true |
ffde99bb0d5d4085bcfe881acdf14a39d623bf28 | DuvanSGF/Python3x | /OperadorAsignacion.py | UTF-8 | 259 | 3.359375 | 3 | [] | no_license | # Asigna el valor resultante de la operacion a la primera variable
# se trata de una especie de taquigrafia que nos evita poner cosas como
# num1 = num1+num2
num1 = 10
num2 = 5
num1 += num2
print (num1)
num1 -= num2
print (num1)
num1 *= num2
print (num1)
| true |
d1aa0293fbb2e7532b6d9ee1a58f8601e8411717 | sulimanfarzat/python_mysqlConnector | /python_mysqlConnector/python_mysqlConnector.py | UTF-8 | 260 | 2.6875 | 3 | [] | no_license |
import mysql.connector
mydb = mysql.connector.connect(
host="xxx",
user="xxxx",
passwd="xxxx",
database="xxxx"
)
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM users")
myresult = mycursor.fetchall()
for x in myresult:
print(x)
| true |
589fb3162600cdbcda05ad4b933532ba88e51267 | dapaohou/TianChi_IndustryAI | /trainModel.py | UTF-8 | 4,334 | 2.65625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LassoCV, ElasticNet # 批量导入要实现的回归算法
from sklearn.tree import DecisionTreeRegressor
from sklearn.svm import SVR # SVM中的回归算法
from sklearn.ensemble.gradient_boosting import GradientBoostingRegresso... | true |
f83ce59717c0105693f15b7dd6e7f183018fdefc | vvendigo/Python-Game-Bricks | /02-moving-sprite.py | UTF-8 | 2,701 | 3.203125 | 3 | [] | no_license | #
# Wandering Hobo: control the sprite
#
import pygame
def make_img(buff, colors, pixel_size=1):
"""helper function to create sprite out of thin air (eh, of list of strings... ;])
buff list of strings, each char represents one pixel (space == transparent)
colors dict of char to RGB mappings... | true |
54be7160bb206c320eca63680adf957383881898 | minicai98/pccu_python | /n3.py | UTF-8 | 931 | 3.8125 | 4 | [] | no_license | import pandas as pd
minder = pd.read_csv('gapminder.csv')
print('內容')
print(minder)
print('長度',minder.index)
print('形狀',minder.shape)
print('維度',minder.ndim)
print('前五筆資料:')
print(minder.head())
print('後五筆資料:')
print(minder.tail())
print('分別輸出第 0 列、第四列的所有資料:')
print(minder.iloc[[0]])
print(minder.iloc[[4]])
print('別... | true |
18261983faf5b097447438ca717a507c12ba0fb8 | phongluudn1997/leet_code | /excel_sheet_column_number.py | UTF-8 | 862 | 4.28125 | 4 | [] | no_license | from string import ascii_uppercase
'''
@Question:
Given a column title as appear in an Excel sheet,
return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Input: "A"... | true |
8fda325a759f6c345b0cb8f9379cacaa215b1b02 | 26tanishabanik/Interview-Coding-Questions | /Sorting/strandSort.py | UTF-8 | 642 | 3.625 | 4 | [
"MIT"
] | permissive | def strand_sort(inp):
output = strand(inp)
while len(inp):
output = merge(output, strand(inp))
return output
def strand(inp):
element, sub = 0, [inp.pop(0)]
while element < len(inp):
if inp[element] > sub[-1]:
sub.append(inp.pop(element))
else:
element += 1
return sub
def ... | true |
dc5580da34655b6973883c1ffc320555bebe08b1 | bopopescu/snippets | /python/sql/connect2postgres.py | UTF-8 | 345 | 2.59375 | 3 | [] | no_license | import psycopg2
import sys
con = None
try:
con = psycopg2.connect(database='bird_tracking', user='bart_aelterman')
cur = con.cursor()
cur.execute('SELECT version()')
ver = cur.fetchone()
print ver
except psycopg2.DatabaseError, e:
print 'Error {0}'.format(e)
sys.exit(-1)
finally:
if ... | true |
ba3964a3231730e2663b67ab151948a8b78b1d71 | prachi-goel06/MiniDes_OFB | /EncryptionMiniDesOFB.py | UTF-8 | 8,681 | 3.421875 | 3 | [] | no_license | # Mini Des algorith with mode of operation cbc
# python version 3.3.0
# referances
# http://stackoverflow.com/
# https://www.cs.uri.edu/cryptography/dessimplified.htm
# skeleton ModesOfOperation.py
# coded by student Name: Prachi Goel
# student ID: 1001234789
import sys
import datetime
class MiniDes:
def __init_... | true |
ccd6fcdb6d623b4297abe2d84d5ee5855d6ad3b2 | DavidAntliff/AdventOfCode | /2019/Day07/p.py | UTF-8 | 2,102 | 3.140625 | 3 | [
"MIT"
] | permissive | # AoC December 2nd Part 1
file_path = r"input.txt"
opcodes = open(file_path, "r").read().split(",")
opcodes = list(map(int, opcodes))
intput = 1
def parameter_mode(opcodes, instruction, idx):
instruction = list(str(instruction))
paramter_modes = ([0]*(5-len(instruction))) + instruction
param1_v... | true |
908a5f245e557c7f3321fde615c1907c1d283d43 | fukeyouko/data-science-coursera | /course2/week2_matplot.py | UTF-8 | 2,997 | 3.203125 | 3 | [] | no_license | import matplotlib as mpl
mpl.get_backend()
import matplotlib.pyplot as plt
plt.plot(3, 2)
plt.plot(3, 2, '.')
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
##################basic
# create a new figure
fig = Figure()
# associate fig with the backend
canvas = Figur... | true |
d3192d9c594c5e06523fedb20bc1b62648ce0643 | kaka20180511/Work | /socket_test/Get_all_IP.py | UTF-8 | 776 | 3.265625 | 3 | [] | no_license | # ============================
# 功能:获取本地电脑所有IP地址
# ============================
import socket
# 查看当前主机名
print('当前主机名称为 : ' + socket.gethostname())
# 根据主机名称获取当前IP
print('当前主机的IP为: ' + socket.gethostbyname(socket.gethostname()))
# 下方代码为获取当前主机IPV4 和IPV6的所有IP地址(所有系统均通用)
addrs = socket.getaddrinfo(socket.gethostname(),N... | true |
2adce5f8b219414c6ee7ac09299dc65c9b98c3a7 | DoctorDroid/CodeSignal | /minimalNumberOfCoins.py | UTF-8 | 825 | 3.828125 | 4 | [] | no_license | def minimalNumberOfCoins(coins, price):
'''
U- Use the least amount of coins to buy something given an array of coin values and a price.
P- begining with the largest coin, use floor division to find the
number of those coins that can be used, then send the remaining price to the next largest coin until... | true |
9c811f3ae332aa8cd664839cebe660e27431786b | washie254/udacity-Intro | /LESSON 5 SCRIPTING/l04 Reading and writing Files/001intro.py | UTF-8 | 658 | 4.03125 | 4 | [] | no_license | # opening a file in python
# open('path','mode') # NB: mode is defaulted to read if not specified
# mode r: Read w: Write
f = open('my_file.txt','r')
file_data = f.read() # Read the contents of a file
print("-----read from file-----")
print(file_data)
#writing into a file
# nb : w overrites currennt file con... | true |
68fac419d537780ab2e66a08c7e86d2ea585a6aa | ZhouWenJiang/rankNotepad | /src/main.py | UTF-8 | 1,200 | 2.515625 | 3 | [] | no_license | # coding=utf8
'''
Created on 2016年3月16日
@author: Zak
'''
from notepadinfo import *;
# Start 参数设置
pageSize = 15;#获取的总页数
_menuId = 223;#品牌Id,联想:160,惠普:223,苹果:544,
_minprice = 3000;#最低价格
_maxprice = 4000;#最高价格
# end参数设置
list = [];
for i in range(pageSize):
list.extend(getnotepadlist(menuid=_menuId, ... | true |
7a990a7c3e5ecc0efee75614fc8674b2da7af733 | getsentry/examples | /aws-lambda/python/custom_tag_and_context/custom_tag_and_context.py | UTF-8 | 1,348 | 2.734375 | 3 | [
"MIT"
] | permissive | # /**
# *******************************************************************************
# * File name : custom_tag_and_context.py
# * Description : This file contains code that instruments handled exception and
# creates custom tag & context
# **********************************************************... | true |
fcc79b7bdca87f806ead2e7f708be911cbae139f | JoannaEbreso/PythonProgress | /FileReverse.py | UTF-8 | 361 | 3.703125 | 4 | [] | no_license | input_file=open("input.txt","r")
output_file=open("output.txt","w")
for line_str in input_file:
new_str=''
line_str=line_str.strip()
for char in line_str:
new_str=char+new_str
print("new_str",file=output_file)
print('Line: {:<12s} is reversed to {:>12s}'. format(line_str,new_str))
input_f... | true |
b3bb37e56b85d415c84e6c96096f4541cbc0995f | gceylan/pro-lang | /piton/stringtools.py | UTF-8 | 2,096 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
def reverse(s):
"""
>>> reverse('happy')
'yppah'
>>> reverse('Python')
'nohtyP'
>>> reverse("")
''
>>> reverse("P")
'P'
"""
return s[::-1]
def mirror(s):
"""
>>> mirror("good")
'gooddoog'
>... | true |
de4e79000014013b75fb8a991aab692b80347324 | jelarsso/CompPhys | /project4/plotting_analytical.py | UTF-8 | 1,488 | 2.703125 | 3 | [] | no_license | import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
N = np.linspace(1, 1e3, int(1e3))
f = open("output1.data", "r")
f.readline(); f.readline()
E = np.zeros_like(N)
M = np.zeros_like(N)
for i in range(int(1e3)):
sent = f.readline()
words = sent.split()
E[i] = wor... | true |
e411bbf1f7646ceb1882f750ab6739d0137623bc | ddobokki/Translator_using_api | /Translator/base_translator.py | UTF-8 | 2,979 | 3.4375 | 3 | [] | no_license | from typing import List
class Translator:
"""
지원 언어
한국어(ko)
영어(en)
일본어(ja)
중국어 간체(zh-CN)
중국어 번체(zh-TW)
베트남어(vi)
인도네시아어(id)
태국어(th)
독일어(de)
러시아어(ru)
스페인어(es)
이탈리아어(it)
프랑스어(fr)
"""
def __init__(self):
self.__surport_lang_list = [
... | true |
e5ac365a850bedca2a9272cf68aabb9624526053 | yuuuhui/Basic-python-answers | /梁勇版_6.20.py | UTF-8 | 294 | 3.9375 | 4 | [] | no_license |
from math import *
x1,y1,x2,y2 = eval(input("Enter x1,y1,x2,y2 to determine the distance between two point:"))
def distance(x1,y1,x2,y2):
distanc = (x1 - x2) ** 2 + (y1 - y2) ** 2
distance = sqrt(distanc)
print("The distance is",distance)
distance(x1,y1,x2,y2)
| true |
b555dbb06560d60da0e51e23320c18f81ef18f37 | miguelabreuss/scripts_python | /CursoEmVideoPython/desafio73.py | UTF-8 | 675 | 3.3125 | 3 | [
"MIT"
] | permissive | times = 'Flamengo', 'Cruzeiro', 'São Paulo', 'Corinthians', 'Botafogo', 'Atlético-MG', 'Chapecoense', 'Vasco', 'Bahia', 'Sport', 'Internacional', 'Santos', 'Athletico-PR', 'Figueirense', 'Grêmio', 'Palmeiras', 'Fortaleza', 'Goiás', 'Fluminense', 'CSA'
print('Os 5 primeiros colocados são: ')
for i in range(0, 5):
pr... | true |
95c08211fe717aa53df63ab4e20a9551225180f5 | fredyramix/2P_Practica1 | /main.py | UTF-8 | 2,455 | 3.328125 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
from lista_funciones import EvaluarConElite
from mutacion import Mutacion
__author__ = 'fredy'
from funciones import *
from menus import *
from cruzamiento import *
import os
import math
#definición de cromosoma:
# x = [, , , , , ]
#combinaciones entre 1 y 0 maximo 31
#F(x)= x^2 donde donde... | true |
c71c842e070004a7d2fcd12edafa1b1871f047f4 | Juvygelbard/BombermanAI | /BombermanAI/Agents/human_agent.py | UTF-8 | 1,082 | 3 | 3 | [] | no_license | from .bot import Agent
from msvcrt import getch
from queue import Queue
from threading import Thread
class HumanAgent(Agent):
def __init__(self):
self.key_to_command = {bytes('w', encoding='UTF-8'):'UP',
bytes('s', encoding='UTF-8'):'DOWN',
byte... | true |
ffbbbf927d8958f37551bb49283f79ce45409a0c | IoanaParfene/Survive | /Implementation/PythonFiles/FrontendFunctions/frontend_environment.py | UTF-8 | 2,229 | 3 | 3 | [] | no_license | from PythonFiles import constants as cs, initialization as init
from PythonFiles.BackendFunctions import backend_time as bbt
from PythonFiles.Screens import screens as sc
########################################################################################
# FUNCTIONS USED DURING GAME LOOP UPDATES
################... | true |
24b4e6ca1ecf62f9c2d8d3edb23189decaa0f891 | JesseJMa/data-structure-and-algorithm | /sorts/quickSort/quick_sort_2_ways.py | UTF-8 | 1,307 | 3.515625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# https://blog.csdn.net/BTUJACK/article/details/81261647
import random
def insertion_sort(arr, l, r):
for i in range(l + 1, r + 1):
temp = arr[i]
index = i
while index > 0 and arr[index - 1] > temp:
arr[index] = arr[index - 1]
index -= 1
... | true |
35517b96f37c0267d1bde0b7e236ab6b796fb458 | LitRidl/route-scanner | /times.py | UTF-8 | 4,354 | 2.609375 | 3 | [] | no_license | import json
import time
from selenium import webdriver
from collections import OrderedDict
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from random import randint as ri, random
from datetime impor... | true |
4b8898b9d66f50842690ed7d489813ce6cdddfa9 | sumanthpalla/Data_Structures_and_Algorithms | /Divide_and_Conquer/Karatsuba.py | UTF-8 | 1,214 | 3.46875 | 3 | [] | no_license | #This code compiles Karatsuba Multiplication in Recursive Method
#By using Master theorm the time complexity is O(n^log3) or O(n^1.58) which is efficient than school grade algorithm
import math
import sys
def Karatsuba(x,y):
if(x<10 or y<10):#base_case
return x*y
n = max(len(str(x)),len(str(y)))#finding... | true |
863bebf7e9a3b74b01df2e0a17e46c4d1f3c59fd | Shyamaladevikct/The-Sparks-Foundation_GRIP | /Social Distancing Detector.py | UTF-8 | 1,316 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
get_ipython().system('pip3 install opencv-python')
import numpy as np
import cv2
# In[2]:
body_classifier = cv2.CascadeClassifier('haarcascade_fullbody.xml')
# In[3]:
image = cv2.imread('beach_crop1.jpg')
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
cv2.imshow(... | true |
eb7e4e90acf02f18fd8cf42c309d159462425632 | gbacce/python-shooter | /shooter_pygame/Shooter.py | UTF-8 | 1,249 | 4.09375 | 4 | [] | no_license | # Include pygame again, because this is a different file.
import pygame
class Shooter(object):
# Remember... Classes have 2 parts.
# 1. Attributes
# 2. Methods
# Initiate the starting attributes with __init__
def __init__(self, screen):
# It is a good idea to create a variable referring to the character's im... | true |
31c684e2ed01623f0b0015f634aa41f3ed577979 | guptaarth87/workalendar | /workalendar/europe/netherlands.py | UTF-8 | 1,358 | 2.953125 | 3 | [
"MIT"
] | permissive | from datetime import date, timedelta
from ..core import WesternCalendar, SUN
from ..registry_tools import iso_register
@iso_register('NL')
class Netherlands(WesternCalendar):
'Netherlands'
include_good_friday = True
include_easter_sunday = True
include_easter_monday = True
include_ascension = Tru... | true |
4f16aa062281e78ef59f9b432766529f7383a355 | actually/blanket | /product/get_alert_hosts.py | UTF-8 | 1,770 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
"""
Search Icinga Service Status Details
Usage:
./get_alert_hosts.py "Disk Usage"
- Returns csv list of hostnames
$ fab -H $(./get_alert_hosts.py "Puppet client status") fix_puppet
- Uses fabric to execute fix_puppet across listed hosts in icinga
"""
import re
import sys
... | true |
8e5126653e12993802ca23249a54ed594cc33be2 | ruhollenbach/WSB-Ticker-Analysis | /WSBRecent.py | UTF-8 | 3,259 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#### This program is similar to WSBHistoricDate. However, the goal is to fetch and analyse comments
#### from the most recent threads. The Pushshift Database is updated too slowly for that which means that
#### we have to use the original Reddit API or PRAW. The progr... | true |
205b93f3a5fcc0723af2d284d3e91e46982ac4b2 | jrecuero/pyos | /apps/brythony/bobject.py | UTF-8 | 4,390 | 3.078125 | 3 | [] | no_license | from collision import CollisionBox
from point import Point
STEP = 20
class BryObject:
def __init__(self, x, y, dx, dy, **kwargs):
self.x = x
self.y = y
self.dx = dx
self.dy = dy
self.floor = False
def get_collision_box(self):
collision_box = CollisionBox()
... | true |
ddc07771f96e2f10ffe6ffd2126b4c1e68aafdec | davidchoysqldba/Restaurant-Recommendations | /project_rest_data/utils/date_util.py | UTF-8 | 1,309 | 2.859375 | 3 | [] | no_license | import dateutil
import datetime
def getValidDateList(file_pattern, date_list, valid_datelist):
#print(valid_datelist)
#print(date_list)
return_list = sorted(list(filter(lambda l: (l[-15:-5] not in valid_datelist), date_list)))
return return_list
def getDateRange(date):
from datetime import date a... | true |
0b1cced15d1baaebce5376b6539a36e7f49916e5 | Nair08/MachineLearning | /Survival_Prediction.py | UTF-8 | 7,088 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Chapter 3 - Regression Models
#
# ### Segment 4 - Logistic Regression
# In[1]:
import numpy as np
import pandas as pd
import seaborn as sb
import matplotlib.pyplot as plt
import sklearn
from pandas import Series, DataFrame
from pylab import rcParams
from sklearn import p... | true |
6016ad28432e378e8d11f2ae0c443f124fa6dd15 | RosaIss/advent_of_code | /2017/d13_1.py | UTF-8 | 634 | 3.59375 | 4 | [] | no_license | """--- Day 13: Packet Scanners ---"""
import sys
def calculate_severity(layers):
severity = 0
for i, depth in enumerate(layers):
if depth == 0:
continue
half_round = i / (depth - 1)
reminder = i % (depth - 1)
if (half_round % 2) == 0 and not reminder:
... | true |
e19f8fbdb1e48019f1262948f64b76a3fc96bd6b | cladren123/AutoFarm | /Web/autofarm/frame/loginregister/value.py | UTF-8 | 398 | 2.921875 | 3 | [] | no_license |
class User:
def __init__(self, u_id,u_pwd,u_name, u_contact, u_addr):
self.u_id = u_id;
self.u_pwd = u_pwd;
self.u_name = u_name;
self.u_contact = u_contact;
self.u_addr = u_addr;
def __str__(self):
return self.u_id + ' ' + self.u_name + ' ' + self... | true |
73a2f67588a55c826f4d46d9042f1565f3cb04f8 | micku/adventofcode | /boilerplates/2017/solve.py | UTF-8 | 529 | 3.296875 | 3 | [] | no_license | #! /usr/bin/env python
"""Solution to the AoC problem"""
import os
def part1(_input):
"""Part 1 solution implementation"""
return None
def part2(_input):
"""Part 2 solution implementation"""
return None
if __name__ == '__main__':
input_path = os.path.join(
os.path.dirname(__file__),... | true |
8156bf9001cba9d6f3545a88e004f49383eb46bb | yaomingshr/DogvsCat | /class_vote.py | UTF-8 | 1,174 | 2.546875 | 3 | [] | no_license | import os
from sklearn import svm
import csv
import pickle
from numpy import *
p_list = [zeros((4000,3)),zeros((4000,3)),zeros((4500,3))]
clf = svm.SVC(C = 0.8)
for train_iter in range(0,3):
for test_iter in range(0,3):
fname = 'train' + str(train_iter) + '-test' + str(test_iter) + '.ares'
ffile = ... | true |
d15f1b5e26e969a08ac9433869fe9ccb6dde7fdb | Katakhan/TrabalhosPython2 | /Aula 23/Aula 23.Ex.4.py | UTF-8 | 1,596 | 3.453125 | 3 | [
"MIT"
] | permissive | # Aula 22 - 10-12-2019
# Classe
# Na I Feira de Cerveja de Ituroró que irá acontecer em 2020, a AMBEV irá colocar 2 conteiners
# de atendimento automatizado, um para bebidas alcoolicas e outro de bebidas não alcoolicas.
# O sistema irá operar da seguinte forma:
# - O cliente se cadastrará no caixa retirando um cartã... | true |