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 |
|---|---|---|---|---|---|---|---|---|---|---|
b2baedab1737e102005c9b4f0418b32936b50750 | ioyy900205/.leetcode | /7.reverse-integer.py | UTF-8 | 1,247 | 3.578125 | 4 | [] | no_license | # @lc app=leetcode id=7 lang=python3
#
# [7] Reverse Integer
#
# @lc tags=math
# @lc imports=start
from imports import *
# @lc imports=end
# @lc idea=start
#
#
#
# @lc idea=end
# @lc group=
# @lc rank=
# @lc code=start
class Solution:
def reverse(self, x: int) -> int:
r = int(str(abs(x))[::... | true |
f4bf2de4d0d63acd73177aded88dd60fc627fdc4 | HiInvoker/python | /pythonNote/pickle/code | UTF-8 | 528 | 3.484375 | 3 | [] | no_license | #!/sur/bin/env python
#Filename: pickle.py
#将文件储存为二进制,将二进制格式的文件打开
impot pickle
my_list = [1,2,[3,4],'hello world']
pickle_f = open('pickle.txt', 'wb')
pickle.dump(my_list, pickle_f) #存储 只能够使用list类型的,所以。如果来源是一个文件。就要:
#f = open(filename)
#lst = []
#for i in f:
# i = i.strip()
# lst.append(i)
pickle_f.close()... | true |
34009ce7bb29dd7d308bc18cf19561d080128909 | oogiayo/TIL | /src/TIL_0728/d3_1215_회문1.py | UTF-8 | 1,184 | 2.828125 | 3 | [] | no_license | dr = [1,0]
dc = [0,1]
T = 10
for tc in range(1, T+1):
N = int(input())
puzzle = [['' for c in range(8)] for r in range(8)]
for r in range(0, 8):
line = input()
for c in range(0, 8):
puzzle[r][c] = line[c]
tot = 0
for r0 in range(0, 8):
for c0 in range(0, 8)... | true |
c670d45875d2c2f64fef6ad580f1ac55cd9269d7 | brooke-k/Apollo_11 | /scripts/papers/scrape_sample_papers_from_curation.py | UTF-8 | 2,760 | 2.5625 | 3 | [] | no_license | # step two of three.
# Step one was to run scrape_sample_papers_from_ads.py
# Step three is to run create_papers_datafile.py
# this script scrapes the lunar sample curation website for excel data docs for each sample number listed in the geoData.csv file
__author__ = 'Feist'
import pandas as pd
import requests
import ... | true |
8751198ff87d3592f86c4cb27710984bf08c532c | saintograph/algorithmic-toolbox | /Week-02/assignment-01/fibonacci_huge/fibonacci_huge.py | UTF-8 | 1,121 | 3.453125 | 3 | [] | no_license | # Uses python3
# An algorithms to get larger Fibonacci numbers with the Q~Matrix
import timeit
fib_matrix = [[1,1],
[1,0]]
def matrix_square(A, mod):
return mat_mult(A,A,mod)
def mat_mult(A,B, mod):
if mod is not None:
return [[(A[0][0]*B[0][0] + A[0][1]*B[1][0])%mod, (A[0][0]*B[0][1] + A[0]... | true |
f8911337bdc629d81004b78c0bbef71ad876b896 | AnatolyDomrachev/karantin | /is28/maznicyn28/raraze96/lab3/day.py | UTF-8 | 241 | 3.09375 | 3 | [] | no_license | import math
s = int(input())
s = s % 7
if s == 1 :
print("пн")
elif s == 2 :
print("вт")
elif s == 3 :
print("ср")
elif s == 4 :
print("чт")
elif s == 5 :
print("пт")
elif s == 6 :
print("сб")
elif s == 0 :
print("вс")
| true |
8cd033129bf03983d2a7f60c4a316907065b934e | brafumSec/HCRESC | /src/DAG/DAG.py | UTF-8 | 1,497 | 2.6875 | 3 | [] | no_license | #coding:utf-8
import re
#print("input file name:")
#name=input()
#with open(name) as f:
# list=f.readlines()
with open('computing-1-calculator.s') as f:
list=f.readlines()
lr=[] #list of variable r
ln=[] #lr中每个r对应的行号
leng=len(list)
i=-1
while i < leng-1:
i+=1
list[i]=list[i].rstrip('\... | true |
91903b7b90b64ea3252797740d3fc9104f7f8341 | stasywow/prj1 | /name.py | UTF-8 | 34 | 2.65625 | 3 | [] | no_license | name = ('Стася')
print(name)
| true |
a2e674b3172aaa8a75940bcd8f5629c604699dd4 | Wiki-fan/generative-models | /src/dra_gan.py | UTF-8 | 9,213 | 3.296875 | 3 | [
"MIT"
] | permissive | """ (DRAGAN) https://arxiv.org/abs/1705.07215
Deep Regret Analytic GAN
The output of DRAGAN's D can be interpreted as a probability, similarly to
MMGAN and NSGAN. DRAGAN is similar to WGANGP, but seems less stable.
Proposes to study GANs from a regret minimization perspective. This
model is very similar to WGAN GP, i... | true |
2a087272547448b699ba8f621acaabd68c26cdb3 | jonnynabors/guet | /guet/git/_file_name_strategy.py | UTF-8 | 346 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | class FileNameStrategy:
def apply(self, base_name: str) -> str:
raise NotImplementedError()
class AlongsideFileNameStrategy(FileNameStrategy):
def apply(self, base_name: str):
return base_name + '-guet'
class BaseFileNameStrategy(FileNameStrategy):
def apply(self, base_name: str) -> str:... | true |
709fc5f6713017472df4ddecdb8b466e96bad39b | Aasthaengg/IBMdataset | /Python_codes/p02640/s383515510.py | UTF-8 | 132 | 3.046875 | 3 | [] | no_license | x,y=map(int,input().split())
if y%2 == 1:
print('No')
elif x*2 > y:
print('No')
elif x*4 < y:
print('No')
else:
print('Yes') | true |
fda1854fdceaa6fa941731eda1e6e63edc97447c | JDSanti/StockMarket | /market.py | UTF-8 | 2,125 | 3.5 | 4 | [] | no_license | '''
Jose D. Santiago
May 1,2020
Python 2.7 Script to get Stock Market Data of NASDAQ companies
'''
#Import Libraries
try:
import argparse
import sys
import yfinance as yf
import matplotlib.pyplot as plt
from datetime import date
from pprint import pprint
except Exception as e:
print('Some M... | true |
7ab09c823e28a57c18ae371fc33fd41b3ffe7af9 | Saurabh4626/dsa | /linklist/kth_Ancestor.py | UTF-8 | 2,176 | 3.921875 | 4 | [] | no_license | import queue
class BinaryTreeNode:
def __init__(self,data):
self.data=data
self.left=None
self.right=None
def printTreeDetailed(root):
if root == None:
return
print(root.data,end=":")
if root.left !=None:
print("L",root.left.data, end=",")
if roo... | true |
70238eba13f7ddad1d21e0fb1b55e94e7c6eb3c7 | abhra2020-smart/the-forest-of-dangers | /main.py | UTF-8 | 353 | 2.59375 | 3 | [] | no_license | Tree: Sprite = None
scene.set_background_color(9)
Abby = sprites.create(sprites.castle.hero_walk_front1, SpriteKind.player)
Abby.set_position(123, 49)
controller.move_sprite(Abby)
for index in range(randint(5, 80)):
Tree = sprites.create(sprites.castle.tree_small_pine, SpriteKind.projectile)
Tree.set_position(r... | true |
27e16df6d52c9a2a40ff447d40758690330a7e06 | mveselov/CodeWars | /katas/beta/logical_and_nonnegative_matrix.py | UTF-8 | 1,082 | 3.09375 | 3 | [
"MIT"
] | permissive | def logical_matrix(matrix):
return all(item in (0, 1) for row in matrix for item in row)
def nonnegative_matrix(matrix):
return all(item >= 0 for row in matrix for item in row)
def sum_nonnegative_logical_matrix(matrix1, matrix2):
if logical_matrix(matrix1) and nonnegative_matrix(matrix1) and \
... | true |
bb8ec0024fb26c16167bc5c3f2941a2024ff6316 | ctrlbadger/Further-Maths-Decision | /BubbleSort.py | UTF-8 | 383 | 3.546875 | 4 | [] | no_license | import random
unsortedList = list(range(25000000))
random.shuffle(unsortedList)
swapped = True
while swapped:
swapped = False
for index in range(0, len(unsortedList) - 1):
if unsortedList[index] > unsortedList[index + 1]:
unsortedList[index], unsortedList[index + 1] = unsortedLis... | true |
87e9a6f3250adc5aaf3285479b84416be3e2aeab | fordf/machine-learning | /src/knearest.py | UTF-8 | 3,070 | 3.578125 | 4 | [] | no_license | """Implement K Nearest Neighbour Classifier in Python."""
from types import FunctionType
from collections import Counter
import numpy as np
class KNearestNeighbors(object):
"""
K Nearest Neigbour Classifier.
KNearestNeighbors(distance_metric='euclidean')
predefined distance metrics:
- 'euc... | true |
82c323d6979e8f299474b9c06e17896d7c7808b0 | RoRu/Python_git | /func.py | UTF-8 | 201 | 3.171875 | 3 | [] | no_license | def phi(x):
"""posledovatelnost' Phibonachi"""
if x == 1 or x == 2:
b = 1
return(b)
else:
b = phi(x-1) + phi(x-2)
return(b)
a = int(input())
print(phi(a)) | true |
68e68c8d40700c98d5211e0cd3b46a688576a29d | knightrohit/monthly_challenges | /leetcode_nov_2020/03_consecutive_character.py | UTF-8 | 263 | 3.015625 | 3 | [] | no_license | """
Time/Space Complexity = O(N)
"""
from itertools import groupby
class Solution:
def maxPower(self, s: str) -> int:
size = 0
for i, k in groupby(s):
size = max(size, len(list(k)))
return size | true |
2915346fe92d435bb52cb2425da0fcfefc571887 | andre13/pw-python-03 | /exercicio_3/main.py | UTF-8 | 969 | 3.625 | 4 | [] | no_license | import os
from os.path import abspath
def pede_caminho ():
while True:
pasta = input("Introduza o caminho (relativo ou absoluto) da pasta: ")
if os.path.isdir(pasta):
break
else:
print("A pasta não existe.")
return pasta
def calcula_tam... | true |
0cdbc19c4c7d43337a2851c740ced77174c61836 | Yeeun-Lee/coding-test-study | /BackTracking/BOJ/BOJ-9663-NQueen.py | UTF-8 | 593 | 3.28125 | 3 | [] | no_license | # N-Queen(PyPy3)
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
N = int(input())
def promising(x):
for row in range(x):
if rows[row]-rows[x] == 0: # or 로 연결해서 제출시 시간초과
return False
if abs(rows[row]-rows[x]) == x - row:
return False
return True
def ... | true |
f2c0866bc1fe96a4fb95c0778e17fc2fd495417a | Maunil/assignments | /code/code.py | UTF-8 | 5,595 | 3.265625 | 3 | [] | no_license | # The code provides fesility to extract the important keywords from a given text story.
# Steps I have taken
# 1) cleaning process (Removing unnecessary things, punctuations, html tags etc) and removing redundant entries.
# 2) Removing the stopping words. For example, a, an, the etc.
# 3) Tokenize the stories usi... | true |
7db6cf285c3ef2ae9037e1cefbf0bf34e9312a37 | pablonewgen/SchoolWork | /CS609/q4.py | UTF-8 | 259 | 3.21875 | 3 | [] | no_license | import sys
def readFile(fileName):
file = open(fileName, 'r')
printLines(file)
def printLines(filePassed):
i = 1
for line in filePassed.readlines():
if i % 2 == 0 :
sys.stdout.write(line)
i += 1
| true |
8295f6c3a368db6625d5f4351ebdd79629ba2bbf | mudrole1/feli_morse | /feli_sim/default.py | UTF-8 | 1,047 | 2.546875 | 3 | [] | no_license | #! /usr/bin/env morseexec
""" Basic MORSE simulation scene for <feli_sim> environment
Feel free to edit this template as you like!
"""
from morse.builder import *
from feli_sim.builder.robots import Feli
# Add the MORSE mascott, MORSY.
# Out-the-box available robots are listed here:
# http://www.openrobots.org/mors... | true |
6764f9f40743ae9b26f6ee162346c9c701f1ffe7 | vyom13/PCA-and-Linear-Regression-in-Python | /Q1.py | UTF-8 | 2,206 | 2.953125 | 3 | [] | no_license |
# coding: utf-8
# In[18]:
import numpy as np
from numpy import genfromtxt
from numpy import linalg as lg
from numpy import linalg as LA
from matplotlib import pyplot as plt
import pandas as pd
def d_PCA(x):
columnMean = x.mean(axis=0)
columnMeanAll = np.tile(columnMean, reps=(x.shape[0], 1))
xMeanCenter... | true |
e0d2b5b3c26559bacf4447c54420ccaa527caced | saisurajpydi/Dynamic-Programming | /LCS/SeqPatternMatchng.py | UTF-8 | 685 | 3.765625 | 4 | [] | no_license | """
str1 = "AXY"
str2 = ""ADXCPY"
output = True (is str1 is a subseq of str2 or not)
"""
class Solution:
def seqPattern(self, A , B):
n1 = len(A)
n2 = len(B)
col = n2 + 1
row = n1 + 1
dp = [[0 for i in range(col)] for i in range(row)]
for i in range(1,row):
... | true |
64a7fefa3d7a15cfdaa1c735a7bf9b5ad809f838 | Tantai2003/Git | /Grader y 1/08_Dict_12.py | UTF-8 | 318 | 2.921875 | 3 | [] | no_license | n = int(input())
p = {}
pp = {}
for i in range(0, n):
m = input().split()
p[m[0]] = m[1]
pp[m[1]] = m[0]
n = int(input())
k = []
for i in range(0, n):
x = input()
k.append(x)
for x in k:
if x in p:
print(p[x])
elif x in pp:
print(pp[x])
else:
print('Not found')
| true |
ad2536862ee495253f0a75ba94508931e90b90d2 | alycejenni/ginji | /ginji/outputs/_base.py | UTF-8 | 925 | 2.890625 | 3 | [] | permissive | from abc import ABC, abstractmethod
class BaseOutput(ABC):
"""An object causing an effect in the system, e.g. a buzzer or a camera."""
def __init__(self):
self._uploaders = []
self._notifiers = []
def register_connectors(self, *connectors):
"""Register connectors to run after the... | true |
706bfdafba4c2d5b88df542de5d47f019d7e984d | AKnittle/Web_Experiments | /queue.py | UTF-8 | 825 | 3.8125 | 4 | [] | no_license | """Queue Helper Class"""
class Queue:
# The option to initialize with just data or with pre-existing child nodes
def __init__(self, queue_list=None):
self.queue_list = queue_list
def add_to_queue(self, data):
if self.queue_list is None:
# print("Creating New Queue...")
... | true |
abb55c68f296777014a481e79218a232f437f2d2 | HomeSen/CTFs | /Hackvent 2015/07 imagination/day07.py | UTF-8 | 547 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
from math import sqrt
from PIL import Image
num = 0x1fc137f82a7a0dd05d76ebbcbb74815d82c720ff555fc018801f78baaf93c051d55e46346fd16dd457f54451df65fcec3a493768ffc00948aff4154e090627753ffebafa7ddd568860a87a3fd88eb
bits = bin(num)[2:]
print bits
print len(bits)
print sqrt(len(bits))
width = int(sqr... | true |
1fc11f84a802ebba4e047600d7c41e02640b1409 | wangyongguang/Python | /python语言程序设计/第三部分-类型的概念/pi.py | UTF-8 | 329 | 3.328125 | 3 | [] | no_license | #pi.py
from random import random
from math import sqrt
from time import clock
DARTS = 1200
hits = 0
clock()
for i in range(1,DARTS) :
x, y=random(),random()
dist = sqrt(x**2+y**2)
if dist <=1.0:
hits = hits +1
pi = 4 * (hits/DARTS)
print("Pi的值是 %s"%pi)
print("程序运行时间是%-5.5ss"%clock())
| true |
6f6bbdf78e00b2ab87ad83cc42b4e42e04f5c39c | Your-Sempai/BratikGoToMe | /Keyboard/ProfilKeyboard.py | UTF-8 | 5,776 | 2.796875 | 3 | [] | no_license | from vk_api.keyboard import VkKeyboard, VkKeyboardColor
# Профиль пользователя
def profil():
keyboard = VkKeyboard(one_time=False)
# False Если клавиатура должна оставаться откртой после нажатия на кнопку
# True если она должна закрваться
keyboard.add_button("Меню", color=VkKeyboardColor.NEGATIVE)
... | true |
11b55a47970d7710a916b34b1d0a452b4a15cc34 | Nidhig631/Mosh_python_course | /video_2/math_func.py | UTF-8 | 95 | 3.046875 | 3 | [] | no_license | import math
print(round(2.9))
print(abs(-2.9))
print(math.ceil(2.2))
print(math.factorial(8))
| true |
86c429dca898373e2dd34ddf9e9dcee9843be6a9 | tirthbal/AlgorithmsAndDataStructures | /python/evaluation_postfix.py | UTF-8 | 444 | 3.703125 | 4 | [] | no_license | from stack_ll import Stack_ll
# 2 3 1 * + 9 -
def cal(a, b, op):
if op == '^':
return a ^ b
if op == '*':
return a * b
if op == '/':
return a / b
if op == '+':
return a + b
if op == '-':
return a - b
def evaluation_postfix(expr):
st = Stack_ll()
for c in expr:
if not c.isdigit():
b = st.pop(... | true |
88e4338421754c6998f8845a531f31cdcc6d2074 | joebhakim/mimic_understander | /src/data/data_utils/preprocessing_utils.py | UTF-8 | 13,287 | 2.5625 | 3 | [
"MIT"
] | permissive |
import pandas as pd
import numpy as np
from .icd_parsing_functions import get_code_categories, charlson_calc
def preprocess_all(static_vars, dynamic_vars, outcome_vars, input_vars):
print(dynamic_vars.head())
top_k_feats = list(dynamic_vars['label'].value_counts()[:5].index)
id_vars = ['subject_id','... | true |
7ebb292a5e410d9b310e94888c040ce1a8e6579e | simassakenis/pet | /merge_logits.py | UTF-8 | 3,836 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # 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 agreed to in writing, software
# distributed under th... | true |
3a302efa79a1ac2c20d987467e2195f71dd2f843 | geomstats/geomstats | /tests/tests_geomstats/test_siegel.py | UTF-8 | 2,706 | 2.515625 | 3 | [
"MIT"
] | permissive | """Unit tests for the Siegel manifold."""
from tests.conftest import Parametrizer
from tests.data.siegel_data import SiegelMetricTestData, SiegelTestData
from tests.geometry_test_cases import ComplexRiemannianMetricTestCase, OpenSetTestCase
class TestSiegel(OpenSetTestCase, metaclass=Parametrizer):
"""Test of Si... | true |
79f169870e62e493acc8bab584b21eec69bba1f8 | Loricon/e_rail_warn | /eRail/scripts/dep/GIS.py | UTF-8 | 2,751 | 2.9375 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
import numpy as np
global R_lon
R_lon = 6356755 #(m)
global R_lat0
R_lat0 = 6378140 #(m)
def geographyToLocal(lon,lat,or_lon,or_lat):
global R_lon
global R_lat0
R_lat = np.cos(np.deg2rad(or_lat))*R_lat0
x = np.deg2rad(lon-or_lon)*R_lat
y = np.deg2rad(lat-or_lat)*R_lon
return x,y
de... | true |
454fbf37df0aa06622e2d578f14d084e8817f8cd | chessplyr888/Chess-Notation | /test.py | UTF-8 | 4,702 | 3 | 3 | [] | no_license | # TEST.PY IS A FILE FOR TESTING ALGORITHMS ON A SINGLE STATIC IMAGE INSTEAD OF A WEBCAM
# NEEDS TO BASED OFF TUPLES LOOK AT THE MATRIX FORMAT
import numpy as np
import cv2
def checkBounds(axis, val):
if val < 0:
return 0
if axis is "x":
if val > cap.get(3):
return cap.get(3)
if axis is "y":
if val > ... | true |
5147ae696b66b046ae2acba9700be66c09517877 | say3no/try_algorithm_and_data_structure | /Algorithm_and_Data_Structure_for_Defeart_Competitive_Programming/Basic/13_weighted_grapgh/13_3_Single_Source_Shortest_Path/01/main.py | UTF-8 | 1,257 | 3.265625 | 3 | [] | no_license | n = int(input())
adjc_list = [[] for _ in range(n)]
INF = 99999999999999999999
V = [ele for ele in range(n)]
S = []
d = [INF] * n
p = [ele for ele in range(n)]
for i in range(n):
tmp = [int(ele) for ele in input().split()]
for j in range(1, tmp[1]*2, 2):
v = tmp[j+1]
w = tmp[j+2]
adjc_l... | true |
1660ccc61452303649c1a9d156390b54d5e5e20d | Sakia025/SimulationenAtom-master | /python/inside-3d-mesh-master/plot.py | UTF-8 | 2,237 | 2.515625 | 3 | [
"MIT"
] | permissive | #from matplotlib import pyplot
from matplotlib import cm
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from os import listdir
from os.path import isfile, join
import numpy as np
def main():
Dosis_Werte =
x, y, z = #SliceDaten(cogs, Dosis_Werte, Koordinate = koordinate, AnzahlSlices... | true |
f6c71ca05b12887dc230921a4bdf50f35927a4f2 | zhangleihong/CatGame | /game_cat.py | UTF-8 | 537 | 3.09375 | 3 | [] | no_license | import pygame
import game_common
class GameCat(object):
def __init__(self):
self.img = pygame.image.load('./res/cat.png')
self.img_rect = self.img.get_rect()
self.img_rect[0] = (game_common.WINDOW_WIDTH - self.img_rect[2])/2
self.img_rect[1] = (game_common.WINDOW_HEIGHT - self.img_r... | true |
ccf45e939764fc0d6931dae990e69fca2b3d6359 | dimagi/commcare-fhir-web-app | /web_app/fhir_client.py | UTF-8 | 1,684 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import logging
from typing import Optional
import requests
from web_app.http import slash_join, base_url, auth_header
def fetch_patient_data(patient_id):
"""
Fetches a Patient resource, and Observation and DiagnosticReport
resources filtered by the Patient's ID.
"""
patient = fetch_resource('Pat... | true |
9e2c2270df570bb77691ec82ad182d9cc3a7c595 | timseymore/depths-of-madness | /src/models/enviroment/wall.py | UTF-8 | 551 | 3.21875 | 3 | [
"MIT"
] | permissive | import pygame
from src.ui.tools.colors import Color
class Wall(pygame.sprite.Sprite):
""" A wall that the player can run into. """
def __init__(self, x, y, width, height):
""" Constructor Method
- x: int : x position
- y: int : y position
- width: int : width of block
... | true |
3c011d35fd9f9a543dd4a4abf6d68bf74ef37c5a | marvjaramillo/ulima-intro210-clases | /s011-guia01/p03.py | UTF-8 | 337 | 3.890625 | 4 | [] | no_license | PI = 3.14159
#Leer radio y longitud
radio = float(input("Ingrese radio del cilindro: "))
longitud = float(input("Ingrese longitud del cilindro: "))
#Calcular el area: pi * (radio ^ 2)
area = PI * radio * radio
#Calcular el volumen: area * longitud
volumen = area * longitud
print("El area es:", area)
print("El volume... | true |
e1c450ddf1176a8832a80a93982e9497536558d8 | adithyanps/Think_python | /practice/ex16.2.py | UTF-8 | 247 | 2.875 | 3 | [] | no_license | import sys
def is_after(T1,T2):
print T1<T2
class time(object):
""
t1=time()
t1.hour=8
t1.minute=50
t1.second=24
class time1(object):
""
t2=time1()
t2.hour=10
t2.minute=20
t2.second=50
is_after(t1,t2)
if __name__ == "__is_after__":
is_after()
| true |
fcdf6d6f7fbfecc74984e42c27007cf5222ba1f9 | kimtaesu/python-algorithm | /leetcode/135.py | UTF-8 | 2,179 | 3.546875 | 4 | [] | no_license | from typing import List
class Solution:
def count(self, n):
return int((n * (n + 1)) / 2)
def candy(self, ratings: List[int]) -> int:
if len(ratings) <= 1:
return len(ratings)
candies = 0
up = 0
down = 0
old_slope = 0
for i in range(1, len... | true |
b48dbc6ec2157256b5c24fe3044167759a3a50eb | zhoutianxun/optical_flow | /LucasKanade.py | UTF-8 | 6,198 | 3 | 3 | [] | no_license | import numpy as np
from math import ceil
import cv2
import matplotlib.pyplot as plt
class LucasKanadeObj:
def __init__(self, winsize=(11,11), maxLevel=2):
"""
Lucas Kanade object
Parameters
----------
winsize : tuple, optional
window size for LK al... | true |
9e3f5d19202309f4c2954051d5168c306a5912a7 | Sparky-Chad/EV3_Dev | /Compute_Rotation.py | UTF-8 | 233 | 2.796875 | 3 | [] | no_license | # Compute the distance traveled in one rotation of the robot
from ev3dev2.motor import MoveTank, OUTPUT_A, OUTPUT_D, SpeedPercent
move = MoveTank(OUTPUT_A, OUTPUT_D)
speed = SpeedPercent(20)
move.on_for_rotations(speed, speed, 1) | true |
274e7434412b707e531e38b027a002103640c463 | csusb-005411285/CodeBreakersCode | /shortest-path-in-a-grid-with-obstacles-elimination.py | UTF-8 | 5,002 | 3.25 | 3 | [] | no_license | # Dijkastra's algorithm
class Solution:
def shortestPath(self, grid: List[List[int]], k: int) -> int:
# init vars
heap= []
visited = set()
cache = defaultdict(int)
min_cost = float('inf')
# process
# add a tuple to heap. Tuple should contain ((row, col), cost,... | true |
e3aeef606e0e2f717c4ef59567babe3c507ae018 | yunieom/Study.2-Algorithm | /프로그래머스/unrated/181942. 문자열 섞기/문자열 섞기.py | UTF-8 | 142 | 3.609375 | 4 | [] | no_license | def solution(str1, str2):
answer = ''
for i in range(len(str1)):
answer += str1[i]
answer += str2[i]
return answer | true |
ad81c57692dd1e702d1d8056f2daa632a530434a | zohnaj/Python-ChallengeFinal | /Python-ChallengeFinal/PyBank/pybank.py | UTF-8 | 2,878 | 3.28125 | 3 | [] | no_license | #Import Modules
import os
import csv
#Path to collect data & write data
budgetpath=os.path.join("Resources", "budget_data.csv")
output_budget=os.path.join("budget_write.txt")
#Define/set initial variable values
net_total=0
dates_change=[]
months_total=0
greatest_profit=0
greatest_loss=0
greatestprofit_date=""
greates... | true |
b17f0f1401ef50060af0d38a27f6f2f8935479e8 | JoaoPauloPereirax/Python-Study | /Mundo3/Tuplas/tuplas001.py | UTF-8 | 949 | 4.28125 | 4 | [
"MIT"
] | permissive | '''Crie um programa que tenha uma tupla totalmente preenchida com uma contagem por extenso, de zero até 20. Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostra-lo por extenso.'''
numeros=('Zero', 'Um', 'Dois', 'Três', 'Quatro', 'Cinco', 'Seis', 'Sete', 'Oito', 'Nove', 'Dez', 'Onze', 'Doze', 'Treze', ... | true |
372c78d0d01e51a24cb9f56ac5e8b3c22693f08e | Mohamed-Aziz-Ben-Nessir/comparative-programming | /cpbook-code/ch2/ex/onlyididit.py | UTF-8 | 421 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
t=int(input())
for i in range(t):
l1=[3,1,2,3]
l2=[4,4,5,6,7]
l3=[5,8,9,10,11,12]
# l1=input().split(" ")
#l2=input().split(" ")
#l3=input().split(" ")
r1=list(np.setdiff1d(l1,l2+l3))
r2=list(np.setdiff1d(l2,l2+l3))
r3=list(np.setdiff1d(l3,l1+l2))
lenr=max(len... | true |
8d2f05e824e7671cb135b9125d6deeedb1ee03ef | e4wong/ConvNet | /generate_squares.py | UTF-8 | 1,663 | 3.03125 | 3 | [] | no_license | from PIL import Image, ImageDraw
import numpy
from os import listdir
from os.path import isfile, join
from lib import *
import math
def too_small(points):
for i in range(0, len(points)):
distances = []
for j in range(0, len(points)):
if i == j:
continue
distances.append(distance(points[i], points[j]))
... | true |
ca483634dc224880694554e7f7bb45c0204d153b | JadeHayes/coding-challenges | /pop_growth.py | UTF-8 | 523 | 3.5 | 4 | [] | no_license | def nb_year(p0, percent, aug, p):
# p0 = current population
# percent = increase per year
# aug = additional inhabitants coming or leaving each year
# p = population we need to surpass
years = 0
# while our current population is less than p
# loop through and add the % increase to the current... | true |
b7a60974af50b140d50f8fbde712f61ebf2bfb88 | Tan170496/DA2-March-2020 | /Python_Exercises/Ex_chapter2.py | UTF-8 | 65 | 2.8125 | 3 | [] | no_license | carname = len("volvo")
print("characters of carname:",carname)
| true |
02e0293ed00c46f191b0e7e363ecb5c1a0cc6ca3 | saeidnp/CPSC526 | /hw4/a4_general.py | UTF-8 | 19,465 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from math import *
import sys
# from pyquaternion import Quaternion ## would be useful for 3D simulation
import numpy as np
window = 0 # number of the glut window
simTime = 0
dT = 0.01
simRun = True
RAD_TO_DEG = 18... | true |
1457ce7151d9cb1dc9027551775fb374f9fbd256 | themockingjester/leetcode-python- | /52. N-Queens II.py | UTF-8 | 1,491 | 3.1875 | 3 | [] | no_license | class Solution:
def checkVertically(self,cr,cc,rows,cols):
while(cr>-1):
if self.mat[cr][cc]==1:
return False
cr-=1
return True
def checkVerticallyLeft(self,cr,cc,rows,cols):
while(cr>-1 and cc>-1):
if self.mat... | true |
f8143b92674b1500f81bf25c81933ac8355fdd64 | echoqyg/lagouproject | /test_wework/page/base_page.py | UTF-8 | 1,560 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
from telnetlib import EC
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_condi... | true |
dc68d6bedd8e2bfb3b7c3f1b0ed4e2c709605f43 | nataway/Python-PTIT | /tongchuso.py | UTF-8 | 455 | 3.09375 | 3 | [] | no_license | """
Author: Tris1702
Github: https://github.com/Tris1702
Gmail: phuonghoand2001@gmail.com
Thank you so much!
"""
import math
T = int(input())
for t in range(T):
res = 0
n = int(input())
n = n * 2
for i in range(2, int(math.sqrt(n))+1):
if n % i != 0:
continue
j = n // i
... | true |
66ca2f1c13dbd1eec9433486aaba5d9af0d75c66 | AvEgA-ChuDoTvoreC/DbRabbDockeAvUpdateConn | /MY_SCRIPTS/usefullinfo.py | UTF-8 | 1,034 | 3.203125 | 3 | [] | no_license | import os
imports = """
--=--IMPORT MODULES--=--
=Invalid Names:=
Actually, you can import a module with an invalid name.
But you'll need to use imp for that, e.g. assuming file is named models.admin.py, you could do
import imp
with open('models.admin.py', 'rb') as fp:
models_admin = imp.load_module(
... | true |
223c5c801e98ff2951971ddc07cc84a2704d72f0 | Saevon/config-sublime | /ScrollLinesFixed.py | UTF-8 | 783 | 2.671875 | 3 | [
"MIT"
] | permissive | import sublime
import sublime_plugin
class ScrollLinesFixedCommand(sublime_plugin.TextCommand):
"""Must work exactly as builtin scroll_lines command, but without moving the cursor when it goes out of the visible area."""
def run(self, edit, amount, by="lines"):
if by == 'pages':
maxy = se... | true |
e33d49f873a7683546688eadbf9e3eaafb65cb09 | TheShadow29/subreddit-classification-dataset | /src/spacy_classifier_simple.py | UTF-8 | 6,797 | 2.703125 | 3 | [
"MIT"
] | permissive | """
Baseline approach to be used in spacy
"""
import json
from pathlib import Path
import pickle
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.line... | true |
2c877b9e7b7e7d1b4bee4b963c2095663dd4b177 | atigerboy/PythonCookBook | /chapter6/6_6Parsing Modifying and Rewriting XML/6_6.py | UTF-8 | 386 | 2.515625 | 3 | [
"MIT"
] | permissive | from xml.etree.ElementTree import parse, Element
doc = parse('pred.xml')
root = doc.getroot()
root.remove(root.find('sri'))
root.remove(root.find('cr'))
#getchildren
for index, val in enumerate( root ):
if val.tag == 'nm':
e = Element('spam')
e.text = 'This is a tree'
root.insert( index+1... | true |
c753a19d268c74ac4b11c50a756bd907744d1973 | arnabs542/Leetcode-18 | /Beautiful Arrangement.py | UTF-8 | 2,452 | 3.578125 | 4 | [] | no_license |
class Solution(object):
# downwards recursive solution, fast
def countArrangement(self, N):
self.counter = 0
def helper(i, X):
if i==1:
self.counter += 1
return
for x in X:
if x%i == 0 or i%x == 0:
... | true |
6a145e82d5d491f448b7fcdad285220c259f45c8 | VladKatsman/Crop-Fields-Detection | /utils/data_utils.py | UTF-8 | 20,066 | 2.921875 | 3 | [] | no_license | import os
import numpy as np
import cv2
import urllib.request
import datetime
from PIL import Image
from tqdm import tqdm
from field_boundaries.utils.map_utils import LatLngTranslator, center_to_url
from pycocotools import mask
def polygons_to_union(image, polygons, return_mask=False):
""" Create an union from po... | true |
802bc4c322eb3fed90ae24f4653d7318144fffe0 | hhhoang/100DaysOfCode_HH | /Day40.py | UTF-8 | 1,179 | 3.828125 | 4 | [] | no_license | """
Create a quiz to test if user knows the states of the US
Missing files: image "blank_states_img.gif" and csv file contains state names, x & y coordinates in the image
"""
import turtle
import pandas as pd
screen = turtle.Screen()
screen.title("US States Game")
image = "blank_states_img.gif"
screen.addshape(image... | true |
143227d7cc52edab342e593dbd68eb6b7ff7946d | softwarefaith/PythonFullStack | /PythonFullStack/000Basic/Day03-函数/代码/10-函数的参数的高级使用.py | UTF-8 | 832 | 3.671875 | 4 | [] | no_license | # def show(name, age, *args, **kwargs):
# print(name, age, args, kwargs)
#
# # 不能使用下面的方式进行调用,因为前面使用的关键字后面不能使用位置参数
# # show(name="李四", age=18, 1, 4, c=1, b=2)
#
# show("李四", 20, 1, 2, 3, a="苹果", b="香蕉")
# def show(*args, name, age, **kwargs):
# print(name, age, args, kwargs)
#
# show(1, 2, 3, 4, name='李四', ag... | true |
4ca1faa89355ffb1f627316a281acdc081549d3c | boryanah/SAM_TNG_clustering | /old/get_mock.py | UTF-8 | 25,992 | 2.625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import plotparams # for making plots pretty, but comment out
plotparams.buba() # same
import Corrfunc # comment out since you're not using it
# This is a function that takes the position of the unshuffled galaxies, their weights (which is to say all 1s if you are work... | true |
23c16c436a053a02f1b2d13ad8f808b6708a342f | ThomasZiegler/Efficient-Smoothing-of-Dilated-Convolutions | /dilated.py | UTF-8 | 18,010 | 2.796875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import numpy as np
import six
import sys
"""
This script provides different 2d dilated convolutions.
I appreciate ideas for a more efficient implementation of the proposed two smoothed dilated convolutions.
"""
def _dilated_conv2d(dilated_type, x, kernel_size, num_o, dilation_factor, name... | true |
d77bc25340c815973c682b66708b749e30307276 | aridavis/big-data-processing | /RDD Introduction/MapReduceWithSpark.py | UTF-8 | 2,318 | 3.765625 | 4 | [] | no_license | #Inisialisasi
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
sc = spark.sparkContext
# Membuat Collection RDD
number = sc.parallelize([1,2,3,4])
#kalau kita langsung print number, maka outputnya seperti baris pertama output
print(number)
#mengoutputkan number
print(number.collect())
... | true |
fc898695339045c55281ce9ec68bae9363a81e7f | lixiang2017/leetcode | /explore/2020/august/Excel_Sheet_Column_Number.py | UTF-8 | 975 | 3.203125 | 3 | [] | no_license | '''
https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/550/week-2-august-8th-august-14th/3419/
You are here!
Your runtime beats 63.18 % of python submissions.
1000 / 1000 test cases passed.
Status: Accepted
Runtime: 24 ms
Memory Usage: 13 MB
Submitted: 0 minutes ago
'''
class Solution(o... | true |
982dce73d6336b4afca0e170914d1128e3792c6d | renovate-tests/cs251-toolkit | /cs251tk/toolkit/save_recordings.py | UTF-8 | 2,379 | 3.015625 | 3 | [
"MIT"
] | permissive | import os
import logging
from cs251tk.formatters import format_collected_data, markdown, gist
from .gist import post_gist
from .tabulate import asciiify
def record_recording_to_disk(results, file_identifier):
results = sorted(results, key=lambda file: file['student'])
results = [file['content'] for file in r... | true |
96547a77e62e444034cf871a8e8c2fe5b3f8baa5 | AlgiosDev/pruebas | /ejerciciosPython/coordinate.py | UTF-8 | 1,342 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# See README.rst file on addon root folder for license details
class Coordinate(object):
def __init__(self,x,y):
self.x = x
self.y = y
def __repr__(self):
return "Coord: " + str(self.__dict__)
def add(a, b):
return Coordinate(a.x + b.x, a.y + b.y)
def s... | true |
2392afd562df688c37469d4eddf1d25aa3c173b9 | Wuxiwuxi/test-hello | /main.py | UTF-8 | 822 | 3.375 | 3 | [] | no_license | # This is a comment
''' Hello
I am talking to myself
have a nice day'''
""" Have
a
nice
day
"""
#data I want to store
name
id
price
date
#Step 1:
print " Download https://nextmovesoftware.com/blog/2014/02/27/unleashing-over-a-million-reactions-into-the-wild/"
#Step 2:
print " open first file and work out how... | true |
8e8259352c6ebfedbadc3143004f52612f9e5d26 | shivesh947/Python_Interview_Practice | /Reverse words in a given string.py | UTF-8 | 158 | 3.25 | 3 | [] | no_license | st="hello my name is rahul"
lst=st.split(" ")
print(lst)
lst2=[]
for i in range(len(lst)):
lst2.insert(0,lst[i])
st=' '.join(lst)
print(st)
| true |
2d9020af69955a4e436dade950ab6656e2492571 | AnimaZer/Django_site | /media/videos/multiproc.py | UTF-8 | 4,836 | 2.890625 | 3 | [] | no_license | import face_recognition as fc
import cv2
from multiprocessing import Process, Pool
import sys
INPUT_VIDEO = sys.argv[1] # input video
INPUT_IMAGE = sys.argv[2] # input image
INPUT_NAME = sys.argv[3] # input name
# Create an output movie file (make sure resolution/frame rate matches input video!)
# fourcc = cv2.VideoW... | true |
95c0fe0f04eca2df09470a4bda77c676c1a72f39 | LucasBoTang/Codecademy_Introduction_to_Data_Analysis | /045inner_merge2.py | UTF-8 | 297 | 3.015625 | 3 | [] | no_license | import pandas as pd
sales = pd.read_csv('sales.csv')
targets = pd.read_csv('targets.csv')
men_women = pd.read_csv('men_women_sales.csv')
all_data = sales.merge(targets).merge(men_women)
results = all_data[(all_data.revenue > all_data.target) & (all_data.women > all_data.men)]
print(results)
| true |
b999761468d7187d0e6355c97d6c060cab2fa4a7 | spacedentist/pyimmutable | /pyimmutable/tests/test_dict_stress.py | UTF-8 | 3,698 | 2.796875 | 3 | [
"MIT"
] | permissive | import collections
import gc
import random
import unittest
from pyimmutable import ImmutableDict
class StressTestImmutableDict(unittest.TestCase):
def test_stress(self):
r = random.Random(123)
class X:
pass
x = X()
objects = [
x,
x,
... | true |
73a89cdfc813ca99a340a84d4f98829f2f417d24 | derlung/atom_python | /section4/google/4-7-5.py | UTF-8 | 398 | 3.578125 | 4 | [] | no_license | import matplotlib.pyplot as plt
#figure 객체 생성
fig = plt.figure()
#서브 슬롯 생성(2행 1열)
ax1 = fig.add_subplot(2,1,1)
ax2 = fig.add_subplot(2,1,2)
#x,y축 생성
x=range(0,256)
#y1축 생성
y1=[v*v for v in x]
#y2축 생성
y2 = [v*v*2 for v in x]
#멀티 라인(1행 1열)
ax1.plot(x,y1,'b',y2,'r--')
#멀티 라인(2행 2열)
ax2.bar(x,y1)
plt.show()
#출력
plt... | true |
5db7978e561e689d1e4232c0961126f6bf5225de | tingzichen/api_auto_test | /common/basic_pattern.py | UTF-8 | 3,421 | 2.6875 | 3 | [] | no_license | # 这里做正则匹配和反射操作
import re
from api_auto_test.common.config import Conf
config = Conf()
normal_user = config.get_option_str('basic', 'normal_user')
pwd = config.get_option_str('basic', 'pwd')
user_id = config.get_option_str('basic', 'user_id')
class Pattern:
def pattern(self,data,pattern):
res = re.findall(p... | true |
8f4039d106866649a4788afbd30aeeb363c32e4c | davidalanb/PA_home | /Py/__laptop___cp1/ps1/quadratic.py | UTF-8 | 179 | 3.375 | 3 | [] | no_license |
import math
a = float(input())
b = float(input())
c = float(input())
d = b**2 - 4*a*c
x1 = (-1*b + math.sqrt(d))/(2*a)
x2 = (-1*b - math.sqrt(d))/(2*a)
print( x1 )
print( x2 ) | true |
8c73db181db75748b8570543fc3463eb0592f0a6 | Mardoniosc/mardonio-bot | /menus/menuPrincipal.py | UTF-8 | 2,149 | 2.703125 | 3 | [
"MIT"
] | permissive | # coding=utf-8
import os
from telebot import TeleBot
from mensagens.mensagens import *
from logs.logs import atualizaLog
bot = TeleBot(os.environ["BOT_TOKEN_DONIOSC"])
@bot.message_handler(commands=["start", "help"])
def send_start_message(message):
atualizaLog(message.text, message.from_user.first_name)
bo... | true |
fda862269f5958487bfe03cf0d391f047c6f1554 | EliyaF/battleship | /protocol_manager.py | UTF-8 | 5,287 | 2.6875 | 3 | [] | no_license | """
name: protocol_manager.py
purpose: a class for managing the battle-ship protocol
author: bis-hanich-8
changelog:
created: 29/12/2020
"""
from tcp_connection import TcpConnection
import struct
from collections import namedtuple
from excpetions import GameEnd
BYTES_LEN = 9
BytesDataTuple =... | true |
e0c158d56eb746b42bdbddfeaf5c4f7af45b881d | dfberenson/Skotheim_Ilastik_Pipeline | /relabelManualTrack.py | UTF-8 | 1,788 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 17:12:52 2017
@author: dfberenson
"""
"""
Introduce Manual Track
Read x,y data from FIJI manual track
Load "Tracked Cell X" image, where X = some number
Go through image, converting pixels whose value matches the value at [x,y] to X
Then can use this image through t... | true |
23bd26b39cfe9f045c4f164c717174729cd7f213 | philipp-gaspar/nmf-lab | /utils/metrics.py | UTF-8 | 1,478 | 3.234375 | 3 | [
"MIT"
] | permissive | import numpy as np
__all__ = ['frobenius_norm',
'kullback_leibler_divergence',
'itakura_saito_divergence']
def frobenius_norm(Y, Y_hat):
"""
Calculate the Frobenius Norm between two matrices.
Parameters
----------
Y : numpy.array
Original matrix.
Y_hat : numpy.ar... | true |
8a9e062cc4e17670821e15cb12421b63c79b4bd0 | ElenaRoche/python | /ecuacion 2 grado.py | UTF-8 | 605 | 3.84375 | 4 | [] | no_license | def parabola():
a=float(input("Valor de a: "))
b=input("Valor de b: ")
c=input("Valor de c: ")
if a!= 0:
raiz=(b**2-4*a*c)**(1/2)
denominador=2*a
sol1=(-b+raiz)/denominador
sol2=(-b-raiz)/denominador
print"Tiene dos soluciones y son: ",sol1,"y",sol2
... | true |
5347fd1c0c2debbf0d356fcd0f22844f2f118b9c | mgd34msu/detanokagaku | /fixedincome2.py | UTF-8 | 22,456 | 2.96875 | 3 | [] | no_license | import pandas as pd
import scipy.optimize as opt
class TVM:
def __init__(self, cf, r, n, m=1, g=0, m_precision=2, p_precision=4, series=0):
self.series = series
if self.series == 1:
self.cf = cf[0]
self.r = r
elif self.series == 2:
self.cf = cf[0]
... | true |
c167713c72ba8f9799447579d4b18a83932e97b1 | oamam/ctci | /5.4.py | UTF-8 | 560 | 3.375 | 3 | [] | no_license | def front(n):
c = n
c0 = 0
c1 = 0
while c & 1 == 0 and c != 0:
c0 += 1
c >>= 1
while c & 1 == 1:
c1 += 1
c >>= 1
return n + (1 << c0) + (1 << (c1 - 1)) - 1
def back(n):
c = n
c0 = 0
c1 = 0
while c & 1 == 1:
c1 += 1
c >>= 1
whi... | true |
e9f7e74b459a4f109e88a7ecc68bb941e487295c | simjxu/Other-MachineLearning | /Helpful Tools/json_test.py | UTF-8 | 2,998 | 2.703125 | 3 | [] | no_license | import json
import numpy as np
import matplotlib.pyplot as plt
# 'r' mode for reading, 'w' mode for writing, read and write 'r+', append 'a'
# jsonfile = open('C:\Users\Simon\Desktop\Petasense\Data\measurement_data_40_L3_z.json', 'r')
# fieldnames = ("FirstName", "LastName", "IDNumber", "Message")
# reader = csv.Dict... | true |
523cae3d1288e098c25f15747242aed2397aa3d4 | gen4438/vtk-python-stubs | /typings/vtkmodules/vtkInteractionWidgets/vtkPlaybackRepresentation.pyi | UTF-8 | 6,363 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | """
This type stub file was generated by pyright.
"""
from .vtkBorderRepresentation import vtkBorderRepresentation
class vtkPlaybackRepresentation(vtkBorderRepresentation):
"""
vtkPlaybackRepresentation - represent the vtkPlaybackWidget
Superclass: vtkBorderRepresentation
This class is used ... | true |
ba684284360fbf0332f6b4334014214897d4b370 | jiangdagongzi/exam | /leetcode/medium/done/minimum_path_sum.py | UTF-8 | 2,768 | 3.328125 | 3 | [] | no_license | class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
n = len(grid)
m = len(grid[0])
sum = [[0] * m for x in range(n)]
# print(sum)
sum[0][0] = grid[0][0]
for i in range(1, m):
s... | true |
2af0c04d24fe50084be07e39266ca0b591a7b091 | Amos-zq/mahv | /extras/get_mask_from_benchmark.py | UTF-8 | 984 | 2.546875 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import os
CURRENT_FILE_PATH = os.path.realpath(__file__)
EXTRAS_PATH = os.path.dirname(CURRENT_FILE_PATH)
REPO_ROOT = os.path.dirname(EXTRAS_PATH)
BENCHMARK_BASE_PATH = 'benchmark-dataset'
BENCHMARK_BASE_PATH = os.path.join(REPO_ROOT, BENCHMARK_BASE_PATH)
FILE_MASK = 'Dragonfly-1-masked.... | true |
bc335a3b9c83787e9b389ef565d3a1baedaf27d3 | neogeoaabbcc/python | /lession_29.py | UTF-8 | 493 | 4.3125 | 4 | [] | no_license | #lession_29
#给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。
#-*- UTF-8 -*-
x = int(input("请输入不大于五位的正整数:\n"))
a = x/10000
b = x%10000/1000
c = x%1000/100
d = x%100/10
e = x%10
if a != 0:
print("5位数:",e,d,c,b,a)
elif b != 0:
print("4位数:",e,d,c,b)
elif c != 0:
print("3位数:",e,c,b)
elif d != 0:
pr... | true |
ef0badf72a8a66b16b72bf36034320b2e340337d | Wishu969/ProjectEulerPython | /problem23.py | UTF-8 | 873 | 3.03125 | 3 | [] | no_license | #solved
with open(r'D:\Python\Courses\ProjectEulergithub\Database\databaseProblem23') as file:
lines = file.read().splitlines()
lines = list(map(int, lines))
def isabundant(n = 1):
while n < 30000:
temp = 0
for i in range(1,(int)(n/2) + 1):
temp = temp + i if n % i == 0 else temp + ... | true |
12f4a51deee1a3f24dc9f633f083a3f692675cb3 | SameerVanjari/PythonProjects | /Flappy_game/main.py | UTF-8 | 9,189 | 2.78125 | 3 | [] | no_license | import random #to generate random nos
import os #to control the window functions
import pygame
from pygame.locals import * #general setup import of pygame
# GLOBAL VARIABLES
FPS = 32
SCREENWIDTH = 289
SCREENHEIGHT = 511
SCREEN = pygame.display.set_mode((SCREENWIDTH, SCREENHEIGHT))
GROUNDY = SCREENHEIGHT *... | true |
99f95180eb314f45f99a68d23e317c70e79195b1 | shubham040195/python | /countchar.py | UTF-8 | 181 | 2.984375 | 3 | [] | no_license | import sys
with open(sys.argv[1], 'r') as file:
l1=[]
for word in file:
for i in range(len(word)):
char=word[i]
l1.append(char)
print len(l1)
| true |
4bb91e183ddd0c2afd06ce9b4b36a846795b7bb8 | Etenil/anvil | /model/user.py | UTF-8 | 2,684 | 2.5625 | 3 | [
"MIT"
] | permissive | import web
from anvillib.avatar import avatar, logo
import common
from hashlib import sha256
import re
def create_user(name, email, password, homepage, description):
if not re.match('^https?://', homepage):
homepage = 'http://' + homepage
common.db.insert('user',
name=name,
... | true |
a989b67e6ef9c048113af4a97910548ba25be4ff | ShadowproofGamer/maturka2008zad4 | /zad4.py | UTF-8 | 1,871 | 3.296875 | 3 | [] | no_license | import math
plik = open("dane.txt")
tab = []
wynik = [0,0,0,0,0,0]
wynik_ile = [0,0,0,0,0,0]
suma = []
plik2 = open("wybory", "w+")
for i in range(20):
#print(i)
temp = plik.readline().split()
tab.append(temp)
#print(tab)
for i in range(20):
temp = 0
for j in range(6):
wynik_ile[j] += int(t... | true |