blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b362bf956d6d3dbc9af0d32514ab0c1aaec61faa | Python | Dwyanepeng/leetcode | /qianxu_144.py | UTF-8 | 1,813 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/7/29 18:56
# @Site :
# @File : qianxu_144.py
# @Software: PyCharm
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
#前序
class Solution(o... | true |
b507ae447b683ff3cf3e97c02832297066a5b390 | Python | Aasthaengg/IBMdataset | /Python_codes/p03862/s133133737.py | UTF-8 | 326 | 3.09375 | 3 | [] | no_license | import sys
def LI():
return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
N,x = LI()
a = LI()
ans = 0
# 左から2番目以降貪欲に
if a[0] > x:
ans += a[0]-x
a[0] = x
for i in range(1,N):
if a[i]+a[i-1] > x:
ans += a[i]+a[i-1]-x
a[i] -= a[i]+a[i-1]-x
print(ans) | true |
f09cbab959e97d4ceae492c80a9c342dacb1221c | Python | alexcamero/name-projects | /Name Clusters/python files/investigation_time_series.py | UTF-8 | 9,284 | 3.09375 | 3 | [] | no_license |
import matplotlib.pyplot as plt
import os, json, csv, requests
import numpy as np
from bs4 import BeautifulSoup as bs
from sklearn.cluster import KMeans
def scrape_totals(
write_to_directory = '../json files/',
url = "https://www.ssa.gov/OACT/babynames/numberUSbirths.html",
headers = {'User-A... | true |
820fb4dd8bb20294d9970fa244dd3e801c7f416f | Python | liamgak/graduating_proj | /parse_dataset_file.py | UTF-8 | 4,112 | 2.90625 | 3 | [] | no_license | class ParseDatasetFile():
file_name="" #file_path
file_name_csv=""
__file_one_hop_friend="GowallaAmerica_LvOneFri.csv"
__file_two_hop_friend="GowallaAmerica_LvTwoFri.csv"
exac_two_hop_friends_list=dict()
one_hop_friends_list=dict()
def __init__(self, file_one_hop_friend="BrightkiteE... | true |
3d8e16a1295d35f04a4867cb9bf8a003bfe4a64e | Python | linhx13/leetcode-code | /code/794-valid-tic-tac-toe-state.py | UTF-8 | 1,985 | 3.375 | 3 | [] | no_license | from typing import List
class Solution:
def validTicTacToe(self, board: List[str]) -> bool:
cnt1, cnt2 = 0, 0
rows = [0, 0, 0]
cols = [0, 0, 0]
xrow, xcol, xdia = 0, 0, 0
orow, ocol, odia = 0, 0, 0
for x, row in enumerate(board):
for y, c in enumerate(ro... | true |
48699e8e37181eedbee42f40070d8f6c148a6059 | Python | manishbalyan/python | /User_Input.py | UTF-8 | 86 | 2.984375 | 3 | [] | no_license | response = raw_input("Hey,How are you")
response = response.lower()
print response
| true |
d65e03047b363091f1285ecfc179f62a877ff034 | Python | zNIKK/Exercicios-Python | /Python_3/DEF/MÓDULOS/Moedas/programa -- Exercitando módulos em Python.py | UTF-8 | 217 | 3.078125 | 3 | [
"MIT"
] | permissive | import calculo as cal
pre=float(input('Digite um preço: R$'))
print(f'A metade de R${pre} é {cal.metade(p):.2f}')
print(f'O dobro de R${pre} é {cal.dob(p):.2f}')
print(f'Aumentando 10%, temos {cal.porc(p,10):.2f}') | true |
876c045623d9fcbf7949806698a2fdafe46cb444 | Python | glue-viz/glue | /glue/core/tests/test_data_retrieval.py | UTF-8 | 1,091 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | # pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
import numpy as np
from ..data import Data, Component
class TestDataRetrieval(object):
def setup_method(self, method):
data1 = Data()
comp1 = Component(np.arange(5))
id1 = data1.add_component(comp1, 'comp_1')
comp2 = Compone... | true |
a904662a56477598ec104e04f497ab27c05dbdac | Python | tberhanu/RevisionS | /revision/3.py | UTF-8 | 680 | 3.96875 | 4 | [] | no_license | """ 3. Get n largest/smallest elts of the array of dicts
"""
import heapq
arr_dicts = [{"name": "John", "age": 23, "city": "Oakland", "state": "CA"},
{"name": "Mary", "age": 33, "city": "San Jose", "state": "CA"},
{"name": "Henock", "age": 27, "city": "Las Vegas", "state": "NV"},
{"name": "James", "age": 19, "city": "S... | true |
68491f157665365d1d2026b4368aff2241746357 | Python | iefuzzer/vnpy_crypto | /vnpy/data/huobi/huobi_data.py | UTF-8 | 7,824 | 2.625 | 3 | [
"MIT"
] | permissive | # encoding: UTF-8
# 从huobi载数据
from datetime import datetime, timezone
import sys
import requests
import execjs
import traceback
from vnpy.trader.app.ctaStrategy.ctaBase import CtaBarData, CtaTickData
from vnpy.trader.vtFunction import systemSymbolToVnSymbol
period_list = ['1min','3min','5min','15min','30min','1day','... | true |
e014a1d05993482f9689fca32cfd7984098c4054 | Python | JayJayDee/python-lecture-examples | /002/dictionary_basics.py | UTF-8 | 161 | 3.21875 | 3 | [] | no_license |
product = {
'name': '딸기',
'price': 8000
}
product_name = product['name']
print(product_name)
product_price = product['price']
print(product_price) | true |
0281d241a38682c5d2347f2f841500804ccd9588 | Python | noureddined/AdventOfCode2016 | /day-6/day6-1.py | UTF-8 | 1,414 | 3.234375 | 3 | [] | no_license | #!/usr/bin/python3
import re
import string
import pprint
from collections import Counter
file = open("input.txt", 'r')
lines = file.readlines()
file.close()
totaal = ''
for line in lines:
s = line
s = " ".join(s)
s= s.replace('\n','')
totaal = totaal +'\n'+ s
totaal = "\n".join(totaal.split("\n")[1:]... | true |
0c221f171e3efbbd5579f0c8518678dff9d68640 | Python | 4179e1/misc | /python/pygame/ch4/allcolor.py | UTF-8 | 403 | 2.984375 | 3 | [] | no_license | import pygame
pygame.init()
screen = pygame.display.set_mode ((640,480))
all_colors = pygame.Surface((4096, 4096), depth=24)
for r in xrange(256):
print r+1, "out of 256"
# x = (r&15) * 256
x = (r % 16) * 256
y = (r>>4) * 256
print x, y
for g in xrange(256):
for b in xrange(256):
all_colors.... | true |
e8ffe13881fc463d25a3271dd230a74dede894d5 | Python | YannChye/web-scraping-challenge | /Missions_to_Mars/scrape_mars.py | UTF-8 | 3,163 | 2.84375 | 3 | [] | no_license | # setup and import dependencies
from splinter import Browser
from bs4 import BeautifulSoup as bs
import pandas as pd
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager
def init_browser():
executable_path={"executable_path":ChromeDriverManager().install()}
return Browser("chrome",**... | true |
6db427a72d40e1ad982db2bd6f95155adc35167e | Python | DennisGordic/Chapter_6 | /Challenge_6_3.py | UTF-8 | 1,423 | 4.375 | 4 | [
"Unlicense"
] | permissive | #Challenge_6_3
#11/24/2014
#Dennis Gordick
def main():
# Guess My Number
#
# The computer picks a random number between 1 and 100
# The player tries to guess it and the computer lets
# the player know if the guess is too high, too low
# or right on the money
import random
def ask_nu... | true |
f2ccc57b0cf46cdf754c2b536cfcb3fd5d26ca05 | Python | casiarobot/motionPlanning | /scripts/beats_plot.py | UTF-8 | 740 | 2.578125 | 3 | [] | no_license | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_json('data-latest.json')
print(df.columns)
# df = df.loc[:, ['Planner', 'time', 'EnvironmentMesh']]
print(df.Planner.unique())
df['instance'] = df.Domain + '_' + df.Seed.astype(str) + '_' + \
df.AgentMesh + '_' + d... | true |
af795a0d5e48f4be87788dd1d9cc889232c0587b | Python | gissellemm/girlswhocodeprojects | /dict_attack.py | UTF-8 | 420 | 3.78125 | 4 | [] | no_license | f = open("dictionary.txt","r")
print("Can your password survive a dictionary attack?")
dict_word = ""
#NOTE - You will have to use .strip() to strip whitespace and newlines from the file and passwords
test_password = input("Type in a trial password: ")
for word in f:
if word.strip() == test_password.strip()... | true |
58fd6d6ba59410109f673c87663936753c7c43f7 | Python | DaniaMartiuk/Ursina | /core.py | UTF-8 | 3,368 | 2.671875 | 3 | [] | no_license | from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina()
# загрузка текстур
grass_block = load_texture('assets/grass_block.png')
dirt_block = load_texture('assets/dirt_block.png')
stone_block = load_texture('assets/stone_block.png')
brick_block= load_texture('assets/... | true |
9c149ee1752f26ad179c2eec9bc21292b786541c | Python | rabe-gitops/rabectl | /src/rabectl/status.py | UTF-8 | 2,926 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import os
import sys
import yaml
import click
import boto3
from PyInquirer import prompt, style_from_dict
from botocore.exceptions import ProfileNotFound
from PyInquirer import Token, Separator, Validator, ValidationError
class AWSProfileValidator(Validator):
def validate(self, profile_doc):
try:
... | true |
3728aa22af829f4907dc47c608bc011abe39a8e0 | Python | khyathipurushotham/python_programs | /list1.py | UTF-8 | 81 | 2.671875 | 3 | [] | no_license | names=['khyathi','purushotham','sarada','sai']
print(names)
print(len(names))
| true |
4fa76e3320ca06fd92d2b5c7684f1b028e6b4c6f | Python | jimmcgaw/CodeEval | /python/timediff/timediff.py | UTF-8 | 1,161 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import datetime
# check that a filename argument was provided, otherwise
if len(sys.argv) < 2:
raise Exception("Filename must be first argument provided")
filename = sys.argv[1]
lines = []
# open file in read mode, assuming file is in same directory as script
try:
file = open(filen... | true |
c6239c9f326bd4680b62118338ed76c43340a8ae | Python | yinon4/YCOIN | /blockchain.py | UTF-8 | 3,623 | 3.078125 | 3 | [] | no_license | from hashlib import sha256
from datetime import date
def hash(string):
return None if (string == None) else sha256(string.encode("ascii")).hexdigest()
class Transaction:
def __init__(self, private_from_address, public_to_address, amount):
self.private_from_address = private_from_address
... | true |
1a7278d3f0d74813846702d08ade55c39482f7b3 | Python | atrukhanov/routine_python | /23_nxopen_refactoring/7_check_pmi_objects.py | UTF-8 | 936 | 2.84375 | 3 | [] | no_license | import NXOpen
class NXJournal:
def __init__(self):
self.session = NXOpen.Session.GetSession()
self.work_part = self.session.Parts.Work
self.lw = self.session.ListingWindow
self.PMIs = self.work_part.PmiManager.Pmis
def find_pmi_objects(self):
try:
if self.... | true |
b6a70ea7f6c7132a8c60f71310f3c5140eafa479 | Python | chxzh/stroke_rendering_thesis | /src/stroke_generalize.py | UTF-8 | 7,734 | 2.59375 | 3 | [] | no_license | from PIL import Image
import random
import math
def get_stroke(color, radius, length, thickness =7):
def draw_head():
r, g, b, a = color
head = Image.new("RGBA", (width, head_length), (255, 255, 255, 0))
data = list(head.getdata())
w, h = head.size
start, end = head... | true |
b2c7e3942990e0c4b5a24dd62c2e26dbb92af5c3 | Python | kimx5227/beginner_python | /Basal_Metabolic_Rate_Redux.py | UTF-8 | 307 | 3.609375 | 4 | [] | no_license | def main():
windchill()
def windchill():
temperature = input("Enter temperature (F): ")
v = input("Enter wind velocity (MPH): ")
windchill = 35.74 = 0.6215*temperature - 35.75 * (v ** (.16)) + 0.4275 * temperature * (v ** (0.16))
print(windchill)
if __name__=='__main__':
main()
| true |
366eb8e0ec2973383d89cee0bfe9b3931691148e | Python | Kingdomdark/ProjectOP2 | /main/classes/databasemanager.py | UTF-8 | 2,270 | 3.34375 | 3 | [] | no_license | import psycopg2
class databasemanager:
# Use the database
def interact_with_database(self, command):
# Connect and set up cursor
#connection = psycopg2.connect("dbname=game_db user=postgres password=postgres")
connection = psycopg2.connect(dbname="game_db", user="postgres", password="... | true |
5613201c8407d0dd2a3c5299da933fc90dcca958 | Python | knts0/atcoder | /AtCoder/ABC/103/a.py | UTF-8 | 103 | 2.90625 | 3 | [] | no_license | a, b, c = map(int, input().split())
l = sorted([abs(a - b), abs(b - c), abs(c - a)])
print(l[0] + l[1]) | true |
0c51839ed097e72c0904860dc32c16859f48c0a6 | Python | dirac1/SecRouter | /test/execute.py | UTF-8 | 583 | 3.015625 | 3 | [] | no_license | import subprocess
def execute(cmd):
popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
for stdout_line in iter(popen.stdout.readline, ""):
yield stdout_line
popen.stdout.close()
return_code = popen.wait()
if return_code:
raise subprocess.CalledProcessErro... | true |
3a2ea957b6d9c772bbd18f79552e21a2bf9d10c8 | Python | marinehero/Capital-construction-project | /Projects/BlogWebSite/框架/Inspect.py | UTF-8 | 1,573 | 3.234375 | 3 | [
"MIT"
] | permissive | import inspect
def a(a, b=0, *c, d, e=1, **f):
pass
aa = inspect.signature(a) # 获取函数的表达签名
print("inspect.signature(fn)是:%s" % aa) #
bb = aa.parameters # [(获取所有参数)]
for name ,parameter in bb.items():
print(name,parameter) # name: a b c d e f parameter 具体映射 a b=0 *c d e=1 **f
print("signature.paramerters属性是:%... | true |
a534d2a6c20c0511fff2864458514d81cacc0486 | Python | Code-Institute-Submissions/richard-ui-b_fitness_store_SepResub | /products/templatetags/product_tags.py | UTF-8 | 846 | 2.75 | 3 | [] | no_license | from django import template
from reviews_list.models import Reviews_list
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def calculate_rating(current_product):
reviews = Reviews_list.objects.filter(product=current_product)
review_avg = 0
# if p... | true |
a5d80594ca73804687c11eb548c70428345d9080 | Python | ChitturiPadma/ComputerVision | /10.Bitwise_Operations.py | UTF-8 | 1,301 | 3.21875 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
#Extract non-rectangular regions of interest (ROI)
import cv2
import numpy as np
import imutils
# In[2]:
#Draw a rectangle
canvas1 = np.zeros((300,300), dtype='uint8')
rectangle = cv2.rectangle(canvas1, (25, 25),(275, 275),255,-1)
cv2.imshow('Rectangle', rectangle) #Binary imagei
cv2.wai... | true |
27ebbde47617b4a0a74183f3d434366cfad42c10 | Python | alvarongg/QSLcardGenerator | /Importador_archivos.py | UTF-8 | 2,947 | 2.890625 | 3 | [
"MIT"
] | permissive | import tkinter as tk
from tkinter import filedialog
import pandas as pd
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
path_foto = ''
def Generador_Imagenes( dia,
mes,
anio,
licencia,
... | true |
3ef48147b11423d0fc8bbe917f16ef9ddda94fa6 | Python | bozenamrozek/PYTHON | /03obliczenia.py | UTF-8 | 179 | 3.296875 | 3 | [] | no_license | a=5
b=2
print('suma=' ,a+b)
print('suma=' ,a-b)
print('suma=' ,a/b)
print('suma=' ,a*b)
print('suma=' ,a**b)
print('suma=' ,a%b)
print('suma=' ,a//b) #dzielenie całkowite | true |
2da3d29de8e36f47817676b1f5b9d2895fa2a46e | Python | praveenn7/blockchain_masterexamples | /Sample1.py | UTF-8 | 181 | 2.53125 | 3 | [] | no_license | from bitcoin import *
priv = random_key()
print("Private Key : ", priv)
pub = privtopub(priv)
print("Public Key : ", pub)
addr = pubtoaddr(pub)
print("Address : " + addr)
| true |
17202184dfe564bb7fab472f37f8c2629797a900 | Python | shilpageo/pythonproject | /advanced python/decorators/demo3.py | UTF-8 | 739 | 2.9375 | 3 | [] | no_license | #
#def vaccinaion portal(**kwargs):
# print("request id allowed location ekm")
#vaccination_portal(name="ram",age=25,address="address",health_issue=True)
#age above>65 or health_issue=True {allowed}
def decorator(fun):
def wrapped(name,age,health_issue,place):
if (age>65)or(health_issue==True):
... | true |
c5df9d21e579388b4d08ca4bf1219615097bab55 | Python | enthusiasm99/crazypython | /04/P94_xiti_02.py | UTF-8 | 220 | 4.03125 | 4 | [] | no_license | size = int(input("请输入一个数字:"))
for i in range(1, size + 1):
# 空格与行数i的关系
kongge = " " * (size - i)
# *与行数i的关系
stars = "*" * (2 * i - 1)
print(kongge + stars) | true |
1b208280698b1dde433c20b1195f0efb0102fad6 | Python | mmaina8/Python-AkiraChixDataModel | /student/models.py | UTF-8 | 1,403 | 2.5625 | 3 | [] | no_license | from django.db import models
from course.models import Course
import datetime
from django.core.exceptions import ValidationError
# Create your models here.
class Student(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
date_of_birth = models.DateField(... | true |
680bb01d5dec29f54dc0b598e855da72c12e0eda | Python | Firmino-Neto/Exercicios---Python--UFC- | /Função e vetores -py/21.py | UTF-8 | 557 | 3.65625 | 4 | [
"MIT"
] | permissive | def Vetor( lista, tam ):
print ("Digite os elementos da lista")
contador = 0
while contador < tam:
numero = int(input("Digite um numero: "))
lista.append( numero )
contador = contador + 1
def subtraiVetor(a,b):
c = []
i = 0
while i < len(a):
subtracao = a[i]-b[i]
c.append(subtracao)
i = i ... | true |
4029c8ed53ebda15d04b606e132ac3c1ec7d8b41 | Python | shengchaohu/shengchao | /yixue/interval.py | UTF-8 | 5,115 | 3.265625 | 3 | [] | no_license | from collections import OrderedDict
import bisect
import load
class Interval:
'''
interval from json file, which is string by default
'''
def time_start_end(self, label=load.label, question_start_time_delta=8,
question_end_time_delta=5):
'''
return a list of time interval, ... | true |
4644ba197803f2a7f1f6012c9676144633b540a1 | Python | jzeeck/BeautifulSoap-Example | /handler.py | UTF-8 | 696 | 2.578125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
def processProduct(baseUrl, Item):
#print "Processing {}{}".format(baseUrl, Item['href'].encode('utf8'))
# Fetch page and parser
r = requests.get(baseUrl + Item['href'].encode('utf8'))
data = r.text
soup = BeautifulSoup(data, "html.parser")
prod_info = soup.find('di... | true |
79a36f9f3052599679dfa7c0d5d6b8e9febf6773 | Python | jace/zine-main | /zine/utils/text.py | UTF-8 | 4,117 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
zine.utils.text
~~~~~~~~~~~~~~~
This module provides various text utility functions.
:copyright: (c) 2009 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
import string
import unicodedata
from urlparse import url... | true |
9cf789f529d8c44b847652739809346399164e9e | Python | ancestor-mithril/UAIC_FII_PYTHON | /PythonProjects/Spanzuratoarea/main.py | UTF-8 | 1,637 | 3.046875 | 3 | [] | no_license | """C3. Spanzuratoarea
Sa se scrie o aplicatie in care utilizatorul trebuie sa ghicesca un anumit cuvant. Cuvintele vor
fi predefinite si vor avea o anumita categorie. La rulare userul alege o categorie si se va alege
un cuvant random din cele existente in categoria aleasa. Utilizatorul poate incerca cate o
litera odat... | true |
2e5e466262dcf6209a1f20ccfbbb751f40974885 | Python | daivikswarup/opensoft16 | /Grapher/test.py | UTF-8 | 28,014 | 2.6875 | 3 | [] | no_license | import curve
import math
from curve import curve
import numpy as np
import cv2
# from SimpleCV import *
from pytesseract import image_to_string
from PIL import Image as IMAGE
#from matplotlib import pyplot as plt
# import matplotlib.pyplot as plt
import re
import time
from sklearn.cluster import KMeans
class graph:... | true |
5e5ac1d9af64a08f513d8eccf281aac64af9c5cc | Python | bhaskarbagchi/HackerNewsRanking | /Ycombinator_scrape/ycombinator_scrape.py | UTF-8 | 715 | 2.765625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
for i in xrange(28):
name = 'https://news.ycombinator.com/news?p='
page = requests.get(name +`(i+1)`)
soup = BeautifulSoup(page.text)
headings = soup.find_all('tr', { 'class':'athing' })
comments = soup.find_all('td', { 'class':'subtext'})
for i in xrange(len(head... | true |
240df440a7f0da9b43436d8016ffb9cd709dc3a8 | Python | bematthe/IST736-Text-Mining | /Becky_MatthewsPeaseHW07.py | UTF-8 | 18,757 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 7 21:13:20 2021
@author: Becky Matthews-Pease
"""
############################################################
#Packages
import nltk
import sklearn
import re
import os
import string
import pandas as pd
import numpy as np
import random as rd
import matpl... | true |
588d194d1c1ec4ed8cf36f93f0d3fa20d5f83530 | Python | ggqshr/fill_mongo | /fill_mongo.py | UTF-8 | 4,747 | 2.703125 | 3 | [] | no_license | import yaml
import pymongo
import random
from os.path import exists
import pickle
import logging
import tqdm
import base64
logging.basicConfig(level=logging.INFO)
CONFIG_FILE = "config.yaml"
BOUND = range(3000, 6000) # 随机对数据进行减少,防止数据都一样
random_list = []
for i in range(65,91):
random_list.append(chr(i))
for i in r... | true |
56ada6bf524975107d2c045096262525437cd49d | Python | tennyson-mccalla/PPaItCS | /7.4.py | UTF-8 | 395 | 3.796875 | 4 | [] | no_license | def standing(credits):
if credits >= 26:
stand = "Senior"
elif credits >= 16:
stand = "Junior"
elif credits >= 7:
stand = "Sophomore"
else:
stand = "Freshman"
return stand
def main():
print()
C = int(input("How many credits have you got?: "))
print()
... | true |
fbbb87dc3bf000ea05b729930e6c5d440b7f7df9 | Python | anirudhpillai/algorithms | /leetcode/max_increase_to_keep_city_skyline.py | UTF-8 | 603 | 2.796875 | 3 | [] | no_license | class Solution(object):
def maxIncreaseKeepingSkyline(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
lr_skyline = [max(row) for row in grid]
tb_skyline = []
for col_idx in range(len(grid[0])):
tb_skyline.append(max(row[col_id... | true |
dd3fc5f23ba2a16893bef3d50c54ae2307e46fe6 | Python | philips-ni/ecfs | /leetcode/077_combinations/python/combinations.py | UTF-8 | 719 | 3.03125 | 3 | [] | no_license | class Solution:
def combine(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[List[int]]
"""
l=list(range(1,n+1))
allPaths=[]
visited = []
self.dfs(l,k,0,visited,allPaths)
return allPaths
def dfs(self,l,k,index,visite... | true |
a1d6e8bc173f3843e466fbe4e680f519ae79fccd | Python | jmr988/serverTips | /tips.py | UTF-8 | 441 | 3.484375 | 3 | [] | no_license | TIP_OUT = .03
totalSales = int(input('Enter total sales:'))
totalBeer = int(input('Enter total beer sales:'))
totalLiquor = int(input('Enter total liquor sales:'))
totalWine = int(input('Enter total wine sales:'))
totalDue = int(input('Enter total due:'))
totalAlchol = (totalBeer + totalLiquor + totalWine)
supp... | true |
18600fe017f7c802b73ff99f516716e92b51a650 | Python | bigfacebig/NGSTools | /VCF/vcf.py | UTF-8 | 4,431 | 2.75 | 3 | [] | no_license | import sys
import os
import re
class VCF:
"""some function to deal with VCF file"""
def __init__(self, file):
# super(VCF, self).__init__()
self.file = file
def _readVCF(self):
"""read vcf file"""
if not os.path.exists(self.file):
sys.exit('%s file not exist\n' % self.file)
if self... | true |
5c086dcabef87c393760cd0ee6fc3a7b32d130ef | Python | C109156233/pythonlearn | /python-mid/階層判斷.py | UTF-8 | 196 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 15:49:24 2021
@author: linnn
"""
m=int(input("請輸入M?"))
b=1
i=1
while(b<m):
i=i+1
b=b*i
print("超過M為",m,"的最小值為:",i) | true |
37e5fc6e8ca941d219eabe9af424bf70ecd8c638 | Python | sanchi191/Plagiarism | /plag-project/plagproject/users/basics.py | UTF-8 | 3,977 | 2.921875 | 3 | [] | no_license | import numpy as np
import os
import matplotlib.pyplot as plt
def remComm(prgm):
n = len(prgm)
res = ""
s_cmt = False
m_cmt = False
#Traversethe given program
i=0
while(i<n):
# Ifsinglelinecomment
if (s_cmt == True and prgm[i] == '\n'):
s_cmt = False
i+... | true |
73ab6f34c063439af6e3c2725973eaf15058583e | Python | ipod825/HOPE | /pysrc/run_batch.py | UTF-8 | 2,117 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import timeit
import config
from config import SolverType
from libdai_solver import JunctionTree, MF, TRWBP
from wish_solver import Wish
import argparse
import math
from utils import listEnum
def parse_arg():
parser = argparse.ArgumentParser(descr... | true |
0f77bb38efc091fe61d785f6bda5bcbc33027eb1 | Python | eraguzin-bnl/nEXO_SiPM_Simulator | /bnl_asic_sim.py | UTF-8 | 10,264 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 18 15:51:50 2019
@author: Eraguzin
This is the top level module for the entire digital simulation. It sets up the GUI and calls the simulation
"""
import Tkinter as tk
import imageio
from simulation import Simulation_Functions
import os, re
class GUI_WIN... | true |
553fe21397313d555e0956b690a8e6c90d15f1c0 | Python | ArielHL/DataScienceRepo | /PythonStatistics/moby_dick_file.py | UTF-8 | 2,098 | 3.5625 | 4 | [] | no_license | import re
def bag_of_words(filename="./data/moby_dick.txt"):
with open(filename, "r", encoding="utf8") as f:
bag = {}
for line in f:
words = re.findall("\w*", line)
for w in words:
if len(w) <= 0:
continue
if w in bag:
... | true |
54e0be56044b96569a25ccd2d1abb660e18b09c3 | Python | hayeong922/final_projec_info_viz | /demo/time_series/time_series.py | UTF-8 | 8,090 | 2.921875 | 3 | [] | no_license | import pandas
import vincent
import re
from collections import defaultdict
import math
import operator
import json
from collections import Counter
from nltk.corpus import stopwords
import string
# f is the file pointer to the JSON data set
emoticons_str = r"""
(?:
[:=;] # Eyes
[oO\-]? # Nose (opti... | true |
ba559319127e38a76b663da7c0a4179b1c36c3a9 | Python | euribates/advent_of_code_2020 | /day05/second.py | UTF-8 | 375 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import loader
karte = {}
for seat in loader.read_input("input"):
karte[seat.seat_id] = seat
min_seat_id = min(karte.keys())
max_seat_id = max(karte.keys())
for i in range(min_seat_id+1, max_seat_id):
if (i-1) in karte and i not in karte and (i+1) in karte:
... | true |
a83bc75fb55ce7fc54c38e388d2a13ed8ea23244 | Python | Zhihao-de/kh_community | /server/util/MessageProducer.py | UTF-8 | 892 | 2.6875 | 3 | [] | no_license | import pika
# 新建连接,rabbitmq安装在本地则hostname为'localhost'
class MessageProducer:
connection = None
def __init__(self, host, username, password):
self.hostname = host
self.port = 5672
self.username = username
self.password = password
def connect(self):
credentials = ... | true |
26529fae28b79323ac40c07e1a63cfd93affb66b | Python | Subtracting/mp3player | /ideas.py | UTF-8 | 423 | 2.671875 | 3 | [] | no_license | # # keyboard input
# if event.type == pygame.KEYDOWN:
# if event.key == pygame.K_s:
# play_song()
# elif event.key == pygame.K_p and paused == False:
# pause_song()
# elif event.key == pygame.K_q:
# # write last known time when quitting
# file1 = open("temp.txt", "w")
# ... | true |
afef230370580c72e01bc79ba5336353d15d36b6 | Python | VicGanoh/Python_Tut | /Python/hello.py | UTF-8 | 83 | 3.296875 | 3 | [] | no_license | #name = input('What is your name?\n')
#print('hello ' + name)
print('hello world') | true |
9a67b182ed7030360568d3d7fb50a81db96c82dc | Python | thiagofeijor/100-days-of-python-bootcamp | /day-35-rain-alert/main.py | UTF-8 | 1,234 | 2.546875 | 3 | [] | no_license | import requests
import os
from twilio.rest import Client
from twilio.http.http_client import TwilioHttpClient
OWM_Endpoint = "https://api.openweathermap.org/data/2.5/onecall"
api_key = os.environ.get("OWM_API_KEY")
account_sid = os.environ.get("sid")
auth_token = os.environ.get("AUTH_TOKEN")
weather_params ... | true |
aef1d9a1480c8729bc0cbcc399b6ba3467b261e2 | Python | DangoWang/dayu_widgets | /dayu_widgets/examples/MLabelTest.py | UTF-8 | 4,035 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: Mu yanru
# Date : 2019.2
# Email : muyanru345@163.com
###################################################################
from dayu_widgets.MDivider import MDivider
from dayu_widgets.MFieldMixin... | true |
b4a841d70d4104908887566e4872ec402cd17632 | Python | omivore/connect4 | /rules/lowinverse.py | UTF-8 | 1,871 | 3.046875 | 3 | [] | no_license | # lowinverse.py
import computer
import itertools
def generate_solutions(board, me):
# Find all combinations of columns. For each pair's columns, find all possible pairs of two vertically consecutive squares
# that have an odd upper square and are empty. Find all combinations of these square pairs to each othe... | true |
36c7926a8f4283bab7fa5b9e301999c0a5e2d8fe | Python | renwenhua/webUI_autoTest | /pageobjects/page_exit.py | UTF-8 | 326 | 2.515625 | 3 | [] | no_license | #!usr/bin/env python
#encoding:utf-8
from pageobjects.base import BasePage
from selenium.webdriver.common.by import By
import sys
class Exit(BasePage):
button_exit=(By.PARTIAL_LINK_TEXT,"退出")
def exit(self):
self.driver.switch_to.window(self.driver.window_handles[0])
self.click(*self.button_exi... | true |
2bc9eeaf3977bea5493bb2ad1999eed3659493b9 | Python | lightstep/lightstep-benchmarks | /benchmark/satellite.py | UTF-8 | 6,415 | 2.75 | 3 | [] | no_license | import logging
import platform
import requests
import time
from os import path
from .utils import BENCHMARK_DIR, start_logging_subprocess
from .exceptions import SatelliteBadResponse, DeadSatellites
DEFAULT_PORTS = list(range(8360, 8368))
logger = logging.getLogger(__name__)
BANDWIDTH_LIMIT_KB_PER_SEC = 50*1024
c... | true |
c67b3401b6c150422d3d18233c63004c20337f38 | Python | marcelopontes1/Estudos-Python-GUPPE | /S5/trigesimo_programa.py | UTF-8 | 272 | 4.28125 | 4 | [] | no_license | num1 = int(input('Insira um número: '))
num2 = int(input('Insira um número: '))
num3 = int(input('Insira um número: '))
numbers = [num1, num2, num3]
# Sorting list of Integers in ascending
numbers.sort()
print(f'A ordem crescente desses números é: {numbers}')
| true |
1e61d5b086adbb0b91072cb1ed003a3754fe6294 | Python | jecustoms/yaweather | /examples/simple.py | UTF-8 | 235 | 2.71875 | 3 | [
"MIT"
] | permissive | from yaweather import UnitedKingdom, YaWeather
y = YaWeather(api_key='secret')
res = y.forecast(UnitedKingdom.London)
print(f'Now: {res.fact.temp} °C, feels like {res.fact.feels_like} °C')
print(f'Condition: {res.fact.condition}')
| true |
d79100c2cf4f428e4b02bcd3fc83fc10f2052fce | Python | Pride7K/Python | /Dicionario/dicionario_exercicio1.py | UTF-8 | 450 | 3.421875 | 3 | [] | no_license | from random import *
from operator import itemgetter
jogadores = {}
jogadores_vencedor = {}
for i in range (1,5):
jogadores[f'Jogador{i}'] = randint(1,6);
print(jogadores)
for jogador,dado in jogadores.items():
print(f'O {jogador} tirou {dado}');
print("");
jogadores_vencedor = sorte... | true |
6b96e6145e09308a795759f7f733bc3924b8f928 | Python | hhhhjjj/my_scrapy | /my_re.py | UTF-8 | 261 | 3.375 | 3 | [] | no_license | import re
line = "Cats are smarter than dogs"
matchObj = re.match(r'(.*) are (.*?) .*', line, re.M | re.I)
# re.M是多行匹配,re.I是对大小写不敏感
if matchObj:
print(matchObj.group(1))
print(matchObj.group(2))
else:
print("no match")
| true |
78a056927bce75e078dc6c277b44cdabb26bea40 | Python | caristi/CursoPython | /Rectangulo.py | UTF-8 | 251 | 3.703125 | 4 | [] | no_license | class Rectangulo:
def __init__(self,base,altura):
self.base = base
self.altura = altura
def calcularArea(self):
return self.base * self.altura
rec = Rectangulo(2,3)
print(rec.calcularArea()) | true |
e9ee625b24848dd5aa237ba9a9b4441374a9f64a | Python | chenxu0602/LeetCode | /1382.balance-a-binary-search-tree.py | UTF-8 | 1,755 | 3.515625 | 4 | [] | no_license | #
# @lc app=leetcode id=1382 lang=python3
#
# [1382] Balance a Binary Search Tree
#
# https://leetcode.com/problems/balance-a-binary-search-tree/description/
#
# algorithms
# Medium (75.48%)
# Likes: 398
# Dislikes: 23
# Total Accepted: 21.9K
# Total Submissions: 29.1K
# Testcase Example: '[1,null,2,null,3,null,... | true |
e5aadd45883492841edc1bcbea1ae7fdc8bfa48a | Python | Miguelmargar/ucd_programming1 | /practical 1/p1p3.py | UTF-8 | 161 | 2.921875 | 3 | [] | no_license | # My third program
print("Name: Miguel Martinez")
print("")
print("Address: 4 Westminster Park, Mount Brown, Blackrock, D8")
print("")
print("Phone no.: 0873752689")
| true |
beb92ba4a298eec5af3f535c45e534c4f7f653f5 | Python | Ihsan545/Search-and-Sort-Array-Assignment | /test_collections/test_sort_and_search_array.py | UTF-8 | 642 | 2.828125 | 3 | [] | no_license | import unittest
import array as r
import fun_with_collections.sort_and_search_array as basic_list_exception
class MyTestCase(unittest.TestCase):
def test_search_array(self):
self.assertFalse(basic_list_exception.search_array([5, -1, 3, 6, 8, 9, 4, 10], -1))
def test_sort_array(self):
n = r.array([9,... | true |
69c56de19260f86dd9ac1ad0e7b22c6f1bc1b81f | Python | Wizmann/ACM-ICPC | /Leetcode/Algorithm/python/1000/00693-Binary Number with Alternating Bits.py | UTF-8 | 195 | 2.5625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | def lowbit(x):
return x & (-x)
class Solution(object):
def hasAlternatingBits(self, n):
a = n ^ (n >> 1)
b = a ^ (a >> 1)
c = b - lowbit(b)
return c == 0
| true |
8e0c89b19ebf6efdea0b42c506edaed4224def0d | Python | md6380/vaccine-feed-ingest | /vaccine_feed_ingest/schema/schema.py | UTF-8 | 4,637 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import warnings
from typing import List, Optional
from pydantic import BaseModel
"""
DEPRECATION NOTICE
vaccine_feed_ingest/schema/schema.py is DEPRECATED. Instead of using this file,
import the published package using the line:
from vaccine_feed_ingest_schema import location
~or~
from vaccin... | true |
74fe53c37c91a3d49d0d414247b77bef2d27ed5b | Python | Murph9/KaggleComp | /intseq/firstreadin.py | UTF-8 | 703 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 13 13:36:59 2016
@author: Kazuma Wittick
"""
"""
import numpy as np
train = np.loadtxt('train.csv', dtype = str)
train = train[1:2]
for row in train:
seq = str(row)
print seq
"""
import re
with open('train.csv') as f:
content = f.readlines()
content.pop... | true |
2bd1b2d6412fa0a567a715a206706e8d758335bf | Python | harryhaos/pyal | /reverselist.py | UTF-8 | 597 | 3.625 | 4 | [] | no_license | __author__ = 'harryhao'
'''
reverse linked list
'''
class Node:
def __init__(self, data, next_n):
self.data = data
self.next_n = next_n
def reve(head):
p = head
q = head.next_n
head.next_n = None
while q:
r = q.next_n
q.next_n = p
p = q
q = r
... | true |
c6b5ab2788210f46d49bca706cc12150c2fc7fe2 | Python | SucharitaDhar/PirplePythonCourse | /Homework #4 (lists)/List.py | UTF-8 | 693 | 3.828125 | 4 | [
"Unlicense"
] | permissive | myUniqueList = []
myLeftovers = []
def addToList(item):
if item in myUniqueList:
addToLeftovers(item)
return False
else:
myUniqueList.append(item)
return True
def addToLeftovers(item):
myLeftovers.append(item)
# Testing the addToList function
print(myUniqueList) #[]
print(ad... | true |
a48510578f6daade35a3b151d73ceffd84baf6e0 | Python | satyx/Data-Structure-Practice | /paranthesis_balance.py | UTF-8 | 559 | 3.21875 | 3 | [] | no_license | test=int(input())
start=('(','{','[')
while test>0:
a=list()
flag=True
exp=input()
for i in exp:
if i in start:
a.append(i)
elif i==')':
if len(a)==0:
flag=False
break
if a.pop()!='(':
flag=False
break
elif i=='}':
if len(a)==0:
flag=False
break
if a.pop()!='{':
flag... | true |
3bebe8768c0ba67dd3b638ddef003e9f7ee04350 | Python | mve17/SPISE-2019 | /Day 3/rain.py | UTF-8 | 1,723 | 3.5 | 4 | [] | no_license | from tkinter import *
import time
WINDOW_WIDTH=1000 #pixels
WINDOW_HEIGHT=300
RAINDROP_WIDTH=10
class Sky():
def __init__(self):
#gui window setup
self.root=Tk()
self.canvas=Canvas(self.root,width=WINDOW_WIDTH,height=WINDOW_HEIGHT)
self.canvas.pack()
#lists to store raindrop information
self.raindrops=[]... | true |
57de17b868dfccdd14d3b7fefccd1d3a9ea8ddfe | Python | lonyle/causal_bandit | /code+data/algorithm_framework.py | UTF-8 | 5,523 | 2.609375 | 3 | [] | no_license | import numpy as np
class AlgorithmFramework:
def __init__(self, algorithm, offline_data, match_machine, option='offline_online'):
self.algorithm = algorithm # the algorithm oracle has 'draw_arm' and 'update' two APIs
self.match_machine = match_machine
self.offline_data = offline_data
self.option = option
s... | true |
b149d514b231196b2e285416ee3177a3c7849695 | Python | laperlej/hkmeans | /kmeans.py | UTF-8 | 6,091 | 3.078125 | 3 | [] | no_license | from itertools import chain, imap
import numpy as np
from scipy.stats import pearsonr
import random
from tree import Tree
import sklearn.metrics as metrics
class ClusteringAlgorithm(object):
def __init__(self, points):
self.points = points
self.idmaker = IdMaker()
self.clusters = None
... | true |
b8ece6cd2dd1b287de1a03dff8ca71ffdd62b5be | Python | alenzhao/Lux | /bf.py | UTF-8 | 4,986 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
import os.path
import re
import numpy
import scipy.stats
import scipy.special
import argparse
def diff_dirichlet_density_at_origin(a,a2):
a = numpy.array(a)
a2 = numpy.array(a2)
if len(a) != 3 or len(a2) != 3:
sys.exit('error: both concentration parameters should have three ... | true |
e9f2fcb61cb0fad2d25349c7d1e68a66971b63b7 | Python | GeforceTesla/ECE661_Computer_Vision_Combined | /Hw9/import/Ncc_Op.py | UTF-8 | 3,515 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
from Epipole_Op import Epipole_Op
class Ncc_Op(object):
def __init__(self, des1, des2, img1, img2, matrix_F):
self.descriptor1 = des1
self.descriptor2 = des2
self.img1 = img1
self.img2 = img2
self.matrix_F = matrix_F
self.ncc_size = 13
... | true |
d160b3ff6a0bc21d5382c1856630f4aa14848385 | Python | jcyang36/YoutubeDemStats | /youtube_stats.py | UTF-8 | 1,526 | 2.625 | 3 | [] | no_license | #We break this out into separate files because of YouTube API Quota Limit
import pandas as pd
import urllib.request
import json
#api key
key = "key=YOURKEYHERE"
#video api and params
youtube_vid_stats = "https://www.googleapis.com/youtube/v3/videos?"
part_stats = "part=statistics"
video_views = []
video_likes = []
v... | true |
8b082caef883032806350423486681638e760828 | Python | Aasthaengg/IBMdataset | /Python_codes/p02409/s115682449.py | UTF-8 | 1,207 | 2.6875 | 3 | [] | no_license | import sys
k1 = [[0 for i in xrange(10)] for j in xrange(3)]
k2 = [[0 for i in xrange(10)] for j in xrange(3)]
k3 = [[0 for i in xrange(10)] for j in xrange(3)]
k4 = [[0 for i in xrange(10)] for j in xrange(3)]
n = input()
for i in xrange(n):
m = map(int,raw_input().split())
if m[0] == 1:
k1[m[1]-1][m[2]... | true |
a291ecb36ca1578c8511f1df3a37d38a44329229 | Python | Rup-Royofficial/Codeforces_solutions | /Gravity_Flip.py | UTF-8 | 97 | 3.671875 | 4 | [] | no_license | a = int(input())
x = list(map(int,input().split()))
x.sort()
for i in x:
print(i,end=" ") | true |
944b137529a001a634728bacacbb13aeb15c974f | Python | meethu/LeetCode | /solutions/0204.count-primes/count-primes.py | UTF-8 | 968 | 3.5 | 4 | [] | no_license | class Solution:
# def isPrime(self, n):
# for i in range(2, int(n ** 0.5) + 1):
# if n % i == 0:
# return False
# return True
# def countPrimes(self, n: int) -> int:
# if n <= 2: return 0
# cnt = 0
# for i in range(2, n):
# if sel... | true |
360f22b4e01448b12533e8c3590111eef8732b6e | Python | Kitsunekoyama/Area | /web/app.py | UTF-8 | 16,569 | 2.734375 | 3 | [] | no_license |
"""
Documentation for the web module
File Handling the front-end of AREA's web interface
"""
from flask import Flask, render_template, request, redirect, url_for
import requests
import time
import json
import sys
app = Flask(__name__)
"""
**Global variables**
ID: Server generated UID
data: ... | true |
cf77327e5d9f5b1ea9357a3f80e6038bd1c23929 | Python | DableUTeeF/sift_rep | /models.py | UTF-8 | 2,763 | 2.5625 | 3 | [] | no_license | from torch import nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, str... | true |
b2e88fcb1d5b040c6df708277b4db06bd0ce0fcc | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/2764.py | UTF-8 | 622 | 3.453125 | 3 | [] | no_license | def check(lista):
return sum(lista) == len(lista)
def convert(string):
return [True if i=='+' else False for i in string]
def invert(lis):
return [not i for i in lis]
def fun(string,n):
lista = convert(string)
count = 0
for i in range(len(lista)-n+1):
if not lista[i]:
... | true |
57ed8830209f2efd772f23bbeeee6cd804d2af82 | Python | MichalKacprzak99/WFiIS-IMN-2020 | /lab07/src/nav_stokes_numba.py | UTF-8 | 5,045 | 2.53125 | 3 | [] | no_license | from numba import njit
import numpy as np
from chart_generator import map_generator, contour_generator
DELTA = 0.01
p = 1.0
mi = 1.0
N_X = 200
N_Y = 90
i1 = 50
j1 = 55
j2 = j1 + 2
IT_MAX = 20000
@njit
def y(i):
return DELTA * i
@njit
def x(i):
return DELTA * i
@njit
def psi_A(psi, Qwe):
for j in rang... | true |
89d5fa2ae37d569134b6f7f503e8ebac45d310a8 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/793.py | UTF-8 | 386 | 3.203125 | 3 | [] | no_license | #!/usr/bin/python
import sys
def deficit(str):
result = 0
preceding = 0
for i in range(len(str)):
result = max(result, i-preceding)
preceding += int(str[i])
return result
if __name__ == "__main__":
sys.stdin.readline()
for i,line in enumerate(sys.stdin.readlines()):
maxShy, levels = line.strip().split(... | true |
8e518ccad4a48ea3af61458e9b1ba09eb36c29b1 | Python | MarineGirardey/TP5_tests | /linkedlist_tp_unittest.py | UTF-8 | 4,915 | 3.875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 3 15:54:03 2021
@author: Marine Girardey
"""
class Node:
"""Node class for a linked list
Attributes
----------
param_data : int
link : node.Node
"""
def __init__(self, data):
"""Class constructor
Paramete... | true |
39e80ab8015684d2830e725208ab34d82a717a33 | Python | chloeeekim/TIL | /Algorithm/Leetcode/Codes/HappyNumber.py | UTF-8 | 1,111 | 3.984375 | 4 | [] | no_license | """
202. Happy Number : https://leetcode.com/problems/happy-number/
양의 정수 하나가 주어졌을 때, 해당 숫자가 happy number인지 확인하는 문제
- happy number : 각 자릿수의 제곱을 더한 값을 구하는 방식을 반복했을 때, 1이 나오는 숫자
- happy number가 아니라면 위 방식을 반복했을 때, 1을 포함하지 않는 숫자들의 cycle이 반복된다
Example:
- Input : 19
- Output : true
- 1^2 + 9^2 = 82 / 8^2 + 2^2 = 68 / 6^2 ... | true |
d69a4625529496d6f9e40011510c50659b6fe813 | Python | PhoduCoder/PythonPractice | /Flatten_List.py | UTF-8 | 201 | 3.0625 | 3 | [] | no_license | #sec_vec=[[1,2,3],[2,3], 4]
sec_vec=[[1,2,3],5,[2,3], 4]
flat_list=[]
for i in sec_vec:
if(type(i)) is list:
for num in i:
flat_list.append(num)
else:
flat_list.append(i)
print (flat_list)
| true |
0a0e3be59583ac287b1771b68798399fd7672347 | Python | sanggs/IndependentStudy-Fall2019 | /JacobiSolver.py | UTF-8 | 3,433 | 2.59375 | 3 | [] | no_license | import torch
import numpy as np
class JacobiSolver:
def __init__(self, particles, femObject):
self.particles = torch.from_numpy(particles)
self.femObject = femObject
self.dampingFactor = 2.0/3.0
# def writeToFile(self, i):
# if i == 0:
# f = open("points.csv", "w")
... | true |
b8c0ef7b6a4ea0a7ba5b34b09072134d56c5e796 | Python | william-letton/ASSIST | /test.py | UTF-8 | 1,637 | 3.21875 | 3 | [
"Unlicense"
] | permissive | ##Perform the SVM classification on the data, using the C and gamma parameters
##chosen from the optimisation, and definining the training and testing data
## according the IDs output by the CreateTrainingData function.
def TrainClassifier(dataset,bestParams,IDgroups):
print("do nothing")
# Import train_... | true |
0f2f6613c578a56eb555c6f872639d6eaa38e959 | Python | anishsujanani/Beanstalk-Reporter | /beanstalk_reporter.py | UTF-8 | 10,272 | 2.515625 | 3 | [] | no_license | '''
Beanstalk-Reporter
-------------------
Reqs: boto3, python3.x
Usage: python3 beanstalk_report.py --profile <aws_cli_profile_name> --env <beanstalk_env_name>
Output: JSON to stdout
Author: Anish Sujanani
Date: November, 2021
'''
import boto3
import sys
import argparse
import json
session = None
def get_resour... | true |