blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
124864ab1f97c15eee48e474368a05241ceda50e
Python
sshyran/Galileo-sdk
/galileo_sdk/business/objects/exceptions.py
UTF-8
133
2.640625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
class JobsException(Exception): def __init__(self, job_id, msg=None): self.job_id = job_id super().__init__(msg)
true
cc6370b12ba8da581de4a976da77c8074b074afc
Python
ashemery/psut
/workshops/131214/diy5.py
UTF-8
476
3.75
4
[]
no_license
######################### # DIY 5 Answer import random f = open("file2.txt", "w") for count in range(100): rnumber = random.randint(0,99) f.write(str(rnumber) + '\n') f.close() odd = [] even = [] f = open('file2.txt','r') for line in f: row = line.split() for i in row: if int(i)...
true
ee8f604c0f22c470b4c31034ae3dcde4900fc4b0
Python
djvita/python-control
/control/freqplot.py
UTF-8
15,685
2.53125
3
[]
no_license
# freqplot.py - frequency domain plots for control systems # # Author: Richard M. Murray # Date: 24 May 09 # # This file contains some standard control system plots: Bode plots, # Nyquist plots and pole-zero diagrams. The code for Nichols charts # is in nichols.py. # # Copyright (c) 2010 by California Institute of Tec...
true
ae377e303d5e1f96c7b96ee63e849688a87e0c18
Python
jingxinmingzhi/jingxinmingzhi
/python/pycharm/learn/xml_learn/test/xml_xmltodict.py
UTF-8
3,011
3.5
4
[]
no_license
import xmltodict from collections import OrderedDict with open('sample.xml', 'r+', encoding='utf-8') as fp: #将xml文件转换成dict,默认是返回OrderedDict。其中,fp.read()返回的是str root = xmltodict.parse(fp.read(), dict_constructor=dict) print(root) sample = root['root'] sample['items']['item'][0]['amount'] = 200 i...
true
9fcd2ca1883ad775b33f2686b920a87900f23101
Python
MrLokans/portfoliosite
/backend/apps/about_me/tests.py
UTF-8
2,350
2.578125
3
[]
no_license
from django.test import TestCase from django.urls import reverse from .models import Project, Technology class ProjectsAPITestCase(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.projects_url = reverse("projects-list") cls.technology_url = reverse("technology-lis...
true
e4aa8dd9442b58ee1f9c4dc5a3a5ec4bbe22dc0b
Python
venkatsvpr/Problems_Solved
/LC_Path_Crossing.py
UTF-8
1,291
3.921875
4
[]
no_license
""" 1496. Path Crossing Given a string path, where path[i] = 'N', 'S', 'E' or 'W', each representing moving one unit north, south, east, or west, respectively. You start at the origin (0, 0) on a 2D plane and walk on the path specified by path. Return True if the path crosses itself at any point, that is, if at any t...
true
af3b2ecf40b688c83f20917a5940cb88ccb368c9
Python
martinvw/e-ink-display
/e-ink-display/screens/screens.py
UTF-8
1,443
2.6875
3
[]
no_license
import openhab class Screen: """Base screen class.""" def __init__(self) -> None: return def refresh(self) -> None: return def button_2_label(self) -> str: return None def button_2_handler(self) -> None: return def button_3_label(self) -> str: return None def ...
true
6b7370650d4a931697e3c06ad841a4ab809eb69b
Python
done-n-dusted/SpeechEmotionRecognition
/text_test/running_models_boW.py
UTF-8
2,622
2.734375
3
[]
no_license
# training and testing on various model for BoW features import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} import sys sys.path.insert(1, '../') from STFE import Models, DataPreparer from tensorflow.keras import optimizers import json def dump_dict(dict, file_name): with open(file_n...
true
b274965e80fef1cfbff76aa23487615474a73a35
Python
prasanna1695/python-code
/3-2.py
UTF-8
1,143
4.46875
4
[]
no_license
# How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? #Push, pop and min should all operate in O(1) time. #you would simply need to store a variable called min and update it as needed. class Stack: def __init__(self): self.minimum = None se...
true
91b8a2364a38a607900f8184bf6e400eb239ffcc
Python
MarloDelatorre/leetcode
/1046_Last_Stone_Weight.py
UTF-8
815
3.5625
4
[]
no_license
from heapq import heapify, heappush, heappop from unittest import main, TestCase class Solution(): @staticmethod def lastStoneWeight(stones): heap = [] for stone in stones: heappush(heap, -stone) while len(heap) > 1: stone_y, stone_x = heappop(heap), heappop(hea...
true
d2192b2289eaaa64eea2216fa118469075afe155
Python
bgoonz/UsefulResourceRepo2.0
/_PYTHON/DATA_STRUC_PYTHON_NOTES/python-prac/mini-scripts/python_Join_Two_Lists__extend().txt.py
UTF-8
76
3.203125
3
[ "MIT" ]
permissive
list1 = ["a", "b", "c"] list2 = [1, 2, 3] list1.extend(list2) print(list1)
true
9982bc9a93696ba5d351ef4ac62bd2e05effdeb1
Python
ismael-wael/Hospital-management-system-tkinter-GUI-
/managePatients.py
UTF-8
7,525
2.609375
3
[]
no_license
from tkinter import * import tkinter as tk from tkinter import ttk from GUI_Functions import * import xlsxwriter import xlrd from helperFunctions import * holdPatientData = [] headings = ["patient ID", "Dep. Name", "Doctor", "Name","Age", "Gender", "Address", "Room number", "phone number", "diagnose"] d...
true
4f6652f3a38bf843521c85f34ed599202abc4585
Python
miroslavpetkovic/python-meme-generator-project
/src/app.py
UTF-8
2,617
2.890625
3
[]
no_license
import random import os import requests from flask import Flask, render_template, abort, request from MemeEngine import MemeEngine from QuoteEngine import Importer from QuoteEngine import QuoteModel dir_path = os.path.dirname(os.path.realpath(__file__)) app = Flask(__name__, static_folder=dir_path) meme = MemeEngin...
true
d10b64e47a1a45c45b52bebb0c862311466b4165
Python
MithVert/P5
/model/categorie.py
UTF-8
1,288
2.75
3
[]
no_license
import mysql.connector class Categorie(): def __init__(self, sqlmng, idc=None, name=None): self.sqlmng = sqlmng self.id = idc self.name = name self.valid = True def update(self): query = ( "SELECT id, Categorie FROM Categories " f"WHERE Categor...
true
a401af168065db964e42d4b9b78c07ccd3b31fee
Python
melwinjose1991/LearningMachineLearning
/python/learning - tensor-flow/Basics/linear_regression.py
UTF-8
3,529
3.625
4
[]
no_license
# from : https://github.com/nlintz/TensorFlow-Tutorials/blob/master/01_linear_regression.py import tensorflow as tf import numpy as np ''' linspace(): Returns 101 evenly spaced samples, calculated over the interval [-1, 1]. ''' trX = np.linspace(-1, 1, 101) print(trX) ''' randn(): Return a sample (or samples) from t...
true
c78751529ba42622d1110bd1267e453478c57ac9
Python
p-jacquot/ISN
/test.py
UTF-8
2,633
2.578125
3
[]
no_license
# Créé par PJACQUOT, le 21/03/2016 en Python 3.2 import pygame from jeu import Jeu from fenetre import Fenetre from molecule import Molecule from dialogue import Dialog from niveau import Niveau import constantes from pattern import * import pickle import niveau def testplay(): jeu.moleculeJoueur = Molecule('hyd...
true
1876e5b09b664ef0b353670e137950d3e1270558
Python
wammar/wammar-utils
/convert-conll-format-to-sent-per-line.py
UTF-8
1,451
3.015625
3
[]
no_license
import io import argparse # parse/validate arguments argparser = argparse.ArgumentParser() argparser.add_argument("-i", "--input_filename", required=True) argparser.add_argument("-o", "--output_filename", required=True) argparser.add_argument("-d", "--delimiter", default="_") argparser.add_argument("-c", "--columns", ...
true
fcd3e0cde7fec1d734cb945d7041906be2618a09
Python
Deepaklal123/Python
/Chapter_02/prac_q_04_input_function.py
UTF-8
220
3.6875
4
[]
no_license
#Author: Deepak Lal # Sukkur IBA University a= input(" Enter your name ") #This alwaays takes inpt as string print(a) num1= input(" Enter your age ") #This alwaays takes inpt as string num1=int(num1) print(num1)
true
998e4c5ab35b65a3e242d0ef51809c2211d9861b
Python
gz5678/CrypticCrosswordSolver
/CrypticSolver.py
UTF-8
3,713
3.84375
4
[]
no_license
import string from SolutionFormat import SolutionFormat from ClueSolver import solve def CrypticSolver(): print_header() run = True while run: # Get the clue, strip punctuation and change to lower case clue_str = input("Insert the clue:\n").translate(str.maketrans('', '', string.punctuati...
true
4c432c358c6749b558bb294829cc4b3187b4cfdd
Python
ChernenkoSergey/Supervised-and-Unsupervised-Learning-with-Python
/Раздел 5 Создание систем рекомендаций/pipeline_trainer.py
UTF-8
3,473
2.984375
3
[]
no_license
from sklearn.datasets import samples_generator from sklearn.feature_selection import SelectKBest, f_regression from sklearn.pipeline import Pipeline from sklearn.ensemble import ExtraTreesClassifier # Генерируем некоторые помеченные образцы данных для обучения и тестирования # Scikit-learn имеет встроенную функцию, ко...
true
fb3464cda5378ddbe8a14e0e8718c2f4b948f605
Python
austinlyons/computer-science
/heap/python/heap.py
UTF-8
4,375
3.828125
4
[]
no_license
from math import floor class Heap: def _left(self, i): return 2*i + 1 def _right(self, i): return 2*i + 2 def _parent(self, i): return int(floor((i-1)/2)) def _swap(self, A, i, j): temp = A[i] A[i] = A[j] A[j] = temp def _valid(self, i): i...
true
c50bf8fcaf38c8f91d3f1743062e2597c1ee27b7
Python
foersterrobert/Pokemon-TD
/bullet.py
UTF-8
958
3.21875
3
[]
no_license
from settings import * import pygame class Bullet: def __init__(self, screen, x, y, ex, ey, bsize, imgB=None): self.screen = screen self.x = x self.y = y self.ex = ex self.ey = ey self.bsize = bsize self.imgB = imgB self.image = None if self.i...
true
541096039db4bb40bcadf12285b0e936fef5d98d
Python
haoruizh/CS322Project
/chatProject/server/User_dic.py
UTF-8
959
2.6875
3
[]
no_license
from socket import * import json import os import openpyxl class User: filename = 'C://Users/Jihui/Documents/GitHub/CS322Project/chatProject/server/user.txt' user_info = {} def __init__(self): pass def show_profile(self, userName): print(self.user_info[userName]) return self.u...
true
83dc2ad21ac34878de0b801df102eb7803fa31d3
Python
anthony-chang/machine-learning-playground
/housingPrices.py
UTF-8
655
2.953125
3
[]
no_license
# https://www.hackerrank.com/challenges/predicting-house-prices/problem from sklearn import linear_model import numpy as np features, N = (int(n) for n in input().split()) x_train = [] y_train = [] x_test = [] x_train = [0 for i in range(N)] for i in range(N): x_train[i] = list(map(float, input().split())) x_tra...
true
cb788dbfc49bdf215aedd7f3e1dc90fe8a5b7077
Python
kate-codebook/movie_recommendersys
/itemBased.py
UTF-8
1,213
3.28125
3
[]
no_license
import pandas as pd import ast def create_item_based_rating(movies): # movies type dict movies = str(movies) rating_data = pd.read_csv('ratings.csv') movie_data = pd.read_csv('movies.csv') user_movie_rating = pd.merge(rating_data, movie_data, on='movieId') user_movie_rating_p = user_movie_rating....
true
90b1d8b52dbaa41f051a98d21c16bbf64d04a5b0
Python
ungerw/class-work
/ch6ex5.py
UTF-8
97
2.59375
3
[]
no_license
str = 'X-DSPAM-Confidence:0.8475' mark = str.find(':') number = float(str[mark+1:]) print(number)
true
1210dcf6d176ad6bc7941c1c25bafc38ce022fcf
Python
msetkin/udacity_streaming
/consumers/models/lines.py
UTF-8
2,126
2.671875
3
[]
no_license
"""Contains functionality related to Lines""" import json import logging from models import Line from ksql import TURNSTILE_SUMMARY_TABLE logger = logging.getLogger(__name__) class Lines: """Contains all train lines""" def __init__(self): """Creates the Lines object""" self.red_line = Line(...
true
d397eaf5dd020a8124d1a7f68af30c3339ad6a93
Python
dingzhaohan/deep_research
/spiders/git/git/spiders/littlegit.py
UTF-8
3,366
2.640625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- import scrapy from git.items import GitItem import pandas as pd import json import time import datetime # df = pd.read_json("/home/zhaohan/Desktop/research/lastdata_papers_with_code_repo.json") df = pd.read_json('/Users/zhaohan/Desktop/deep_research/data/links-between-papers-and-code.json') ''' ...
true
100f0252883b40d7eb2501a04338306c06ed6794
Python
SimmonsChen/LeetCode
/公司真题/顺丰/不要1.py
UTF-8
1,027
3.40625
3
[]
no_license
def helper(n): while n > 0: if n % 10 != 1: return False n = n // 10 return True def isHaveOne(n): if n == 1: return True if n < 10: return False cur = n # 保留原数字 tar = [] while cur > 0: t = cur % 10 if t == 1: return True tar.append(t) ...
true
d12747e228c13b95ea4c87b58b391179d65d8220
Python
iblezya/Python
/Semana 2/Cuarentena/cond8.py
UTF-8
859
3.78125
4
[]
no_license
Nombre = str(input('Ingrese el nombre del producto: ')) while (True): try: Precio = float(input('Ingrese el precio del producto(S/.): ')) Cantidad = int(input('Ingrese la cantidad de productos: ')) Monto = Precio*Cantidad if Cantidad >= 100: MontoFinal = 0....
true
69d0d49788987a148607933c3f188bea27469e90
Python
muskanmahajan37/python-scic
/sesion_3/resorte.py
UTF-8
294
2.96875
3
[]
no_license
import math A = 10 j = 1 k = 3 m = 1 def xf(t): w = (k / m) ** 0.5 return A * math.sin(w * t + j) f = open("resorte.csv", "w") n = 100 t_min = 0 t_max = 4 for i in range(n): t = t_min + (t_max - t_min) / (n - 1) * i x = xf(t) f.write("{}, {}\n".format(t, x)) f.close()
true
d1e2a7a35b02158767334621fab48c736e364d3d
Python
barry-jin/array-api-tests
/array_api_tests/special_cases/test_atan2.py
UTF-8
12,415
3.03125
3
[ "MIT" ]
permissive
""" Special cases tests for atan2. These tests are generated from the special cases listed in the spec. NOTE: This file is generated automatically by the generate_stubs.py script. Do not modify it directly. """ from ..array_helpers import (NaN, assert_exactly_equal, exactly_equal, greater, infinity, isfinite, ...
true
4a86bb3dfb25dd90f71c488dcc084e913df87edc
Python
Zararthustra/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/9-model_state_filter_a.py
UTF-8
789
2.59375
3
[]
no_license
#!/usr/bin/python3 """ lists all State objects that contain the letter a from the database hbtn_0e_6_usa """ import sqlalchemy import sys from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from model_state import Base, State if __name__ == "__main__": username = sys.argv[1] password =...
true
a7e21e100a132df9a3ed88666c965a0ce6e6807d
Python
delaven007/AI
/2/5-ridge-岭回归2.py
UTF-8
1,035
3.046875
3
[]
no_license
import numpy as np import sklearn.linear_model as lm import matplotlib.pyplot as mp # 采集数据 x, y = np.loadtxt('./data/ml_data/abnormal.txt', delimiter=',', usecols=(0,1), unpack=True) x = x.reshape(-1, 1) # 创建线性回归模型 model = lm.LinearRegression() # 训练模型 model.fit(x, y) # 根据输入预测输出 pred_y1 = model.predict(x) # 创建岭回归模型 mode...
true
a59a298ad1e8b4273f4bcc5d264b84d72eec2688
Python
decentjik1128/python_code
/ch_1/pythonic_code/list_comprehensions.py
UTF-8
793
3.828125
4
[]
no_license
#List Comprehension result = [i for i in range(10)] print(result) #조건을 만족할 때만 추가 result = [i for i in range(10) if i%2 == 0] print(result) #이중 for문 방식 word_1 = 'Hello' word_2 = 'World' #1차원 방 result = [i+j for i in word_1 for j in word_2] print(result) case_1 = ['A', 'B', 'C'] case_2 = ['D', 'E', 'A'] #1차원 방식 result...
true
899323fab920fa2c86edc03662a8fdab5cca0ac3
Python
mwstobo/rent-toronto
/cache.py
UTF-8
1,049
2.90625
3
[ "MIT" ]
permissive
"""Caching for advert ids""" from typing import List import redis import config REDIS_POOL = redis.ConnectionPool(host=config.REDIS_HOST, decode_responses=True) ADVERT_IDS_KEY = "adverts" ADVERT_INFO_KEY = "advert_info" def contains_id(advert_id: str) -> bool: """Check if this advert is in the cache""" cl...
true
f949490feda8260fcbd2bfd44409522012978172
Python
tessyoncom/lessons
/greet.py
UTF-8
98
2.71875
3
[]
no_license
tes = 'Hello, World!' print(tes) if 5<10: print("hurry, I know maths!") print("program ends")
true
cb99f15517f56a5d6a8d6374a0274c0b58a7ef12
Python
DiniH1/python_engineer89_basics
/variables.py
UTF-8
1,597
4.75
5
[]
no_license
# lets test print("Hello Dini H") #print func used to display outcome provided in the string #Variables #python variables as a place holder to store data # it could me a string "anything between these quotations" # integers/numbers #Syntax to create a variable name of the variable = value of the variable #foolow your ...
true
662a4b1ae882a22b1448d866d24e781b22072fa2
Python
RajeshDas7/webscraping
/tweeter/twitter_fetch_hashtag.py
UTF-8
921
2.75
3
[]
no_license
import tweepy consumer_key = "nvEV4sEBSWM3HjwkcPu9ug6VR" consumer_secret = "3I6VFDNLbRGGkq7um1RqouLFs7EArViu3KoKMdN72QzN2i7Mwm" access_token = "1086269917295390720-rwbnIFrN2tjmQNjmr4dh849WH2Aewk" access_token_secret = "hwweAzNe6ltT9MaFHRaFTk7ZJPd04a6HdFHuDUDEKniyH" import csv # import pandas as pd auth = t...
true
3128c86386e2f379053ea5f73dc056f6d5c39370
Python
coti/adventofcode
/day13/day13part1.py
UTF-8
2,163
2.96875
3
[]
no_license
#!/usr/bin/env python import sys import itertools def parseFile( line ): line = line.split( '.\n' )[0] tab = line.split( ' ' ) a = tab[0] b = tab[-1] h = -1 try: h = int(tab[3]) except ValueError: print "happyness", tab[3], "error" return None if tab[2] == "lose...
true
be3521d923cfa433022aa5f8f4290b6a7d8bae1c
Python
StoneCong/tools
/teaching_kids/001.your_name.py
UTF-8
116
3.765625
4
[]
no_license
# this will ask for your name and then print it out for you. name = input("What is your name? ") print("Hi,", name)
true
c9a5faff9139475cc1deb3ca4a09f1d8989460eb
Python
ishine/SpectralCluster
/tests/utils_test.py
UTF-8
2,849
2.640625
3
[ "Apache-2.0" ]
permissive
import unittest import numpy as np from spectralcluster import utils class TestComputeAffinityMatrix(unittest.TestCase): """Tests for the compute_affinity_matrix function.""" def test_4by2_matrix(self): matrix = np.array([[3, 4], [-4, 3], [6, 8], [-3, -4]]) affinity = utils.compute_affinity_matrix(matri...
true
a9710c0f4a245cd63a4bd92fa919ff228a1766f4
Python
vectominist/MedNLP
/src/model/qa_model_rulebase_2.py
UTF-8
3,969
2.546875
3
[ "MIT" ]
permissive
''' File [ src/model/qa_model_rulebase_2.py ] Author [ Chun-Wei Ho & Heng-Jui Chang (NTUEE) ] Synopsis [ New rule-based QA method ] ''' import numpy as np import tqdm import edit_distance import re import multiprocessing as mp inv_chars = '錯|誤|有誤|不|沒|(非(?!常|洲))|(無(?!套))' def is_inv(sent: str): ...
true
9439da95bdf627509cf8fe25d37f12226346b06e
Python
dawidbrzozowski/sentiment_analysis
/text_clsf_lib/preprocessing/vectorization/data_vectorizers.py
UTF-8
933
3.125
3
[]
no_license
from text_clsf_lib.preprocessing.vectorization.output_vectorizers import OutputVectorizer from text_clsf_lib.preprocessing.vectorization.text_vectorizers import TextVectorizer class DataVectorizer: """ This class is meant to vectorize X and y (texts and outputs). To perform that, it uses TextVectorizer an...
true
f5f25b3ed4946536b875ae34afa736b28792f7b6
Python
mrirecon/SSA-FARY
/SupFig4/plot.py
UTF-8
2,900
2.515625
3
[]
no_license
#!/usr/bin/env python3 # Copyright 2020. Uecker Lab, University Medical Center Goettingen. # # Author: Sebastian Rosenzweig, 2020 # sebastian.rosenzweig@med.uni-goettingen.de # # Script to reproduce SupFig4 of the following manuscript: # # Rosenzweig S et al. # Cardiac and Respiratory Self-Gating in Radial MRI using an...
true
8683e4b2fb78ec57c1566e971614ab1878b9433c
Python
VP-0822/miniexcel
/src/excel.py
UTF-8
2,200
2.875
3
[]
no_license
import JSONDeserializer import workbook class WorkbookHandler: 'This class handles workbook opening/closing jobs.' #dictionary to maintain opened workbooks against thier file paths opened_workbooks = {} def __init__(self, workbook_name): self.workbook_name = workbook_name self.w...
true
2d1ec10a765c9ae7deee7b322729adf03793c09b
Python
pcicales/MICCAI_2021_aglom
/utils/eval_utils.py
UTF-8
10,030
2.78125
3
[]
no_license
import torch import numpy as np import matplotlib.pyplot as plt # from sklearn.utils.multiclass import unique_labels import os def get_binary_accuracy(y_true, y_prob): assert y_true.ndim == 1 and y_true.size() == y_prob.size() y_prob = y_prob > 0.5 return (y_true == y_prob).sum().item() / y_true.size(0) d...
true
d13f8aa0f2fb53bb59ac4258abaa6cefe7dc6ce1
Python
ssj24/TIL
/03_django/03_django_form/articles/templatetags/make_link.py
UTF-8
862
2.765625
3
[]
no_license
from django import template register = template.Library() # 기존 템플릿 라이브러리에 @register.filter def hashtag_link(word): # word는 article 객체가 들어갈 건데 # article의 content들만 모두 가져와서 그 중 해시태그에만 링크를 붙인다 content = word.content + ' ' # 공백으로 구분하기 때문 hashtags = word.hashtags.all() for hashtag in hashtags: ...
true
88e3daf1fd0e0a363f2749b1b434bfd2fb3a426a
Python
offbynull/offbynull.github.io
/docs/data/learn/Bioinformatics/input/ch4_code/src/helpers/HashableCollections.py
UTF-8
935
2.921875
3
[]
no_license
from collections import Counter class HashableCounter(Counter): def __init__(self, v=None): if v is None: super().__init__() else: super().__init__(v) def __hash__(self): return hash(tuple(sorted(self.items()))) class HashableList(list): def __init__(self...
true
bb378cc47edd1ec722339c192c645b36c7fa5ba6
Python
chenshanghao/Interview_preparation
/Leetcode_250/Problem_70/my_solution.py
UTF-8
501
3.453125
3
[]
no_license
class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ # Question 1: would n be smaller than 1 ? # Question 2: would n be larger than maxint # In Python 3, this question doesn't apply. The plain int type is unbounded. ...
true
d3c4fb21c01d834e1dfabe7ceb04e1cce801fca3
Python
jianhui-ben/leetcode_python
/2013. Detect Squares.py
UTF-8
1,406
4.34375
4
[]
no_license
# 2013. Detect Squares # You are given a stream of points on the X-Y plane. Design an algorithm that: # # Adds new points from the stream into a data structure. Duplicate points are allowed and should be treated as different points. # Given a query point, counts the number of ways to choose three points from the data s...
true
5540d0a34c9c5ecb8073e3c270f44d7c05145f7c
Python
kiligsmile/python
/05_高级数据类型/sml_16_字符串判断方法.py
UTF-8
374
3.921875
4
[]
no_license
# 1.判断空白字符 space_str = " " print(space_str.isspace()) space_str = "a" print(space_str.isspace()) space_str = "\t\n" print(space_str.isspace()) # 1>都不能判断小数 # num_str="1.1" # 2>unicode字符串 num_str = "\u00b2" # 3>中文数字 num_str = "一千零一" print(num_str) print(num_str.isdecimal()) print(num_str.isdigit()) print(num_str.isnumer...
true
46a745821501963813500cfb57708797a3896abb
Python
thevalzo/dataAnalytics2018
/focused_crawler/focused_crawler/spiders/GDB_spyder.py
UTF-8
3,376
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy import unidecode import MySQLdb from bs4 import BeautifulSoup class GDBSpider(scrapy.Spider): # Spyder name name = "GDB" db = "" def start_requests(self): #Keywords to search in the search engine of GDB #keywords=["brescia"] keywords = ...
true
ab12a5d11ddc81bd90c421af7bf8f99426a16345
Python
antofik/captcha
/statistics.py
UTF-8
1,326
2.78125
3
[]
no_license
import os import json from library import * try: with open('cache.txt', 'r') as f: cache = json.loads(f.read()) or {} except Exception,e: cache = {} if not os.path.exists("letters"): os.makedirs("letters") s = {} def check(image, index): global cache global s im...
true
59cbb3aff9665ad2d7bfdf30db8be4d2329f27ed
Python
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4162/codes/1800_2568.py
UTF-8
213
2.71875
3
[]
no_license
from numpy import* m = int(input("tamanho:")) f = zeros(m, dtype=int) d = "*" e = "*" g = "" o = "" for i in range(size(f)): e = "*" d = "*" g = g + o d = "*"*m e = "*"*m print(d+o+e) m = m - 1 o = o +"oo"
true
993d210b2086cefc927fefb05c593c920726aa68
Python
ForceCry/iem
/scripts/coop/compute_climate.py
UTF-8
3,858
2.546875
3
[]
no_license
# Computes the Climatology and fills out the table! import mx.DateTime import iemdb import psycopg2.extras import network import sys nt = network.Table(("IACLIMATE", "MNCLIMATE", "NDCLIMATE", "SDCLIMATE", "NECLIMATE", "KSCLIMATE", "MOCLIMATE", "ILCLIMATE", "WICLIMATE", "MICLIMATE", "INCLIMATE", "OHCLIMATE", "KYCLIM...
true
6e015350a30b5a7e234623d7f771745ff1278133
Python
HanifanNahwi/Python-Projects-Protek
/Chapter 8/Project13.py
UTF-8
735
3.078125
3
[]
no_license
nilai = [{'nim' : 'A01', 'nama' : 'Amir', 'mid' : 50, 'uas' : 80}, {'nim' : 'A02', 'nama' : 'Budi', 'mid' : 40, 'uas' : 90}, {'nim' : 'A03', 'nama' : 'Cici', 'mid' : 50, 'uas' : 50}, {'nim' : 'A04', 'nama' : 'Dedi', 'mid' : 20, 'uas' : 30}, {'nim' : 'A05', 'nama' : 'Fifi', 'mid' ...
true
76012fa4f7af19a8315927d4e5e62797be029cc9
Python
LorenzoPratesi/DataSecurity
/Set_1/text_frequency.py
UTF-8
5,330
3.5
4
[]
no_license
import re import math import matplotlib.pyplot as plot def get_text(): return open("texts/Moby_Dick_chapter_one.txt", 'r').read().replace('\n', '') def trim_text(text): text = text.upper() # conversione in maiuscolo text = re.sub(r"['\",.;:_@#()”“’—?!&$\n]+ *", " ", text) # conversione dei caratteri s...
true
b30ba08b9a017e7baa2c097816b427bff1ce30de
Python
tmibvishal/healTrip
/auth_queries.py
UTF-8
1,695
2.78125
3
[]
no_license
import db def new_user(username, email, password): if(username=='admin'): db.commit("insert into users(uname,email,pass,is_admin) values(%s, %s, %s, %s)", (username, email, password, True)) else: db.commit("insert into users(uname,email,pass,is_admin) values(%s, %s, %s, %s)", (username, email, ...
true
6d8c9be56d6e219218a9b5f19451edefbe551c92
Python
devin-liu/LTV
/CohortAnalysis.py
UTF-8
3,017
3.171875
3
[]
no_license
# Import modules import pandas as pd import numpy as np from datetime import datetime, timedelta, date # Load in data set by reading the CSV my_data = pd.read_csv('MRR Company Data Set.csv') def get_datetime_from_string(date_string): return datetime.strptime(date_string, '%m/%d/%y') def get_order_period_from_date...
true
703d36e44d1f053dfadf455aab11a46307603f49
Python
barrosfabio/result-analysis
/convert_to_one.py
UTF-8
1,565
2.609375
3
[]
no_license
import pandas as pd import os columns = ['none', 'ros', 'smote', 'borderline', 'adasyn', 'smote-enn', 'smote-tomek'] def write_df_csv(path, results_df): final_results_df = pd.DataFrame(columns=columns) final_results_df['none'] = results_df.iloc[:,0] final_results_df['ros'] = results_df.iloc[:,1] final...
true
ad2867a3ba17b7310c7d9ade5cfcedadcb540e89
Python
Ran4/py-contract-disallower
/tests/test.py
UTF-8
1,332
3.015625
3
[]
no_license
import unittest from disallower import disallow, require, Warn, Ignore from base import ContractWarning, ContractException ## Predicate functions: def negative_values(x: int) -> bool: return x < 0 def valid_lang(s: str) -> bool: return s.lower() in ["sv", "en"] ## Test function definitions: @disallow(age=n...
true
1c5f970757b4fe8a79d0220f0dd3dffbf5683dd2
Python
ntpz/rbm2m
/rbm2m/action/record_importer.py
UTF-8
3,718
2.75
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- import logging from record_manager import RecordManager from scan_manager import ScanManager import scraper from rbm2m.util import to_str logger = logging.getLogger(__name__) class RecordImporter(object): def __init__(self, session, scan): self.session = session self.sc...
true
8c612752cbc0760323bb904bd4539a881a99bf10
Python
harris-ippp/hw-6-linapp
/e2.py
UTF-8
1,036
2.765625
3
[]
no_license
#!/usr/bin/env python from bs4 import BeautifulSoup import requests url_va = 'http://historical.elections.virginia.gov/elections/search/year_from:1924/year_to:2016/office_id:1/stage:General' req_va = requests.get(url_va) html_va = req_va.content #getting the contents of the website soup = BeautifulSoup(html_v...
true
76446456c548660d046f8658ec3687591e281ce4
Python
chrispun0518/personal_demo
/leetcode/88. Merge Sorted Array.py
UTF-8
874
2.859375
3
[]
no_license
class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead. """ pt1 = m - 1 pt2 = n - 1 poi...
true
981b7e93b10f53cbd6223640e3312bc297d3a1d9
Python
csvoss/onelinerizer
/tests/try_except.py
UTF-8
1,212
3.484375
3
[ "MIT" ]
permissive
try: print 'try 0' except AssertionError: print 'except 0' else: print 'else 0' try: print 'try 1' assert False except AssertionError: print 'except 1' else: print 'else 1' try: try: print 'try 2' assert False except ZeroDivisionError: print 'wrong except 2'...
true
49f680989861bf1a247746e373567db6702c89fa
Python
MyungSeKyo/algorithms
/백준/1748.py
UTF-8
538
3.28125
3
[]
no_license
import sys input = sys.stdin.readline n = input().strip() digits = len(n) - 1 n = int(n) ret = 0 for i in range(digits): ret += 9 * (10 ** i) * (i + 1) ret += (n - (10 ** digits - 1)) * (digits + 1) print(ret) MAX = '100000000' # 9자리 sum_lst = [0] len_all = 0 for i in range(1, len(MAX)+1) : len_all += 9...
true
5eb1cb5f27bc80d8cbcff76719fc6d453ec7d806
Python
skosarew/EpamPython2019
/06-advanced-python/hw/task1.py
UTF-8
2,123
3.625
4
[]
no_license
""" E - dict(<V> : [<V>, <V>, ...]) Ключ - строка, идентифицирующая вершину графа значение - список вершин, достижимых из данной Сделать так, чтобы по графу можно было итерироваться(обходом в ширину) """ import collections class GraphIterator(collections.abc.Iterator): def __init__(self, collection): self...
true
1efc8f1b8fc85ff891d7835868c1627a7bb65f1c
Python
nicokiritan/sosc-sosw-modder
/ypac_unpack.py
UTF-8
792
2.859375
3
[]
no_license
import os import sys import exg if len(sys.argv) < 3: print("Drag&drop .dat and .hed") input() exit() dat_path = "" hed_path = "" drop_files = sys.argv[1:] for drop_file in drop_files: if drop_file[-4:] == ".dat": dat_path = drop_file elif drop_file[-4:] == ".hed": hed_path = drop_file if dat_pat...
true
172fc50d89794ed365517792ae75be9650c0d13b
Python
s0ap/arpmRes
/arpym/estimation/fit_factor_analysis.py
UTF-8
1,973
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np from arpym.estimation.factor_analysis_paf import factor_analysis_paf from arpym.estimation.factor_analysis_mlf import factor_analysis_mlf from arpym.statistics.meancov_sp import meancov_sp def fit_factor_analysis(x, k_, p=None, method='PrincAxFact'):...
true
8a875241356049a99d00341a59c5dbca861bba4b
Python
anakka6/algorithms
/algorithms/add_lists_reverse.py
UTF-8
2,314
3.859375
4
[]
no_license
'''Add 342 and 465 and print 807, The lists are set up as 2->4->3 and 5->6->4. The output should be 7->0->8.''' class Node(): def __init__(self, data): self.data = data self.next = None class LinkedList(): def __init__(self, head=None): self.head = head def append(s...
true
117d0cffb5a9faa7b0918ae98a8f4ecb2e38a041
Python
GinkgoX/MachineLearning
/KNN/digitsRecognize.py
UTF-8
1,435
3.203125
3
[]
no_license
import operator import numpy as np from os import listdir from sklearn.neighbors import KNeighborsClassifier as kNN ''' Function : img2vector(filename) Description : to covert img(in filename) to vector Args : filename Rets : vectorImg ''' def img2vector(filename): vectorImg = np.zeros((1, 1024)) fr = open(filen...
true
f64b6129e5015f95b71e756b183ea5598b93a179
Python
khygu0919/codefight
/Intro/allLongestStrings.py
UTF-8
307
3.53125
4
[]
no_license
''' Given an array of strings, return another array containing all of its longest strings. ''' def allLongestStrings(inputArray): b=[] c=0 for i in inputArray: b.append(len(i)) c=max(b) b=[] for j in inputArray: if len(j)==c: b.append(j) return b
true
07a08414711196f8ea857bc69f1a93a544b8b717
Python
elezbar/Python_Tetris
/test.py
UTF-8
180
3
3
[]
no_license
s = [{"name": "A", "parents": []}, {"name": "B", "parents": ["A", "C"]}, {"name": "C", "parents": ["A"]}] def parr(d,p, i = 1): for k in d: if p in k[parents]
true
715417861c882a0e110f52f7287b320219dd9b24
Python
gcastroid/img2mif
/img2mif.py
UTF-8
2,024
3.359375
3
[ "MIT" ]
permissive
from PIL import Image import sys # read the arguments img_file = sys.argv[1] out_file = sys.argv[2] # read the image image = Image.open(img_file) pixels = image.load() h_pixels, v_pixels = image.size # calc the number of address bits and the memory depth h_bits = (h_pixels - 1).bit_length() v_bits = (...
true
c5c04301b377f99cf2b9420248d2a3ab1c913267
Python
Melkemann84/ProjectEuler
/projectEuler_04.py
UTF-8
820
4.1875
4
[]
no_license
import time # https://projecteuler.net/problem=4 ''' Larges palindrome product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. ''' def isPalindrome(num): ...
true
95bc83ce3b68800ca1ee1ac892aff276274c3787
Python
GyuReeKim/DailyCode
/July/code_0714_1.py
UTF-8
2,394
4.4375
4
[]
no_license
# if문을 활용한 선택 프로그램 작성 import random print("게임 이름을 입력하세요.") game_name = input() hunter = ["타격감", "솔플", "운영"] survivor = ["멘탈", "팀워크", "스릴", "뚝배기"] # 랜덤 추출1 hunt_random1 = random.choice(hunter) surv_random1 = random.choice(survivor) # 질문1 print(f"당신에게는 {hunt_random1}과 {surv_random1} 중에 어떤 것이 중요합니까?") print(f"{hunt_ra...
true
4b0bdefee6479b70711da69cfccc8739ca61f69f
Python
pchatanan/AllState
/src/AllState.py
UTF-8
19,852
3.171875
3
[]
no_license
# coding: utf-8 # In[1]: import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt # Print all rows and columns. Dont hide any pd.set_option('display.max_rows', None) pd.set_option('display.max_columns', None) # Disable SettingWithCopyWarning pd.option...
true
b6aaacd39fb2e27ab205d5d724e079ea3ba7a982
Python
aljeshishe/tickets
/proxies/parse.py
UTF-8
508
2.59375
3
[]
no_license
import sys import json import re from collections import defaultdict d = defaultdict(lambda: defaultdict(int)) with open(sys.argv[1]) as f: for line in f: protos, domen = re.match('.+\[(.+)\].+ (.+)>', line).groups() protos = protos.split(', ') print(protos, domen) for proto in prot...
true
4ef264f871bfafdb542384612ecff49659b5b2e2
Python
benpmeredith/Ames_Iowa_Exercise
/lib/__init__.py
UTF-8
583
2.671875
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import tqdm import warnings warnings.filterwarnings('ignore') np.random.seed(42) from IPython.display import display from bs4 import BeautifulSoup import csv print('Pandas Initiated') print('Numpy Initiated') print('M...
true
212c18ac96bf1804d5ba1172d4b71705400144de
Python
pablo-solis/VARDER
/utilsVAR.py
UTF-8
10,075
2.609375
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import nltk import yfinance as yf # from nltk.sentiment.vader import SentimentIntensityAnalyzer import io import base64 import re import seaborn as sns # import bls # Import Statsmodels from statsmodels.tsa.api import VAR from random import choic...
true
57aa59e3207780fe30917d50be4f7db06003f95a
Python
JohnCorley/PythonLearning
/FirstExample.py
UTF-8
601
4.25
4
[]
no_license
Garage = "Tesla", "Lexus", "Bike" for each_car in Garage: print(each_car) print('He said \"Hello There\"') print(4**4) count = 0 while count < 10: print("The count is ",count) count += 1 for y in range(1,100,7): print ("Y is :",y) count=int(input("Enter Count")) if count < y: print ("Count ...
true
1b230ed871a9c39da46b3884badc0af5651434bd
Python
mercurialjc/cryptopals
/implement_pkcs7_padding.py
UTF-8
910
3.984375
4
[]
no_license
#!/usr/bin/env python """Implement PKCS#7 padding A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of plaintext into ciphertext. But we almost never want to transform a single block; we encrypt irregularly-sized messages. One way we account for irregularly-sized messages is by padding, creating a...
true
652dfa5591681ac300a834e68b0884eeb2351367
Python
PencilCode/pencilcode
/content/lib/pencilcode.py
UTF-8
7,259
2.875
3
[ "MIT", "BSD-3-Clause" ]
permissive
import pencilcode_internal # The SpriteObject class wraps a jQuery-turtle object so it can be used in Python. # This includes Turtle, Sprite, Piano, and Pencil objects. class SpriteObject(): def __init__(self, jsSpriteObject): self.jsSpriteObject = jsSpriteObject ################### ## Move Comman...
true
36fc8273143ca086da34d4d34cd140e1a32c7765
Python
Charleo85/SIS-Rebuild
/misc/data/hello.py
UTF-8
851
2.8125
3
[ "BSD-3-Clause" ]
permissive
from pyspark import SparkContext sc = SparkContext("spark://spark-master:7077", "PopularItems") data = sc.textFile("/tmp/data/inputs/sample.in", 2) # each worker loads a piece of the data file pairs = data.map(lambda line: line.split(",")) # tell each worker to split each line of it's partition pages = pairs.m...
true
f93b3a6286ea77881d77265a76c4b36daac7c99d
Python
crystalee01/read112
/read112code.py
UTF-8
12,719
3.46875
3
[]
no_license
from cmu_112_graphics import * from texttospeech import * from tkinter import * import random, math from PIL import Image import string ''' Goal: make educational app for children with dyslexia Features: - generate random words with confusing vowels and playback separate phonetic sounds - highlight; lots of colors...
true
8ba6f3b56c4603d64614b137859efbcdd275c35c
Python
felipesteodoro/tdc2020sp
/template_simple_ga_feature_selection.py
UTF-8
4,269
2.53125
3
[]
no_license
import random import numpy as np #pip install deap from deap import base from deap import creator from deap import algorithms from deap import tools import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn.metrics i...
true
aa0435b4dd54a4d902dd9318f965c2f04582b32b
Python
chahinMalek/automata
/main.py
UTF-8
546
2.78125
3
[]
no_license
from automata import Alphabet from automata import Nfa al = Alphabet({'a', 'b'}) n = Nfa(3, al, 0, 0) n.add_transition(0, 1, 'b') n.add_transition(0, 2, None) n.add_transition(1, 1, 'a') n.add_transition(1, 2, 'a') n.add_transition(1, 2, 'b') n.add_transition(2, 0, 'a') # n: Nfa = Nfa(2, al, 0, 0) # n.add_transiti...
true
32851ce2d3bc79cd24acf298faf62738df4c9376
Python
comojin1994/Algorithm_Study
/Uijeong/Python/SM/test4.py
UTF-8
832
3.21875
3
[]
no_license
import sys input = sys.stdin.readline def binary_search(arr, key): lower = 0 upper = len(arr) - 1 while lower <= upper: mid = (lower + upper) // 2 if key <= arr[mid]: upper = mid - 1 else: lower = mid + 1 return lower if __name__ == "__main__": N = i...
true
a3904dcb5bcc3be09aa51b4b6f1afa577abd8117
Python
akaped/pygments-styles
/themes/vividchalk.py
UTF-8
1,176
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ Vividchalk Colorscheme ~~~~~~~~~~~~~~~~~~~~~~ Converted by Vim Colorscheme Converter """ from pygments.style import Style from pygments.token import Token, Comment, Name, Keyword, Generic, Number, Operator, String class VividchalkStyle(Style): background_color = '#000000' ...
true
8c1b0c7373b4c24b7907c9e7a4bc7251c3b9605e
Python
MarkCBell/bigger
/bigger/draw.py
UTF-8
17,958
2.8125
3
[ "MIT" ]
permissive
""" A module for making images of laminations. """ from __future__ import annotations import os from copy import deepcopy from math import sin, cos, pi, ceil from typing import Any, Generic, Optional, TypeVar from PIL import Image, ImageDraw, ImageFont # type: ignore import bigger from bigger.types import Edge, Co...
true
050fec0ac2fd0eb74e694485b79c7b6da7369525
Python
ScottLiao920/Arduino_Hourglass
/gy521/calibration.py
UTF-8
1,555
3.234375
3
[ "Apache-2.0" ]
permissive
import serial import io from sympy import * def getparas(): x = 0 y = 0 z = 0 for i in range(5): x += float(sio.readline()) y += float(sio.readline()) z += float(sio.readline()) print("AcX AcY AcZ") print(x,y,z) x = x/5.00 y = y/5.00 ...
true
56014991cfe57f34749b7f8b2c5897c8a5b1ee4c
Python
nanakwame667/Wine-Quality-Prediction
/PROJECT_FILES/utils.py
UTF-8
2,089
2.71875
3
[]
no_license
import time import pandas as pd # models from sklearn.linear_model import LinearRegression, LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.preprocessing import StandardScaler from sklearn.tree import DecisionTreeClassifier from sklearn.svm import SVC from sklearn.metrics import co...
true
7cb7af696f740899d577af67074e035905dcbf3c
Python
lrdmic/Pycharm-Projects
/26_listas.py
UTF-8
1,765
4.46875
4
[]
no_license
# LISTAS # Una lista es una coleccion de elementos, las listas estan ordenadas, y son mutables. numeros = [5, 2, 23, 55, 1, 9, 6] frutas = ["Manzanas", "Peras", "Uvas", "Naranjas", "Mandarinas", "Bananas", "Kiwi"] print("LISTA ORIGINAL DE FRUTAS:") print(frutas) print() # print(frutas[-1]) # print(frutas[-3]) # print(...
true
d6cdb9b5554288077e4fa1a58d6e8b7578966da7
Python
robintema/django-likeable
/likeable/models.py
UTF-8
2,766
2.8125
3
[ "Apache-2.0" ]
permissive
# # django-likeable # # See LICENSE for licensing details. # from django.db import models from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.utils.translation import ugettext as _ class Like(models.Model): """ ...
true
a68baa0e0cfc18f29974563c6b276f1bf7dd753d
Python
ashwinpn/Computer-Vision
/mesh/src/nerf/tree.py
UTF-8
13,843
2.875
3
[ "MIT" ]
permissive
import torch class Node: def __init__(self, config, bounds, depth): self.config = config self.bounds = bounds self.depth = depth self.max_depth = self.config.tree.max_depth if self.depth == 0: self.count = self.config.tree.subdivision_outer_count else: ...
true
7d437cf3d540feba8b44cf58fdabb34ac8380261
Python
mateuscmartins-1/Space_Run
/tela_inicial.py
UTF-8
848
2.625
3
[ "CC-BY-4.0" ]
permissive
import pygame from config import FPS, QUIT, INTRODUCTION from assets import MUSICA_ENTRADA, load_assets def tela_inicial(janela): assets = load_assets() clock = pygame.time.Clock() tela_de_inicio = pygame.image.load('imgs/Spacerun.png').convert() tela_de_inicio_rect = tela_de_inicio.get_rect() jogo...
true
23cc903479cba9587bad7e7a3a7f5675cf0f0445
Python
MarshallMoler/django_project
/meiduo_mall/meiduo_mall/apps/users/utils.py
UTF-8
799
2.828125
3
[]
no_license
from django.contrib.auth.backends import ModelBackend import re from .models import User def get_user_account(account): '''判断account是否是手机号,并返回user''' try: if re.match('^1[3-9]\d{9}$',account): # 根据手机号获得用户名 user = User.objects.get(mobile=account) else: # 根据用户...
true
90d7f20d2b670bdaca28a5c84ffb93b671b412a2
Python
kexinshine/leetcode
/287.寻找重复数.py
UTF-8
302
2.578125
3
[]
no_license
# # @lc app=leetcode.cn id=287 lang=python3 # # [287] 寻找重复数 # # @lc code=start class Solution: def findDuplicate(self, nums: List[int]) -> int: n=len(nums) d=[0]*n for i in nums: d[i]+=1 if d[i]>1: return i # @lc code=end
true
461af85e3a77e2f97bf2261adf8296012543c389
Python
juliafealves/tst-lp1
/unidade-3/ano-bissexto/ano_bissexto.py
UTF-8
300
3.59375
4
[]
no_license
# coding: utf-8 # Aluno: Júlia Alves # Matricula: 117211383 # Atividade: Ano Bissexto - Unidade 3 ano = int(raw_input()) mensagem = "não é bissexto" # Verifica se o ano é bissexto. if (ano % 400 == 0) or (ano % 4 == 0 and ano % 100 != 0): mensagem = "é bissexto" print "%i %s" % (ano, mensagem)
true