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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ebba057cc11d03ab94750b33d30f1125c4b9abc9 | Python | mistrzunio/random | /advent1.py | UTF-8 | 654 | 3.4375 | 3 | [] | no_license | with open('input.txt') as f:
content = f.readlines()
numbers = [int(i) for i in content]
numbers.sort()
pivot = 0
beg = 1
end = -1
tries = 0
giveup = False
while numbers[pivot]+numbers[beg]+numbers[end] != 2020 and not giveup:
tries += 1
if numbers[pivot]+numbers[beg]+numbers[end] > 2020:
end -=... | true |
97ec1cf8a928a9477fb44fe28ff9a9d3fdd16697 | Python | podhmo/individual-sandbox | /daily/20200109/example_handofcats/04multi-driver/cli-exposed-typed.py | UTF-8 | 1,048 | 2.8125 | 3 | [] | no_license | from handofcats import as_subcommand
@as_subcommand
def hello(*, name: str = "world"):
print(f"hello {name}")
@as_subcommand
def byebye(name):
print(f"byebye {name}")
as_subcommand.run()
from typing import Optional, List # noqa: E402
def main(argv: Optional[List[str]] = None) -> None:
import arg... | true |
916e7eb8f1a0dad9fefea348b01d9d8b3fcfffc1 | Python | rikukawamura/atcoder | /AtcoderProblems/ABC/ABC215/B.py | UTF-8 | 278 | 2.921875 | 3 | [] | no_license | def int_sp():
return map(int, input().split())
def li_int_sp():
return list(map(int, input().split()))
def trans_li_int_sp():
return list(map(list, (zip(*[li_int_sp() for _ in range(N)]))))
import pdb
N = int(input())
k = 0
while 2**k <= N:
k+=1
print(k-1) | true |
3353d46c4291845f30ab50987cfceadb6f40f55c | Python | hanchenn/python_demos | /Demos/pydemo1.py | UTF-8 | 241 | 3.796875 | 4 | [] | no_license | def happy():
print("Happy birthday to you~")
def sing(person):
happy()
happy()
#注意python大小写敏感
print("Happy birthday,dear",person+"!")
happy()
def main():
sing("Mike")
print()
sing("Lily")
print()
sing("Elmer")
main() | true |
6771a5a502b0370d5d2dbc397c705627a8399de4 | Python | GregHarrison/autonomous-vehicle | /nav.py | UTF-8 | 900 | 3.375 | 3 | [] | no_license | import picar_4wd as fc
import time
SPEED = 15
def reverse30():
"""
#Car reverses ~30cm
"""
speed4 = fc.Speed(25)
speed4.start()
fc.backward(SPEED)
x = 0
for i in range(5):
time.sleep(0.1)
speed = speed4()
x += speed * 0.1
speed4.deinit()
fc.stop()
def main():
"""
... | true |
0490258f0f1fe82693e644881c87490f94acf44d | Python | wangscript007/Miniwin | /src/3rdparty/grt/build/python/examples/FeatureExtractionModulesExamples/kmeans_quantizer_example.py | UTF-8 | 2,470 | 3.796875 | 4 | [
"MIT"
] | permissive | import GRT
import sys
import argparse
def main():
'''GRT KMeansQuantizer Example
This examples demonstrates how to use the KMeansQuantizer module.
The KMeansQuantizer module quantizes the N-dimensional input vector to a 1-dimensional discrete
value. This value will be between [0 K-1], where K ... | true |
19e3eb8679bda20df1485ff483d37561720111a6 | Python | csyanzhao/PythonTest | /test3.py | UTF-8 | 185 | 3.796875 | 4 | [] | no_license | msg = input("请输入你的值:")
#msg1 = input("请输入你的值:")
#print (int(msg)+int(msg1))
if msg == 'e':
print("您输入的是"+msg)
else:
print("您输入的不是e")
| true |
a25fcbbb672c9b6bbfe763c4e3bfc0feb754540e | Python | featherblacker/LeetCode | /Medium/338/338.py | UTF-8 | 660 | 3.21875 | 3 | [
"MIT"
] | permissive | class Solution(object):
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
res = [0]
while len(res) <= num:
res += [i+1 for i in res]
return res[:num+1]
def countBits1(self, nums):
output= []
for i in range(num+1):... | true |
2f6e55afbbdd2741c63a1770f52a6f646c679e84 | Python | Linux-cpp-lisp/sitator | /sitator/dynamics/MergeSitesByDynamics.py | UTF-8 | 6,565 | 2.765625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
from sitator.dynamics import JumpAnalysis
from sitator.util import PBCCalculator
from sitator.network.merging import MergeSites
from sitator.util.mcl import markov_clustering
import logging
logger = logging.getLogger(__name__)
class MergeSitesByDynamics(MergeSites):
"""Merges sites using dyna... | true |
c6e1b926f3aca0f189248118695e7117b1fc2b96 | Python | RcZo/MachineLearning | /tf_serv_app.py | UTF-8 | 1,901 | 2.65625 | 3 | [] | no_license | import json
import codecs
import numpy as np
import requests
from flask import Flask, request, jsonify
from flask_cors import cross_origin
from waitress import serve
from keras_bert import Tokenizer
dict_path = "/home/vuser/app/vocab.txt"
token_dict = {}
with codecs.open(dict_path, "r", "utf8") as reader:
... | true |
531f3a3a2c2caafc59687e5436808f2f00b82810 | Python | nekapoor7/Python-and-Django | /HACKEREARTH/Toggle String.py | UTF-8 | 50 | 2.765625 | 3 | [] | no_license | String = str(input())
print(str.swapcase(String)) | true |
b4058ab31fe38a4f71e58fdb2afead57804a4513 | Python | Wasi-git/Cryptography | /permutation box.py | UTF-8 | 799 | 3.46875 | 3 | [] | no_license | print("--- Permutation Box ---\n\n")
pBox = [
['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'],
['5','9','C','F','7','0','B','4','E','1','D','6','2','A','8','3']
]
print("P-Box:\n")
for i in range(2):
for j in range(16):
print(pBox[i][j],end=" ")
print("")
dataSi... | true |
87d7c55fdd03bea0567994b0e916e1e03d4f6020 | Python | JoTaijiquan/Python | /Pygame/pg-1-1-5.py | UTF-8 | 2,444 | 3.171875 | 3 | [] | no_license | #Python 3.7.3
#Pygame 1.9.6
#Example PG-1-1-5
import pygame, sys
from pygame.locals import *
SCREEN_SIZE = (800,600)
SCREEN_CAPTION = "Ghost Run"
FPS = 50
WHITE = (255, 255, 255)
class App:
def __init__(self):
pygame.init()
pygame.display.set_caption(SCREEN_CAPTION)
self.view = pygame.di... | true |
7ee8947fe40ac652b5d85feac434df7d1d3dd400 | Python | ZtokarZ/cs_375 | /face.py | UTF-8 | 1,254 | 3.359375 | 3 | [] | no_license | from graphics import*
def main():
win = GraphWin("Face Drawing", 1000, 1000)
win.setCoords(0,50,50,0)
win.setBackground(color_rgb(32,111,215))
draw_sun(win)
draw_rectangle(win)
draw_mast(win)
draw_stick(win)
draw_left(win)
draw_right(win)
input("Press any key to quit")
def ... | true |
976bc80181d21c75e4418225889c330e1c583aaa | Python | satyamgupta8340/pythonassignment6 | /assign6qB.py | UTF-8 | 1,157 | 3.25 | 3 | [] | no_license | # b). Deduce the percentage of developers who know python in each country.
data1['Country'].nunique()
languages=data1[data1['LanguageWorkedWith'].notnull()]
languages.head()
countries=languages['Country'].unique()
country_python={}
languages.groupby(['Country'])['LanguageWorkedWith'].value_counts()
for country in co... | true |
04aaf24d8d9116af4d00b406ae8bb909f7302ae5 | Python | asm32cn/asm32-article-sqlite3-2018 | /App_Data/asm32-article-sqlite3-sort.py | UTF-8 | 1,612 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python 2.7
# asm32-article-sqlite3-sort.py
import sqlite3
f = 'asm32.article.sqlite3'
f2 = 'asm32.article.2.sqlite3'
strTable = 'table_article'
_createQuery = '''CREATE TABLE if not exists `%s`(
`id` int,
`strTitle` varchar(255),
`strFrom` varchar(100) default nu... | true |
170a8b851ef4ae01a72b6e96c23058be409b6d4b | Python | mohammed-saleek/Python | /Sample Programs/Reverse_digits_another.py | UTF-8 | 214 | 3.828125 | 4 | [] | no_license | #Reverse of a number
#Get the range using start and end variable
start = int(input("Enter the starting limit:"))
end = int(input("Enter the end Limit:"))
for count in range(start,end)[::-1]:
print(count) | true |
f7498915490fc98dc5f0345de15396baaa157bf8 | Python | KaiShimanaka/finance | /indicators.py | UTF-8 | 16,772 | 3 | 3 | [] | no_license | # coding: utf-8
import numpy as np
import pandas as pd
from scipy.signal import lfilter, lfilter_zi
from numba import jit
# dfのデータからtfで指定するタイムフレームの4本足データを作成する関数
def TF_ohlc(df, tf):
x = df.resample(tf).ohlc()
O = x['Open']['open']
H = x['High']['high']
L = x['Low']['low']
C = x['Close']['close']
... | true |
80daafc4843cf328b760d07b67c4cde187f5ee43 | Python | lhliew/hc2020 | /audioin.py | UTF-8 | 457 | 2.78125 | 3 | [
"MIT"
] | permissive | import speech_recognition as sr
import pyaudio
print(sr.__version__)
for index, name in enumerate(sr.Microphone.list_microphone_names()):
print("Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name))
r = sr.Recognizer()
mic = sr.Microphone(device_index=0)
with mic as source:... | true |
ba9c6571a4c94cf233f43f8c252b5628d8049032 | Python | AmmarKamoona/imm-pytorch | /imm_model.py | UTF-8 | 8,934 | 2.765625 | 3 | [] | no_license | """
Implementation of
Unsupervised Learning of Object Landmarks through Conditional Image Generation
http://www.robots.ox.ac.uk/~vgg/research/unsupervised_landmarks/unsupervised_landmarks.pdf
"""
import torch
import torch.nn as nn
from torch.nn import init
from torch.nn import functional as F
def _init_weight(module... | true |
3e09229e51776f585d4f5ecff9e7480fc56826b0 | Python | rishikant42/Python-TheHardWay | /others/fib8.py | UTF-8 | 331 | 3.046875 | 3 | [] | no_license | from multiprocessing import Process
def fib1(n):
a,b = 1,1
for i in range(n-1):
a,b = b,a+b
return a
def fib2(n):
a,b = 1,1
for i in range(n-1):
a,b = b,a+b
return a
p1 = Process(target = fib1, args = (500000, ))
p1.start()
p2 = Process(target = fib2, args = (500000, ))
p2.start()
p1.join()
p2.join()
pr... | true |
5e140af1003e697d7efebb73da53e9524a9fa253 | Python | emmableu/CuratingExamples | /Datasets/CodeShape.py | UTF-8 | 7,194 | 2.640625 | 3 | [] | no_license | import sys
sys.path.append("/Users/wwang33/Documents/ProgSnap2DataAnalysis/Datasets")
from Dataset import *
sys.path.append("/Users/wwang33/Documents/ProgSnap2DataAnalysis/Models")
import json
import copy
from anytree import Node, RenderTree
from tqdm import tqdm
# This class represents a directed graph using corres... | true |
0cf0457c2cf4ca067fbcf06d6260fe0dbd173aca | Python | Kalpesh-Makwana/Python | /Exercism Exercises/atbash_cipher.py | UTF-8 | 429 | 3.328125 | 3 | [] | no_license | a = 'abcdefghijklmnopqrstuvwxyz'
b = 'zyxwvutsrqponmlkjihgfedcba'
a2b = str.maketrans(a, b, ',.')
b2a = str.maketrans(b, a)
def encode(plain_text):
encoded = plain_text.lower().translate(a2b).replace(' ', '')
s = ''
m, n = divmod(len(encoded), 5)
for i in range(m):
s += encoded[i*5:i*5+5] + ' '... | true |
85259c163e6940ab7ce3c91e22ba052dd7fa8db8 | Python | recuraki/PythonJunkTest | /atcoder/ABC/245_e.py | UTF-8 | 4,608 | 2.796875 | 3 | [] | no_license |
import sys
from io import StringIO
import unittest
import logging
logging.basicConfig(level=logging.DEBUG)
def resolve():
import sys
input = sys.stdin.readline
from pprint import pprint
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
import math
INF = 1 <<... | true |
7f2188f17f6d49e906e32a816707c3eeed33ed6e | Python | ADVRHumanoids/Horizon_old | /python/utils/conversions_to_euler.py | UTF-8 | 955 | 2.90625 | 3 | [] | no_license | from casadi import *
import math
from scipy.spatial.transform import Rotation as Rot
def rotation_matrix_to_euler(R):
def rotationMatrixToEulerAngles(R):
sy = math.sqrt(R[0, 0] * R[0, 0] + R[1, 0] * R[1, 0])
singular = sy < 1e-6
if not singular:
x = math.atan2(R[2, 1], R[2, 2]... | true |
958a13333241678e41227cd6e0aaad2cae52ed58 | Python | glennneiger/Selenium_with_Python | /05_Implicit_wait.py | UTF-8 | 647 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome(executable_path="C:/DRIVERS/Selenium_drivers/chromedriver_win32/chromedriver.exe")
driver.get("http://newtours.demoaut.com/")
# Wait up until "x" seconds until the next step is executed if an element is not found
d... | true |
9191a7e64ecb3de899d91bbe610a43793e238d24 | Python | rosekc/acm | /contest/2018/lanqiao1/3.py | UTF-8 | 538 | 3.34375 | 3 | [] | no_license | cnt = 0
def check(i):
s = str(i)
ok = True
f = True
for j in range(1, len(s)):
if s[j - 1] > s[j]:
if not f:
ok = False
break
elif s[j - 1] < s[j]:
if f and j != 1:
f = False
elif j == 1:
... | true |
7a71e8da2f3a7ae3f5a1f9ad8d6c9060ebb9a428 | Python | zinh/exercism | /python/affine-cipher/affine_cipher.py | UTF-8 | 1,449 | 3.40625 | 3 | [] | no_license | def encode(plain_text, a, b):
if not coprime(a, 26):
raise ValueError("a, 26 must be coprime")
encoded_chars = [encode_char(c, a, b) if is_ascii_char(c) else c for c in plain_text if valid_char(c)]
return " ".join(["".join(encoded_chars[i:i+5]) for i in range(0, len(encoded_chars), 5)])
def encode_... | true |
9ac04f78e88c61e344ec7d9ca69122b4c97f533c | Python | Samira-Mas/Fat-Segmentation-in-MR-using-domain-adaptation | /Visceral_fat_segmentation_U-net/data.py | UTF-8 | 3,478 | 2.515625 | 3 | [] | no_license | from __future__ import print_function
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import cv2
import glob
import skimage.io as io
import skimage.transform as trans
# from skimage.filters import threshold_multiotsu
def normalize(arr, N=254, eps=1e-14):
"""
T... | true |
1a61efe742a702d213401d98ec09c7a0cf46f503 | Python | Zhu-Jian/- | /第一类图.py | UTF-8 | 4,397 | 2.953125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from datetime import datetime
import matplotlib.dates as mdates
plt.rcParams['font.sans-serif']=['SimHei'] #显示中文标签
plt.rcParams['axes.unicode_minus']=False #这两行需要手动设置
#设置字体显示
from matplotlib.font_manager import Fon... | true |
0561cccbee20f378871cae0ac0173eee245c8aa9 | Python | rokujyouhitoma/pylisp | /pylisp/__init__.py | UTF-8 | 6,324 | 3.015625 | 3 | [
"MIT"
] | permissive | import typing
from dataclasses import dataclass
from enum import Enum
@dataclass
class Err:
reason: str
@dataclass
class Result:
value: typing.Any
err: Err
class Expression:
def to_string(self) -> str:
pass
@dataclass
class Bool(Expression):
value: bool
@dataclass
class Symbol(Expr... | true |
d94044a393e8e58b16c3908f7f84d4ac4cd1c096 | Python | john525/BachLSTM | /model.py | UTF-8 | 1,161 | 2.734375 | 3 | [] | no_license | import tensorflow as tf
class Model(tf.keras.Model):
def __init__(self):
super(Model, self).__init__()
# Define hyperparameters
self.vocab_size = 8326
self.output_size = 8326
self.batch_size = 52
# Define layers
# Define optimizer
# TODO: fill out ... | true |
46a1d56b074986aaae67c148f65a1f7417dfc6ca | Python | dandrews19/MusicLibrarySimulator | /ITP115_A10_Andrews_Dylan.py | UTF-8 | 6,123 | 3.5 | 4 | [] | no_license | # Dylan Andrews, dmandrew@usc.edu
# ITP 115, Fall 2020
# Assignment 10
# Description:
# This program will simulate a user's music library using an already-created music library, and save the music library
# with any changes back in the same file
import MusicLibraryHelper
import random
# displays menu with all the opt... | true |
25bd0010e5b971a7e71145cca842cfdf17f250a0 | Python | HS-Mannheim-GNN-KIS-SS19/GNN-KIS | /src/TestData.py | UTF-8 | 221 | 2.9375 | 3 | [] | no_license | import numpy as np
def read_matrix_from_file(path):
return np.loadtxt(path, usecols=range(3))
def random_matrix(width, height):
return np.random.randn(height, width)
print(read_matrix_from_file("Test.txt"))
| true |
cf02e4209a250019cdf9e13f714ea682e272ef72 | Python | Naouali/titinic-data | /model.py | UTF-8 | 628 | 2.65625 | 3 | [] | no_license | # Import libraries for mode
import tensorflow as tf
from tensorflow import keras
import numpy as np
import pandas as pd
# Import and preprocess the training and test data
Train = pd.read_csv("train.csv")
Test = pd.read_csv("test.csv")
X_train = Train.drop(['Survived'], axis=1)
#X_train = X_train.fillna("ffill")
X_... | true |
cfca55c253c3adc99ec076c7da6f609b3af5fba6 | Python | HPI-MachineIntelligence-MetaLearning/multi-building-detector | /multibuildingdetector/datasets/ImageBoundingBoxDataset.py | UTF-8 | 418 | 2.515625 | 3 | [
"MIT"
] | permissive | import chainer
from chainercv.utils import read_image
class ImageBoundingBoxDataset(chainer.dataset.DatasetMixin):
def __init__(self, annotations):
self.annotations = annotations
def __len__(self):
return len(self.annotations)
def get_example(self, i):
img_file, bbox, label = s... | true |
1adcee6345732cd7910257ad3256aa6eccee6318 | Python | mathuriarohan/nptsp | /code/greedyFailure.py | UTF-8 | 2,484 | 3.21875 | 3 | [] | no_license | #Author: Rohan Mathuria
#GENERATES NP-TSP PROBLEMS ON WHICH GREEDY ALGORITHMS FAIL
import random
OUTPUT_PATH = "IO/"
def gen():
#randomly generate optimal path
bestPath = list(range(0, 50))
random.shuffle(bestPath)
a = 1
#create a somewhat-random charachter assignment consistent with our optimal path
charAss ... | true |
7b22ead092d5cd226fa272389a3c2d43c2bd1bd7 | Python | x2ever/Face-Tracking | /Tracking.py | UTF-8 | 1,637 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
class Tracking:
def __init__(self):
self.boxes = list()
self.numbers = list()
self.face_num = 0
def update(self, boxes: list):
previous_boxes = self.boxes
previous_numbers = self.numbers
self.boxes = boxes
if len(boxes) =... | true |
cca8c7d8fed2b368272b63f9f16f38176a2a39fe | Python | akench/Learning-Machine-Learning | /testing/mnist_softmax.py | UTF-8 | 2,664 | 2.8125 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.examples.tutorials.mnist import input_data
import argparse
import sys
import tensorflow as tf
FLAGS = None
def main(_):
#import MNIST data
mnist = input_data.read_data_sets... | true |
4a0d896613fab0714631ccc247c39f1e56e3a0b2 | Python | efueger/recomole | /src/bin/analyze_loan_cosim_bench_run.py | UTF-8 | 2,030 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- mode: python -*-
"""
Small created to parse and analyze output from bench run against ortograf
The bench script is located in pytools
example usage:
bench http://xpdev-p01:7371/recomole/loan-cosim /home/shm/git/pytools/recomole-requests-10.json -r 1000 -m post |... | true |
72a36f0ce96b7cc647557c0661df693a4cd7c0e4 | Python | tahmidurrafid/generating-Planar-Graph | /plot.py | UTF-8 | 1,237 | 3.640625 | 4 | [] | no_license | import matplotlib.pyplot as plt
import math
# x axis values
x = []
# corresponding y axis values
y = []
xori = []
yori = []
x2 = []
y2 = []
f = open("out.dat", "r")
n = int(f.readline())
print(n)
for i in range(1, 1000):
val = int(f.readline())
if val > 0:
xori.append(i)
yori.append(val... | true |
4b0d472cd5c87ff2e276b989a75106f36951a6f6 | Python | MaxwellMkondiwa/geo-hpc | /ingest/add_raster.py | UTF-8 | 19,363 | 2.53125 | 3 | [
"MIT"
] | permissive | """
add raster dataset to asdf
- validate options
- generate metadata for dataset resources
- create document
- update mongo database
"""
import sys
import os
import re
from pprint import pprint
import datetime
import json
import pymongo
from warnings import warn
utils_dir = os.path.join(
os.path.... | true |
d77ad335b2e68d82ccdcc797a41f964429751937 | Python | Tsumifa/CAN-SAT | /Lc-Sat Data Treatment/src/script/video.py | UTF-8 | 1,495 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-s
try:
print("Chargement fichier video.py")
import cv2 as cv
import matplotlib.pyplot as plt
except Exception as e:
raise e
# class liaison avec l'interface
class Video:
# Liaison avec la class Motion filtering
def video_motion_filtering(self, video_path):
return Video_Motion_Filt... | true |
ad284247410649c90ab00b8703e97106a9f313be | Python | D3R/SublimeD3R | /d3r/commands/create_interface_command.py | UTF-8 | 2,096 | 2.515625 | 3 | [] | no_license | import sublime
import sublime_plugin
import os.path
import datetime
from ..utilities import load_data_file
from ..utilities import find_base_directory
from ..utilities import make_directory
from ..settings import get_setting
class CreateInterfaceCommand(sublime_plugin.TextCommand):
def run(self, edit):
v... | true |
485e98731dc8b527cbc2c8a0f23c20184793bd11 | Python | tjyiiuan/Project-Euler | /Python/pe002.py | UTF-8 | 220 | 3.515625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Problem 2
# Even Fibonacci numbers
m, n = 1, 2
ssum = 0
while n < 4000000:
if n % 2 == 0:
ssum += n
m, n = n, m + n
print(str(ssum))
# 4613732
# 0.001 s
| true |
c0dc94af855106642cb681487695b51932f2365f | Python | lilychen0221/leetcode | /minstack2.py | UTF-8 | 1,434 | 4.25 | 4 | [] | no_license | ####### FileName = MinStack2.py
'''Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
getMin() -- Retrieve the minimum element in the stack.'''
class N... | true |
be7e7ebb6b612263d663a73c8a2d554f3f65d195 | Python | JayFoxFoxy/ProjectEuler | /P10Old.py | UTF-8 | 776 | 3.5 | 4 | [] | no_license | def checkPrimeNumber(number):
aux = 0
count = 0
houses = 2
start = 0
if (number <=10):
count = number
else:
count = 100
if (number % 2 == 0):
start = 2
else:
start = 3
if (number == 2):
return number
elif (number == 3):
return number
else:
for i in range(start, number, houses):
#print(i)... | true |
98060f6ba1c4df767aa71fde4abbbf3938a45a2e | Python | Randheerkumar/Deep-learning_CS671 | /Assignment3/2/main.py | UTF-8 | 7,435 | 2.65625 | 3 | [] | no_license |
#importing required libraries
import numpy as np
import tensorflow as tf
import argparse
import cv2
import os
#parser for taking argument
parser = argparse.ArgumentParser()
parser.add_argument('--phase', default='train')
parser.add_argument('--train_data_path', default='dataset/output1/')
parser.add_argument('--test... | true |
b16a1be87c1025c4312bbd077c08da0a3af8d335 | Python | WalterGoedecke/ceres | /CERES/scripts/ceres_ebaf-sw_clr-1a.py | UTF-8 | 3,208 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 22 13:52:07 2015
@author: walter
"""
from netCDF4 import Dataset #, date2index
import numpy as np
from numpy import *
#import matplotlib
#import matplotlib.pyplot as plt
from pylab import *
# Add directory to path.
import sys
sys.path.insert(0, "../modules")
import Met... | true |
3dc5ae6864ca75a9b60284a27827a726498ed439 | Python | prawn-cake/lecs | /core/merkletree.py | UTF-8 | 7,283 | 3.890625 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import math
import codecs
import functools
def str_to_hex(s: str) -> bytes:
"""Convert a string to its' hex representation
>>> str_to_hex('hello world')
>>> b'68656c6c6f20776f726c64'
"""
return codecs.encode(s.encode(), 'hex')
class MerkleTree(object):
"""Simple Mer... | true |
7d5e3f27946c8c75d016fda973c94125ddc82a68 | Python | amanverma15/programing | /Aman/OldWork/turtlexyz.py | UTF-8 | 557 | 2.828125 | 3 | [] | no_license | import turtle
x = "yes"
while x != "no":
print("Hi,I am Cortana and I am going to be your calculars")
a = input("Do you want to use the calculater")
if a == "no":
a = input("Do you want to use the calculater")
elif a == "yes":
print("Thanks for using me for once")
b = int(i... | true |
29911243248f553871ac3515ed5f1dcdc8a003c1 | Python | sethmh82/SethDevelopment | /Python/00-Sorting/Breadth-First-Search-Example.py | UTF-8 | 1,280 | 3.640625 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 31 13:58:27 2020
@author: SethHarden
"""
"""
n = number of nodes
g = adjacency list of the unweighted graph
Function bfs(start_node, end_node)
prev = solve(start_node)
return reconstructPath(start_n, end_n, run)
"""
def reconstructPath(s, e, prev):
# setup an e... | true |
a4a976be04069d5104e8edcd9b2579a1e5d24402 | Python | MKamath/InteractivePython | /Blackjack.py | UTF-8 | 7,777 | 3.71875 | 4 | [] | no_license | # Title - Blackjack
# Description :-
# Blackjack is a simple, popular card game that is played in many casinos. Cards in Blackjack
# have the following values: an ace may be valued as either 1 or 11 (player's choice), face
# cards (kings, queens and jacks) are valued at 10 and the value of the remaining cards
# corre... | true |
9bd733e731ea0b0e25360ce729e8655a9c68742f | Python | chiqeen03/cuenca_code_challenge | /test_solutions.py | UTF-8 | 233 | 2.84375 | 3 | [] | no_license | import pytest
from queens import get_all_possible_solutions
@pytest.mark.parametrize("n, output",[(8,92),(9,352),(10,724)])
def test_size(n, output):
solutions = get_all_possible_solutions(n)
assert len(solutions) == output | true |
a904cf469f8ee5f71c8e276ae2726daa42bd6d35 | Python | yuyamashiro/StaticAnalysisFromFreeEnergy | /NumericalCalculation/StaticsApproximationF.py | UTF-8 | 2,221 | 3.09375 | 3 | [] | no_license | import numpy as np
class FreeEnergy:
def __init__(self, mlist):
self.mlist = mlist.copy()
self.m = mlist
def f(self, s, lam):
raise NotImplementedError('You should implement f(s, lam) which is free energy.')
def selfconsistent_m(self, s, lam):
raise NotImplementedError('Y... | true |
670d3719e540c1f07c0588e3dc222156bacd27d0 | Python | ML1ForTheFun/Exercises | /E2/2_3.py | UTF-8 | 890 | 2.703125 | 3 | [] | no_license | import matplotlib.pyplot as mplt, numpy, pylab
xs = numpy.linspace(-2, 2, 100)
maxhiddenunits = 10
maxmlps = 50
bestfunctions = []
for std in [0.5,2]:
mse = []
functions = []
for mlp in range(maxmlps):
yvaluesoverx = [0 for x in xs]
for i in range(maxhiddenunits):
ai... | true |
aeaf48d46ae443bb2bc5a52449ad647dd14f21d1 | Python | ghodouss/Roulette-Simulator | /outcome.py | UTF-8 | 5,998 | 3.546875 | 4 | [] | no_license | from random import randint, choice
class Outcome(object):
"""
Medium to Outcomes
"""
def __init__(self, name, odds):
# initialize name and odds
self.name = name
self.odds = odds
def win_ammount(self, ammount):
"""calculate winnings"""
return ammount * self.... | true |
cf09dd0b3787c8f449c0339c9904102437f0dec0 | Python | minh-tech/Bitwise-Algorithms | /Basic/Prob_27-findSumBy2BitsNum.py | UTF-8 | 676 | 4.46875 | 4 | [] | no_license | # Sum of numbers with exactly 2 bits set
# Given a number n. Find sum of all number upto n whose 2 bits are set.
# Input : 10
# Output : 33
# 3 + 5 + 6 + 9 + 10 = 33
# Input : 100
# Output : 762
def findSumBy2BitsNum(n):
num1 = 1
sum_ = 0
while num1 < n:
num1 = num1 << 1
num2 = 1
while (num1 | num2) <= n a... | true |
88cd239fa2014b9dade21b031faa6e6002f2b17c | Python | cherkesky/planetlist | /planetsChallenge.py | UTF-8 | 800 | 4.3125 | 4 | [] | no_license | '''
Challenge: Iterating over planets
Create another list containing tuples. Each tuple will hold the name of a spacecraft that we have launched, and the names of the planet(s) that it has visited, or landed on.
# Example spacecraft list
spacecraft = [
("Cassini", "Saturn"),
("Viking", "Mars"),
]
Iterate over y... | true |
f5896b07e9298b0afea918652839ed4781438c07 | Python | asasinder/py1902 | /22/09/дз.py | UTF-8 | 742 | 3.171875 | 3 | [] | no_license |
import time
ф = input('Пожалуста ведите Фамилию>')
time.sleep(1)
и = input('пожалуста ведите имя>')
time.sleep(1)
о = input('пожалуста ведите отчество >')
time.sleep(2)
j = input("пожалуста ведите сколька вам лет>")
gps = input("пожалуста ведите ваше место жительства>")
time.sleep(1)
print('....')
time.sleep(1)
pri... | true |
5358090e19e7c83fc7c039a501410a08ad2db13d | Python | TechieBoy/deepfake-detection | /experiments/head_pose/test_face_landmark.py | UTF-8 | 1,315 | 2.859375 | 3 | [
"MIT"
] | permissive | import cv2
from face import face_68_landmarks, face_5_landmarks
def test():
image_file = sample_image("yoga_01.jpg")
im = cv2.imread(image_file)
landmarks = face_68_landmarks(im)
for face in landmarks:
for (x, y) in face:
cv2.circle(im, (x, y), 2, (0, 255, 0), 1, cv2.LINE_AA)
... | true |
9439e7a4d249e1eed7d48f9e4adaafe54c2804b9 | Python | qfsf0220/gitskills | /checkio/pawn-brotherhood.py | UTF-8 | 870 | 3.28125 | 3 | [] | no_license | from string import ascii_lowercase
def safe_pawns(pawns):
count=0
for a in pawns:
print(a)
need1 =ascii_lowercase [ascii_lowercase.find(a[0])-1]+ str(int(a[1])-1)
need2 = ascii_lowercase [ascii_lowercase.find(a[0])+1]+ str(int(a[1])-1)
print(need1,need2 )
if need1 an... | true |
2cc7eb2fcb4a3e84816eeef5e5fead6aef49ee9c | Python | Marlysson/Pycep | /tests.py | UTF-8 | 2,567 | 2.84375 | 3 | [] | no_license | # -*- coding : utf-8 -*-
import unittest
from exceptions import AddressNotFound, InvalidCepException
from models import CEP , Address
from pycep import PyCEP as pycep
class TestBehaviorCEPModel(unittest.TestCase):
def test_cep_must_be_right_format_with_string(self):
cep = CEP("00000111")
def test_cep_must_... | true |
0d87e0c562edf97fa05c127d537c7df394d86c6c | Python | wooght/HandBook | /python/db-redis/index.py | UTF-8 | 2,005 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# @method : redis 基础
# @Time : 2018/3/26
# @Author : wooght
# @File : index.py
import redis, random
# 连接方式
pool = redis.ConnectionPool(host='192.168.10.10', port=6379, db=0) # 连接池
r = redis.Redis(connection_pool=pool) #连接,指定连接池
allname = ['puwenfeng', 'wooght', 'PWF... | true |
81a2e81ac15dcadc26bb848c6a74a7c122ad3c6f | Python | 1339475125/algorithms | /delete_linked_node.py | UTF-8 | 768 | 3.671875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
"""
在O(1)时间内删除链表节点
"""
class ListNode(object):
def __int__(self, x):
self.value = x
self.next = None
def __del__(self):
self.value = None
self.next = None
class Solution(object):
def delete_node(self, head, del_node):
if not head or not del... | true |
c5d8e725634e1fb6e5a5fb1a9721ca6045aad126 | Python | tinaba96/coding | /acode/abc305/d/ans.py | UTF-8 | 557 | 2.71875 | 3 | [] | no_license | from bisect import *
n = int(input())
A = list(map(int, input().split())) + [10**9+1]
RA = [0]
for i, ai in enumerate(A):
if i == 0: continue
if i%2==0:
RA.append(RA[-1] + A[i] - A[i-1])
else:
RA.append(RA[-1])
# print(RA)
def solv(r):
rp = bisect_right(A, r)
# print(rp, RA[rp-1], ... | true |
cd86a6f9e2629e93668b7a952000453e843934c4 | Python | jtveals1/my-python-software | /LargestElement.py | UTF-8 | 732 | 3.984375 | 4 | [] | no_license | #largestelement
#jason veals
#7-15-16
import random
def main():
numbers = [0]*10
for i in range(10):
numbers[i] = random.randint(1,100)
for i in range(10):
print(numbers[i])
highNum = getLargest(numbers,(len(numbers) - 1))
print()
print('high num = ',highNum)
d... | true |
77b6695fc69abc8abfa2a7f7b8643d0a8a576cbf | Python | Junaid-Akram/5271-Keystroke-Dynamics | /ditto/python/partitioner/fixed_partitioner.py | UTF-8 | 3,259 | 2.8125 | 3 | [] | no_license | import sys
from abstract_partitioner import AbstractPartitioner
class FixedPartitioner(AbstractPartitioner):
def __init__(self, nonfixed=False):
self.partionSize = 10 # Groups of people withing 10 wpm
self.lowestPartitionWPM = 20 #No group will have less than 20 wpm
self.lowestPartitionNu... | true |
d32f706706006868b4ad3728cee00ab23108b7b2 | Python | daltdoerfer/Python_Templates-1 | /00_Templates/01_Basics/24_Daytime_Zeiten_angeben.py | UTF-8 | 699 | 4.25 | 4 | [] | no_license | # https://docs.python.org/2/library/datetime.html
import datetime
# Get Current Date and Time
datetime_object = datetime.datetime.now()
print(datetime_object)
datetime_time = datetime.time()
print(datetime_time,"_")
# Get Current Date
date_object = datetime.date.today()
print(date_object)
# Format date using strf... | true |
cb43671274eab88bb49835d7c14a6f2f53a5ea93 | Python | qsblublu/MGA-machine-generate-annotation | /lib/dataset.py | UTF-8 | 3,713 | 3.15625 | 3 | [] | no_license | import re
import random
import torch
import os
from io import open
from config import config
class Lang(object):
def __init__(self, name):
self.name = name
self.word2index = {config.UDW_token: 2}
self.word2count = {config.UDW_token: 1}
self.index2word = {0: 'SOS', 1: 'EOS', 2: 'UDW... | true |
db8a7bf84cee6dd8e188eb07f8aacae7e094cdc4 | Python | gokererdogan/AdaptiveMCMCwithPG | /plot_reward_surfaces.py | UTF-8 | 4,000 | 2.765625 | 3 | [] | no_license | """
Learning Data-Driven Proposals
Plots the reward (e.g., auto-correlation time, efficiency, acceptance rate) surface
with respect to parameters of the data-driven proposal for various settings.
https://github.com/gokererdogan
5 Dec. 2016
"""
import autograd.numpy as np
import reward
import target_distribution
impor... | true |
c005d3395108851fe77db7992fba35fa0f595557 | Python | wenmeiyu/ChildProgram | /WordCloud.py | UTF-8 | 849 | 2.921875 | 3 | [] | no_license | from wordcloud import WordCloud
import numpy
import PIL.Image as Image
import xlrd
with xlrd.open_workbook("./data/majors.xlsx", encoding_override="utf-8")as excel:
sheet = excel.sheets()[0] # 读取第一个表
rows = sheet.row_values(0) # 读取第一行
print(rows) # 打印第一行
clou_list = sheet.col_values(4) # 读取第五列
... | true |
238159d23640943c9bb6cd270c8eb76bfaf4500f | Python | tmatsuo/appengine-ndb-snippets | /structured_property_models.py | UTF-8 | 1,627 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 required by applicable law or ... | true |
bda919346e80caccefa2c67c48cf002d379076f5 | Python | decodethedev/math-interpreter | /lexer.py | UTF-8 | 3,584 | 3.703125 | 4 | [
"Apache-2.0"
] | permissive | from tokens import Token , TokenType
WHITESPACE = '\n\t '
DIGITS = ['0','1','2','3','4','5','6','7','8','9']
class Lexer:
def __init__(self , text):
self.text = iter(text)
self.textoriginal = text
self.advance()
def advance(self):
try:
self.cur... | true |
3ee87ee93879209d283d233ead5d899bb15e04aa | Python | JAlexander22/Cyber_Security_Course | /cal_db/app/main.py | UTF-8 | 1,473 | 3.453125 | 3 | [] | no_license | import sqlite3
from contextlib import closing
from cal_package import calculator_module
import json
counter = 0
equation = {
}
json_object = []
for i in range (counter, 5):
counter +=1
number1 = int(input("What's your first number?: "))
number2 = int(input("What's your second number?: "))
add_val... | true |
7e8576a29701e25228548de1201964579ba0fb24 | Python | fivosf/compilers1920a2 | /html-processor.py | UTF-8 | 2,274 | 3.53125 | 4 | [] | no_license | import re
#.................Building expressions........................
#remove title tag expression
removeTitle = re.compile('<title>(.*?)</title>')
#remove comments expression
removeComments = re.compile('<!--.*?-->',re.DOTALL)
#remove style and script tag and all its contents expression
removeCode = ... | true |
ed514e288ebfa15b024ef762306c87a5f33456d0 | Python | carnotresearch/cr-vision | /src/cr/vision/saliency/saliency.py | UTF-8 | 1,542 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | '''
Wrapper class and methods for OpenCV saliency module
'''
import cv2
from cr import vision as iv
class Saliency:
'''Wrapper class for saliency models'''
def __init__(self, saliency):
self.saliency = saliency
def compute_saliency(self, image):
'''Computes the saliency map'''
re... | true |
7098fad6e3ca96af6df2be4c27c1bb3c51d444ac | Python | sagnik106/AR-Sudoku | /detect.py | UTF-8 | 2,711 | 2.53125 | 3 | [] | no_license | import cv2
import numpy as np
red=(0,0,255)
def transform(img, corners):
rows,cols,ch = img.shape
side=corners[3][0]-corners[0][0]
pts1 = np.array([corners[0], corners[2],corners[1], corners[3]], dtype='float32')
pts2 = np.array([[0, 0], [0, side-1], [side - 1, side - 1], [side-1,0]], dtype='float32'... | true |
91b4e5dbcb2b622d0b1902c26d56ecebf56131c4 | Python | helloAakash/python | /Games/space invaders.py | UTF-8 | 2,210 | 3.3125 | 3 | [] | no_license |
import pygame
import random
import math
pygame.init()
screen = pygame.display.set_mode((500,500))
pygame.display.set_caption('Space Invaders')
player_x = 100
player_y = 200
p_width = 50
p_height = 30
speed = 5
enemy_x = random.randint(0,450)
enemy_y = random.randint(0,100)
e_width = 40
e_height = 20
e_pos_x = 3
e... | true |
44cd4a923e297e485d926f528645d558a9442625 | Python | Shashwat-1995/API | /code.py | UTF-8 | 5,827 | 2.859375 | 3 | [] | no_license | #Required Libraries
import sqlite3
import time
import os
from transformers.pipelines import pipeline
from flask import Flask
from flask import request
from flask import jsonify
#Creating the App using Flask
app = Flask(__name__)
#Connecting to the database
db = sqlite3.connect('database.db')
c = db.cursor()
db.exec... | true |
040ab73c1225d2d06c937f7d784dbd66ca53fa68 | Python | hamzahbaig/Genetic-Algorithm | /assignment1.py | UTF-8 | 7,089 | 3.125 | 3 | [] | no_license | import random
import pygame
from pygame.locals import *
import time
# from matplotlib import pyplot as plt
# Movements:
# 0 -> no_action
# 1 -> left_rotation
# 2 -> right_rotation
# 3 -> forward
# Face Of Robot
#
# 3
# ^
# |
# 2 <- -> 0
# |
# v
# 1
populationSize = 100
trailSize = 28
validMo... | true |
bee2030703cef73e3e360fed3cddbd609bec2185 | Python | sanathkumarbs/gradscout | /dev/production/production-website/backend/recommend.py | UTF-8 | 12,810 | 2.8125 | 3 | [] | no_license | from filters import Filters
from matchingAlgorithm import MatchingAlgo
from database import Firebase
import pandas as pd
"""
1. FilterSelection class gets the selected user input criteria
and assignins that value to the respective paramaters
2. Whatever value is not None will get passed to the respective
filter m... | true |
59d52ab91266bfe19ef454fdc0e4c807f7892584 | Python | HarryLeaks/Blockchain-in-python-without-signed-transactions | /main.py | UTF-8 | 525 | 2.59375 | 3 | [] | no_license | from blockchain import Blockchain, Transaction
coin = Blockchain()
Trans = Transaction("address1", "address2", 100)
coin.createTransaction(Trans)
Trans = Transaction("address2", "address1", 50)
coin.createTransaction(Trans)
print('Starting the miner...')
coin.minePendingTransactions("kiko-address")
print(... | true |
9510f6e39dd160f9c50e6c75ebe3e1348272a8ba | Python | scientifichackers/foundation_bootcamp | /backend_dev/3_weather_api.py | UTF-8 | 457 | 2.671875 | 3 | [] | no_license | from flask import Flask, request
import json
import weather_info
app = Flask(__name__)
@app.route('/')
def get_weather_data():
city = request.args.get("city")
if city == None:
response = "Please enter a city in the url."
return response
else:
weather_data = weather_info.main(city)
... | true |
7e5061a792e70bcedcf31e961a175009f765b8fd | Python | jonberliner/pyt | /modules/svd_linear.py | UTF-8 | 6,937 | 2.9375 | 3 | [] | no_license | import torch
from torch import nn
from torch.nn import functional as F
class SVDLinear(nn.Module):
"""
linear layer (not affine) with params constituted by svd of the weight matrix.
increases forward compute cost at the expense of not needing to compute svd
"""
def __init__(self,
... | true |
5fc1498ec2a3c407659dded7bd1ff8899f672492 | Python | sungminoh/vim-autoimport | /python3/vim_autoimport/managers/manager.py | UTF-8 | 4,103 | 3.015625 | 3 | [
"MIT"
] | permissive | """vim_autoimport.managers.manager"""
import itertools
import re
from typing import Any, Dict, Optional, List, Tuple, Iterable
from abc import ABC, abstractmethod
import vim
from ..vim_utils import funcref
LineNumber = int # 1-indexed line number as integer.
class AutoImportManager(ABC):
# TODO: Define l... | true |
2cbc186ef3fa05e01cf79f889c634b84e1c55dd4 | Python | ArtemiyFirsov/notion-tegridy | /Services/weather/BaseWeatherAPI.py | UTF-8 | 363 | 3.078125 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
from enum import Enum
class TempScale(Enum):
Celcius = 0
Fahrenheit = 1
def celcius_to_fahrenheit(value: float):
return 9.0 / 5.0 * value + 32
class BaseWeatherAPI(metaclass=ABCMeta):
@abstractmethod
def get_current_temperature(self, scale: TempScale) ->... | true |
f15c5b5375cc5e2fd45eacdf8f31d175e8f843ad | Python | getachew67/Programming-for-Business-Intelligence-and-Analytics | /HW1(6)TianyangBai.py | UTF-8 | 1,998 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 2 18:25:37 2021
@author: hulkb
"""
print("Question 6: part 1")
import pandas as pd
ReadExcel = pd.read_excel(r'C:\Users\hulkb\Desktop\Academic\PythonP\HW1\Sample1.xlsx')
print(ReadExcel)
df1 = pd.DataFrame(ReadExcel, columns = ['Account_Bal', 'Prop_01... | true |
c8eb613ef03e7ed363c6d8be6051c17852596837 | Python | marcusRB/predictive-maintenance-spark | /kafka/engine_cycle_consumer_struct.py | UTF-8 | 5,091 | 2.765625 | 3 | [] | no_license | """
Usage: engine_cycle_consumer.py <broker_list> <topic>
spark-submit --master local[2] --packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.0 --jars spark-streaming-kafka-0-10_2.11-2.4.0.jar kafka/engine_cycle_consumer_struct.py localhost:9092 engine-stream -w 30 -s 30 -r 150
"""
import sys
import os
import ar... | true |
2eb0239a8308d73c9cd5eaad75af6de7cc55fc18 | Python | aktwo/thesis | /Code/regret_analysis.py | UTF-8 | 9,109 | 2.796875 | 3 | [] | no_license | import json
from datetime import datetime, date, timedelta
import collections
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
###################################################
### Helper functions to process input JSON file ###
###################################################
def conversation_da... | true |
c0afc837413b65ff49ed981678931643c3624fb2 | Python | RazRus8/ITMO-Python-Tasks | /Final_task/product_model.py | UTF-8 | 216 | 2.65625 | 3 | [] | no_license | class Product:
def __init__(self, id, category, product, price, date):
self.id = id
self.category = category
self.product = product
self.price = price
self.date = date | true |
d1b86b07e39847a5105b0475850e5ec86e022066 | Python | pzbelen/-au | /10.py | UTF-8 | 214 | 4.09375 | 4 | [] | no_license | N = int(input("Ingrese un valor: "))
suma = 0
for a in range (1,N):
if N%a == 0:
suma += a
if suma == N:
print("El valor es un numero perfecto")
else:
print("El valor no es un numero perfecto") | true |
02c0f6b9f3ab43a7735a78bcf52132473d03cb88 | Python | quervernetzt/maps-route-search-astar | /main.py | UTF-8 | 398 | 2.8125 | 3 | [
"MIT"
] | permissive | from typing import List
from helpers import Map, load_map
from solution import shortest_path
from tests import test
###################################
# Tests
###################################
test(shortest_path)
###################################
# Demo
###################################
map_40: Map = load_ma... | true |
f1ada0a3f6b5324785186b922cf7a71504541739 | Python | mandalsaroj/buddyadvisor | /input_data.py | UTF-8 | 2,377 | 2.859375 | 3 | [] | no_license |
#!/usr/bin/python
# view_rows.py - Fetch and display the rows from a MySQL database query
# import the MySQLdb and sys modules
import MySQLdb
import sys
import numpy as np
from datetime import timedelta
from datetime import datetime
from math import floor
fobject=[]
outputarray=[]
activities = []
def preprocessing(m... | true |
5d77e39c94d0c91b0360af710196c23d3afd693e | Python | GrantWils23/Texas_Hold_Em_Poker_Project | /tests/validators/test_flush_validator.py | UTF-8 | 1,540 | 3.46875 | 3 | [] | no_license | import unittest
from poker.card import Card
from poker.validators import FlushValidator
class FlushValidatorTest(unittest.TestCase):
def setUp(self):
self.three_of_hearts = Card(rank = "3", suit = "Hearts")
self.five_of_hearts = Card(rank = "5", suit = "Hearts")
self.nine_of_... | true |
3ec299a23336dfe0926c00b26127c1d81f9a4332 | Python | snakeli/CANoe_AS | /Log_Edit.py | UTF-8 | 2,979 | 2.71875 | 3 | [] | no_license | import os
import sys
import traceback
POWER_MODE_DICT = {"00":"OFF", "01":"ACC", "02":"RUN", "03":"Crank"}
def get_logs(log_folder):
log_path = os.path.dirname(os.path.realpath(sys.argv[0])) + os.sep + log_folder
print("Auto Sequences file path: ", log_path)
log_list = []
for root, directory, fil... | true |
1b2a76c16c4e2da3d7c2f2b631fefbb3e67bc3ff | Python | Aasthaengg/IBMdataset | /Python_codes/p03829/s990298243.py | UTF-8 | 165 | 2.671875 | 3 | [] | no_license | n, a, b = map(int,input().split())
x = list(map(int,input().split()))
cost = 0
for i in range(1, n):
ca = a * (x[i] - x[i-1])
cost += min(ca, b)
print(cost) | true |
a135f2638d1778a953172a8a2fecabbe6f699627 | Python | KFernandoDilepix/rest-api | /main.py | UTF-8 | 977 | 2.6875 | 3 | [] | no_license | from pymongo import MongoClient
from bson import json_util
from flask import Flask, request
from flask_cors import CORS
def data_base(data_limit=1):
client = MongoClient()
db = client['new_york']
restaurants_collection = db['restaurants']
data = []
for restau in restaurants_collection.find(limi... | true |
36a6513f1ea23d75dacf92d2e6a2bc968b0eca9a | Python | richasharma3101/-100--Days-of-Code | /code/Day-2/reversestring.py | UTF-8 | 207 | 4.125 | 4 | [] | no_license | def reverse(n):
str=""
for i in n:
str=i + str
return str
n=input("Enter a string")
print("The original string is:")
print(n)
print("The reverse string is:")
print (reverse(n))
| true |
eb5ee79c7ca90299c0dc4568756da9d1b2898988 | Python | a663E-36z1120/coding-interview-prep | /recursive_sorting.py | UTF-8 | 2,693 | 3.984375 | 4 | [] | no_license | from typing import Any, List, Tuple
def mergesort(lst: List) -> List:
"""Return a sorted list with the same elements as <lst>.
This is a *non-mutating* version of mergesort; it does not mutate the
input list.
>>> mergesort([10, 2, 5, -6, 17, 10])
[-6, 2, 5, 10, 10, 17]
"""
if len(lst) < ... | true |