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 |
|---|---|---|---|---|---|---|---|---|---|---|
14e4a0710ede8885ca236f73ee8bb745a1f88744 | saleisha57/DesktopClean2 | /DLD/HW0/addition.py | UTF-8 | 735 | 2.984375 | 3 | [] | no_license | s = "1001"
st = "0101"
c = 0
hold = 0
b = []
r = []
h = []
for x in range(len(s)):
r.append(s[x])
for a in range(len(st)):
h.append(st[a])
for y in range(len(s)):
if r[y] == 1 and h[y] == 1:
c = 0
hold = 1
if r[y] == 0 and h[y] == 0 and c != 0:
c = 0
... | true |
2cd2669f754b0697fe27fade4a72d46090ac9d66 | mahanta-tapas/WebScrapers | /thtr_detail.py | UTF-8 | 1,686 | 2.71875 | 3 | [] | no_license | import requests
import json
from collections import OrderedDict
rf = open("restaurant.txt","w+")
def write_in_file(reqdata):
full_data = reqdata['results']
for thtr in full_data:
rf.write(json.dumps(thtr['name']))
rf.write(json.dumps(thtr['geometry']))
rf.write(json.dumps(thtr['types']))
rf.write('\n')
outpu... | true |
7376d23b9dd2187563fd97d17fa25e543139144d | uvehj/Bot-Emperor-Of-Dune | /BEoDTesting.py | UTF-8 | 1,380 | 3.15625 | 3 | [
"MIT"
] | permissive | #Creates and prints a tweet, doesn't send it
import markovify
# Get raw text as string.
with open("./geod.txt") as f:
text = f.read()
# Build the model.
text_model = markovify.NewlineText(text)
#Creates the first sentence, max characters to the twitter max
text_body = text_model.make_short_sentence(240, max_ove... | true |
1b24f4e4c8199e6c1b88571e7eda6c6e78419efc | Aaron9477/tiny_code | /leetcode/15/15_3Sum.py | UTF-8 | 1,578 | 2.96875 | 3 | [] | no_license | #coding=utf-8
class Solution(object):
def threeSum(self, nums):
# 这里不能先运行tudyArray,然后判断不同的数字 够不够三个,因为可能有[-1,-1,2]这种形式,不同的数字只有两个,但是能够组成0
# 三个0的最特殊,必须单独判断,不能在
if len(nums) < 3:
return []
res = []
arr_set, arr_repeat = self.tidyArray(nums)
self.helpSumDiff(a... | true |
cc631eb471e604cd4a128a82c38aed94d0c1ad3e | Bhanoosingh/PythonExample | /Devloper.py | UTF-8 | 583 | 3.015625 | 3 | [] | no_license | from MyModule import Employee as emp
class Devloper(emp.Employee):
raise_up=1.10
def __init__(self,fname,lname,pay,plang):
#Employee.__init__(fname,lname,pay)
super().__init__(fname,lname,pay)
self.plang=plang
def display(self):
super().display()
... | true |
a130c986ff6d32ab33d30b7d7e1dfa65b3cc3151 | FrozenWolfyy/Peacock-Solar-Marketing-Data-Analysis | /Final_project_Task 4/Python Codes/pre_processing.py | UTF-8 | 2,098 | 2.6875 | 3 | [] | no_license | import pandas as pd
import seaborn as sns
import os
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter
df=pd.read_csv('/home/frozenwolfy/Desktop/Ed/PS_ML/Peacock Solar Marketing Data Analysis/Final_project_Task 4/data/data_before_preprocessing.csv')
# print(df.head())
row,col=df.shape
... | true |
d78c54affb3a6cd352e3707714cea6bb32fda4a3 | Yuchen112211/CS6200-Information-Retrieval | /Assignment1/InputParser.py | UTF-8 | 2,077 | 2.640625 | 3 | [] | no_license | from xml.etree.ElementTree import re
from collections import defaultdict
import xml.etree.ElementTree as ET
stoplist = ' '.join(open('stoplist.txt', 'r').readlines())
stopWords = set(stoplist.split())
class inputParser(object):
def __init__(self):
self.docText = defaultdict(str)
self.wordAppearance = defaultdict... | true |
1f67db37dde2abad7f9a9181e5e777120f6fac4c | abevieiramotasas/pro_python | /chapter2/decorator_.py | UTF-8 | 924 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
# -*- encoding: utf-8 -*-
# decorator sem param
def print_exec_time(func):
def wrapper(*args, **kwargs):
from datetime import datetime
init_time = datetime.now()
func(*args, **kwargs)
exec_time = datetime.now() - init_time
print('Tempo de execução = %d' % exec_time.total_seconds())
ret... | true |
0044c981834cf638cec94eab6368433afd0d0c21 | amordovin/test_test | /dowload_file.py | UTF-8 | 1,136 | 2.78125 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
import os
import time
try:
link = "http://suninjuly.github.io/file_input.html"
browser = webdriver.Chrome()
browser.get(link)
input_name = browser.find_element_by_css_sele... | true |
bb5239d1e9ea6c447f72f81599d1567b09f1a853 | kevinhamlin/Google_Places_Address_Lookup | /src/functions.py | UTF-8 | 2,500 | 2.96875 | 3 | [] | no_license | import pandas as pd
import string
import requests
import json
def fill_lists(filepath_in, agencies_orig, passcodes, agencies_formatted):
with pd.ExcelFile(filepath_in) as xlsx:
sample = pd.read_excel(xlsx)
for i in sample.index:
agencies_orig.append(sample["Agency"][i])
pa... | true |
dc5dd70bd9e5bc8b19d89e68c2b63105e003efcb | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_97/1825.py | UTF-8 | 545 | 2.9375 | 3 | [] | no_license | #qwertyuiopasdfghjklzxcvbnm
#zfotwajdkrynscvxuigqmephbl
import sys
f = open('C-small-attempt0.in')
t = f.readlines()
t = t[1:]
nr = 1
import itertools
def check(a, b):
sa = str(a)
sb = str(b)
l = len(sa)
for i in range(1, l):
if sa[l-i:]+sa[:l-i]==sb:
return True
return False
for line in t:
... | true |
4166058e813309b6d81e4630edf80f4425131beb | yncat/nyancode | /project/io.py | UTF-8 | 286 | 2.875 | 3 | [] | no_license | class IO:
def dump(self, filename, content):
with open(filename, "w", encoding="UTF-8") as f:
f.write(content)
def load(self, path):
with open(path, "r", encoding="UTF-8") as f:
c = f.read()
# end with
return c
| true |
e83f9c6b07559ac4193317eb15b24f03677ce8c0 | Sireesha0907/python-programs | /add_of_natural_no.py | UTF-8 | 138 | 3.640625 | 4 | [] | no_license | n=int(input("Enter Natural Number : "))
add=0
for i in range(1,n+1,1):
add=add+i
print("The Sum of N natural Nummber is : ",add)
| true |
fa85109214abeb4159d3444c24c71f2bb768936b | Th3Lourde/l33tcode | /226_invert_binary_tree.py | UTF-8 | 747 | 3.5 | 4 | [] | no_license |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
'''
in:
4
/ \
2 7
/ \ / \
1 3 6 9
4
/ \
7 2
/ \ / \
6 9 1 3
'''
'''
out:
4
/ \
7 2
/ \ / \
9 6 3 1
'''
'''
starting point is node
cm... | true |
c92c67838e4cdeae00cf415b9f93392ffab48a6d | Paloma-G/Aulas-em-Python | /MARTINI/Listaex002.py | UTF-8 | 2,676 | 4.78125 | 5 | [] | no_license | '''
Biblioteca math
Bem vamos voltar à biblioteca math. Essa biblioteca nos oferece algumas funções além da sqrt(), vou mostrar uma listinha abaixo:
math.sqrt(numero): Retorna a raíz quadrada do número.
math.cos(numero): Retorna o cosseno do número em radiano.
math.sin(numero): Retorna o seno do número em radiano.
mat... | true |
5f06ba781071de02bf15d207608afdf7e40e2312 | gouldenm/toy-hydro | /sod_shock_test.py | UTF-8 | 3,107 | 3.078125 | 3 | [] | no_license | """
A toy model for hydro simulations, used to test things
before trying out Arepo.
Author: Maggie Celeste
Date: 07/11/2019
"""
import numpy as np
import matplotlib.pyplot as plt
gamma = 1.4
CFL = 0.5
boundary = "flow"
#Set up empty vectors
#100 grid points w/ ghost cell either side
#thus 103 cell walls
nx = 1000
x ... | true |
c34d8b1fccd7f110ae3bab33c76c58cc5c549643 | Aasthaengg/IBMdataset | /Python_codes/p03252/s496810927.py | UTF-8 | 760 | 2.765625 | 3 | [] | no_license | import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
S = input()
T = input()
s = [[] for _ in range(26)]
t = [[] for _ in rang... | true |
04f3627f623f1009723ae1acca843ce5a126448d | crazyLayne/LeetCode-China- | /leetcodePython/T_547_findCircleNum.py | UTF-8 | 638 | 2.984375 | 3 | [] | no_license | class Solution:
def findCircleNum(self, M):
"""
:type M: List[List[int]]
:rtype: int
"""
unvisit = set(list(range(len(M))))
count = 0
while len(unvisit)>0:
count += 1
p = unvisit.pop()
# DFS遍历p的所有节点
self.DFS(M, u... | true |
39d3f7ea449e9408d9615ec7eb160d553c31e21b | scheu-dev/NLP | /5_NER/uebung5-NotWorkingAsIntended/uebung5-eval.py | UTF-8 | 2,859 | 3.109375 | 3 | [] | no_license | import sys
def main():
GOLD_STANDARD = sys.argv[1]
PREDICTION_FILE = sys.argv[2]
# read true labels, tokens and predictions
with open(GOLD_STANDARD, 'r') as f:
lines = f.readlines()
lines = [line.strip() for line in lines]
labels = [str.split(line, '\t')[1] if len(line) is not 0 els... | true |
64878f8fd9c1c305b519c079f82a505733c6d494 | Velasko/latexfy | /latexfy.py | UTF-8 | 464 | 3.265625 | 3 | [] | no_license | def latexfy(s):
s = list(s)
simbols = {
'é' : "\\'e",
'ê' : "\\^e",
'á' : "\\'a",
'â' : "\\^a",
'à' : "\\`a",
'ã' : "\\~a",
'ç' : "\\c{c}",
'í' : "\\'i",
'ó' : "\\'o",
'ô' : "\\^o",
'õ' : "\\~o",
'ú' : "\\'u"
}
for n, l in enumerate(s):
if l in simbols:
s[n] = simbols[l]
elif l.lower() in simbol... | true |
c92ba8e0784eb9ba2169176382910b05ffd82f52 | pietervanzuijlen/utilities | /plotter.py | UTF-8 | 14,345 | 2.6875 | 3 | [] | no_license | from nutils import *
import numpy
import matplotlib as mpl
import matplotlib.pyplot as plt
def plot_indicators(name, domain, geom, indicators, npoints=5, shape=0, bartitle='', alpha=0, normalize=False, labelsize=10):
# Amount of subplots
n = len(indicators)
# Define subplot shape
if shape == 0:
... | true |
a222260b97cc6c2850897176dbc5374025ad1972 | Dhanjoor/PE-33 | /Simulation/generateurSon.py | UTF-8 | 1,993 | 3.046875 | 3 | [] | no_license | #content : 0 rien, 1 porte, 2 mur
def genSound(x0,y0,volume):
if x0<0 or x0>=xSize or y0<0 or y0>=ySize or carte[x0][y0].content==1:
print("genSound error")
return()
carte[x0][y0].sound+=volume
if volume<=1:
return()
moves=[(0,1), (0,-1), (1,0), (-1,0), (-1,-1), (-1,1... | true |
7648e97ae433c094e52a3ac99d2c59e328ba7af6 | Akshive/Exercism-Python-Solutions | /transpose/transpose.py | UTF-8 | 595 | 2.921875 | 3 | [
"MIT"
] | permissive | def transpose(lines):
mat = lines.split('\n')
m = len(mat)
n = 1
for word in mat:
n = max(n, len(word))
ans = ['' for i in range(n)]
for j in range(n):
for i in range(m):
if(j < len(mat[i])):
ans[j] += mat[i][j]
else:
... | true |
7931192850bb307e34536c147851cc28e52f23a1 | Madhan13K/python-programs | /accounts.py | UTF-8 | 1,459 | 3.3125 | 3 | [] | no_license | import datetime
import pytz
class accounts:
""" simple account class with balance """
@staticmethod
def _current_time():
utc_now=datetime.datetime.utcnow()
return pytz.utc.localize(utc_now)
def __init__(self,name,balance):
self.name=name
self.balance=balan... | true |
a8e641fb236241948d16977af4c40904a9bf7544 | crmathieu/Orbital | /celestial/objects.py | UTF-8 | 17,333 | 2.515625 | 3 | [
"MIT"
] | permissive | from orbit3D import *
from visual import *
class simpleArrow:
def __init__(self, color, radius, dtype, start, axisp, context = None):
#self.Origin = frame() if context == None else context
self.Radius = radius if radius > 0 else dtype
self.Color = color
self.Context = context
... | true |
a985272d30079b77569f963c2d839f9c3fe7da54 | davethecipo/signalslot | /signalslot/contrib/task/test.py | UTF-8 | 3,623 | 2.59375 | 3 | [] | no_license | import pytest
import mock
import eventlet
eventlet.monkey_patch(time=True)
import time
from signalslot import Signal
from signalslot.contrib.task import Task
class TestTask(object):
def setup_method(self, method):
self.signal = mock.Mock()
def get_task_mock(self, *methods):
task_mock = Task... | true |
4b5c3de7fa523e54ac52c048e6ece1dfd577371c | Sjyhne/backgammon_classic_rl | /current/q_vs_q.py | UTF-8 | 5,832 | 2.8125 | 3 | [] | no_license | # Pip installed imports
import gym
import numpy as np
from tqdm import tqdm
from numpy import load, asarray, save, savetxt
import matplotlib.pyplot as plt
# Basic imports
import random
import math
import time
from agents import RandomAgent, QAgent
# Selfmade imports
from utils import flip_observation, flip_action
... | true |
f18368bc45d75dbf98163e0b9210becaffaa76b7 | usha-developer/sentimentalanalysis | /test1.py | UTF-8 | 1,649 | 2.796875 | 3 | [] | no_license | import sklearn
import numpy as np
import pandas as pd
##import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import TfidfVecto... | true |
8d4e15b9469bf3995f028159220c368a65f05477 | jwcheong0420/TIL | /language/python/opentutorials-lecture/string.py | UTF-8 | 873 | 4.21875 | 4 | [] | no_license | print("=== String ===")
print('Hello')
print("Hello")
#print('Hello") #SyntaxError: EOL while scanning string literal
#print('Hello 'world'') #SyntaxError: invalid syntax
print("Hello 'world'")
print('Hello "world"')
print("=== String control ===")
print('Hello ' + 'world')
print('Hello '*3)
#print('Hello ' - 'world')... | true |
b0e61ec268dcacbebe795f52225ff673b51034c2 | hakgyu2298/Python_test | /20210618_실습1C-1.py | UTF-8 | 269 | 4.34375 | 4 | [] | no_license | # 이름을 입력받아 인사하기
print('이름을 입력하세요.: ',end='')
name = input()
print(f'안녕하세요? {name}님.')
# 이름을 입력받아 인사하기
name = input('이름을 입력하세요.: ')
print(f'안녕하세요? {name}님')
| true |
eee68186370724d16759525635bd717ebbdaed06 | LemonTre/python_work | /Chap09/restaurants.py | UTF-8 | 656 | 3.609375 | 4 | [] | no_license | class Restaurant():
def __init__(self,restaurant_name,cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
print("\nThe name of restaurant is: " + self.restaurant_name.title() + ".")
print("The type of restaurant is: " + self.cuisine_type + "."... | true |
8cb8893221f49db5f3f8d460566002c9ef32e5cf | 3lpsy/iscloudip | /app/exceptions/common.py | UTF-8 | 164 | 2.75 | 3 | [] | no_license |
class CommonExeception(Exception):
def __init__(self, message, *args,**kwargs):
self.message = message
Exception.__init__(self,*args,**kwargs)
| true |
0038be254b357c499f980c55fcfe06b9a6eb993b | johnfelipe/nba-mvp-prediction | /cli.py | UTF-8 | 3,644 | 2.578125 | 3 | [] | no_license | import argparse
import datetime
import pandas
from nba import br_extractor, clean, train
__version__ = "0.1.0"
year = datetime.datetime.now().year
def get_parser():
"""
Creates a new argument parser.
"""
parser = argparse.ArgumentParser()
version = "%(prog)s " + __version__
parser.add_argumen... | true |
f0eda14bf7e2e483d69361071a7cc58e8803eda3 | murakumo512/Python | /pertemuan 4 minggu/Python/13.py | UTF-8 | 201 | 3.109375 | 3 | [] | no_license | def fun(a):
return a*2
def fin(a):
return a/2
def fon(a):
return a+2
def fan(a):
return a-2
print(fin(fun(fon(fun(2)))))
print(round(3.14159,3))
print(float(30)) | true |
70e726f5c61fbf2afae93ada68d89640a883b6a9 | hancse/ai_model_deployment | /OOSE_Web_interface/backend-hanwatts-prediction-model-web-interface-master@c8c18f1ae2a/app/energy/domain.py | UTF-8 | 1,629 | 2.578125 | 3 | [] | no_license | class EnergyPoint:
def __init__(self, no, time, V1, V2, V3, I1, I2, I3, P1, P2, P3, Q1, Q2, Q3, S1, S2, S3, PF1, PF2, PF3, F):
self.__no = no
self.__time = time
self.__V1 = V1
self.__V2 = V2
self.__V3 = V3
self.__I1 = I1
self.__I2 = I2
self.__I3 = I3
... | true |
0a26b00e22de61a7213a73a31b41184bf9be272d | DuckBoss/ExPaStack | /src/expastack.py | UTF-8 | 3,250 | 2.703125 | 3 | [
"MIT"
] | permissive | import sys
from .utils import FileAccessUtility, CliUtility, EncodingUtility, JSONUtility
from .exceptions import IncorrectInputError
import assets.config as config
class PrimaryRunner:
object_path = ''
optional_params = []
filter_list = []
filter_type = ''
map_names = {}
include_header = Fal... | true |
6d9223c593c5107ec74b46108ab31c5307cf12b5 | razerrezar/chatPython | /main.py | UTF-8 | 612 | 2.84375 | 3 | [] | no_license | # -*- codding:utf8 -*-
import Tkinter
def envoyer():
pass
def actualiser():
pass
if __name__=="__main__":
mainFen = Tkinter.Tk()
mainFen.title("Chat")
buttonActualiser = Tkinter.Button(mainFen, text = "Actualiser", command = actualiser)
buttonActualiser.pack(side = "top")
label... | true |
ef438e4fe5d3d5b1e3ca591b9f9e4665ad7153d5 | wangshiz/Python_Test | /Function/ApplicationOfFunctionName.py | UTF-8 | 552 | 4.21875 | 4 | [] | no_license | """
函数名的应用
函数名实际上就是一个变量
"""
def fun():
print("这是fun()的内容")
# a = fun()
b = fun
# 函数名可以当作变量放到数据结构中
list = [fun, b]
print(list)
for el in list:
el()
# 可以把方法名作为参数,传递给另外一个方法
def fun2():
print("这是fun2()的内容")
def fun3(fun2):
fun2()
fun3(fun2)
# 函数名可以当作返回值
'''
闭包
'''
def fun4():
def fun5():... | true |
55e83bcf9714b8973d4c5aa43af5dd4d1556801c | HuyaneMatsu/hata | /hata/discord/channel/channel_metadata/tests/test__parse_user_limit.py | UTF-8 | 418 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import vampytest
from ..constants import USER_LIMIT_DEFAULT
from ..fields import parse_user_limit
def test__parse_user_limit():
"""
Tests whether ``parse_user_limit`` works as intended.
"""
for input_data, expected_output in (
({}, USER_LIMIT_DEFAULT),
({'user_limit': 1}, 1),
):
... | true |
6362a0a2c74ec500ab22c391c5b27535899c73ac | jigeesha523/InfyTQ-Solutions | /PROGRAMMING FUNDAMENTALS USING PYTHON/Day9/Assignments/Assignment60.py | UTF-8 | 280 | 2.71875 | 3 | [] | no_license | #PF-Assgn-60
def remove_duplicates(value):
rmvdp = []
list1=list(value)
for i in list1:
if i not in rmvdp:
rmvdp.append(i)
return "".join(rmvdp)
#start writing your code here
print(remove_duplicates("11223445566666ababzzz@@@123#*#*")) | true |
3a99b9a93f4adfd613fb604dba286d0815362978 | mefistofelerion/VisionComputacional | /DeteccionBordes.py | UTF-8 | 5,703 | 3.21875 | 3 | [] | no_license | import PIL
import Tkinter
from Tkinter import*
import Image,ImageTk
import sys,time
original=sys.argv[1]
imageLoaded=Image.open(original)
show=Tkinter.Tk()
#imageLoaded = imageLoaded.resize((1024, 650)) lo ocupo para redimensionar imagenes muy grandes
def load(): #se carga la imagen original
# show=Tkinter.Tk()
... | true |
da0845796508bfc6dd9c6058d2524a74e5e0da46 | Shadow-linux/ops-for-study | /src/public/permission/tests.py | UTF-8 | 1,193 | 3.390625 | 3 | [] | no_license | import threading
import time
from functools import wraps
task_list = []
def time_limited(timer):
'''
一个规定函数执行时间的装饰器
:param timer:
:return:
'''
@wraps(func)
def wrapper(func):
def __wrapper():
# 通过设置守护线程强制规定函数的运行时间
t = threading.Thread(target=func)
... | true |
a86f337f3d424435b306ac76328d4bb10208e93e | 824zzy/Leetcode | /B_HashTable/1189_Maximum_Number_of_Balloons.py | UTF-8 | 364 | 3.609375 | 4 | [] | no_license | """ L1
From counter, fin the minimum letter appears the least in "balon".
"""
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
T = Counter(text)
target = "balon"
ans = float('inf')
for t in target:
if t=='l' or t=='o': ans = min(T[t]//2, ans)
e... | true |
d6517a40344dd5236ff857069bf3e7aa31d2fe19 | nestauk/beis-indicators | /ds/beis_indicators/crunchbase/make_crunchbase.py | UTF-8 | 5,060 | 2.59375 | 3 | [
"MIT"
] | permissive | import os
import re
import json
from data_getters.labs.core import download_file
from data_getters.core import get_engine
from ast import literal_eval
import pandas as pd
import beis_indicators
from beis_indicators.geo.reverse_geocoder import reverse_geocode
from beis_indicators.utils.dir_file_management import *
from... | true |
94dcc9bef675aa2d91706f3ca548877e2cc842aa | agarwala95/Ladder | /ladders.py | UTF-8 | 2,452 | 3.15625 | 3 | [] | no_license | import string
import collections
import queue
import sys
def hashing(word):
sum = 0
for character in word.rstrip():
sum += alpha_list[character]
#print(sum)
return sum
def gen_dict():
values = {}
i = 1
for index, letter in enumerate(string.ascii_lowercase):
... | true |
90a7fb2dd768d1c8a682cde3048144b2d43303ec | madberry/x84 | /bbs/scripting.py | UTF-8 | 3,200 | 2.6875 | 3 | [
"MIT",
"ISC",
"Apache-2.0"
] | permissive | """
Scripting package for x/84, http://github.com/jquast/x84/
"""
import os
import io
import imp
import logging
SCRIPT_PATH = 'default/'
#pylint: disable=C0103
# Invalid name "logger" for type constant (should match
logger = logging.getLogger()
def init(global_script_path):
"""
Set the folder path wher... | true |
9e226b153667a8e93497e6a450afd5df4ba5d029 | Aasthaengg/IBMdataset | /Python_codes/p02959/s053872697.py | UTF-8 | 455 | 2.875 | 3 | [] | no_license |
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in reversed(range(1,N+1)):
if A[i]<B[i-1]:
ans+=A[i]
B[i-1]=B[i-1]-A[i]
A[i]=0
else:
ans+=B[i-1]
A[i]=A[i]-B[i-1]
B[i-1]=0
if A[i-1]<B[i-1]:
ans+=A[i-1]
... | true |
96d3790568350617c682066444e5b28c8f1a08df | denniscf/MachineLearning | /Python/GradientDescent.py | UTF-8 | 881 | 2.984375 | 3 | [] | no_license | __author__ = 'DCFURLA'
import numpy as np
import matplotlib.pyplot as plt
def PlotError(errors):
plt.figure()
plt.plot(errors)
plt.title('Error')
plt.xlabel('Iterations')
plt.ylabel('Error')
plt.show()
def GradientDescent(ComputeGradient, features, target, alpha, initCoefEstimate):
pastCo... | true |
970c8cc5fce3fb05f2f1d89c86339e117d3d42c4 | whr94621/VisualDecoding | /visual_decoding/visual_decoding.py | UTF-8 | 1,238 | 3.21875 | 3 | [] | no_license | from graphviz import Graph
__all__ = ['visual_decoding']
def _plot_sent(graph, sent, flag=None):
prev = None
if flag is not None:
eos = 'EOS_%s' % flag
else:
eos = 'EOS'
_sent = sent + [eos]
for i, w in enumerate(_sent):
n = '%s_%d' % (w, i)
graph.node(n, w)
... | true |
41c0cd09c0760aa31b409eaf35b20a2b83a35bf9 | SrinivasPithani/devops | /python/sets.py | UTF-8 | 229 | 3.53125 | 4 | [] | no_license | import random
set1 = set()
set2 = set()
for t1 in range(5):
set1.add(random.randint(1,6))
set2.add(random.randint(1,6))
print (set1, set2)
print ("So you have these numbers {} in common".format(set1.intersection(set2)))
| true |
c93699892a9c16b5c507f407819c17e580b43a7d | vshevch/PyCharm | /Database Checker.py | UTF-8 | 1,397 | 3.234375 | 3 | [] | no_license | import mysql.connector
import requests
import json
# Connecting to the MySQL
db = mysql.connector.connect(user ='root', passwd = 'tester1', database='TEST')
cur = db.cursor() #invoke cursor function
# Queries' Definitions
qry_select = """select valid_to from stores where merchant = '%s';""" # Get date query
qry_updat... | true |
1d73c0ac9b4f183030121c4b1e453985754d2adb | YoungsAppWorkshop/codewars | /r1/day34_some_egyption_fractions.py | UTF-8 | 3,078 | 4.375 | 4 | [] | no_license | #!/usr/bin/env python3
"""
Some Egyptian fractions
Given a rational number n
- n >= 0, with denominator strictly positive -
as a string (example: "2/3" in Ruby, Python, Clojure, JS, CS) or
as two strings (example: "2" "3" in Haskell, Java, CSharp, C++, Swift)
decompose this number as a sum o... | true |
da46b9b62ca831ec9612755c6902e6aae1093e77 | NickBayard/sudoko | /tests/test_solver.py | UTF-8 | 378 | 2.859375 | 3 | [] | no_license | import pytest
def test_0(solver, dimension, expected):
result = solver.solve()
assert isinstance(result, list)
assert len(result) == (dimension ** 2)
assert all(isinstance(r, list) for r in result)
assert all(len(r) == (dimension ** 2) for r in result)
print(result)
# for index, row in e... | true |
e31314af92c349355ea2e84ff538cd98299ae36b | dreamcoin1998/IcpSide | /apps/detect/views.py | UTF-8 | 658 | 2.609375 | 3 | [] | no_license | import time, json
from utils.detect.detect_sensitives import DFAFilter, detect_sensitives
from utils.response import Response
def detect(request):
"""
敏感词的过滤接口
"""
# 计时器
# time1 = time.time()
# print('time1', time1)
# 获取前端数据
data = request.body.decode('utf-8')
data = json.loads(dat... | true |
52b13d0247c74cd6972f342f34a2387ce09e06bf | chrisxue815/leetcode_python | /problems/test_0659.py | UTF-8 | 1,037 | 2.703125 | 3 | [
"Unlicense"
] | permissive | import heapq
import unittest
from typing import List
import utils
class Solution:
def isPossible(self, nums: List[int]) -> bool:
if not nums:
return False
curr_num = nums[0]
curr_queue = []
next_queue = []
for num in nums:
if num != curr_num:
... | true |
c81a4d68d1e3748d5a28d8b71c70fe71165f429b | EswarSakamuri/OnlineExercises | /longest_word.py | UTF-8 | 329 | 3.4375 | 3 | [] | no_license | import re
def LongestWord(sen):
# code goes here
max_len = 0
word = ''
p = re.compile(r'[a-zA-Z0-9]+')
for x in p.findall(sen):
if len(x) >= max_len:
max_len = len(x)
word = x
sen = word
return sen
# keep this function call here
print(LongestWord('["one","th... | true |
506a62f3d20bf01719291c64eb3e7ff57f60dfd5 | Blacknux/PythonConLucas | /Clase01/Ejercicios/Ejercicio3 .py | UTF-8 | 246 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#- Escribir un programa que reciba un nombre de usuario, luego de obtenerlo diga "Las computadoras dominaremos el mundo, @nombre"
nombre=input("Ingrese su nombre: ")
print("Las computadoras dominaremos el mundo ",nombre) | true |
ce2cb072a8fdfa77e32644cd46e2d2ef7990b8da | aita/py-mincaml | /mincaml/elim.py | UTF-8 | 1,980 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | from . import logger
from .knorm import free_variables
def effect(e):
"eに副作用があるか判定"
name = e[0]
if name == "Let":
return effect(e[2]) or effect(e[3])
elif name in ("IfEq", "IfLE"):
return effect(e[3]) or effect(e[4])
elif name == "LetRec":
return effect(e[2])
elif name ... | true |
7c2d901123a305b7a31abeb976f1175c0bf51684 | sebastiandittrich/Neural-Network-Python | /scikit/learn.py | UTF-8 | 2,152 | 2.625 | 3 | [] | no_license | from sklearn.neural_network import MLPClassifier
import json
from scipy import misc
import numpy as np
import time
import sys
import os
def im_to_array(path):
return misc.imread(name=path, mode='L')
def prepareimage(array):
return np.array(misc.imresize(array, (64,64))).flatten().tolist()
def prepare(path):
... | true |
43d48c14b91223c31f2822ae8d40882d9f976f7d | jagaraj10/python_programming | /beginner level/hello for n times.py | UTF-8 | 74 | 3.15625 | 3 | [] | no_license | a=int(input("enter no of times"))
for i in range(0,a):
print("hello")
| true |
2339b936a1578cc419bbbe9fd3d71364cbd88f4e | mukesh-jogi/python_repo | /Sem-5/try_except/userdefinedexception.py | UTF-8 | 481 | 3.9375 | 4 | [] | no_license | try:
num = int(input("Enter any number : "))
if num < 0:
raise TypeError("Value can not be less than zero")
elif num >= 0 and num <= 10:
raise ValueError("Value can not be between 1 to 10")
elif num >= 11 and num <= 20:
raise Exception("Value can not be between 11 to 20")
pri... | true |
acc835289c66d66e71030f1a07b56423798c242f | JeanetteHolmes/FizzBuzz | /fizzbang.py | UTF-8 | 1,061 | 3.75 | 4 | [] | no_license |
def fizz_bang (n):
""" (n) ->
Happily pretend that a computer can play FizzBang until n.
Note that mistakes are not inserted intentionally, as it is not
in the nature of a computer to get drunk. In fact mistakes
resulting in the computer being required to intake alcohol
might result in the ... | true |
839a912139596f40f94fd47b148c6c3ea5ec7280 | dumengnan/proxy_spider | /com_proxy.py | UTF-8 | 2,106 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
import time
import urllib2
from bs4 import BeautifulSoup
from util.url_request import reqByHttpProxy
from urlparse import urljoin
from util.proxy_item import ProxyItem
from util.data_storage import DataSaveToMongo
def parse_html(url_address):
html_content = reqByHttpProxy... | true |
8ce4760537ef74cabb2faf56a4dd72dddf0dbc4b | hohaidang/Python_Basic2Advance | /4PointOpenCV/src/transfrom.py | UTF-8 | 2,051 | 3.046875 | 3 | [] | no_license | '''
Created on Dec 13, 2019
@author: prnsoft
'''
import numpy as np
import cv2
from numpy import dtype
def order_points(pts):
# initialzie a list of coordinates that will be ordered
# such that the first entry in the list is the top-left,
# the second entry is the top-right, the third is the
# bottom-... | true |
750aa2c7389232bb0f9d207aa8f46ac2eae12754 | taillessscorpion/C4T-BO3 | /session10/listOfDict/printListOfDict.py | UTF-8 | 337 | 2.703125 | 3 | [] | no_license | listEmploy = [{
'Name': 'Huy',
'Role': 'Waiter',
'Hours': '12',
'SalaryPerHour': '0.8',
}, {
'Name': 'Tung',
'Role': 'Cook',
'Hours': '24',
'SalaryPerHour': '1.5',
}, {
'Name': 'M. Duc',
'Role': 'Manager',
'Hours': '20',
'SalaryPerHour': '2',
}]
for i,j in enumerate(listE... | true |
612be53810588cf9b8ae32b0939a9a9aeca687b5 | bensenberner/ctci | /numTwosBetween.py | UTF-8 | 267 | 3.609375 | 4 | [] | no_license | def cumulativeNumTwos(num):
res = 0
for i in range(num):
res += numTwos(i)
return res
def numTwos(num):
strNum = str(num)
i = 0
for n in strNum:
if n == '2':
i += 1
return i
print(cumulativeNumTwos(10000000))
| true |
dc919f31df0e29eba23f420dbbabbae8974996f4 | realentertain/tt-gpu | /experiments/sequential-walk-multithread/plot-used-threads.py | UTF-8 | 2,899 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
import json
import matplotlib.pyplot as plt
import numpy as np
filename1 = "out-used-threads/1-cg-kernels-different-elem.json"
filename2 = "out-used-threads/2-cg-kernels-different-elem.json"
filename3 = "out-used-threads/4-cg-kernels-different-elem.json"
filename4 = "out-used-threads/12-cg-kernels-... | true |
25360286bde024350531cfe1cc51dd13b71ec1e7 | johnboy5358/project-euler | /problem-023/non-abundant-sums.py | UTF-8 | 1,836 | 4.53125 | 5 | [] | no_license | # Non-abundant sums
# Problem 23
# A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
#
# A number n is called deficient if the sum of its prope... | true |
a5af6b1e390ce8e836d070958f28ba9dfe5799f6 | w19980126/Computational_Physics_Python | /Area_Circle.py | UTF-8 | 262 | 3.84375 | 4 | [] | no_license | # Area.py: Area of a circle, simple program
from math import pi
N = 1
r = 1.
C = 2.* pi* r
A = pi * r**2
print ('Program number =', N, '\n r, C, A = ', r, C, A)
""" Expected OUTPUT
Program number = 1
r, C, A = 1.0 6.283185307179586 3.141592653589793"""
| true |
7bb8e4f791ebca1fbc94501e1d840d527ff0215f | leonardo1909/CEP_validator | /validator_cep.py | UTF-8 | 515 | 3.4375 | 3 | [] | no_license | import re
class Cep:
def __init__(self, cep):
self.cep = cep
def validar(self):
try:
if re.match('[1-9]{1}[0-9]{5}$', self.cep):
for part in range(int((len(self.cep))/3)+1):
if self.cep[part] == self.cep[part+2]:
return ... | true |
d5b3699917b098546f11ce90a9f913985bd91209 | alvarogomezmu/dam | /SistemasGestion/Python/2ev/pruebas/ficheros/ejercicio3withopen.py | UTF-8 | 235 | 3.125 | 3 | [] | no_license | #_*_coding:utf-8_*_
archivo = open ("a.txt","a")
lista = ["\nesto","\ntambien","\nlo","\nmeto"]
archivo.writelines(lista)
archivo.close()
archivo1 = open ("a.txt","r")
contenido = archivo1.read()
print contenido
archivo1.close()
| true |
77045102566b785694bd4fd1869ff38d13eaf6e2 | ljw222/CS4300sp2021-ljw222-rsp99-mot23-rgb226-ss2698 | /cosinesim.py | UTF-8 | 3,917 | 2.875 | 3 | [] | no_license | from collections import defaultdict
from collections import Counter
import json
import math
import string
import time
import numpy as np
from nltk.tokenize import TreebankWordTokenizer
#from IPython.core.display import HTML
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.stem import PorterStemmer
... | true |
7df2a6b05b4e8e7d7459cbd237416d78726d97a8 | a3lentyr/allohibou | /lib/road.py | UTF-8 | 3,563 | 3.3125 | 3 | [] | no_license | from math import sqrt, floor
from typing import Tuple
from lib.stackDrawer import StackDrawer
from lib import commonMath
class Road:
_start: Tuple[int, int]
_end: Tuple[int, int]
_type: str
_boatType: str
_scale: int = 2 * 4
def __init__(self, start: Tuple[int, int], end: Tuple[int, int], sc... | true |
0783a8ce2f634373eef58ff37362ee5d067c4319 | kiekie/Food-Recipe-CNN | /deploy/utils_food.py | UTF-8 | 2,843 | 2.65625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.preprocessing import image
def plot_preds(image, probabilities, top_n, categories):
"""Plot the probabilities from the Inception network."""
plt.imshow(image)
plt.axis('off')
plt.figure()
order = list(reversed(range(... | true |
82a56b4f110ea01d73825168e929a61b4349cf54 | jowilf/MapcomTrainings-RYJ- | /mapcom_test/sum.py | UTF-8 | 408 | 3.125 | 3 | [] | no_license | import itertools
N = 10000
sum = list(itertools.accumulate(range(1, N + 1)))
even = list(itertools.accumulate(range(1, 2 * N + 1, 2)))
odd = list(itertools.accumulate(range(2, 2 * N + 1, 2)))
# print(sum, even, odd, sep='\n')
with open('sum.in') as f:
for _ in range(int(f.readline())):
k, n = map(int, f.re... | true |
c553318ea914c58f36a3a6d9b5af9a3a48fe449c | Daniel-UCAS/Turbulence | /Turbulence_Generator_2D.py | UTF-8 | 8,795 | 2.78125 | 3 | [] | no_license | #
# IsoTurbGen.h
#
# The MIT License (MIT)
#
# Copyright (c) 2015, Tony Saad. All rights reserved.
#
# 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 witho... | true |
ab1765b45c5edbef02774e6c0e2f06af0707f165 | sgtFloyd/project-euler | /01-10/10.py | UTF-8 | 442 | 3.328125 | 3 | [] | no_license | # The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
#
# Find the sum of all the primes below two million.
def sieve(n):
a = [True]*(n+1)
a[0] = a[1] = False
for i in xrange(n/2+1):
if a[i]:
for j in xrange(2*i, n+1, i):
a[j] = False
return [i for i, prime in enumerate(a) if prime]
print ... | true |
850bf35e0425700ec6d06566ced9fd29705696d2 | Alexlivtex/StockAnalyzer | /ticker_downloader/downloader/StockDownloader.py | UTF-8 | 826 | 2.6875 | 3 | [] | no_license | from ..SymbolDownloader import SymbolDownloader
from ..symbols.Stock import Stock
from ..compat import text
class StockDownloader(SymbolDownloader):
def __init__(self):
SymbolDownloader.__init__(self, "stocks")
def decodeSymbolsContainer(self, json):
symbols = []
count = 0
fo... | true |
55fb4b78bc54d25a1277409c26122ae97252e0ac | NeaguLorena/GooglePythonCourse | /Curs6.py | UTF-8 | 871 | 3.921875 | 4 | [] | no_license | #
items = [1,2,3,4,5]
squared = list(map(lambda x: x**2, items))
print(squared)
#names that start with 'a' or 'b'
names = ['Ana', 'Cristi', 'Bogdan']
filter_names = list(filter(lambda x: x[0] == 'A' or x[0] == 'B', names))
print(filter_names)
#Redure
product = 1
list = [1,2,3,4,5]
for num in list:
product *= nu... | true |
eb4818ca50c14de6826be166610fe8f34bb7b215 | pramotharun/Numerical-Methods-with-Python | /braistow method.py | UTF-8 | 1,683 | 3.71875 | 4 | [
"MIT"
] | permissive |
#Bairstow Method
import numpy as np
n = int(input("Degree of polynomial"))
p = float(input("P value"))
q = float(input("q value"))
no_iterations = int(input("number of iterations"))
a = np.zeros((n+2,1))
b = np.zeros((n+2,1))
c = np.zeros((n+2,1))
j = n+1
for i in range(n+1):
a[i] = float(input("Enter coeffic... | true |
a60a42492b4992d074295a9dba5f020f6fba1718 | AdwaitNPradhan/COVID-19-TRACKER-GUI | /backend.py | UTF-8 | 1,248 | 2.703125 | 3 | [] | no_license | import json
import requests
import subprocess as sp
url = "https://api.rootnet.in/covid19-in/stats/latest"
response = requests.get(url)
parsed=response.text
data=json.loads(parsed)
def official_data(CVD):
#data printing of official data
CVD['cc'] = data['data']['summary']['total']
CVD['cci']... | true |
f926e4edd2ade37b60893159c2e83f1aefd73a2f | ryu022304/atcoder | /みんなのプロコン2019/b_path.py | UTF-8 | 196 | 3.265625 | 3 | [] | no_license | path = []
for _ in [0]*3:
path.extend(input().split())
if path.count('1') == 3 or path.count('2') == 3 or path.count('3') == 3 or path.count('4') == 3:
print('NO')
else:
print('YES')
| true |
bb136c40967fc9a9b58c758e4e988c961545025c | sailesh2/CompetitiveCode | /2020/cf554D2.py | UTF-8 | 232 | 3.296875 | 3 | [] | no_license | import math
x=input().split(' ')
a=int(x[0])
b=int(x[1])
diff=max(a,b) - min(a,b)
if diff==0:
print(diff)
else:
next= int(math.ceil(min(a,b)/diff))
next=next*diff
next=next-min(a,b)
print(next)
| true |
bbbd8a99685d50fc96f2ba71d8852067eaf3bd93 | arthurscience/multilingualtastic | /python/2_files.py | UTF-8 | 698 | 4.40625 | 4 | [] | no_license | #!/usr/bin/env python
a_string = 'This is a string. Wow!\n'
another_string = 'Whoa, this is another string!\n'
file_location = '2_files/temp.txt'
#You must open and close data streams (aka "file handles") to files:
#THINK: What is `output`?
#ANSWER: It is a "file object". It's not the file itself. It represents the f... | true |
4541ee8f7b3455ac0cc99348c4e8288aaad7503a | thaldi/f1CalenderNotify | /f1Scheduler.py | UTF-8 | 1,170 | 2.828125 | 3 | [
"MIT"
] | permissive | import HtmlHelper as htmlHelper
import datetime as dt
import ToastHelper as toast
baseUrl = "https://www.formula1.com"
parser = htmlHelper.HtmlParserHelper("{}/en/racing/2019.html".format(baseUrl))
allElements = parser.GetElements()
def ClearRaceDateValue(values):
dateValues = values.split("-")
raceDay = d... | true |
f6883ae8730d317830d3ef60f4e3ee6c63326cdb | deba999/InterviewBit | /Binary Search/sorted_insert_position.py | UTF-8 | 641 | 3.546875 | 4 | [] | no_license | # Sorted Insert Position:
# https://www.interviewbit.com/problems/sorted-insert-position/
class Solution:
# @param A : list of integers
# @param B : integer
# @return an integer
def searchInsert(self, A, B):
lower = 0
upper = len(A)
mid = lower + (upper - lower) // 2
whi... | true |
3414ddccaa22d0ef5a90f8e20b9ee3daab1e6d58 | FXTD-ODYSSEY/vscode-mayapy | /py/ptvsd/_vendored/pydevd/tests_python/test_resolvers.py | UTF-8 | 9,111 | 2.59375 | 3 | [
"EPL-1.0",
"MIT"
] | permissive | from tests_python.debug_constants import IS_PY2
def check_len_entry(len_entry, first_2_params):
assert len_entry[:2] == first_2_params
assert callable(len_entry[2])
assert len_entry[2]('check') == 'len(check)'
def test_dict_resolver():
from _pydevd_bundle.pydevd_resolver import DictResolver
dict... | true |
5da6f3a2a6c7959c0b9a3d233c2f0051e5fc04ba | yuvallanger/cosmic-aggressors | /main.py | UTF-8 | 4,869 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
from __future__ import print_function
from builtins import range
from builtins import object
from kivy.app import App
#from kivy.vector import Vector
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.properties import NumericProperty #, Ob... | true |
8ea48a2b9f5e856a371a8ae5bfc92ca1c9b9ee16 | ngxson/edu-tkinter-demo | /game.py | UTF-8 | 1,050 | 3.234375 | 3 | [] | no_license | from tkinter import *
from utils.tkinter_png import *
from player import Player
class Game:
def __init__(self, root):
self.root = root
self.setup_canvas()
# setup game objects
self.player = Player(self.canvas)
self.background_photo = PngImageTk('assets/background.png')
self.backg... | true |
9790eaa73881e6d0379cf830f1528c2c34b8b80c | Lazerbeam50/War-Game | /Script/createdata.py | UTF-8 | 32,446 | 2.96875 | 3 | [] | no_license | '''
Created on 3 Sep 2018
@author: Femi
'''
import sqlite3
db = sqlite3.connect('Game Data/game database') #create or connect to database
cursor = db.cursor()
factionsTotal = 0
spellsTotal = 0
wargearTotal = 0
wargearListsTotal = 0
modelsTotal = 0
unitsTotal = 0
#---------------------------------Set up factions---... | true |
d1311cc3aaad79b3bc6b8985d982c4351eda7920 | pondodev/photo_sorter | /review.py | UTF-8 | 2,154 | 3.125 | 3 | [] | no_license | #!/usr/bin/python
import tkinter
from PIL import ImageTk, Image
import os
# globals
image_index = 0
image_files = []
image_directory = "./images/"
max_image_size = 1024, 1024
# button functions
def approve():
# do approval stuff here
print("approving " + image_files[image_index])
os.rename(image_director... | true |
45c2a3e4e24b9bf5bbc6413dcaca52bff73fdc6e | EllenRoberts/MA | /language_csv_creator.py | UTF-8 | 1,367 | 2.53125 | 3 | [
"CC0-1.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 11 17:07:04 2019
@author: efr587
"""
import os
import ast
import pandas as pd
import pandas
from collections import defaultdict
x = "U:/Git/final_files/etymology_etymon_langs_clean_spellings.txt"
count = []
final_word = []
with open("U:/Git/final_fi... | true |
a14cb9b62b668be218a8d2f4e6c1a4eaf358cb63 | Cfhansen/stephenson-pywb56 | /main.py | UTF-8 | 710 | 3.6875 | 4 | [] | no_license | print("Enter number of minutes and texts:")
minutes, texts = input().split(',')
minutes = int(minutes)
texts = int(texts)
base_charge = 15.0
minutes_charge = 0
if minutes > 50:
minutes_charge += .25 * (minutes - 50)
texts_charge = 0
if texts > 50:
texts_charge += .15 * (texts - 50)
charge_911 = 0.44
tax = 0.05 * (... | true |
e0e25490270ba5b69d464f596fd3d01c2379968c | cristcorrea/ejercicios_python | /Clase03/Cris/tablamult.py | UTF-8 | 789 | 3.640625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 22 17:52:19 2021
@author: cris
"""
numeros = [0,1,2,3,4,5,6,7,8,9]
lista2 = []
for i, numero in enumerate(numeros):
valor = numero
resultado = 0
lista = [0]
for numero in range(9):
resultado += int(valor)
lista.appen... | true |
04c53f01b253fa6c0cafecf4a5f8ab20b4fa7163 | y0ungdev/Algorithm | /SWEA/해설/SWEA_1224_계산기3_해설.py | UTF-8 | 1,663 | 3.515625 | 4 | [] | no_license |
import sys
sys.stdin = open("input.txt", "r")
priority = {'*': 2, '/': 2, '+': 1, '-': 1, '(': 0}
for tc in range(1, 11):
input()
line = input()
ans = ''
stack = []
for i in range(len(line)):
# 괄호라면
if line[i] == '(' or line[i] == ')' :
if line[i] == '(':
... | true |
45c8e153b3f8dfc1f3f03dba347d9069aa87f24f | Mrd278/Codeforces_Java | /if.py | UTF-8 | 196 | 3.421875 | 3 | [] | no_license | h=input()
if int(h)>50:
print("50+")
print(h)
else:
print("50-")
print (h)
k=input()
if int(k)>50:
print ("50+")
print(k)
else:
print("50-")
print (k)
print("Good bye!")
| true |
3b7f5aaafb7dadf79da48798e1dd11df026885d6 | cjacoby/robotwedding | /experiments/buttons/adc_test.py | UTF-8 | 1,040 | 3.390625 | 3 | [] | no_license | # Importing modules
import spidev # To communicate with SPI devices
from numpy import interp # To scale values
from time import sleep # To add delay
import RPi.GPIO as GPIO # To use GPIO pins
# Start SPI connection
spi = spidev.SpiDev() # Created an object
spi.open(0,1)
# Initializing LED pin as OUTPUT pin
#... | true |
e7b635559cda57d3ad7249c9bd2da26675f68c08 | hallel21-meet/meet2019y1lab4 | /funturtle.py | UTF-8 | 662 | 3.21875 | 3 | [
"MIT"
] | permissive | import turtle
turtle.shape('square')
turtle.shape('turtle')
finn = turtle.clone()
turtle.shape('square')
finn.goto(100,100)
finn.goto(200,100)
finn.goto(100,0)
finn.goto(0,0)
finn.goto(0,-100)
finn.goto(100,-100)
finn.goto(100,0)
finn.goto(200,100)
finn.right(90)
finn.goto(200,0)
finn.goto(100,-100)
charlie = turtle.cl... | true |
46b82e8585a72f1c9dbdca74a7a172fe964feea9 | danni/uwebsockets | /examples/echo_ssl_websocket_org.py | UTF-8 | 347 | 2.75 | 3 | [
"MIT"
] | permissive | import uwebsockets.client
uri = "wss://echo.websocket.org/"
websocket = uwebsockets.client.connect(uri)
print("Connecting to {}:".format(uri))
mesg = "The quick brown fox jumps over the lazy dog"
websocket.send(mesg + "\r\n")
resp = websocket.recv()
print(resp)
assert(mesg + "\r\n" == resp)
# close the socket to reclai... | true |
f565927791a7b0352a41f31e663935b1e7700e96 | ChengHan111/PytorchBasics | /tensor_math_comparison.py | UTF-8 | 1,979 | 3.484375 | 3 | [] | no_license | import torch
x = torch.tensor([1,2,3])
y = torch.tensor([9,8,7])
# Addition
z1 = torch.empty(3)
torch.add(x,y,out=z1)
z2 = torch.add(x,y)
z = x + y
# Subtraction
z = x - y
# Division
z = torch.true_divide(x,y) #1/9 2/8 3/7 separately
# inplace operations
t = torch.zeros(3)
t.add_(x)
# when we have '_', it means th... | true |