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 |
|---|---|---|---|---|---|---|---|---|---|---|
0b42636cc7ee2e1c62d14b44a0c7a799bd842079 | arentil/Zajecia-z-Pythona | /Zajecia-7/triangle.py | UTF-8 | 2,477 | 3.71875 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#kompilacja z python3
from points import Point
from math import *
class Triangle:
"""Klasa reprezentująca trójkąty na płaszczyźnie."""
def __init__(self, x1=0, y1=0, x2=0, y2=0, x3=0, y3=0):
if ((x1 == x2 and x2 == x3) or (y1 == y2 and y2 == y3)):
... | true |
acc75d1aa907e271fc328b6108bf5e4a24d48dfc | Edison1234567/CSE | /Edison Shapiro - World Map OOP.py | UTF-8 | 2,023 | 3.078125 | 3 | [] | no_license | class Room(object):
def __init__(self, name, north, east, south, west, description):
self.name = name
self.north = north
self.east = east
self.south = south
self.west = west
self.description = description
def move(self, direction):
global current_node
... | true |
9f20f9d44c4c7063c5ac43072d039e11ffb3cc57 | ianaralggaliza/Aulas-Fatec-SP | /primeiro_semestre/Python/Estudo P2/FE7.py | UTF-8 | 165 | 3.890625 | 4 | [] | no_license | def impar(n):
if n%2 != 0:
return True
else:
return False
n=int(input('n: '))
if impar(n):
print('É ímpar')
else:
print('É par')
| true |
669ae576255216dd5c4c65a7cd80d5eab79cafd7 | xyphoid/adventofcode2018 | /p1/advent1.py | UTF-8 | 177 | 3.21875 | 3 | [] | no_license | # https://adventofcode.com/2018/day/1
# add up all line items in stdin
import sys
data = sys.stdin.readlines()
total = 0
for item in data:
total += int(item)
print total | true |
34adf3fac5fd2782ed21113d90bcd99bb7ca2bea | cillian1/Univeristy-Thesis | /code/python-evo-audio-master/main.py | UTF-8 | 942 | 2.9375 | 3 | [] | no_license | from scipy.io import wavfile # scipy library to read wav files
import numpy as np
from scipy.fftpack import fft # fourier transform
from scipy.io.wavfile import write
import matplotlib.pyplot as plt
from scipy import signal
firstSound = "test.wav" # Audio File
secondSound = "Trumpet.wav"
fs, Audiodata1 = wavfile.read(f... | true |
ef2bba5c43ae182c7d0fad89d1a53ef47fd8ce18 | huangyingw/submissions | /343/343.integer-break.233525440.Accepted.leetcode.py | UTF-8 | 710 | 2.890625 | 3 | [] | no_license | class Solution(object):
def integerBreak(self, n):
if n <= 3:
return n - 1
threes, remainder = divmod(n - 4, 3)
product = 3**threes
remainder += 4
if remainder == 4:
return product * 2 * 2
if remainder == 5:
return product * 3 * 2
... | true |
776f8ea91b0501d8079c8efe9cc19bac2164816b | bosmobosmo/advent-of-code | /2015/day 12/day2.py | UTF-8 | 565 | 3.359375 | 3 | [] | no_license | import json
with open('input.json') as json_file:
data = json.load(json_file)
def loop(item):
if type(item) == int:
return item
elif type(item) == list:
value = 0
for n in item:
value += loop(n)
return value
elif type(item) == dict:
if 'red' in item.... | true |
3aacc49024be136f3f71cf3c6994d1b1079b3fef | carlo007/AI-Pygame | /managers/sound_manager.py | UTF-8 | 1,347 | 3.015625 | 3 | [
"CC0-1.0"
] | permissive | import pygame as pg
#Variables
background_playback = False
vol_adj = 0
#Constants
BEEP_VOLUME = 0.5
VOL_ADJUSTER = 0.20
#Load Sound
BEEP = pg.mixer.Sound('sound/beep.wav')
MUSIC = pg.mixer.Sound('sound/paradise3.wav')
PEW = pg.mixer.Sound('sound/pew.wav')
#Manual Channels
BACKGROUND = pg.mixer.find_channel()
#Man... | true |
88804288fd4649642d5bc9602da5903e3dd391aa | Kentix/PyDupeStats | /PyDupeStats.py | UTF-8 | 5,233 | 2.65625 | 3 | [
"MIT"
] | permissive | # --Usage-- PyDupeStats.py "D:\Path\To\Inspect" ChunkInspectionSizeInByte
# --Usage Example-- PyDupeStats.py "E:\Data\Virtual_Machines" 16384
import os
import sys
import hashlib
from datetime import datetime
# TODO: Add argument for scanning only a maximum of x GB of bytes,
# potentially random chunk layouts
# TODO:... | true |
df5d475c9b83e69c32567259278cddb0c27f2756 | Tszohar/diabetic_retinopathy | /convert_model2csv.py | UTF-8 | 2,363 | 2.515625 | 3 | [] | no_license | import os
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader
import parameters
from data import BDDataset
from functions import predict_label
from network import BDNetwork
from resnet import ResNet
def model2csv(data_csv, data_dir, model_path, output_path, classifier_type):
... | true |
8d646a747662cfe3e57a627fe3c2cd7d4389dfe0 | DICFACT/bettercry | /modules/vm.py | UTF-8 | 4,772 | 2.90625 | 3 | [] | no_license | import sys
import typing as t
from random import randint
from .getch import getch
class InputWrapper:
@staticmethod
def read(_):
return getch()
class VirtualMachine:
def __init__(self, mem_size: int = 14, out_buffer_size: int = 8, output: t.Any = sys.stdout, input_: t.Any = InputWrapper):
... | true |
14d657293ef90cbad6ad0faddd3d63cecc408479 | Robin-Wujw/leetcode_py | /1.两数之和.py | UTF-8 | 823 | 3.3125 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=1 lang=python3
#给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。
# 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。
# 你可以按任意顺序返回答案。
# [1] 两数之和
#
# @lc code=start
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
dict = {}
for i... | true |
f5555b859f9a51ed5adb54c2a9731dda7b956836 | saijayadeep1998/NumPy-Sorting-Arrays | /Sorting a 2-D Array.py | UTF-8 | 78 | 2.96875 | 3 | [] | no_license | import numpy as np
arr = np.array([[3, 2, 4], [5, 0, 1]])
print(np.sort(arr))
| true |
327b115d2479d466dc600840dd58b63c5e457b1c | endlessmeal/data_science_learning | /statistics/bar_chart.py | UTF-8 | 381 | 2.984375 | 3 | [] | no_license | from matplotlib import pyplot as plt
movies = ["Энни Холл", "Бен-Гур", "Касабланка", "Ганди", "Вестсайдская история"]
num_oscars = [5, 11, 3, 8, 10]
xs = [i + 0.1 for i, _ in enumerate(movies)]
plt.bar(xs, num_oscars)
plt.ylabel('Количество наград')
plt.title('Говно фильмы')
plt.xticks(xs, movies)
plt.show() | true |
a311bee76f6c52b1da2ca2c047fe6e0e822a3356 | HackerExperience/Logflix | /base.py | UTF-8 | 3,873 | 2.546875 | 3 | [] | no_license | from __future__ import (print_function, division, unicode_literals,
absolute_import)
import os
from PySide.QtCore import QMetaObject
from PySide.QtUiTools import QUiLoader
from PySide.QtGui import *
SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
class UiLoader(QUiLoader):
... | true |
d19a773d07ac75f859375b6abdd8836c3194e3b7 | pydevar/Secret-Code | /code_generator.py | UTF-8 | 691 | 3.46875 | 3 | [] | no_license | #!usr/bin/env python
class Secuence():
COLOURS = (1,2,3,4,5,6,7,8)
TAM = 4
ILEGAL_ARGUMENT = "ilegal argument"
def __init__(self,codigo = []):
for a in codigo:
if a in COLOURS:
continue
else:
raise ValueError(ILEGAL_ARGUMENT)
sel... | true |
d4a6b694d7acd7902e74292cf8e7ce8dcde9d65f | damike-cj/uReflowOven-Esp32-Micropython | /MAIN/load_profiles.py | UTF-8 | 4,714 | 2.5625 | 3 | [] | no_license | import uos
import ujson
class LoadProfiles:
def __init__(self, default_alloy_name):
self.profile_json_list = uos.listdir('profiles')
self.profile_alloy_names = []
self.profile_dict = {}
for profile_path in self.profile_json_list:
with open('profiles/' + profile_path, 'r... | true |
fb8ff331a8f445a4ca9f8a5a9958cbbfbcb2975a | nacho1415/Toy_Blockchain | /OneDrive/바탕 화면/알고리즘/1000~2000/1225.py | UTF-8 | 146 | 3.015625 | 3 | [] | no_license | a, b = input().split()
a = list(map(int, a))
b = list(map(int, b))
sum_b = 0
b = sum(b)
for i in range(len(a)):
sum_b+= b * a[i]
print(sum_b) | true |
656fcc8f155c23ed5f6b895990e566ff8b4a03a7 | sea702/sea702 | /scrapy/diyifanwen/diyifanwen/spiders/get_link_spider.py | UTF-8 | 3,515 | 2.640625 | 3 | [] | no_license | from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from diyifanwen.items import DiyifanwenItem
import time
import MySQLdb
from scrapy import log
from scrapy.exceptions import DontCloseSpider
import collections
from scrapy import signals
# title: //a[@id=... | true |
cd71bf3c316425bafdbc92d798d5fa005fb6023d | antonioMedina97/server_python_light_controller | /app.py | UTF-8 | 1,904 | 2.953125 | 3 | [] | no_license | import json
import re
import requests
from flask import Flask, jsonify, render_template, request, Response
def create_app():
app = Flask(__name__)
return app
app = create_app()
@app.route('/', methods=['GET'])
def index():
return render_template('/index.html')
@app.route('/light... | true |
1f4bada3a5e0f81c042feae2a1a8b02e93045ae7 | x2mercy/Leetcode_Solution | /Excel Sheet Column Title/solution.py | UTF-8 | 346 | 2.9375 | 3 | [] | no_license | class Solution(object):
def convertToTitle(self,n):
if n==0:
return ""
alpha={}
result=[]
for i in range(1,27):
alpha[i]=chr(i+64)
while n>0:
result.append(alpha[(n-1)%26+1])
n=(n-1)//26
result.reverse()
return... | true |
54cc321f0dfd929bfa5a236e2535a017639e283d | pome-ta/pysta-raytracing | /210430_1824.py | UTF-8 | 1,756 | 2.625 | 3 | [
"MIT"
] | permissive | precision highp float;
uniform float u_time;
uniform vec2 u_sprite_size;
//uniform float u_scale;
uniform sampler2D u_texture;
//uniform vec4 u_tint_color;
//uniform vec4 u_fill_color;
varying vec2 v_tex_coord;
// https://qiita.com/doxas/items/477fda867da467116f8d
// とりあえず陰影つけてみっか!!!!
struct Ray {
vec3 origin; /... | true |
85d7109a71dc4a6da4beba0f8b1d5a61fd3e723c | ZaidanNur/PojectProjectan | /konversi_suhu1.py | UTF-8 | 2,826 | 3.5625 | 4 | [] | no_license | import os
def main():
print("\t\tKONVERSI SUHU\t")
print("Pilih Satuan Suhu Yang Akan Dikonversikan\n")
print("1.Celcius","\n2.Fahrenheit","\n3.Kelvin","\n4.Reamur")
def back_main():
inp_ganti = str(input("Pilih Satuan Lain ? (y/n)"))
if inp_ganti == "y" :
main()
inp_pilih... | true |
c7e61c04644e8ef1fae68bb03659fa257fc5841a | scztt/qpm | /qpmlib/endpoints/url.py | UTF-8 | 2,245 | 2.9375 | 3 | [
"ISC"
] | permissive | import urllib, re, tempfile, zipfile, tarfile, shutil, os
from base import EndpointBase
from glob import glob
class UrlEndpoint(EndpointBase):
types = ['http://', 'https://', 'ftp://']
extensions = ['tar', 'zip', 'json']
compressed_extensions = ['tar', 'zip']
pattern = '(?P<url>(?P<type>\w+://).*\.(?P... | true |
1987b544314f4d5f29949b55f569576994378d36 | b4ld/imageSender | /server.py | UTF-8 | 1,538 | 2.515625 | 3 | [] | no_license | #!flask/bin/python
import base64
from flask import Flask, jsonify
import asyncio
app = Flask(__name__)
# tasks = [
# {
# 'id': 1,
# 'title': u'Buy groceries',
# 'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
# 'done': False
# },
# {
# 'id': 2,
# 't... | true |
763addf9d89b0f497482fde8dc59d58c2cb6ac6f | paulhiv/B2-Python | /scripts/3a-save.py | UTF-8 | 1,514 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3
# Description: create a backup of a directory
# Author: Paul hivert
# Date: 11/11/2018
import datetime
import os
import sys
import shutil
from shutil import make_archive
import filecmp
import signal
def CreateBackup():
shutil.make_archive(_Create_ArchiveName, 'gztar', workingDirecto... | true |
1ff80968d6ef88994d0d1c5ed5655094501c8a97 | lee000000/leetcodePractice | /125.py | UTF-8 | 1,144 | 4.3125 | 4 | [] | no_license | '''
125. Valid Palindrome
Given a string, determine if it is a palindrome,
considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a palindrome.
Note:
Have you consider that the string might be empty? This is a
good question to... | true |
116d18fb491357e28f64db9e04bcb5516a09dae1 | ibrsam/pyiron_atomistics | /pyiron_atomistics/atomistics/structure/structurestorage.py | UTF-8 | 8,086 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | # coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
"""
Alternative structure container that stores them in flattened arrays.
"""
import numpy as np
from pyiron_base impo... | true |
488bf6192cfe9e4a378d0f3f3fb1ce5c71dab682 | YoupengLi/leetcode-sorting | /Solutions/0024_swapPairs.py | UTF-8 | 2,633 | 4.09375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/3/15 0015 07:49
# @Author : Youpeng Li
# @Site :
# @File : 0024_swapPairs.py
# @Software: PyCharm
'''
24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.
You may not modify the values in the list's nodes, only nod... | true |
a257c13f070072f53447365256f689294bd599d4 | jasonzhuyx/pyml | /ml/misc/grid.py | UTF-8 | 3,641 | 3.84375 | 4 | [
"GPL-3.0-only"
] | permissive | """
ml/misc/grid.py
"""
import copy
class Grid:
'''
Grid is an N x M grid of "alive" or "dead" grid cells.
A transformation on the input grid using the following rules:
- An "alive" cell remains alive if 2 or 3 neighbors are "alive";
otherwise, it becomes "dead."
- A "dead" cell becomes ali... | true |
c7c623024ea35e1736397f628c3296e77997d004 | ConnorNelson/ctf-league | /ctf_league.py | UTF-8 | 1,861 | 3.109375 | 3 | [] | no_license | import collections
import datetime
import requests
def ctftime_get(endpoint, params=None):
return requests.get(
"https://ctftime.org/api/v1" + endpoint,
params=params,
headers={"User-Agent": "definitely-not-requests"},
).json()
def ctftime_year_events(year):
return ctftime_get(
... | true |
1f010a7eed82c9090c00ee81b0179262fa97fdc4 | TinaHaitongWang/bme590hrm | /test_files/test_importData.py | UTF-8 | 1,953 | 2.90625 | 3 | [
"MIT"
] | permissive | from function_files.readCSV import importdata
import pytest
import pandas as pd
# compare the first row and last row of each csv file
test_data1 = pd.DataFrame(data={'time': [0, 27.775],
'voltage': [-0.145, 0.72]},
index=[0, 9999])
test_data5 = pd.DataFrame(dat... | true |
57be54f3d2aebcdd47f4926e7ba32541768786c4 | MuhammadAlzamily/the_height_calculator | /height_calculator.py | UTF-8 | 871 | 3.46875 | 3 | [
"MIT"
] | permissive | from tkinter import ttk, Tk, Frame, Label, Button
from tkinter.messagebox import showinfo, showerror
def showheight():
global height
if height.get():
showinfo(title="Results", message=f"Your height is {height.get()}")
else:
showerror(title="Empty Field", message="Text field can't be empty"... | true |
fa625a1636c97ada66b1e685f27a8290d820a7be | ysmintor/MLAlgorithm | /PythonPratice/practice30.py | UTF-8 | 192 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python3
import pandas as pd
import numpy as np
string_data = pd.Series(['aardvark', 'artichoke', np.nan, 'avocado'])
print(string_data)
string_data[0] = None
string_data.isnull() | true |
72976937899e14169e163a7701d27a314f1839b1 | tejasjoshi01/ProblemSolvingHackerrank-Python | /Counting_Valleys.py | UTF-8 | 256 | 3.1875 | 3 | [] | no_license |
v = int(input())
ud = input()
udint = []
count = 0
sum = 0
for i in range(v):
if "U" == ud[i]:
udint.append(1)
else:
udint.append(-1)
for i in range(v):
sum = sum + udint[i]
if sum == 0:
count+=1
print(count-1)
| true |
119af7c7057354994151a28b4c4e2a7e4da43e93 | xiaotwins/python-for-office | /需求3:Excel文件读取数据处理/example3_2.py | UTF-8 | 414 | 3.40625 | 3 | [
"MIT"
] | permissive | import openpyxl
# 读文件、读表
workFile = openpyxl.load_workbook("./resources/ex3_2/进楼登记.xlsx")
wb = workFile["体温表"]
feverList = []
# 遍历行数据
for rowData in wb.rows:
name = rowData[0].value
# 跳过表头
if name == "姓名":
continue
temperature = rowData[1].value
# 判断
if float(temperature) > 37:
... | true |
6456aac6fb7250f3baa1ed591c5b313b6e596960 | erynne/BetYourBimbo | /myBot.py | UTF-8 | 9,772 | 2.65625 | 3 | [] | no_license | import discord
import asyncio
from discord.ext import commands
import random
import pprint
import time
import sqlite3
from bimbotconfig import *
import game
import betyourbimbo as bimbo
description = '''Welcome to the Bimbonator 3001x! \nYou may use the following commands:'''
TEST = True
CMD_PREFIX = '!'
bot = co... | true |
ce458d7c71c930c3197e3f2fd4dc131782804389 | cjc77/HackerRankAI | /pac_man_astar.py | UTF-8 | 2,478 | 3.34375 | 3 | [] | no_license | # Method borrowed from Wikipedia [https://en.wikipedia.org/wiki/A*_search_algorithm]
from queue import PriorityQueue
from math import inf
WALL = '%'
# [UP, LEFT, RIGHT, DOWN]
moves = [(-1, 0), (0, -1), (0, 1), (1, 0)]
m = n = 0
def manhattan_est(p1, p):
return abs(p1[0] - p[0]) + abs(p1[1] - p[1])
def init_sc... | true |
d1558c3c45e4120cb3ac7aa2266a29fe4f437a72 | priya-gitTest/py-kerapu | /test/BulkTest.py | UTF-8 | 2,695 | 2.734375 | 3 | [
"MIT"
] | permissive | import csv
import glob
from unittest import TestCase
from kerapu.Kerapu import Kerapu
from kerapu.lbz.Subtraject import Subtraject
class BulkTest(TestCase):
"""
Bulk testen.
"""
# ------------------------------------------------------------------------------------------------------------------
d... | true |
72a2d4a2f5d4217f9301672126ee38f396bcaada | tsaiaditya/Leetcode | /BFS DFS/keys_rooms.py | UTF-8 | 1,132 | 3.640625 | 4 | [] | no_license | '''
There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.
Formally, each room i has a list of keys rooms[i], and each key rooms[i][j] is an integer in [0, 1, ..., N-1] where N = rooms.length. A key rooms[i][j] = v o... | true |
d7e513c9b93c5ec42abe3f0911d4ecf2ed10347f | Jomanw/tinder-react-native | /moviefindr/backend/models.py | UTF-8 | 1,075 | 2.65625 | 3 | [
"MIT"
] | permissive | from django.db import models
import django.contrib.admin
# Create your models here.
class Movie(models.Model):
title = models.CharField(max_length=200)
movieDbId = models.IntegerField()
description = models.TextField()
posterUrl = models.CharField(max_length=1000)
netflixOk = models.BooleanField()
... | true |
309d0cdf75e8987084c6e10af4aea120ce6fb29e | CS-Global-Student-Challenge/challenge-models | /Models-Malay.py | UTF-8 | 2,474 | 3.15625 | 3 | [] | no_license | # Modals
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestRegressor, AdaBoostClassifier
# Test train split
from sklearn.model_selection import train_test_... | true |
3c3bbd5bd8cc6743bfce389a0cefc59b3c07d85d | niguang-arrow/DownMak | /Cpp/Algorithm/MachineLearning/code/6-pca.py | UTF-8 | 4,084 | 3.5 | 4 | [] | no_license | #_*_ coding:utf-8 _*_
"""
PCA: 主成分分析, 最大化样本之间的方差, 使用梯度上升法求解
PCA 不能使用 StandardScaler 对数据标准化, 否则方差就为 1
"""
import numpy as np
import matplotlib.pyplot as plt
X = np.empty((100, 2))
X[:, 0] = np.random.uniform(0., 100., size=len(X))
X[:, 1] = 0.75 * X[:, 0] + 3. + np.random.normal(0., 10., size=len(X))
# plt.figure()
... | true |
c195b4ddce7d7f21c4a0ec7266f27988ce5e8f0e | cloelius/StructureHomework | /Project 1/psuedospin.py | UTF-8 | 7,097 | 2.59375 | 3 | [] | no_license | import numpy as np
import sympy
import scipy.special
def printlatex(a):
return " \\\\\n".join([" & ".join(map('{0:.2f}'.format, line)) for line in a])
def commutator(x,y):
return x.dot(y)-y.dot(x)
class Hamiltonian:
H=0
W=0
V=0
epsilon=0
Jms=0
H0=0
H1=0... | true |
4f1cafcab987357bd69b5efb9352c088d151cf90 | supercomputra/pyground | /control_flow.py | UTF-8 | 693 | 4.34375 | 4 | [] | no_license | string = "hello"
nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
def print_characters_in_string(string):
for character in string:
print(character)
def print_numbers_in_list(numbers):
for number in numbers:
print(2 ** numbers)
# this should execute with python3 intrepreter
def print_numbers_from_inpu... | true |
d2e80807c2e59fc8c1e2f7f555db6583296988df | BIT-ENGD/lstm | /bilstm_att_ori.py | UTF-8 | 3,134 | 3.046875 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
dtype = torch.FloatTensor
embedding_dim = 3
n_hidden = 5
num_classes = 2 # 0 or 1
sentences = ["i love you", "he loves me", "she likes baseball", "i hate you"... | true |
ee1508e98852e2e1fcc7866ab66e169f48323661 | Joebreda/covid-mobility-analysis | /DTW/DTW.py | UTF-8 | 5,158 | 2.53125 | 3 | [] | no_license | import numpy as np
import csv
from numpy import linalg as LA
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter, freqz
from dtw import *
from scipy import stats
from dtaidistance import dtw as dtw_visualize
from dtaidistance import dtw_visualisation as dtwvis
def moving_average(data, n=7) :
r... | true |
ae48f6bfeff56e8a0d2cecf5bcdd1d056059e731 | wilsonn/PythonBasico | /EjerciciosEstructurasSeleccion/MenorCuatroNumero.py | UTF-8 | 850 | 4.0625 | 4 | [] | no_license | print("##### Menor de Cuatro numeros #####")
num1 = float(input("Ingresar primer numero"))
num2 = float(input("Ingresar segundo numero"))
num3 = float(input("Ingresar tercer numero"))
num4 = float(input("Ingresar cuarto numero"))
if num1 < num2:
if num1 < num3:
if num1 < num4:
print("El numero... | true |
6be6588fd35643d2da60d7f54f4fc75c644e7e0f | nephraim/e-mission-server | /emission/analysis/modelling/tour_model/similarity.py | UTF-8 | 6,449 | 3.375 | 3 | [
"BSD-3-Clause"
] | permissive | # Standard imports
import math
import matplotlib.pyplot as plt
import numpy
from sklearn import metrics
from sklearn.metrics.cluster import homogeneity_score, completeness_score
"""
This class organizes data into bins by similarity. It then orders the bins
by largest to smallest and removes the bottom portion of the ... | true |
e8f31a465fbe2605ec890aeb81c008378ee0066a | karawoo/dcc-survey | /main.py | UTF-8 | 984 | 2.71875 | 3 | [] | no_license | from flask import Flask, render_template, request
import json
import datetime
import os
app = Flask(__name__)
@app.route('/')
def show_survey():
"""Show the main survey page"""
return render_template('index.html')
@app.route('/submit', methods=['POST'])
def submit():
"""
Write out data to a JSON file ... | true |
112840129ccac08ba6a6aa32e67dc578a32376ae | isaaccormack/huffman_coding | /util/replace_non_ascii_chars.py | UTF-8 | 547 | 3.140625 | 3 | [] | no_license | import sys
curr_ascii = 48
with open(sys.argv[1], 'r') as fileobj:
f = open(sys.argv[1] + "_clean.txt", "w")
for line in fileobj:
for ch in line:
if ord(ch) < 0 or ord(ch) > 127:
# write a standard distribution of ascii chars
f.write(chr(curr_ascii))
... | true |
7a101b1b034f13be52812cb62eea25e4d0e56707 | AstroEWill/AdventOfCode2020 | /AOC_Day3.py | UTF-8 | 637 | 3.5625 | 4 | [] | no_license | dataFile = open("AOC_Day3.txt")
splitInfo = dataFile.read().split("\n")
def tobogganSlope(slopeX, slopeY):
for i in range(0, len(splitInfo)):
x = 0
y = 0
treeCount = 0
while (y <= len(splitInfo) - (slopeY + 1)):
x += slopeX
y += slopeY
... | true |
45a5975c0608dc65e833cdbefa1fbb87529a8ebb | jpgeiger6789/project-euler | /python files/id41.py | UTF-8 | 1,432 | 3.28125 | 3 | [] | no_license | #id41.py
#This program finds the largest n-pandigital prime
from math import sqrt
from random import randrange
from random import randint
from primetest import isprime
flist = []
blist = [9, 8, 7, 6, 5, 4, 3, 2, 1]
tflist = flist
tblist = blist
def ID41(backlist, frontlist):
backlength = len(backlist)
fron... | true |
ce6b269d4335ae8abf9b6112feabe8b44691cbb3 | ishan-modi/Cryptography-algorithms | /algorithm-python/railfencecipher.py | UTF-8 | 2,030 | 3.03125 | 3 | [
"MIT"
] | permissive | from numpy import *
def encrypt():
cnt=0
j=0
for i in range(len(plaintext)):
if(cnt%2==0):
m[j,i]=plaintext[i]
j+=1
if(j==depth-1):
cnt+=1
continue
else:
m[j,i]=plaintext[i]
... | true |
343a693a0529fc3d6d8800c3304522d07b0d7203 | Aasthaengg/IBMdataset | /Python_codes/p03139/s272499537.py | UTF-8 | 105 | 2.6875 | 3 | [] | no_license | n,a,b = map(int,input().split())
max_ans = min(a,b)
min_ans = max(0, (a + b) - n)
print(max_ans, min_ans) | true |
e942912988a04547e59f9082fdef27259c66f159 | iskandarumidov/CompetitiveProgramming | /codeforces/contests/timur/stack/main.py | UTF-8 | 901 | 2.71875 | 3 | [] | no_license | from collections import deque
n = int(input())
clients = []
for i in range(n):
clients.append(list(map(int, input().split())))
clients[i] = [clients[i][0]*60+clients[i][1], clients[i][2], i]
# print(clients)
def minToHour(mins):
h = mins // 60
mins = mins % 60
return [h, mins]
def solve(clients):
qu... | true |
9b9a2899c6092639efcbf160576c47a7dc03bd8d | TheInfamousWayne/Stock-Price-Prediction | /senti.py | UTF-8 | 2,857 | 2.6875 | 3 | [] | no_license | import nltk
from nltk.corpus import stopwords
from nltk.parse.stanford import StanfordDependencyParser
import os
import networkx as nx
from textblob import TextBlob
java_path = "C:/Program Files/Java/jdk1.8.0_111/bin/java.exe"
os.environ['JAVAHOME'] = java_path
path_to_jar = 'D:/Python Codes/Sentdex/stanford-corenlp-... | true |
9001b4220314ffdef739afc53a8019e8193adce2 | dogestoyevsky/ExceptionalPlanePartitions | /symbolic_poset_functions.py | UTF-8 | 5,552 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 1 14:55:10 2017
@author: hollymandel
"""
from sympy import *
import numpy as np
import math as math
from IPython import embed
# want tableau-describing input to be array of multiplicities
def rushShiSymbolic(ord,tableauIn):
# ord is the order ... | true |
f5ebfb72bfeb3db65575a5d8a6d994fd316531bf | mbruzek/codechef | /FLOW018/python/small_factorial.py | UTF-8 | 344 | 3.65625 | 4 | [] | no_license | #!/bin/env python
import sys
def factorial(n):
"""Return the factorial value of the parameter n."""
fact = 1
# range(4, 1, -1) = [4, 3, 2]
for x in range(n, 1, -1):
fact *= x
return fact
lines = sys.stdin.readline()
for x in range(0, int(lines)):
line = sys.stdin.readline()
prin... | true |
0f0e18fcf60206f501e2b1d5bb28383771838c3c | castri1/reserve-estimating | /Models/mack_model.py | UTF-8 | 12,655 | 3.25 | 3 | [] | no_license | # coding: utf-8
import numpy as np
from Utils import get_matrix_dimensions, gen_standard_output, fj, vco_matrix, \
xijs_from_cijs, standard_triangle_check, prod, prediction_error, sigma_square, \
scale_triangle
def estimate_cij(triangle, fjs_, i, j):
"""
Estimador de :math:`C_{i, j}` interpretado co... | true |
bb9ff4f81aa2f3e76d38766cea3ab294455fbf76 | lanyecheng/alien_invasion | /game_stats.py | UTF-8 | 676 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:albert time:2019/12/21
class GameStats:
"""跟踪游戏的统计信息"""
def __init__(self, ai_settings):
self.ai_settings = ai_settings
self.game_active = False
self.reset_stats()
self.open_file_higt()
def reset_stats(self):
"... | true |
0dbd0053cc28d50f6bc887f96ed6baeab679be91 | Near-River/ml_note | /bayes_classifier/naive_bayes_classifier.py | UTF-8 | 3,034 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
# coding=utf-8
"""
朴素贝叶斯分类器(使用拉普拉斯修正):西瓜数据集3.0
"""
import numpy as np
import pandas as pd
from math import sqrt, exp, pow, pi
csv_file = '../decision_tree/watermelon3.0.csv'
def load_data():
df = pd.read_csv(csv_file, encoding="utf-8")
dataset = df.values[:, 1:]
return dataset
d... | true |
097607719feaf1959beb92f9c9bf82bf5ed4a065 | vijayantyadav11/codeproject | /IB/FastTrackCourses/Python/Level4_set-operations.py | UTF-8 | 877 | 3.34375 | 3 | [] | no_license |
def printset(setx):
li = list(setx)
li.sort()
print(li)
def main():
# Below are the three sets
X = set([1, 3, 7, 5, 6, 10, 20, 21, 22, 23, 55, 51, 2, 19, 9, 17, 27, 26, 25, 35])
Y = set([2, 10, 13, 18, 17, 22, 28, 27, 5, 49, 46, 43, 3])
Z = set([21, 1, 32, 25, 12, 11, 8,... | true |
7e76fe26c756def22b1b8942568184590e27d762 | Maksymilianx/Interview_exercises | /Junior_exercises/Codility_test_exercise_1.py | UTF-8 | 600 | 3.125 | 3 | [] | no_license | def solution(A):
"""
:param A: an undefined list of zeros and ones
:return: catches how many 0 should equal 1 or 1 should equal 0 to sort list in [0,1,0,1] or [1,0,1,0,1,0] order.
"""
x = 0
k = 0
for i in A:
if i != k:
x += 1
if k == 0:
k = 1
e... | true |
39a5def10d0ed80a190108f42f16b38c5edbe06f | yacmeno/roles-classification | /get_player_matches.py | UTF-8 | 747 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3
"""
Script to retrieve the 100 latest captain's draft matches (IDs) from specific players
"""
import sys
import requests
# api request for specific player
# use from terminal as "./get_player_matches player_id" (see get_matches_files.sh)
player_id = sys.argv[1]
url = 'https://api.opendota.com/api/... | true |
f67dd5e7f4a54a86642cc9fccac2076e609f6617 | quietsos/Python_course | /loop_in_python/atm.py | UTF-8 | 2,373 | 3.546875 | 4 | [] | no_license | print('Welcome to ATM')
restart=('y')
chances = 3
balance = 100
while chances >= 0:
pin = input('Please enter your 4 digit pin: ')
if pin == ('1234'):
print('You entered your pin correctly\n')
while restart not in ('n'):
print('Please press 1 for your balance\n')
print('... | true |
d968c4abbd1ece3c2c7c3394f0234a1eea31473c | ConnorJensen1296/Spatial-Decision-Support-Tools | /app.py | UTF-8 | 1,315 | 2.828125 | 3 | [] | no_license | from flask import Flask, render_template, request, jsonify
import requests
import pandas as pd
app = Flask(__name__)
class DataStore():
place_id = None
data = DataStore()
@app.route("/",)
def home():
return render_template("home.html")
@app.route('/origin_data', methods = ['POST', 'GET'])
def get_origin()... | true |
ed50ec8e97639b3fa915ab6e6e3d16c59088badb | formeo/checkio_tasks | /TheMostWantedLetter.py | UTF-8 | 351 | 2.828125 | 3 | [
"MIT"
] | permissive | def checkio(text):
d = dict()
for c in text.lower():
if c.isalpha():
if ord(c) not in d:
d[ord(c)] = 1
else:
d[ord(c)] += 1
l = list(d.keys())
l.sort()
p=d[l[0]]
s = chr(l[0])
for i in l:
if d[i] > p:
p= d[i]
... | true |
ddccfecb81c0e43beeeb4a6c1263c291e8d6430e | AsbjornOlling/oshit | /oshit/config.py | UTF-8 | 6,578 | 3.03125 | 3 | [
"WTFPL"
] | permissive | # standard imports
import argparse
import collections # for abstract base classes
import os
# external imports
import configparser
class Config(collections.MutableMapping):
""" Class that reads and holds configuration.
Uses argparser to read cli options,
and configparser to read from .ini file.
Inhe... | true |
c148b36aae524cb1b8b0248f10dc2e6ed03f3a91 | EdSwordsmith/ExerciciosFP | /cap4/exe10.py | UTF-8 | 477 | 3.328125 | 3 | [] | no_license | def codifica(texto):
par = ""
impar = ""
for i in range(len(texto)):
if i % 2 == 0:
par = par + texto[i]
else:
impar = impar + texto[i]
return par + impar
def descodifica(texto):
par = texto[:round(len(texto)/2)]
impar = texto[round(len(texto)/2):]
... | true |
0e0a0f582111d302b7ad1d39a75c4da89135b3ce | aks1804/ComputerNetworks_Lab | /Socket Programming/Week 3/Question 2/server.py | UTF-8 | 870 | 3.1875 | 3 | [] | no_license | import socket
def myfunc(e):
return len(e)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = socket.gethostname()
PORT = 2468
s.bind((HOST, PORT))
s.listen(5)
clientsocket, address = s.accept()
strings = []
while True:
string = clientsocket.recv(1024).decode("utf-8")
p... | true |
aca9ba1060640cb925d9b78af2ea1b7d6b98e443 | jeroenseegers/git-history | /git_history.py | UTF-8 | 1,288 | 2.65625 | 3 | [
"MIT"
] | permissive | import os
import subprocess
import sys
__version__ = '0.0.1'
__author__ = 'Jeroen Seegers'
__license__ = 'MIT'
HOME_DIR = os.path.expanduser('~')
HISTORY_FILE = HOME_DIR + '/.git-history.log'
def ensure_history_file():
"""Ensure the history file exists"""
if not os.path.isfile(HISTORY_FILE) and os.access(... | true |
3cb797e0c9f3ceb1d0a49195dab84e3909eff6e9 | paulinapmk/ML-project | /comparator.py | UTF-8 | 4,967 | 2.984375 | 3 | [
"MIT"
] | permissive | from __future__ import division
import collections
import re
from sklearn.metrics import precision_score, accuracy_score, recall_score
## alphabet_structure: List containing SSP secondary structure symbols
alphabet_structure = ['C', 'H', 'E', 'T']
## alphabet_proteins: List containing aminoacid IUPAC symbols
alphabet_... | true |
cd4420acf3c80aa79cef0730c1e5d83db995663c | Roolthasiva/MD_Analysis_Scripts | /src/calc/crystallinity.py | UTF-8 | 5,116 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A module to calculate the degree of crystallinity of a structure.
The degree of crystallinity is calculated by seeing how far (as a percentage)
a structure's density is from the crystal or amorphous density.
"""
import numpy as np
from src.calc import general_calc as... | true |
6472c1a3da57dcc89d168e7dd686cf03562eb30e | mkioga/43_python_Comprehensions | /nestedchallenge.py | UTF-8 | 4,661 | 4.3125 | 4 | [] | no_license |
# ======================
# nestedchallenge.py
# ======================
# In an earlier lesson, we used a "for loop" to print the times table, for values from 1 to 10.
# We used a nested loop shown below.
for i in range(1, 5):
for j in range(1, 5):
print("i = {}: j = {}: i x j = {}".format(i, j, i * j))
p... | true |
a2aedfb4ab736b6e1031ae7419d02a02c04ca57a | razzlestorm/Project_Balance | /framework.py | UTF-8 | 761 | 2.984375 | 3 | [
"MIT"
] | permissive | "Stay informed, but stay sane"
News app uses sentiment analysis to ensure that people don't read too much negative news without reading positive news.
Uses topic modeling to divide into major categories, and then further into subcategories
No navigation, just browsing
adjust weights for suggestions between postive/ne... | true |
306c8f7f32d9d8bc3d5128e7f068c7581458d5c8 | nandhu321/guvi | /smallestnumer.py | UTF-8 | 173 | 3.140625 | 3 | [] | no_license | m,n=map(int,input().split())
if(m>n):
if(m%n==0):
print(n)
elif(n>m):
if(n%m==0):
print(m)
else:
print(m)
if(m%n!=0 and n%m!=0):
print(m*n)
| true |
1e3cc6abb832ddaf2a878c61187613173faf67b6 | henrylin2008/Coding_Problems | /DailyCoding/shiftedArraySearch.py | UTF-8 | 2,778 | 4.40625 | 4 | [] | no_license | # Daily Coding Problem #58
# Problem
# This problem was asked by Amazon.
#
# An sorted array of integers was rotated an unknown number of times.
#
# Given such an array, find the index of the element in the array in faster than linear time. If the element doesn't
# exist in the array, return null.
#
# For example, give... | true |
a0e328e1470900f574e04203a9670fcd99d9ff21 | mattlynley/Metarating | /pythonpractice/isprime.py | UTF-8 | 398 | 4.21875 | 4 | [] | no_license |
getprime = input("Enter a number: ")
def divisors(divisor):
divides = False
for i in range(2,divisor):
if divisor % i == 0:
divides = True
return(divides)
def isprime(num):
prime = ""
if divisors(num) == True:
prime = "Not a prime number"
else:
prime = "Prime number"
if num == 1 or num == 2:
... | true |
3a82843558a11b4063b57d8edad46ae730799811 | freshines/script | /mapred/reducer.py | UTF-8 | 280 | 2.671875 | 3 | [] | no_license | import sys
last=''
lastv=''
for line in sys.stdin:
x = line.strip().split('\t')
if last==x[0]:
if lastv != '':
print "%s\t%s" % (lastv, last)
lastv=''
print "%s\t%s" % (x[1], x[0])
else:
last = x[0]
lastv = x[1]
| true |
d4befd343c5510be171824c59f9b1795d5c3ff40 | noone1234567/rest | /solution-1.py | UTF-8 | 1,561 | 2.578125 | 3 | [] | no_license | from flask_restful import reqparse, abort, Api, Resource
from flask import Flask, jsonify, make_response
from DBManager import *
app = Flask(__name__)
api = Api(app)
db = DB()
parser = reqparse.RequestParser()
parser.add_argument('title', required=True)
parser.add_argument('content', required=True)
parser.... | true |
7831f6224f15c5ba3fa9a02f0beb4a05673e289c | DhaneshShetty/GestureControlOnMSTeams | /main.py | UTF-8 | 878 | 2.5625 | 3 | [] | no_license | import handmodule as htm
import cv2
import pyautogui
video = cv2.VideoCapture(0)
detector = htm.HandDetector()
mute = False
while True:
success, img = video.read()
image = detector.drawHands(img)
positions = detector.findPosition(img)
if len(positions) > 0:
if abs(positions[8][1] - positions[4... | true |
348f5f1339e6623aa1469e91026c571c9deb10f3 | zwelinhtet129/PythonSampleB | /OpenCV/py_colorspace.py | UTF-8 | 627 | 2.6875 | 3 | [] | no_license | import cv2 as cv
import numpy as np
cap = cv.VideoCapture(0)
while(1):
# Take each frame
_, frame = cap.read()
# Convert BGR to HSV
hsv = cv.cvtColor(frame, cv.COLOR_BGR2HSV)
# define range of blue color in HSV
lower_blue = np.array([44,54,63])
upper_blue = np.array([71,255,255])
#Threshold the HSV image... | true |
e14a4b967e0a23aa0fec56f808177e9e887c89de | damiano96/NumericalMethodsUJCourse | /N8/raylegih_method.py | UTF-8 | 715 | 3.046875 | 3 | [] | no_license | import numpy as np
e = 1e-8
def rayleigh(A):
vectors_b = [np.array([1.0, 0.0, 0.0]), np.array([0.0, 1.0, 0.0]), np.array([0.0, 0.0, 1.0])]
eigenvalues = []
for b in vectors_b:
l_new = np.dot(b.T, np.dot(A, b))
while True:
l_old = l_new
w = np.linalg.sol... | true |
ea030929c2a8cd8ea6606dd00f23556b8b3400b0 | daniel-reich/turbo-robot | /gdzS7pXsPexY8j4A3_6.py | UTF-8 | 778 | 4.1875 | 4 | [] | no_license | """
Create a function that takes in a list of integers and returns the number of
even or odd digits for each number, depending on the parameter.
### Examples
count_digits([22, 53, 99, 61, 777, 8], "odd") ➞ [0, 2, 2, 1, 3, 0]
count_digits([22, 53, 99, 61, 777, 8], "even") ➞ [2, 0, 0, 1, 0, 1]
... | true |
6a135e6609609c11da5b1690f9baa9db1dcef4f8 | YanaZharova/Progect1 | /post edit 000.py | WINDOWS-1251 | 1,641 | 2.796875 | 3 | [] | no_license | import csv
import os
G = {}
Names = []
all_authors = set()
with open(" MATERIALS SCIENCE MULTIDISCIPLINARY 2016.csv") as r_file:
file = csv.DictReader(r_file, delimiter = ";")
for item in file:
if item[''] != '':
if item[''] == '[]':
authors = ['Nobody']
... | true |
d6266feefc047dbca4e12cd6c4c6187cc336feff | aiifabbf/leetcode-memo | /735.py | UTF-8 | 1,014 | 3.28125 | 3 | [] | no_license | from typing import *
class Solution:
def asteroidCollision(self, asteroids: List[int]) -> List[int]:
if not asteroids:
return []
stack = [asteroids.pop(0)]
while asteroids:
asteroid = asteroids.pop(0)
if stack:
if asteroid * stack[-1] > 0:... | true |
cae6bcf46ab021af8d95bea7ae287b29623f71ce | dkoes/md-scripts | /diversemdselect.py | UTF-8 | 2,641 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import MDAnalysis, argparse
from MDAnalysis.analysis.rms import rmsd
import MDAnalysis.analysis
import os
from os.path import splitext, basename
#This finds the most distinct set of frames. Does not perform alignment, just rmsd.
def compute_cluster_sizes(current, model, selection):
"""Given a... | true |
0dcb331d37c3a58e9b6042491955ec4084573553 | tomoya1997/recRestourant | /home.py | UTF-8 | 420 | 2.6875 | 3 | [] | no_license | import package.roboko_package.roboko as Roboko
import package.csv_file.csv as csv_file
roboko = Roboko.Roboko()
csv_file = csv_file.Csv()
# 挨拶
roboko.greet()
# オススメ
if csv_file.exist:
restaurants = csv_file.populerRestaurants()
roboko.suggest(restaurants)
# 質問(レストラン)
roboko.ask()
# csvへの書き込み
csv_file.write(ro... | true |
8099f0fd86f0a862f34560b57439fc981e1e9518 | rahmankashfia/hello-world | /analyze.py | UTF-8 | 289 | 3.640625 | 4 | [] | no_license |
def add_space(x):
print("start")
txt = "Hello World"
y = len(txt)
for z in range(y, 0, -1):
print("-----------------------------------------------")
for x in range(0, z):
print("txt[{}:{}] {}".format(x, z, txt[x:z]))
print("this is txt[3:3] \"{}\" ".format(txt[3:3]))
| true |
953d0388005f3736cea595609acad43d4aa1200e | yaronin/DevOps_Course | /MemoryGame.py | UTF-8 | 1,632 | 4.625 | 5 | [] | no_license | # The purpose of memory game is to display an amount of random numbers to the users for 0.7
# seconds and then prompt them from the user for the numbers that he remember. If he was right
# with all the numbers the user will win otherwise he will lose
import random
import os
from time import sleep
# Will gene... | true |
e993c3773cb812c56b65f6485d4cf54ebc7b9643 | adelabuhashim/Let-the-blind-see | /project.py | UTF-8 | 1,396 | 2.53125 | 3 | [] | no_license | from imageai.Detection import ObjectDetection
import os
import cv2
import pyttsx3
import engineio
engineio = pyttsx3.init()
voices = engineio.getProperty('voices')
engineio.setProperty('rate', 150)
engineio.setProperty('voice',voices[0].id)
def speak(text):
engineio.say(text)
engineio.runAndWait(... | true |
d21088efd0d5eb0deb668129fdca11f1e05a4cd0 | LEUNGUU/data-structure-algorithms-python | /Recursion/linear_sum.py | UTF-8 | 290 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def linear_sum(S, n):
"""Return the sum of the first n numbers of sequence S"""
if n == 0:
return 0
else:
return linear_sum(S, n - 1) + S[n - 1]
if __name__ == "__main__":
print(linear_sum([1, 2, 3, 4], 3))
| true |
ca1128672b715408c9f29e780de52b851459b869 | SudheerBabuGitHub/AOC2019 | /Day13.py | UTF-8 | 11,214 | 2.609375 | 3 | [] | no_license | import numpy as np
import pygame
import sys
class Intcode:
def __init__(self, seq):
self.sequence = seq
self.input_val = 0
self.output_val = 0
self.waitonip = True
self.waitonop = True
self.state = 0
#0-init
#1-waiting on imput
#2-waiting on output
#3-complet... | true |
152da14801fb61252ec3a8319f64f856eca861c8 | modhamankar/pythonbutton | /disable button.py | UTF-8 | 424 | 2.9375 | 3 | [] | no_license | from tkinter import *
root = Tk()
var=StringVar()
def check():
a=e1.get()
if(a)=="meena":
b1.configure(state="active")
else:
print("no")
b1.configure(state="disabled")
l1=Label(root,text="Enter name")
l1.pack()
e1=Entry(root,textvariable=var)
a=e1.get()
e1.pack()
b1=Button(root,text... | true |
20ff6bdb95c3eae95b8e453cbbb69a8c847a5550 | AnastasiaShad/Echo-server | /main_client.py | UTF-8 | 4,366 | 3.046875 | 3 | [] | no_license | import socket, getpass, re
# Значение по-умолчанию
HOST = '127.0.0.1'
PORT = 65333
# проверяем данные ip, port
def check_inf(ip, port):
try:
ip = ip.group() if ip else HOST
port = int(port) if port != '' else PORT
port = port if -1 < port < 65537 else PORT
return ip... | true |
0fda652a0771e57d8000a9c82fb475b38e41d668 | carlFandino/pytkanim-1.0.1 | /pytkanim/__init__.py | UTF-8 | 2,972 | 2.90625 | 3 | [
"MIT"
] | permissive | # PyTkAnim : Animator for Tkinter GUI module.
# Copyright (c) 2021 Carl Fandino
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation th... | true |
8ccbd64015712d9a9110b8c8b499a838e0039187 | pranavmswamy/leetcode | /implementPrefixTreeTrie.py | UTF-8 | 2,924 | 4.125 | 4 | [] | no_license | class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.end = False
self.trie = list()
def insert(self, word: str) -> None:
"""
Inserts a word into the trie.
"""
cur_trie = self
# iterat... | true |
b1a239b5631f74c7f2dffb4c0d4a6fccf060d852 | gamebusterz/ud120-projects | /datasets_questions/explore_enron_data.py | UTF-8 | 1,633 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python
from __future__ import division
"""
Starter code for exploring the Enron dataset (emails + finances);
loads up the dataset (pickled dict of dicts).
The dataset has the form:
enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"] = { features_dict }
{features_dict} is a dictionary of feat... | true |
16e13aa695ce9ce7f36d1b477c375b917868e679 | TheTechnicianGuy/flashcard-squared | /main_edit.py | UTF-8 | 1,997 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import os
from tkinter import *
from tkinter import simpledialog, filedialog, messagebox
global newWindow
newWindow = Tk() # create another Tk instance
print("Window opened.")
def addWord():
print("Add Word Pressed")
exec(open("saveDialog_addWord.py").read())
def changeDefinition():
print("Change Def... | true |