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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e71afa6cb3b4132c537ccb18bf22b7638df8f743 | Python | kk3vin/ChemHammer | /MatrixSort.py | UTF-8 | 3,853 | 3.53125 | 4 | [
"Unlicense"
] | permissive | """
Author: Cameron Hargreaves
This code will take in a square distance matrix and then use a hierarchical
clustering algorithm to sort these points into a dendogram
"""
import numpy as np
from scipy.spatial.distance import pdist, squareform
from fastcluster import linkage
from sklearn import datasets
import matplotli... | true |
597f2b13aade6f5470867ca36c9e74c6db1dd010 | Python | JSanders2/pampro | /pampro/pampro_utilities.py | UTF-8 | 2,889 | 3.09375 | 3 | [] | no_license | import re
import collections
def design_variable_name(signal, statistic):
variable_name = "error"
if isinstance(statistic, list):
variable_name = str(signal) + "_" + str(statistic[0]) + "_" + str(statistic[1])
else:
variable_name = str(signal) + "_" + str(statistic)
return variable_name
def des... | true |
a5175987cc5877f28fc3a0236d94e0a164e6077b | Python | srihariprasad-r/workable-code | /hackerearth/Algorithms/Graphs/Connected_components.py | UTF-8 | 912 | 3.359375 | 3 | [] | no_license | '''
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
'''
# Write your code here
import sys
inputs = sys.stdin.read().splitl... | true |
6ea48875661e1f406c447ad1db73cb50ec646ff6 | Python | IvoCostajr/Codigos | /fsdfsdfsd.py | UTF-8 | 95 | 3.53125 | 4 | [] | no_license | num=[]
for i in range(5):
num.append(int(input()))
num.sort()
print(num[0])
| true |
955f6c969e8905a2dd0368c57ac59b4f4336625d | Python | achal1206/Python-Programming | /lab2.py | UTF-8 | 1,663 | 3.53125 | 4 | [] | no_license | def l():
C=['Joey','Monica', 'Ross', 'Phebe','Chandlier']
print("Current List:\n")
print(C,"\n")
print("Append:", "\n")
n=input("Enter a list element to append:\n")
C.append(n)
print(C,"\n")
print("Remove:", "\n")
n=input("Enter a list element to remove:\n")
C.remove(n)
print(C,"\n")
print("Insert:","\n")
... | true |
bd77e377a3a87e37dcda0ea4936729d615c812b6 | Python | Kurolox/python-learning | /listformatting.py | UTF-8 | 195 | 3.234375 | 3 | [] | no_license | def organize(list):
return ((", ".join(list[:-1])) + " and " + list[-1])
print(organize(["alpha", "beta", "gamma", "delta", "delta", "delta", "delta", "delta", "delta", "delta", "delta"]))
| true |
f0e530c82a09fd0680350b8ed56a99b085f18e8f | Python | rkdntm1/Python_Project | /game.py | UTF-8 | 657 | 3.421875 | 3 | [] | no_license | import pygame
pygame.init() # 초기화(반드시 필요)
#화면 크기 설정
screen_width = 480 # 가로 크기
screen_height =640 # 세로 크기
screen = pygame.display.set_mode((screen_width,screen_height)) #화면 설정
#화면 타이틀 설정
pygame.display.set_caption("Nado Game") #게임 이름
# 이벤트 루프
running = True # 게임이 진행중인가? 확인
while running:
for event in pygame.ev... | true |
21f84a1a9dfcc28c6153521a30ad01792a68dcb9 | Python | zoharai/Lexical-Event-Ordering-with-an-Edge-Factored-Model---improved | /preprocess_data.py | UTF-8 | 1,755 | 3.359375 | 3 | [] | no_license | """
Add the word 'you' in the beginning of every sentence.
"""
import sys, itertools
TARGET_VERB_FILE = 'resources/verb_list.txt'
def run_preprocessing(in_file,out_file,verb_list=None):
if verb_list == None:
verb_list = get_target_verb_list(TARGET_VERB_FILE)
f_in = open(in_file)
f_out = open(out_fi... | true |
df2c813f8b913d48b921f4e4c41dab617cd7b1c7 | Python | Aasthaengg/IBMdataset | /Python_codes/p03272/s294298885.py | UTF-8 | 131 | 2.90625 | 3 | [] | no_license | n, i = map(int, input().split())
count = 0
for num in range(n, 0, -1):
count += 1
if num == i:
break
print(count) | true |
817fead25f428abbc57cf28d0bdda43bd01038fd | Python | tomerpq/All-Projects-Of-Tomer-Paz | /Python Projects/Proj5/hw5_315311365.py | UTF-8 | 17,212 | 3.625 | 4 | [] | no_license | #Skeleton file for HW5 - Fall 2017 - extended intro to CS
#Add your implementation to this file
#You may add other utility functions to this file,
#but you may NOT change the signature of the existing ones.
#Change the name of the file to your ID number (extension .py).
############
# QUESTION 1
############
class... | true |
43633e71b37c42b641e2f67b271fb96ebb0c8b52 | Python | UpCoder/Location | /User.py | UTF-8 | 1,542 | 2.671875 | 3 | [] | no_license | # -*- coding=utf-8 -*-
from prepare import *
from Config import Config
def split_testdataset_byusershown(train_csv_path, val_csv_path, save_csv_paths):
'''
将val数据将所有记录分成user之前出现过和没有出现过
:param train_csv_path 训练的记录
:param val_csv_path 测试的记录
:param save_csv_paths 保存的新文件的路径,第一个是出现过的,第二个是... | true |
f2b99100d308a21f4aebcd83ff50a3cb79d0a1da | Python | a1610b/Hybrid-Model | /functions/ELM.py | UTF-8 | 3,732 | 2.78125 | 3 | [] | no_license |
from sklearn.preprocessing import OneHotEncoder
import numpy as np
from sklearn.datasets import load_iris # 数据集
from sklearn.model_selection import train_test_split # 数据集的分割函数
from sklearn.preprocessing import StandardScaler # 数据预处理
from sklearn import metrics
import functions.get_data as get_data
cla... | true |
d8ca8bd43e8f8c44c42ed1ee0c677bf2e5b71f94 | Python | KShaz/Project-ImageMining | /food5k.py | UTF-8 | 3,517 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''Data loading module.
'''
from __future__ import print_function
import os
import numpy as np
import csv
from tensorflow.python.keras import backend as K
from keras.preprocessing import image
from imagenet_utils import decode_predictions, preprocess_input
import pandas as pd
im... | true |
70d5e7fe9c64b908b4357f6e2d10d555898d6ca3 | Python | Moe520/csv-pipeline-strategy-pattern | /utils/sql_insert_file_outputter.py | UTF-8 | 452 | 3.15625 | 3 | [] | no_license | import numpy as np
def write_inserts_to_text_file(output_path, header_statement, data_ref):
"""
Writes sql inserts to a text file
:param output_path: file to write to
:param header_statement: The first row of the insert statement
:param data_ref: parameterized data to write to the file
:return... | true |
777c13b8dbce953ef1ea1aa655200e0e9fdfb6cf | Python | bucuram/iMaterialist-Challenge-Furniture | /generator.py | UTF-8 | 2,472 | 2.53125 | 3 | [] | no_license | from tensorflow.keras.utils import Sequence
from tensorflow.keras.utils import to_categorical
import numpy as np
import cv2
import json
import os
from PIL import Image
import imgaug.augmenters as iaa
from sklearn.utils import shuffle
base_dir = '/data/'
class Generator(Sequence):
def __init__(self, data, batch_si... | true |
db4cc818538201dce259aa62bcb334e118d2e300 | Python | KillerKing18/GIW | /Practica10/autenticacion.py | UTF-8 | 6,636 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
##
## Carlos Bilbao, Mario Bocos, Álvaro López y David Élbez declaramos que esta solución es fruto exclusivamente
## de nuestro trabajo personal. No hemos sido ayudados por ninguna otra persona ni hemos
## obtenido la solución de fuentes externas, y tampoco hemos compartido nuestra solució... | true |
c35a195fae2231daf4cba4561e0c2872767c07ec | Python | jsolosky735/lab1python | /main.py | UTF-8 | 534 | 4.125 | 4 | [] | no_license | # Author: Jamys Solosky jjs7331@psu.edu
# Collaborator: Colton Giordano jcg5896@psu.edu
# Collaborator: Lauren Hughes lmh5981@psu.edu
# Collaborator: Timothy Zheng txz5165@psu.edu
temp = input("Enter temperature: ")
unit = input("Enter unit in F/f or C/c: ")
temp = float(temp)
if unit == "C" or unit =="c":
... | true |
69f16ecc1827aeedb4271b8eee9727a8e44a8586 | Python | anderson-dan-w/artificial-intelligence | /ai/percepdelta.py | UTF-8 | 1,831 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
import math
def f(xvec, wvec):
""" Sigmoid activations function: multiply each x_i*w_i, sum them, then
plug that in to the typical sigmoid function."""
s = sum(x*w for x,w in zip(xvec, wvec))
return 1/(1+math.e**(-1 * s))
def delta(xvec, wvec, desired):
""" Calculate de... | true |
7f521187dac8536ca204c2cbb82d845037f42cc4 | Python | ulyssesMonte/prog1-2019-telem-tica | /exercícios dicionário/exercicios dicionário 1.py | UTF-8 | 434 | 3.515625 | 4 | [] | no_license | vogaisConsideradas={ "A":0,"E":0,"I":0,"O":0,"U":0}
x=True
while x==True:
e=input("Digite uma letra ")
if e.upper()=="A":
vogaisConsideradas["A"]+=1
elif e.upper()=="E":
vogaisConsideradas["E"]+=1
elif e.upper()=="I":
vogaisConsideradas["I"]+=1
elif e.upper()=="O":
vogaisConsiderada... | true |
831f833cc400baf0fd6f03afbc8cfed195b1c539 | Python | marwynnsomridhivej/ahcats | /ahcats/decorators.py | UTF-8 | 685 | 2.75 | 3 | [
"MIT"
] | permissive | import functools
import inspect
from .errors import MissingDependency
def check_pil_importable(func: callable):
@functools.wraps(func)
def decorator(*args, **kwargs):
"""Decorator interface to check if the Pillow module can be
imported
:param func: the function to decorate
:t... | true |
3fd7835a22d7d27b4a1874c2f66726e6e58b5de7 | Python | Aasthaengg/IBMdataset | /Python_codes/p03730/s522037919.py | UTF-8 | 130 | 3.09375 | 3 | [] | no_license | A,B,C = map(int,input().split())
for i in range(A,A*100000,A):
if(i % B == C):
print("YES")
exit()
print("NO") | true |
f8dc3eff5e6a45a1e3d7bc15fc6f3e18e419aa87 | Python | doyeon-kim-93/algorithm | /알고리즘47일차_0410/linked_list 소스코드1.py | UTF-8 | 4,364 | 3.515625 | 4 | [] | no_license | class Node:
def __init__(self,data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
self.cnt = 0
# <---------------------------insert---------------------------->
def insertfirst(self,data):
newnode... | true |
4be787f87463ee74372ba8f50babfbf8b07d2e62 | Python | tqtezos/kaiko-oracle | /oracle/start_feed.py | UTF-8 | 2,495 | 2.640625 | 3 | [
"MIT"
] | permissive | from apscheduler.schedulers.background import BackgroundScheduler
from flask import Flask
import atexit
import os
import datetime
import json
from time import sleep
from oracle.oracle import OracleServer
from oracle import api
oracle_address = os.environ.get('ORACLE_ADDRESS')
key = os.environ.get('TEZOS_USER_KEY')
en... | true |
8aff309f5ae59074c9862b571a4c3788fd1d96c1 | Python | abriehalgryn/algorithm-analysis | /Q3. Algorithm Analysis/table_print.py | UTF-8 | 1,966 | 3.640625 | 4 | [] | no_license | def right_pad_string(string, width):
padding = (width - len(string)) * " "
return padding + " " + string + " "
def left_pad_string(string, width):
padding = (width - len(string)) * " "
return " " + string + " " + padding
def print_table(data, alignments=None, separator_char="|",
... | true |
3defdb6f9f17a46d09f63f3033fe15d4e1a7600c | Python | cashew22/adventOfCode | /1/solver.py | UTF-8 | 386 | 3.1875 | 3 | [
"MIT"
] | permissive | f = open('lvl.txt', 'r')
lvl = 0
char = 0
first = 0
max_l = 0
min_l = 0
for l in f:
for c in l:
if c == '(':
lvl = lvl + 1
elif c == ')':
lvl = lvl - 1
char = char + 1
if lvl < 0 and first == 0:
first = first + 1
print "Basement at char: ", char
if lvl > max_l:
max_l = lvl
if lvl < min_l:
... | true |
3b60906777a17785619d53ba5e57c4ef88474962 | Python | ChristerNilsson/Lab | /2019/015B-PuzzleCS50/test.py | UTF-8 | 1,178 | 3.375 | 3 | [] | no_license | from Board import Board,manhattan
def testManhattan():
assert 0 == manhattan(0, 0)
assert 3 == manhattan(0, 3)
assert 1 == manhattan(0, 1)
assert 1 == manhattan(0, 4)
assert 3 == manhattan(0, 9)
assert 5 == manhattan(0, 14)
assert 6 == manhattan(0, 15)
assert 3 == manhattan(1, 10)
assert 3 == manhattan(2, 4)
... | true |
8853daeb5f2e0ea779a8203cf48421cf0a5ed219 | Python | wangyixi/xiaodou.online | /xiaodou_web/WEBX/wechat/wgetWeather.py | UTF-8 | 1,937 | 3.125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#需求:查询地区天气
#分析:第一步,抓取上面所有的天气信息
from html.parser import HTMLParser
from urllib import request
import pickle
import json
import sys
import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
#解析中国天气网HTML
class WeatherHtmlParser(HTMLParser):
def __init__(self):
... | true |
0e62fc68b549f7cc30e2e0497557a2b48001157a | Python | mgurunathreddy/Music-Learning-Tools | /singing_range_identification/src/singerSepTestTrainNotes.py | UTF-8 | 1,704 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 9 21:41:58 2015
Description:
Inputs:
Outputs:
@author: Gurunath Reddy M
"""
import waveio as io
import numpy as np
(fs, x) = io.wavread('../wave/Scale A#Mono.wav') # Read the samples of input wavefile
x = np.array(x, np.float64) # Convert the sample... | true |
c0955974cbc5df4537aa5e5ee144e6d9f3bbd599 | Python | Daniluvatar/PicoPlaca | /Utilities.py | UTF-8 | 863 | 3.5625 | 4 | [] | no_license | from Validations import ValidTypes, ValidDates
from datetime import datetime
class StringOperations:
"""
This class should implement all the methods needed
to process all kind of string operations
"""
@staticmethod
def getLastChar(string_var):
"""
Returns the last element of... | true |
df7272241ff6925159e78d2dc18b7ef03b2cbbe5 | Python | yuzhi233/MyProject | /暂时没用的/K折交叉验证.py | UTF-8 | 9,010 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 13:41:30 2020
@author: zhoubo
"""
import torch
import time
import DataProcess as DP
import torch.nn as nn
import time
import torch.nn.functional as F
import myplot
import numpy as np
import myplot
from matplotlib import pyplot as plt
device =torch.device('cuda'if t... | true |
57f3d79320c0c5148c26a3c510b62eea225bf307 | Python | Quiveutdumiel/Echoguidage | /tests_unitaires/pt_aiguille.py | UTF-8 | 4,360 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 10 09:41:15 2018
@author: corazzal
"""
from math import atan2, cos, sin, tan, pi, radians, degrees
global h_aiguille, h_sonde, l_sonde
h_aiguille = 0.19 #distance extremite-boule de marquage de l'aiguille
h_sonde = 0.125
l_sonde = 0.07
def orien... | true |
03c6eea9a943340e7e3b95a8b85e8f31b29e5484 | Python | LoicGrobol/python-im | /exos/chifoumi.py | UTF-8 | 1,750 | 3.765625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# chifoumi tout nul fait en cours de Python
import random
def draw(coups):
"""
Coup aléatoire au chifoumi
pas d'arguments
"""
coup = coups[random.randint(0,2)]
return coup
def rules(player_1, player_2):
"""
implémentation naïve des règles du chifoumi
arg... | true |
1973fa0cb5d19d8ec929393794b4b78391336b89 | Python | Kodsport/sakerhetssm-2021-solutions | /kval/crypto-kulla-gullas-hemlighet/solve-mkg.py | UTF-8 | 1,174 | 3.078125 | 3 | [] | no_license | #!/bin/env python3
import sys
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ"
n = 2
ciphertext = "TQNHCAREVUTRJTIÄKZJÖAUJXBVKWFÅLHBEKA"
ciphertext = [alphabet.index(x) for x in ciphertext]
print(ciphertext)
# MVHKG
knownp = [alphabet.index(x) for x in "VHKG"]
def decrypt(key):
if dec(ciphertext[-2:], key) != knownp[2:... | true |
88dbc610ce93eafafb7c35ad4f68b4f8f10378c3 | Python | thakur-amrita/Cardea | /cardea/fhir/CarePlan.py | UTF-8 | 19,942 | 2.640625 | 3 | [
"MIT"
] | permissive | from .fhirbase import fhirbase
class CarePlan(fhirbase):
"""
Describes the intention of how one or more practitioners intend to
deliver care for a particular patient, group or community for a period
of time, possibly limited to care for a specific condition or set of
conditions.
Args:
... | true |
560ad56f587c0abdbddc253e4450af539f86489f | Python | IsabelBirds/Rosalind | /Python_village/INI3.py | UTF-8 | 441 | 3.796875 | 4 | [
"MIT"
] | permissive | #Problem
#Given: A string s of length at most 200 letters and four integers a, b, c and d.
#Return: The slice of this string from indices a through b and c through d (with space in between), inclusively.
# In other words, we should include elements s[b] and s[d] in our slice.
str = 'HumptyDumptysatonawallHumptyDumpty... | true |
0c5490a37b5a0504813fbe0ddd1d1ac4811485fe | Python | CarolMazini/Manifold-Learning-for-Real-World-Event-Understanding | /projections/projections.py | UTF-8 | 7,102 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
from sklearn.datasets import make_blobs
import random
colors = ['orchid','darkblue','royalblue','r','g','b', 'c', 'm', 'y', 'darksalmon', 'blueviolet','black','darkred','silver']... | true |
fc3c2c5d8cf7c38db67bcdaa17d5f376e9c3b015 | Python | calebschoepp/linked-offline | /test-pipeline/merged-PDF.py | UTF-8 | 2,390 | 3.0625 | 3 | [
"MIT"
] | permissive | import json, sys
from PyPDF4 import PdfFileReader, PdfFileWriter
def add_link(pdf_writer, pg_from, pg_to, coords, pg_height, pg_width, draw_border=False):
if draw_border:
border = [0, 0, 1]
else:
border = None
xll1 = coords["x0"]
yll1 = pg_height - coords["y1"]
xur1 = coords["x1"]
... | true |
9de19cdba85e8ee72bd07b37c484135ce040600b | Python | Arujazzz/Python | /TSIS1-informatics/e.py | UTF-8 | 128 | 2.890625 | 3 | [] | no_license | k, n = map(int, input().split())
page=((n - 1) // k) + 1
line=((n - 1) % k) + 1
print(page, line)
"""
k n
20 25
2 5
p l
""" | true |
a0c260aff28b097cf8491258deb8084df7ba7ec8 | Python | Sulthanaimar/Pygame | /trashbin.py | UTF-8 | 1,175 | 3 | 3 | [] | no_license | snake_pos = [100, 50]
snake_body = [[100, 50], [100-10, 50], [100-(2*10), 50]]
food_pos = [random.randrange(1, (frame_size_x//10)) * 10, random.randrange(1, (frame_size_y//10)) * 10]
food_spawn = True
direction = 'RIGHT'
change_to = direction
score = 0
heart_image = pygame.image.load('heart.jpg')
... | true |
e18f30e305e24dede765568752e1eb3a08f3ae14 | Python | TWSFar/CSRNet | /utils/visualization.py | UTF-8 | 2,613 | 2.53125 | 3 | [] | no_license | import os
import cv2
import torch
from torchvision.utils import make_grid
from tensorboardX import SummaryWriter
# from dataloaders.utils import decode_seg_map_sequence
def create_vis_plot(vis, X_, Y_, title_, legend_):
return vis.line(
X=torch.zeros((1,)).cpu(),
Y=torch.zeros((1, len(legend_))).c... | true |
a75a647e65d407e6661171cb4502c86fd1806ad2 | Python | jeffmayn/DM557-Network-and-Security | /socket_programming/UDP/UDPServer.py | UTF-8 | 590 | 2.84375 | 3 | [] | no_license | from socket import *
serverPort = int(input('type port which server should listen on: '))
serverSocket = socket(AF_INET, SOCK_DGRAM)
# assigns the user applied port number to the server's socket
serverSocket.bind(('', serverPort))
print("Server is running ...")
while True:
message, clientAddress = serverSocket.rec... | true |
6fcf72fde7bec689fd79ad3034d27a6b4b54b07b | Python | normanmkhl/Coswara-Exp | /manually_annotate.py | UTF-8 | 5,902 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 17 15:02:50 2020
@author: shreyasr
"""
import os
import sys
import numpy as np
import subprocess
import pandas as pd
from pdb import set_trace as bp
# from playsound import playsound
# """
# In case playsound doesn't work:
def playsound(f):
s... | true |
0cb1b54fbddcda2cf4b2d30c3c4b5854d77bb5fb | Python | r030285/RecordSoundPython | /Recognition2.py | UTF-8 | 675 | 2.59375 | 3 | [] | no_license | import time
from google.cloud import speech
client = speech.SpeechClient()
operation = client.long_running_recognize(
audio=speech.types.RecognitionAudio(
uri='gs://my-bucket/recording.flac',
),
config=speech.types.RecognitionConfig(
encoding='LINEAR16',
language_code='en-US',
... | true |
0d3504d286e4dbb33fdb8114cc3a352c444b9da8 | Python | mayasrikanth/TwitterStudiesCode | /twitter/preprocess_efficient.py | UTF-8 | 4,045 | 2.984375 | 3 | [] | no_license | __author__ = "Maya"
__version__ = 1.0
'''Preprocessing script for social media data that uses parallel processing with dask.
Warning: lemmatization code present but commented out, as not doing so gives better results for dynamic
keyword search. '''
import preprocessor as p
import re
import sys
# remove stopwords
imp... | true |
992254007cd3d641856d075778b10055571d1286 | Python | SpeddieSwagetti/Sandbox | /password_entry.py | UTF-8 | 608 | 3.78125 | 4 | [] | no_license | """Mitchell Marks"""
while True:
try:
MIN_PASSWORD_LENGTH = int(input("Specify a minimum password length: "))
break
except ValueError or NameError:
print("Enter a valid length, you simpleton")
while True:
try:
password = input("Please enter a valid password {} characters lon... | true |
f64b007377de3bdcdd429ced22f88e666ce32e6e | Python | raulvillalobosjr/SCIENCErv | /SCIENCErv/__init__.py | UTF-8 | 1,310 | 3.0625 | 3 | [] | no_license | def convert(minutes):
return minutes*60
def how_many_seconds(hours):
return hours*60*60
def calc_age(age):
return age*365
def circuit_power(voltage, current):
return voltage*current
def convertToSecs(hours, minutes):
return (hours*60*60)+(minutes*60)
def frames(minutes, fps):
return fps*60*minutes
def calcu... | true |
be8ff7a115f32c00b4025e5f4d265a819b47d843 | Python | matheusbonjour/Graduacao | /TCC+/dominio-tcc1.py | UTF-8 | 5,569 | 2.671875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
# pacotes relacionados às funcionalidades do cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import shapely.geometry as sgeom
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
extent=[-50,-41,-30,-22]
##### TESTE ######
#... | true |
a7cdfe2f164f059bc121f5e794ff940ed63511e9 | Python | vitorlombardi/exercicios_exemplo_aulas_blue | /modulo1/exercicios/lista de exercicios/lista.py | UTF-8 | 7,981 | 4.125 | 4 | [] | no_license | #01 - Utilizando estruturas condicionais faça um programa que pergunte ao usuário dois números e mostre:
#⦁ A soma deles;
#⦁ A multiplicação entre eles;
#⦁ A divisão inteira deles;
#⦁ Mostre na tela qual é o maior;
#⦁ Verifique se o resultado da soma é par ou ímpar e mostre na tela;
#⦁ Se a multiplicação entre eles fo... | true |
c9e5eeae5f6a1882c17df6cc05588cd1ee684a41 | Python | Aasthaengg/IBMdataset | /Python_codes/p03110/s099425746.py | UTF-8 | 182 | 2.921875 | 3 | [] | no_license | n = int(input())
xu = [input().split() for i in range(n)]
y = 0
b = 0
for j in xu:
if j[1] == "JPY":
y += int(j[0])
else:
b += float(j[0])
ans = y + 380000 * b
print(ans) | true |
17cd2d3d0a9cdcc804d36d159c312f16f16c170d | Python | knowmefly/cv_with_opencv | /7-3_image_describe.py | UTF-8 | 1,317 | 2.6875 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread('source.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_, thr = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)
# cv2.imshow('Source iamge', img)
# cv2.imshow('Threshold image', thr)
# 获得图像轮廓
cnts, hier = cv2.findContours(thr, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
co... | true |
5ba6dc11fd03433790be896846982c33264d273c | Python | seyoungnam/Udacity-Data-Structures-Algorithms | /Project3/problem_7.py | UTF-8 | 2,805 | 3.828125 | 4 | [] | no_license | # A RouteTrie will store our routes and their associated handlers
class RouteTrie:
def __init__(self, root_handler = None):
self.root = RouteTrieNode(root_handler)
def insert(self, paths, handler):
curr = self.root
for path in paths:
if path not in curr.children:
... | true |
b6a0f20b24ec91b1cbdf811ffbb68ca12145a5fc | Python | diogoamvieira/DSBA-Data-Mining-Ex | /Ex1.py | UTF-8 | 381 | 4.40625 | 4 | [] | no_license | '''gives the volume of the cylinder and the surface area of that cylinder'''
import numpy as np
pi = np.pi
r = int(input('Choose a Radius for a Cylinder: '))
h = int(input('Choose a Height for a Cylinder: '))
totalvolume = pi * r ** 2 * h
surface = 2 * pi * r * 2 + 2 * pi * r * h
print('The cylinder has a volume o... | true |
8e18f02f1a6ad3228acb4effa9f58c15c43339e1 | Python | mauro37ar/ejercicios_2018 | /ejercicio_B.py | UTF-8 | 342 | 3.65625 | 4 | [] | no_license | #Dada una cadena en minúsculas pasarla a mayúsculas.
#Dada una cadena en mayúsculas pasarla a minúsculas.
#Reemplace una palabra de una cadena por otra.
#Reporte el offset (ubicación) de una palabra específica en una cadena
x ="hola"
s=x.upper()
j=s.lower()
p=j.replace("hola","adios")
u=x.find(s)
print (s)
print (j)
pr... | true |
cdff05b9ff09e29f91d96a956a823639dde2cca6 | Python | MartineJohanna/scraper_jobsearch | /alle scrapers/scraper it-contracts.py | UTF-8 | 2,561 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
# import packages
import requests
import pandas as pd
import numpy as np
import time
import requests
import datetime
import pandas as pd
import re, html
import bs4
import numpy as np
from bs4 import BeautifulSoup
# In[136]:
pd.set_option('display.... | true |
60f0086322042aa813a0f9ff729e3c6bb4ff1b9d | Python | houyingshi/mxnet | /DataOperate/ndarray.py | UTF-8 | 230 | 2.515625 | 3 | [] | no_license | from mxnet import nd
import numpy as np
X = nd.arange(12).reshape((3, 4))
print(X)
P = np.ones((2, 3))
print(P)
D = nd.array(P)
print(D)
print(D.asnumpy())
Y = nd.array([[2, 1, 4, 3], [1, 2, 3, 4], [4, 3, 2, 1]])
print(X > Y) | true |
b13057d905811a1eab4a15671336c03544ccb2e0 | Python | DaltonCole/evolutionary_algorithms | /program_files/shape.py | UTF-8 | 1,941 | 3.203125 | 3 | [] | no_license | # File name: shape.py
# Author: Dalton Cole
from shape_base import Shape_base
from random import randrange
class Shape(Shape_base):
"""Used as an interface to Shape_base
This class is used to implement Shape_base without requiring the
expensive calculations from it each time a new board is created.
I... | true |
81f95794b50f83bea5cc7fe8658d4a591f779195 | Python | simphony/simphony-numerrin | /numerrin_wrapper/numerrin_wrapper.py | UTF-8 | 6,167 | 2.546875 | 3 | [] | no_license | """ numerrin_wrapper module
Wrapper module for Numerrin using native Numerrin-Python interface
"""
from simphony.cuds.abc_modeling_engine import ABCModelingEngine
from simphony.core.data_container import DataContainer
from .numerrin_pool import NumerrinPool
from .numerrin_code import NumerrinCode
from .numerrin_mes... | true |
5e152d6158221a23a6bd2d694db070baa43d524d | Python | theLoFix/30DOP | /Day26/Day26_Excercise04.py | UTF-8 | 143 | 2.921875 | 3 | [] | no_license | # Create a read function using a partial that opens a file in read ("r") mode.
from functools import partial
read = partial(open, mode="r")
| true |
b667d5fb487f0b118649ef3f4a9d64eef3339780 | Python | hbharmal/CS303E-CS313E | /goldback.py | UTF-8 | 816 | 4 | 4 | [] | no_license | #creating a function that lists all the prime numbers from 2 to n
def is_prime (n):
if (n == 1):
return False
limit = int (n ** 0.5) + 1
div = 2
while (div < limit):
if (n % div == 0):
return False
div += 1
return True
def goldback():
a = int(input("Enter the lower limit: "))
b = int(input("Enter the u... | true |
e50e262e6708b6b82e93765bbeb716bdd18d09f3 | Python | lauradondiego/Algorithms | /stock_prices/stock_prices.py | UTF-8 | 1,347 | 4.15625 | 4 | [] | no_license | #!/usr/bin/python
import argparse
def find_max_profit(prices):
right_prices = prices[1:] # starts looking at index[1] until the end
max_price = max(right_prices) # find the max_price after first index
# if max_price is at index[0], find next largest price
# find index of largest price
# this r... | true |
551072cfd02731f3cdd0c97b093af11f91ec0b46 | Python | jermcmahan/ATM | /ATM/converter/multigraph.py | UTF-8 | 3,586 | 3.96875 | 4 | [] | no_license |
"""
MultiGraph --- class that represents a general dynamic directed multi-graph
:author Jeremy McMahan
"""
class MultiGraph:
"""
Construct the empty graph
"""
def __init__(self):
self.adjList = dict()
"""
Adds a vertex to the graph
:param u the vertex to be added
"""
de... | true |
4c82f54ab62b0eb1a6a43aa53ad94b68d75ada6f | Python | dsuess/kinkycrystals | /do | UTF-8 | 4,335 | 2.734375 | 3 | [
"BSD-2-Clause-Views"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
Usage:
do labeling [--datadir=<dd>] [--labeldir=<ld>] [--fileglob=<fg>]
do view [--datadir=<dd>] [--labeldir=<ld>] [--fileglob=<fg>]
Options:
--datadir=<dd> Where to look for the data files [default: tests/data]
--labeldir=<ld> Where to look for the label ... | true |
09242fcb3137908108c6bc1fb0467e58f396e2e2 | Python | enderson1941/Note-Collection | /LearningPython/Basic_Python/test6.2.py | UTF-8 | 966 | 3.703125 | 4 | [] | no_license | from functools import reduce
a = "this is a string"
print(a[0])
b = list(a)
print(b)
print(type(b))
b[2:4] = ["a", "t"]
print(b)
class A(object):
def __init__(self, a, b):
self.__a = a
self.__b = b
def myprint(self):
print("a= ", self.__a, "b= ", self.__b)
def __str__(self):
... | true |
acea2073dd4a053d636a32f90b088227cb4e1224 | Python | a358003542/luyiba | /luyiba/datetime_helper.py | UTF-8 | 663 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*-coding:utf-8-*-
import time
from datetime import datetime
def get_timestamp():
"""
获得当前的timestamp
:return:
"""
timestamp = time.time()
return int(timestamp)
def dt_to_timestamp(dt):
timestamp = dt.timestamp()
return int(timestamp)
... | true |
dbe682dfcc0129f1b2cf6ff44aa9c7151a2839e1 | Python | Akshidhlavanya/pythonprogramming1 | /beginnerlevel/Beginnerset10(7)printrevrsingnumber.py | UTF-8 | 111 | 3.390625 | 3 | [] | no_license | num=int(input())
rev=0
if(num<=1000):
while(num>0):
r=num%10
rev=rev*10+r
num=num//10
print(rev)
| true |
d89a53a689b6be7575ad164ae6efc211df697102 | Python | transientskp/tkp | /tests/test_utility/test_fits_utility.py | UTF-8 | 985 | 2.921875 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
import astropy.io.fits as fits
import math
import tempfile
from tkp.utility.fits import fix_reference_dec
class TestFixReferenceDec(unittest.TestCase):
def test_dec_90(self):
# Default unit is degrees.
self._test_for_reference_dec(90.0)
def test_dec_minus90(self):
# Def... | true |
0a6ea41b142b24cfa95f179da75f9b0f31155e87 | Python | SreeramSP/Python-Data-Collection-and-Processing | /#Below, we’ve provided a list of lists. Use in statements to create.py | UTF-8 | 505 | 4.1875 | 4 | [] | no_license | #Below, we’ve provided a list of lists. Use in statements to create variables with Boolean values - see the ActiveCode window for further directions.
L = [[5, 8, 7], ['hello', 'hi', 'hola'], [6.6, 1.54, 3.99], ['small', 'large']]
# Test if 'hola' is in the list L. Save to variable name test1
test1='hola' in L
... | true |
1de4c2b52209890fb83d09fe92629996f3571ccb | Python | igorcobelo/microbenthos | /microbenthos/model/resume.py | UTF-8 | 6,338 | 3.15625 | 3 | [
"MIT"
] | permissive | """
Module to implement the resumption of a simulation run.
The assumption is that a model object is created, and a HDF data store is available.
"""
import logging
from collections.abc import Mapping
import h5py as hdf
import numpy as np
def check_compatibility(state, store):
"""
Check that the given model ... | true |
69069268ca5683e7ba2e56642efc35f64c759049 | Python | pyotr777/mlframework | /lib/master_functions.py | UTF-8 | 5,101 | 3.234375 | 3 | [] | no_license | # Produce number of tasks with parameters from given ranges.
# 2017 (C) Bryzgalov Peter @ CHITEC, Stair Lab
import yaml, json
import numpy as np
def jsonify(pars):
if type(pars) is list:
a = pars.tolist()
else:
a = json.dumps(pars)
return a
def unjsonify(a):
if type(a) is dict:
... | true |
d613fcc94cd456aec389fdad4b13d513f5fb5371 | Python | myersjustinc/octostarfish | /octostarfish/repo.py | UTF-8 | 1,724 | 2.84375 | 3 | [] | no_license | import logging
import git
from .exceptions import InvalidRepoError
logger = logging.getLogger(__name__)
class Repo(object):
"""Manage the state of a local GitHub repo's clone."""
def __init__(self, gh_path, clone_url, default_branch):
self.gh_path = gh_path
self.clone_url = clone_url
... | true |
89501f339507a6ceec5280aba7a2928698b284c9 | Python | jbschtlr/Project-1 | /source/gamestates/gameState.py | UTF-8 | 4,910 | 3.125 | 3 | [] | no_license | # -*-coding:Latin-1 -*
import pygame
import globals
from models import map, character, projectile, building
from globals import NB_SQUARES_PER_ROW, NB_SQUARES_PER_COL, SQUARE_SIDE
class GameContext:
"""Context dans le state design pattern"""
def __init__(self):
""""""
self.states = {
'menu': MenuState(),
... | true |
3880543089520a89afa0215506c5fb182e16e3e2 | Python | athosduke/Puzzle_DominoesGame | /puzzle.py | UTF-8 | 5,775 | 3.15625 | 3 | [] | no_license | import math
import random
import time
from queue import PriorityQueue
import copy
def solve_distinct_disks(length, n):
if length<=n:
return None
#create board
board = []
goalboard = []
for i in range (1,length+1):
if i <= n:
board.append(i)
else:
... | true |
a4fe652c2738588102a2bef4a1a1f518a54a1685 | Python | keyu-tian/Computer-Network-2020Fall-Assignment | /src/crawler/interface.py | UTF-8 | 1,936 | 2.8125 | 3 | [] | no_license | # 2020/12/01
# Copyright by Keyu Tian, College of Software, Beihang University.
# This file is a part of my crawler assignment for Computer Network.
# All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import Any, Tuple, List
class AbsCrawler(metaclass=ABCMeta):
"""
爬虫抽象类,需要实现符合规范的爬虫方法
... | true |
fde20c846399904c530924ed0e29bb58296fbfed | Python | miararoy/feature_lib | /etl_abc/etl_abc.py | UTF-8 | 506 | 2.78125 | 3 | [] | no_license | import pandas as pd
from abc import abstractmethod, ABC
class AbstractEtl(ABC):
def __init__(self, df: pd.core.frame.DataFrame):
self.df = df.copy()
super(AbstractEtl, self).__init__()
@abstractmethod
def extract(self) -> pd.core.frame.DataFrame:
"""developer will have to imp... | true |
d1f99a88fbe1a656b16f94fa1232d9a222f8ac37 | Python | nccgroup/featherduster | /tests/test_single_byte_xor.py | UTF-8 | 286 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | import cryptanalib as ca
plaintext = 'I am the very model of a modern major-general'
ciphertext = ca.sxor(plaintext, '\x3f'*len(plaintext))
output = ca.break_single_byte_xor(ciphertext)
print output
if output[0][0] != plaintext:
raise Exception('Single byte XOR solver is broken')
| true |
8a18dea3de75c062c9870ba967b3859fe428c90c | Python | fox016/projectEuler | /euler32.py | UTF-8 | 286 | 3.25 | 3 | [] | no_license | products = set()
for a in xrange(2000):
for b in xrange(a, 2000):
numStr = str(a) + str(b) + str(a*b)
length = len(numStr)
if length < 9:
continue
if length > 9:
break
if sorted(numStr) == ['1','2','3','4','5','6','7','8','9']:
products.add(a*b)
print sum(products)
| true |
a29316f2c4023010ccfc5ca5d03669eb52152176 | Python | zereight/OpenCV- | /registerUser.py | UTF-8 | 1,763 | 2.71875 | 3 | [] | no_license |
import cv2
import os
import init
def registUser():
try:
face_detector = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml"
)
cam = cv2.VideoCapture(0)
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT,... | true |
801c2df08da301c864ea7bcc4365cfb61c3a01d1 | Python | DanielBecker-IE/BeckerHinesISSC2021 | /code/MultiModelRunner/graph.py | UTF-8 | 412 | 2.796875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import random
import pandas
results = pandas.DataFrame()
for p in range(0,11):
temp = pandas.DataFrame.from_records({'Index':p, 'Percent': "{0}/{1}".format(p*10, (10-p)*10), 'Result': random.randint(0, 1)}, index=['Percent'])
results=pandas.concat([results,te... | true |
a771ce6f2fccfd463837d27702a9828aac2f7a42 | Python | Dapro9706/voom-the-game | /player.py | UTF-8 | 287 | 2.953125 | 3 | [] | no_license | class Player:
def __init__(self):
self.rect = {'x': 0, 'y': 0}
def move(self, x, y):
self.rect['x'] += x
self.rect['y'] += y
def pre_render(self):
return {
'x': self.rect['x'] * 32,
'y': self.rect['y'] * 32
}
| true |
089c23d91f4485655891f8ff8120516d51092084 | Python | sarsees/Course_Files | /Projecto/weighted_fitting.py | UTF-8 | 5,796 | 3.25 | 3 | [] | no_license | from openpyxl import load_workbook
import scipy.optimize
import numpy as np
import csv
import matplotlib.pyplot as plt
#Read me: describe the problem and anything you need to run the code
#Conclusion of nested loop
def extract_data(data,start_row,end_row,start_col,end_col):
data_range_start = []
data_range_en... | true |
5bfaa051b645fc09826e8d852de8236f4bd33feb | Python | jfreds91/pipeline_template | /train_model.py | UTF-8 | 12,043 | 2.6875 | 3 | [] | no_license | # core
from typing import Tuple
import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import json
import os
import re
import logging
from configparser import ConfigParser
from tqdm import tqdm
# model eval
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.... | true |
9a85106e8cf67ef0e91d0dbd2c204a5c96c15fc0 | Python | dozymoe/emerge_conflict_resolve | /emerge.py | UTF-8 | 2,259 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
import asyncio
import sys
from re import compile
RE_COLOR = compile(r'\x1b\[\d+(;\d+)?(;\d+)?m')
RE_CONFLICTED_PACKAGES = compile(
r'^\s+[>=~<]*(?P<package1>[\w/-]+?)(:|\[|-\d+).* required by '
r'\((?P<package2>[\w/-]+?)-\d+.*, installed\)$'
)
emerge_running = True
packages_reinstalled... | true |
4f020837e3b8ad7927ff21fd16babd218561100a | Python | tthoraldson/hacker_rank | /python/Introduction/whats-your-name.py | UTF-8 | 210 | 3.375 | 3 | [
"MIT"
] | permissive | # Completed on 4/28/2016 by Theresa Thoraldson
# source: https://www.hackerrank.com/challenges/whats-your-name
first = raw_input()
last = raw_input()
print("Hello " + first + " " + last +"! You just delved into python.") | true |
6277b16bf37af73742c8b4aa6b096d6500ed68b8 | Python | adibl/corsera_algoritems | /tests/2-data-structures/4-binary-search-trees/test_treaversals.py | UTF-8 | 1,943 | 2.921875 | 3 | [] | no_license | import string
import random
import test_class
class Test_spec(test_class.Test):
COURSE_PATH = '/home/adi/PycharmProjects/algoritems/solutions/2-data-structures/4-binary-search-trees/'
MY_PATH = '/home/adi/PycharmProjects/algoritems/my_solutions/2-data-structures/4-binary-search-trees/'
IS_PRINT_OUTPUTS = ... | true |
ef7dca91aee565f74bda816faac028eb4f4feab4 | Python | NanXiangPU/leetcode | /copy-list-with-random-node/copyListWithRandomNode.py | UTF-8 | 1,676 | 3.625 | 4 | [] | no_license | # Definition for singly-linked list with a random pointer.
# class RandomListNode(object):
# def __init__(self, x):
# self.label = x
# self.next = None
# self.random = None
class Solution(object):
#O(n) space, O(n) time with hashmap
def copyRandomList(self, head):
"""
:... | true |
9179d0c2b6c573be01a89b7af62725c8e69a07d3 | Python | enderquestral/Reed-CSCI121 | /Week7/collatz_length.py | UTF-8 | 239 | 2.71875 | 3 | [] | no_license | #partner: hanheller
#partner: thomsonc
def collatz_length(n):
if n==1:
return 1
else:
if n%2 ==0:
n = n//2
else:
n = (n*3) +1
# print(n)
return collatz_length(n) + 1
| true |
70d817d36163a98cdc3660e0229f34cd38112e7e | Python | YizheZhang-Ervin/AlgorithmsJS | /6-常规算法/笔试/小偷问题.py | UTF-8 | 2,166 | 3.453125 | 3 | [] | no_license | # 198. House Robber:小偷不能偷相邻的房子,求最大收益
class Solution(object):
def rob(self, nums):
size = len(nums)
if size == 0: return 0
if size <=2: return max(nums)
Values = [nums[0],max(nums[0],nums[1])]
for i in range(2,size):
Values.append(max(Values[i-2]+nums[i],Values[i-1... | true |
0ce6293f969fde9846485a49fe5cd94a976e4fcf | Python | Inpurple/Leetcode | /121. Best Time to Buy and Sell Stock/Solution_动态规划.py | UTF-8 | 1,004 | 3.34375 | 3 | [] | no_license | class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
'''粗暴方法,O(n的平方)超出时间限制
diff=0
dic={}
for index2 in range(0,len(prices)):
for index1 in range(0,len(prices)):
if index2>index1:
... | true |
472f36385be536775ff79a2eee5e65e2b953b201 | Python | CharmingCheol/python-algorithm | /백준/그래프/1197(최소 스패닝 트리).py | UTF-8 | 1,157 | 3.4375 | 3 | [] | no_license | import sys
# 특정 노드의 부모 노드 찾기
def getParent(x):
if graph[x] == x: return x # 현재 노드가 부모의 노드가 같다면(자신을 가리킨다면)
graph[x] = getParent(graph[x]) # 재귀로 자신의 부모 찾기
return graph[x]
# 각 부모 노드를 합침. 더 작은 값으로 갱신
def unionParent(a, b):
a = getParent(a) # 부모 찾기
b = getParent(b) # 부모 찾기
if a < b:
g... | true |
7b35d87346d6d6300a76e61dc05e293e4a887e27 | Python | gyang274/leetcode | /src/0800-0899/0875.koko.eat.banana.py | UTF-8 | 714 | 3.5625 | 4 | [] | no_license | from typing import List
class Solution:
def minEatingSpeed(self, piles: List[int], H: int) -> int:
if H == len(piles):
return max(piles)
l, r = max(1, sum(piles) // H), max(piles)
while l < r:
m = l + (r - l) // 2
# s = sum(map(lambda x: (x // m) + bool(x % m), piles))
s = sum(map... | true |
6715004a19156d0852148e0d838ebee50277dadd | Python | Kendralabs/atk | /integration-tests/tests/model_rename_test.py | UTF-8 | 4,362 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # vim: set encoding=utf-8
#
# Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | true |
3683efebf042f620810c4110a003e2526dbddc90 | Python | 19manu98/HackerRank | /SumMultiple3and5/sum.py | UTF-8 | 317 | 3.515625 | 4 | [] | no_license | import sys
t = int(input("How many Numbers do you want to sum? ").strip())
for a0 in range(t):
n = int(input("enter the number you want to sum ").strip())
nFif = 0
nThree = (n-1)//3
nFive = (n-1)//5
nFif = (n-1)//15
print(3*nThree*(nThree+1)//2 + 5*nFive*(nFive+1)//2 - 15*nFif*(nFif+1)//2)
| true |
0039b7171b14dfebcf6722ceef17ab4599e4667a | Python | zhiqwang/vision | /torchvision/prototype/transforms/functional/_utils.py | UTF-8 | 3,162 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import functools
import inspect
from typing import Any, Optional, Callable, TypeVar, Dict
import torch
import torch.overrides
from torchvision.prototype import features
F = TypeVar("F", bound=features._Feature)
def dispatch(kernels: Dict[Any, Optional[Callable]]) -> Callable[[Callable[..., F]], Callable[..., F]]:
... | true |
6aed5f3614f7437d9c2403e37c14a81c665a73e1 | Python | masaldede/sample-test-quiz | /testquiz.py | UTF-8 | 2,452 | 3.71875 | 4 | [] | no_license | """
Behavior: These variables will be questions and answers.
Inputs: Questions and answers
Outputs: None
"""
easy_text = """
elephants have tails (yes/no) __1__
crows have 3 eyes (true/false) __2__
result of this (21/7)+2 __3__
capital of turkey? __4__
"""
easy_answers = ["yes","false","5","ankara"]
... | true |
f0aa3f7024f2e635b30de9440f6009ba89cc68d6 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2281/60695/295604.py | UTF-8 | 328 | 3.671875 | 4 | [] | no_license | t = int(input())
for i in range(t):
n = int(input())
a = input().split(" ")
a = list(map(int, a))
for i in range(n - 1):
flag = True
for j in range(i + 1, n):
if a[i] < a[j]:
flag = False
if flag:
print(str(a[i]) + " ", end="")
print(a[... | true |
0440b89772ac5dbf25a4fbf635bfe8df3953eaa3 | Python | sivakumar2505/chatbot | /twitter_api_link.py | UTF-8 | 516 | 2.6875 | 3 | [] | no_license | import requests
import json
def twitter_api():
urls = []
url = "https://api.twitter.com/2/tweets/search/recent?query=lang:en corona virus&max_results=10&tweet.fields=created_at&expansions=author_id"
header = {
'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAAOJkKgEAAAAAiRCEQoX9hZajRJP1nvOAdBHQoPI%3Dd... | true |
34aa97bb6c08c50d87c0132525bbb17523e24e2a | Python | yordan-marinov/advanced_python | /comprehensions/even_matrix.py | UTF-8 | 193 | 3.015625 | 3 | [] | no_license | def even_numbers_list_checker():
return [i for i in map(int, input().split(", ")) if i % 2 == 0]
n = int(input())
matrix = [even_numbers_list_checker() for _ in range(n)]
print(matrix)
| true |
e290def9573b46bcfd5957fd3bdd6a408f768e7d | Python | sergiomafra/codility-solutions | /lesson1_binarygap.py | UTF-8 | 311 | 2.90625 | 3 | [] | no_license | import re
def solution(N):
# Converting N to binary
b = bin(int(N)).lstrip('0b')
# Regex for the rescue
matches = re.finditer(r'(?=(10{1,}1))', b)
results = [len(match.group(1).strip('1')) for match in matches]
if results == []:
return 0
else:
return max(results)
| true |
ad5f3f795ad5503c90e687a0eba2b50c9b59d21c | Python | olls/advent-of-code | /day1.py | UTF-8 | 219 | 3.5 | 4 | [] | no_license | def parta(inp):
return inp.count('(') - inp.count(')')
def partb(inp):
floor = 0
for p, c in enumerate(inp):
floor += int(c == '(') * 2 - 1
if floor < 0:
break
return p + 1
| true |
73504bc1c9ccd5d5e8f374b7739e64708678f37d | Python | mickymicmouse/Algorithm | /2231.py | UTF-8 | 227 | 3.109375 | 3 | [] | no_license | N = int(input())
result=False
for i in range(1, N+1):
string = str(i)
num = i
for j in string:
num+=int(j)
if num == N:
result=True
print(i)
break
if result==False:
print(0)
| true |