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 |
|---|---|---|---|---|---|---|---|---|---|---|
429f3f9fb1b9c38c70903e1ff3fadcb2e6aef37c | Tianhaofish/hw | /chapter 12/chapter 12 Q1.py | UTF-8 | 276 | 3.125 | 3 | [] | no_license | import calendar
cal = calendar.TextCalendar()
cal.pryear(2012)
#1B
cal = calendar.TextCalendar(3)
cal.pryear(2018)
#C
cal= calendar.TextCalendar(6)
cal.prmonth(2018,10)
#D
d = calendar.LocaleTextCalendar(6, "esperanto")
d.pryear(2012)
#E
print(calendar.isleap(-1600000))
| true |
70cc55d807853f9a4ee9761d9e5c5fa638b0acca | PKU-EECS/Ransac | /testRansac.py | UTF-8 | 1,867 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 17 21:48:58 2018
@author: Sikasjc
"""
import numpy as np
import matplotlib.pyplot as plt
import random
import Ransac
import time
num_iterations = 500
num_samples = 2000
noise_ratio = 0.9
num_noise = int(noise_ratio * num_samples)
def setup():
global ax1
X = np.... | true |
e5a0c771a0c24c6a58c2b1cc6d6321c32ea6408c | ericksc/pythonbasico | /clase_5_reduce.py | UTF-8 | 136 | 3.203125 | 3 | [] | no_license | nombres = ['sue', 'john', 'tom']
from functools import reduce
resultado = reduce( lambda x, y: f'{x} {y}', nombres )
print(resultado)
| true |
1fd4f52f9a0b2c424a5a1fa97e76a7be06803e17 | JStalnac/Marksite | /templates/pages/make.py | UTF-8 | 781 | 3.28125 | 3 | [
"MIT"
] | permissive | import os
import sys
import toml
def make_page(name):
if not os.path.isdir(name):
os.mkdir(name)
os.chdir(name)
page_data = {"title": "New Page", "authors": ["None"] }
with open("page.cfg", "w+") as f:
toml.dump(page_data, f)
f.close()
with open("pa... | true |
58fa6259c8e7cf474a99baae7804a48b4f71948a | Jason0221/backup | /HOME/笔记/python/Python基础代码-T/zip-F.py | UTF-8 | 168 | 3.234375 | 3 | [] | no_license | #!/usr/bin/python
#coding=utf-8
'''
zip() 函数的使用
'''
keys = ['spam','eggs','toast']
vals = [1,3,5]
d = {}
for (k,v) in zip(keys,vals):
d[k] = v
print d
| true |
5640fe917b920c40388326af968c94ac12da5b7c | AnSolo27/com_port_visual | /test.py | UTF-8 | 303 | 2.75 | 3 | [] | no_license | import random
from itertools import count
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
plt.style.use('fivethirtyeight')
x_val = [1, 2, 2, 1, 1]
ch1_y_val = [1, 1, 2, 2, 1]
ch1_z_val = [1, 1, 2, 2, 1]
plt.plot(x_val, ch1_y_val, ch1_z_val)
plt.show() | true |
7d791c4641c52ec451ac83fc68833213bd260f63 | rdhananjay7/coding-practice | /extract_and_sum.py | UTF-8 | 1,538 | 4.0625 | 4 | [] | no_license | """
Given a String, extract out all the numbers and print sum of all the numbers(Note: its numbers, not digits).
Assume that numbers can be in the range [-2147483648 to 2147483647]
Sample 0:
Input: abc22def42ghi123
Output: 187
Explanation: 22+42+123= 187
Sample 1:
Input: ~@123...33def4u55
Output: 215
Sample 2:
Inpu... | true |
d474bd718721075fa93f6986382c465fc8ee153a | missile777/learning | /lesson3.py | UTF-8 | 662 | 3.75 | 4 | [] | no_license |
import unittest
def get_first(n: list):
return n[0]
def get_second(n: list):
return n[1]
def is_empty(n: list):
return len(n) == 0
class TestListMethod(unittest.TestCase):
def test_get_first(self):
nums = [10, 20, 40, 80]
self.assertEqual(get_first(nums), 10)
def test_get_s... | true |
f8fd78f23f102bcffce2d24dd6e7b393cde7dad1 | AndrewTNaber/memeffpsd | /setup_psd_completion.py | UTF-8 | 1,963 | 2.890625 | 3 | [] | no_license | """
NAME: setup_psd_completion.py
AUTHOR: ANONYMOUS
AFFILIATION: ANONYMOUS
DATE MODIFIED: 10 June 2020
DESCRIPTION: Helper functions to set up the data for PSD matrix completion
problems.
"""
# Standard imports
import numpy as np
import scipy.linalg as la
import scipy.sparse as sp
import scipy.sparse.lina... | true |
1148116a29bc5c409b4cc38d3905fdf1842c5046 | Lee2Sh000/Python_minilabs | /RockScissorPaper_Game.py | UTF-8 | 2,728 | 3.40625 | 3 | [] | no_license | import random
import tkinter as tk
window = tk.Tk()
window.geometry("500x500")
window.title("파이썬 가위바위보 게임")
USER_SCORE = 0
COMP_SCORE = 0
TIE = 0
USER_CHOICE = ""
COMP_CHOICE = ""
def choice_to_number(choice):
rps = {'바위':0,'보':1,'가위':2}
return rps[choice]
def number_to_choice(number):
rps={0:'바위',1:'보',... | true |
f60d3c17e63855ca63b9c7c7ca0cebd535cdfe53 | MegaIng/greenery | /greenery/multiplier.py | UTF-8 | 6,338 | 3.3125 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
__all__ = (
"Multiplier",
"ONE",
"PLUS",
"QM",
"STAR",
"ZERO",
"symbolic",
)
from dataclasses import dataclass, field
from typing import Mapping
from .bound import INF, Bound
@dataclass(frozen=True)
class Multiplier:
"""
A min and a max. The va... | true |
15a2947b5df362ec29443fcfc7b4c3c98f081d83 | verystrongjoe/master-rl-for-two-days | /day1/dp/gamblers.py | UTF-8 | 3,519 | 3.96875 | 4 | [
"MIT"
] | permissive | """
A gambler has the opportunity to make bets on the outcomes of a sequence of coin flips.
If the coin comes up heads, he wins as many dollars as he has staked on that flip;
if it is tails, he loses his stake.
The game ends when the gambler wins by reaching his goal of $100, or loses by running out of money.
On each ... | true |
fd8ad74f19be21fba89311e1edb97712a9f80b80 | oreHGA/HomicideAnalysis | /HomicideByCity.py | UTF-8 | 3,170 | 3.171875 | 3 | [] | no_license | '''
File name: HomicideByCity.py
@author: Connor Zablow 815560792 CS496 SDSU
Date created: 5/5/2017
Date last modified: 5/8/2017
Sort the list to find non firearm-related homicides in the city.
Blunt Object, Strangulation, Unknown, Knife, Fall, Drowning, Suffocation, Explosives, Fire, Poison
'... | true |
0b353facfff5dc178be6a08ce92dc66f853703a4 | rkc98/Python_100_days_challenge | /day_21/snake.py | UTF-8 | 1,400 | 3.65625 | 4 | [] | no_license | from turtle import Turtle
UP = 90
DOWN = 270
RIGHT = 0
LEFT = 180
class Snake:
def __init__(self):
self.segemnts = []
self.start_positions = [(0, 0), (-20, 0), (-40, 0)]
self.create_snake()
self.move_distance = 20
self.head = self.segemnts[0]
def create_snake(self):
... | true |
99c120c3a0c5090c5540fd9a7835d0e298704783 | ilisha0512/project111 | /project.py | UTF-8 | 3,709 | 3.1875 | 3 | [] | no_license | import pandas as pd
import plotly.figure_factory as ff
import statistics
import plotly.graph_objects as go
import random
df = pd.read_csv("medium_data.csv")
population_mean = df["reading_time"].tolist()
mean = statistics.mean(population_mean)
median = statistics.median(population_mean)
mode = statistics.mode(p... | true |
0c10fd199261e24f7280aa5fea33428fe7395da0 | cmccandless/ExercismSolutions-python | /sublist/sublist.py | UTF-8 | 470 | 3.171875 | 3 | [
"MIT"
] | permissive | SUBLIST = 0
SUPERLIST = 1
EQUAL = 2
UNEQUAL = 3
def check_lists(s, a, checkSuper=True):
m, n = (len(s), len(a))
smaller, larger = (s, a)
if m == n:
result = EQUAL
elif m < n:
result = SUBLIST
else:
m, n = (n, m)
smaller, larger = (a, s)
result = SUPERLIST
... | true |
2c4bd12334670e961176f25702528e48e6a6753e | vmirisas/Python_Lessons | /exercise3.py | UTF-8 | 85 | 2.609375 | 3 | [] | no_license | interest_rate = 0.01
deposit = 100
deposit += interest_rate * deposit
print(deposit)
| true |
aca0fa7b777684ecc36edadbcf4e687f16466e9d | panditpg/it3038c-scripts | /Labs/lab5.py | UTF-8 | 2,759 | 4.71875 | 5 | [] | no_license | ###In this guessing number game, the computer will generate a random number between 1 to 10, and the user will have to guess it in 5 attempts.
###So, based on the user’s guess, the computer will give several hints if the number is high or low and as the user guess matches the number,
###the computer will then print t... | true |
b17cd21d863b7726e3a97ba105d5a1516907374b | jnasante/IDS | /neural_gas_ids.py | UTF-8 | 842 | 2.890625 | 3 | [] | no_license | import data_processor
# Parameters
cluster_units_number = (50,)
epochs = 1
obj_file_name = 'objects/kohonenGrowingGas.pkl'
############### Kohonen Growing Gas ###############
def createKohonenGrowingGas():
import kohonen
params = kohonen.GrowingGasParameters(
dimension=data_processor.num_features,
shape=(clust... | true |
fe04013e5f11b9cdfbfeea816a3fc03bfde9081b | borzari/ria_convae | /superpixel_MNIST_dataset/superpixels_withintensity_withoutzeros_jrway.py | UTF-8 | 16,158 | 2.640625 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import torchvision.transforms as transforms
import torchvision.datasets
import numpy as np
import matplotlib.pyplot as plt
import time
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1 import make_axes_locatable
# Starting tim... | true |
85adbe0ddaf24c5a1154112767bc97209d1c7c9c | JasonWorger/QAC_Challenges | /rectangle_test.py | UTF-8 | 141 | 2.71875 | 3 | [] | no_license | import pytest
import rectangle
def test_rectangle_returns_correct_area():
rect = rectangle.Rectangle(5,6)
assert rect.area() == 30
| true |
40eef1f2cddfbd18ec9adb8409a26ec63ab38f4f | UserGraund/test | /kinomania/utils.py | UTF-8 | 4,536 | 2.59375 | 3 | [] | no_license | import json
import os
import random
import sys
import math
from datetime import timedelta
from django.conf import settings
from django.contrib import messages
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.db import transaction
from django.urls import rever... | true |
72819dd3e4ebfeddd12e8c28465dac3b18c92209 | youngseong/hackerrank | /algorithm/flip_matrix.py | UTF-8 | 887 | 3.21875 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/flipping-the-matrix/problem
import math
import os
import random
import re
import sys
# Complete the flippingMatrix function below.
def flippingMatrix(matrix):
N = len(matrix)
n = N // 2
s = 0
for r in range(n):
for c in range(n):
r_opp = N-1-... | true |
fb315bc5f0413e9fe0ce581144921657e5323e8d | muyisanshuiliang/python | /leet_code/503. 下一个更大元素 II.py | UTF-8 | 1,975 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : 503. 下一个更大元素 II.py
@Contact : muyisanshuiliang@hotmail.com
@Modify Time @Author @Version
------------ ------- --------
2021/3/8 16:23 muyisanshuiliang 3.9
@Description:
-----------------------... | true |
b8a38231022bf3eabc57d80ff8171459fb696f2b | netmode/ACROSS_ORCA_OC1_EXPERIMENT | /SIG_exchange/rv.py | UTF-8 | 2,349 | 3.1875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python2
#############################################
### Script: discover.py ###
### Authors: K. Tsitseklis, G. Kakkavas ###
### Licence: MIT ###
### Python version: Python 2.7 ###
#############################################
import sys
from col... | true |
aeda0d9d48ebffcd93416d9add565ed102cd21b0 | Viktor-Sok/Python_program_QuantumStructures | /Contour_plot_of_transmission_coeficient_in_magnetic_strip/T_solve.py | UTF-8 | 1,338 | 2.765625 | 3 | [] | no_license | #imports module for numerical calculations
import numpy as np
#import module for scientific calculations
import scipy as sc
import scipy.linalg as scla
#imports module for visualization of results
import matplotlib.pyplot as plt
from scipy import optimize
def transmisson_coeff(d,kx,ky,H):
N = len(ky)
... | true |
4f66d6126250f926cd528aef12bdd7ae8320b24f | Tailen/Halite3_Bot | /Halite3_Python3_Windows_x86-64/hlt/tree_search.py | UTF-8 | 259 | 2.546875 | 3 | [
"MIT"
] | permissive | from .positionals import Direction
class Node:
"""
Tree Node class for action tree search
"""
def __init__(self):
actions = Direction.get_all_cardinals() + [Direction.Still]
children = []
def expand(self):
return | true |
266d51b9074a90a5bcdc3a467c57b9dbe577df48 | fan1018wen/Packages | /FactorLib/scripts/growth_industry.py | UTF-8 | 1,240 | 2.890625 | 3 | [] | no_license | """
把非周期成长性的股票合并,创建一个新的指数,指数的代码命名为101003。周期性强的行业划分为:
1. 电子元器件
2. 计算机
3. 传媒
4. 通信
"""
from data_source import data_source
import pandas as pd
start = '20070101'
end = '20170709'
industry_codes = ['CI005025', 'CI005027', 'CI005028', 'CI005026']
new_code = '101003'
# 合并行业成分股
cycle_strong = []
for industry in industry_... | true |
d50100ab4d8e38546e8906c6c6c84d14e81f7cbf | hvandang/auth2 | /my_script.py | UTF-8 | 726 | 2.671875 | 3 | [] | no_license | from flask import Flask
from flask_restful import reqparse, abort, Api, Resource
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
api.add_resource(HelloWorld, '/')
parser = reqparse.RequestParser()
parser.add_argument('username', type=str)
parse... | true |
b5d19b9e4c97c2b838a29907636742c165875d52 | angelo6868/reportObstacle | /backend/pager.py | UTF-8 | 3,320 | 3.171875 | 3 | [] | no_license | """
该模块用于实现分页的功能
"""
import math
class Pagination(object):
# current_page,11,user_list,10
def __init__(self,dataTotalNum,currentPage,numbersPerPage,pageNum):
"""
:param dataTotalNum: 数据总的内容条数
:param currentPage: 当前显示的页码
:param numbersPerPage: 每页显示的内容条数
:param pageNum: 页... | true |
ba2a1fae3436b8bab5f990b3f0d4e5693d5029c5 | gciruelos/imagenes-practicas | /practica1/ej05.py | UTF-8 | 345 | 2.859375 | 3 | [] | no_license | '''
Implementar una funcion que devuelva el histograma de niveles de gris de una
imagen.
Modo de uso:
python3 ej05.py <img1>
'''
import numpy as np
from PIL import Image
from sys import argv
import side_by_side
im1 = np.asarray(Image.open(argv[1]).convert('L'))
side_by_side.sbys_histogram([im1], None, argv[2] if l... | true |
6605cf82722fb9836de413b4ca4551f1df9b3425 | sdvinay/blackjack | /optimizer.py | UTF-8 | 2,513 | 3 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import blackjack as bj
import simulator as sim
def run_iteration(n, strat_base, previous_instructions):
comput = sim.compute_instructions(n, strat_base)
outputs = pd.DataFrame(comput).set_index(['score_p', 'score_d'])
instructi... | true |
09322d0c17d26de40955c6dd48247aae2434307b | MarcosLopez7/Simulacion-Aerolinea | /depegue.py | UTF-8 | 2,739 | 2.640625 | 3 | [] | no_license | from avion import Avion
from aerolinea import Aerolinea
from pasajero import Pasajero
from generador import Congruencial
from datetime import datetime, timedelta
from time import gmtime
class Despegue:
def __init__(self):
aviones_en_cola = 0
def taxing(self,vuelo):
tiempo_espera = 0
aero = Aerolinea()
aviones... | true |
fa98d81f5b307d5d9468e1855e8782009197bd5c | Code-Institute-Submissions/go-tennis | /products/tests/test_models.py | UTF-8 | 856 | 2.5625 | 3 | [] | no_license | from django.test import TestCase
from products.models import Category, Product
class TestProductModels(TestCase):
def test_category_model(self):
category = Category.objects.create(
name="test_category",
friendly_name="Test Category",
)
self.assertEqual(str(category... | true |
2397703c1f99ed04aea47bcfeefc165c2c25f2f8 | jamilnyc/mealshare | /lambda/application/deployment_package/messages.py | UTF-8 | 2,322 | 3.09375 | 3 | [] | no_license | """
messages.py
Class that handles all interactions with the mealshare_messages table.
"""
import boto3
from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Key
import time
from decimal import Decimal
class MealShareMessages:
TABLE_NAME = 'mealshare_messages'
REGION = 'us-east-1... | true |
3fa9037bc867b598864ea0925eed27f64ab7f373 | Yeraze/rvwhisper-monitor | /rvWhisperUtils.py | UTF-8 | 610 | 3.171875 | 3 | [
"MIT"
] | permissive | # Utilities for various things
# Smooth a typical sqlite result query
# delta is the "radius" of the smooth (We will average +/- delta values from each one)
# rows should be a List of 2-element Tuples (Timestamp, value)
def smoothTimeseries(rows, delta):
smoothedRows = []
for i in range(0,len(rows)):
... | true |
a957842669f4f9eae2962f00f2bd0b663078aa78 | vxda7/pycharm | /Algorithm 190926/groundragon.py | UTF-8 | 765 | 2.671875 | 3 | [] | no_license | import sys, time
sys.stdin = open('groundragon.txt', 'r')
start = time.time()
def find(now, N):
global minV
if now == N:
x = 0
y = 0
for i in range(N//2):
x += where[i * 2][0] - where[i * 2 + 1][0]
y += where[i * 2][1] - where[i * 2 +1][1]
res = x**2 + y**... | true |
d466f46ef2703f6aec12be1796e510ead45af9df | mark-marshall/Algorithms | /recipe_batches/recipe_batches.py | UTF-8 | 1,084 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python
# Conditions
# The keys will be the ingredient names, with their associated values being the amounts
# Your function should output the maximum number of whole batches that can be made
def recipe_batches(recipe, inventory):
leftovers = []
# loop over the key/value pairs of the recipe dictionary
... | true |
e4f9ff544bd7b63324cecdb358fd705cb5781576 | catboost/catboost | /contrib/python/prompt-toolkit/py2/prompt_toolkit/key_binding/vi_state.py | UTF-8 | 1,734 | 2.90625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | from __future__ import unicode_literals
__all__ = (
'InputMode',
'CharacterFind',
'ViState',
)
class InputMode(object):
INSERT = 'vi-insert'
INSERT_MULTIPLE = 'vi-insert-multiple'
NAVIGATION = 'vi-navigation'
REPLACE = 'vi-replace'
class CharacterFind(object):
def __init__(self, cha... | true |
2757b5e41797de9e6877a0c65efca873d4f11c54 | smarc-project/lolo_common | /captain_interface/scripts/usbl_output.py | UTF-8 | 705 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import rospy
from std_msgs.msg import Char
import sys
class asdf:
def __init__(self):
self.message = ""
def callback(self, msg):
#rospy.loginfo(rospy.get_caller_id() + 'I heard %s', data.data)
#msg = str(data.data)
self.message += chr(msg.data)
if... | true |
945a562d025203bd60b6462d1a444e73b71b3c0f | leo9711/rw | /BackUp.py | UTF-8 | 1,936 | 3.15625 | 3 | [] | no_license | import sys
import os
import time
import shutil
import tkinter
from tkinter import *
from zipfile import ZipFile
###########################
# Programme #
# de sauvegarde #
#########... | true |
6194798040b0c19cfcc3216d87ba8f8fbab67590 | sadams115/Grindstone | /gs_decentralized/Specialized/Maya/gs_assets/gs_scripts/Common/gs_NonDefHistCheck_class.py | UTF-8 | 2,091 | 2.65625 | 3 | [] | no_license | # Grindstone gs_NonDefHistCheck_class.py
# Authors: Sam Carnes and Sean Adams
# This file scans every DAG object in the scene and checks for any non-deformer history.
# The script returns a true or false depending on the results
import pymel.core as pm
import maya.cmds as cmds
class NonDefHistCheck:
... | true |
55ae7d4ec3c818f4ff0812c18fc063d48fe3aa16 | moriahclose/homework_3 | /exercise4.py | UTF-8 | 326 | 3.671875 | 4 | [] | no_license | # exercise4.py
# Moriah Tolliver and Gabriel Say
balance = float(input("Initial balance: "));
monthlyInterestRate = float(input("Annual interest rate in percent: ")) / 1200;
for balanceNum in range (1 , 4):
balance = balance + ( balance * monthlyInterestRate )
print("Balance after month" , balanceNum , ":" ... | true |
9aeac79fde56c86a9e8e021f4a2051766a9dc1c4 | robgoyal/CodeChallenges | /HackerRank/30DaysOfCode/Day10.py | UTF-8 | 405 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env/python
# Day10.py
# Code written by Robin Goyal
# Created on 28-07-2016
# Last updated on 28-07-2016
n = int(raw_input().strip())
binary_n = bin(n)[2:]
print binary_n
elements = []
count = 0
for i in binary_n:
if int(i) == 1:
count += 1
elif int(i) == 0:
elements.append(count)
... | true |
c14feafb0b5005812344a16dff4b84c19ee17eb8 | alexdjalali/pynatlog | /pynatlog/lexlearner.py | UTF-8 | 2,251 | 3.09375 | 3 | [] | no_license | from nltk.corpus import wordnet as wn
from symbols import *
class LexLearner:
def __init__(self, s1, s2, pos):
self.s1 = s1
self.s2 = s2
self.pos = pos
def get_lexical_relation(self):
return self.wn_lexical_relation()
def cat2wn(self, cat):
pcat2wn_map = {
... | true |
012c572b4fc58f664108ba45e2d701b93864dc6b | deepabalan/python-basics | /2/43.py | UTF-8 | 171 | 3.546875 | 4 | [] | no_license | # dict
s = {'apple': 2, 'orange': 3}
print 'apple' in s
print 2 in s
print 'orange' in s
print 3 in s
vals = s.values()
print 3 in vals
for i in vals:
print i
| true |
6e353efa157a41d02b188f6e8e087e9d5771501a | nvaytet/scipp | /src/scipp/plotting/controller1d.py | UTF-8 | 1,572 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @author Neil Vaytet
from .controller import PlotController
import numpy as np
class PlotController1d(PlotController):
"""
Controller class for 1d plots.
"""
def __init__(self, *args, **kwargs)... | true |
d6df6730e2b7811b692d487342732f82e8d478a9 | rjraiyani/Repository2 | /while_time.py | UTF-8 | 191 | 3.625 | 4 | [] | no_license | hours = 0
while hours < 24:
minutes = 0
while minutes < 60:
seconds = 0
while seconds < 60:
print (hours, minutes, seconds)
seconds += 1
minutes += 1
hours += 1
| true |
f5ccd3adcc1046732c0755a6fb9bb46497f1dfb3 | kinggodhj/python_coding_test | /programmers/42885.py | UTF-8 | 370 | 2.984375 | 3 | [] | no_license | def solution(people, limit):
people.sort()
i=0
j=len(people)-1
answer=0
while(i<=j):
if i==j:
answer+=1
return answer
if people[i]+people[j]<=limit:
i+=1
answer+=1
j-=1
return answer
#solution([10, 10, 90, 90], 100)
#solution([... | true |
264c6a7d28149e7e2666a1492a61df398810f3ca | xzl995/Python | /CourseGrading/4.1.16遍历矩阵.py | UTF-8 | 627 | 4.65625 | 5 | [] | no_license | """
【问题描述】
输入一个单词矩阵,输出单词序列。
【输入形式】
3行。每一行有3列,元素之间用空格分隔。每一个元素是一个单词(字母组成的字符串,不含空格)。
【输出形式】
一行。先输出第1列各行,接着第2列各行,再第3列各行。单词之间用一个空格间隔。
【样例输入】
one two three
on to to
go hello ear
【样例输出】
one on go two to hello three to ear
"""
temp = []
for i in range(3):
word = input().split()
temp.append(word)
for a in range(3):
... | true |
f7f2ae62afca20e9b225d7410c4707d1993ee745 | colinzyj/learncode | /python-reboot/base/expr.py | UTF-8 | 1,806 | 3.625 | 4 | [] | no_license | #encoding:utf-8
#分割字符串表达式
def split_expr(expr):
expr_list=[]
num_str=''
for i in expr:
if i not in '+-*/':
num_str+=i
else:
expr_list.append(float(num_str))
num_str=''
expr_list.append(i)
if num_str != '':
expr_list.append(float(n... | true |
ce61b38e5ae352c0f518c309c717e1ff0d551fde | applicationsbypaul/Module6 | /test_functions/test_valid_input_in_functions.py | UTF-8 | 1,063 | 3.25 | 3 | [] | no_license | """
Program: test_valid_input_in_functions.py
Author: Paul Ford
Last date modified: 06/17/2020
Purpose: test score input function
"""
import unittest
from more_functions.validate_input_in_functions import score_input
class MyTestCase(unittest.TestCase):
def test_score_input_test_name(self):
self.assertEq... | true |
84b2ab76950daa60b5093a22c43330fb5f188bde | c-tucci/pdsnd_github | /bikeshare_tucci.py | UTF-8 | 5,761 | 3.796875 | 4 | [] | no_license | import time
import pandas as pd
import numpy as np
invalid_input = 'Sorry that is not a valid input. Please try again.'
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
def get_filters():
print('Hello! Let\'s explore some ... | true |
f8a1fef56fb912f29b288eed3dc02c19d59743ce | m0nk3ycm0nk3ydo/phav | /Album.py | UTF-8 | 3,228 | 3.0625 | 3 | [] | no_license | import os
from PIL import Image
import glob
import tkinter
from PIL import ImageTk
from shutil import copyfile
class AlbumSelector:
currentEvent = None
def __init__(self, src, tgt):
self.src = src
self.tgt = tgt
self.files = glob.glob(self.src)
self.curIdx = 0
self.cu... | true |
6259e7a200279ab7b1766230e17bc60ba2095da8 | chingyi071/Cell-behavior-labeling | /visualize_util.py | UTF-8 | 2,121 | 3.1875 | 3 | [] | no_license | import sys
import matplotlib.pyplot as plt
class CropInterface(object):
"""
Like Cursor but the crosshair snaps to the nearest x, y point.
For simplicity, this assumes that *x* is sorted.
"""
# def __init__(self, ax, x, y):
def __init__(self, axs, ims, default_border = [-1, -1, -1, -1]):
... | true |
bf3eb5526d71a8d2a20b11f0372c7883be792778 | ArlenPP/data_mining_hw1 | /convert_generator.py | UTF-8 | 1,148 | 2.96875 | 3 | [] | no_license | import csv
from config import config
def clearspace(str):
for i in range(len(str)):
if str[i] != ' ':
return str[i:]
def getstr(str):
for i in range(0, len(str)):
if str[i] == ' ':
return str[:i], str[i:]
def removelast(str):
return str[:len(str) - 2]
from argparse im... | true |
dcc92d12d857444328c512a591020d4f4cba6a8c | yassinerabhi/IoT-WQMS | /generator.py | UTF-8 | 979 | 3.3125 | 3 | [] | no_license | """
This module is the generator which select data from DB
and prepares the data into csv format for download
Date: 31st May, 2019
Author: John PK Erbynn - john.erbynn@gmail.com
"""
import sqlite3
import csv
def generate_csv_file(parameter):
# database connection
con = sqlite3.connect('iot_wqms_data.db')
... | true |
f30ca89e970e59e4435ae03ff8078bf2fc859343 | jsmadis/python-pytest-cases | /pytest_cases/tests/pytest_extension/fixtures/fixture_unions/test_fixtures_union_2hard.py | UTF-8 | 1,562 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | from pytest_cases import param_fixture, fixture_union
# basic parametrized fixtures
a = param_fixture('a', ['x', 'y'])
b = param_fixture('b', [1, 2])
# union fixtures
c = fixture_union('c', [a, b])
d = fixture_union('d', [b, a])
def test_fixture_union_harder(c, a, d):
print(c, a, d)
def test_synthesis(module_... | true |
032c07a1137166d1c4bb839a102110f1636b196f | guoweifeng216/python | /selenium_frame/chapter5/pbulic.py | UTF-8 | 703 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
"""
author: weifeng.guo
data: 2019/9/2 14:12
filename: pbulic
"""
class Login():
def __init__(self):
pass
def user_login(self, driver, username, password):
print('start login---------')
driver.find_element_by_id("idInput").clear()
... | true |
36f4081dd1b602b2ea61f73a409add5b882aa131 | 520MianXiangDuiXiang520/python | /Web-Scraping/Scripy框架/demo/demo/spiders/test.py | UTF-8 | 1,101 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from demo.items import DemoItem
class TestSpider(scrapy.Spider):
# 唯一必须参数,爬虫名
name = 'test'
# 界定url,只有该url域下的url才会被爬取
allowed_domains = ['xinli001.com']
base_url='https://www.xinli001.com/info?is_ajax=1&page='
page=0
# 起始url,爬虫将从此开始爬取
start_urls = ... | true |
5f348b8ef57515df763fbc214313a78a5262dc0f | ZhangNing777/LeetCode_Python | /offer_33.py | UTF-8 | 1,140 | 3.484375 | 3 | [] | no_license | '''
输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回 true,否则返回 false。假设输入的数组的任意两个数字都互不相同。
参考以下这颗二叉搜索树:
5
/ \
2 6
/ \
1 3
示例 1:
输入: [1,6,3,2,5]
输出: false
示例 2:
输入: [1,3,2,6,5]
输出: true
提示:
数组长度 <= 1000
'''
from typing import List
class Solution:
def verifyPostorder(self, postorder: List[int]) -> boo... | true |
14e6e98db6a8877f25b41d300c2baa370ec0b9dc | xapple/forest_puller | /forest_puller/viz/increments_extras.py | UTF-8 | 5,270 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair and Paul Rougieux.
JRC Biomass Project.
Unit D1 Bioeconomy.
"""
# Built-in modules #
# Internal modules #
# First party modules #
from plumbing.cache import property_cached
# Third party modules #
#######################################... | true |
d4f5a9745cffd2c67e700e45a4841868afa07e55 | zflemingg1/Testing-For-SSL-Vulnerabilities-Misconfigurations | /Vulnerabilties/TLS Version 1.0 Protocol Detection/ssl_tls_1_0.py | UTF-8 | 6,412 | 3.296875 | 3 | [] | no_license | #!../../Custom_Python/build/bin/python2
# Description: This script will test to see if the target site supports tl1v1
# Author: Zach Fleming
# Date: 18/04/2018
# Import The Relevant Libraries
import socket # connecting to hosts
import ssl # ssl protocols
from termcolor import colored # needed for colored print
impor... | true |
bd8c5ebe36b16f81940846412bc1a9784fc811a2 | swayamxd/Gavy | /tasks/reddit.py | UTF-8 | 857 | 3.140625 | 3 | [] | no_license |
def open():
driver = selenium.webdriver.Firefox()
driver.get('https://www.reddit.com')
def login(username, password):
driver = selenium.webdriver.Firefox()
driver.get('https://www.reddit.com')
username = driver.find_element_by_name('user')
username.send_keys(username)
driver.find_element_by_name('passwd').sen... | true |
8a44ff1e467634536262cf87f428a26d352cfd5c | isshe/coding-life | /D.编程语言/6.Python/1.Python编程:从入门到实践/11.测试代码/Examples/1.test_function/test_name_function.py | UTF-8 | 271 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from name_function import get_formatted_name
class NamesTestCase(unittest.TestCase):
def test_first_last_name(self):
formatted_name = get_formatted_name('abc', 'bcd')
self.assertEqual(formatted_name, 'Abc Bcd')
unittest.main() | true |
a01f8bce7e43c556c84ccbedb32e82856998aff5 | unshorn-forks/STAC | /Engagement_Challenges/Engagement_4/tour_planner/proofs/Analysis and Proofs/Timing_Encrypted.py | UTF-8 | 3,217 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # MIT License
#
# Copyright (c) 2017 Apogee Research
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | true |
be357b85a9bd01af9400b1688da316fa6baa0db4 | freemanwang/Algorithm | /剑指offer/4.SearchInMatrix.py | UTF-8 | 1,061 | 3.234375 | 3 | [] | no_license | matrix = [
[1,2,8,0],
[2,4,9,12],
[4,7,10,13],
[6,8,11,15]
]
def search(matrix, num):
if matrix == None:
print('查无此矩阵')
return
sum = 0
for t in matrix:
sum += len(t)
y = len(matrix) #矩阵行数
x = sum/y #矩阵列数
if x != y:
print('输入的矩阵不正确')
... | true |
d68c2e748f7f220bc856abfc73bbea2405489751 | dannycho7/RTP_Latest | /src/relevancy_measures/calc_NCDG.py | UTF-8 | 3,594 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
import sys
import argparse
import math
parser = argparse.ArgumentParser(description='Post-processing after labeling, please put your rating in a file with '
'the same order as in docs.txt, one rating per line.')
parser.add_argument('--doc', required=Tru... | true |
f80f267e269bd0284ee89b0cc7fe5053418c2cfe | Sukhrobjon/Codesignal-Challenges | /challenges/replace_arr_elem.py | UTF-8 | 388 | 3.984375 | 4 | [
"MIT"
] | permissive | def array_replace(input_array, elem_to_replace, substitution_elem):
"""Replace all occurance of the elem_to_replace with substitution elements
"""
for i, elem in enumerate(input_array):
if elem == elem_to_replace:
# substitute the element
input_array[i] = substitution_elem
... | true |
055cfbab2c5c2cac19a308ef2bcb1fcecc30d8c5 | sinishadj/dj-txmoney | /txmoney/money/money.py | UTF-8 | 40,836 | 2.921875 | 3 | [] | no_license | # coding=utf-8
from __future__ import absolute_import, division, unicode_literals
from datetime import date
from decimal import ROUND_HALF_UP, Decimal, InvalidOperation
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible, st... | true |
cd845ad9fbe62e01728cd52c83ec95f8af5ed02c | spanthetree/duo-api-examples | /duo/duo_auth.py | UTF-8 | 2,593 | 2.609375 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
#Checks various endpoints in duo auth_api. methods are defined in:
#https://duo.com/docs/authapi#endpoints
#
#Use help option to see required parameters.
import sys, csv, argparse, getpass, yaml
import duo_client
from six.moves import input
__author__ = "David Woodruff"
def check_auth(auth_api... | true |
f71985a4dfbeba3f945066e0b07aba6779ace2b8 | nimra/module_gen | /nodes/Bisong19Building/B_PartI/A_Chapter1/index.py | UTF-8 | 3,076 | 2.59375 | 3 | [] | no_license | # Lawrence McAfee
# ~~~~~~~~ import ~~~~~~~~
from modules.node.HierNode import HierNode
from modules.node.LeafNode import LeafNode
from modules.node.Stage import Stage
from modules.node.block.CodeBlock import CodeBlock as cbk
from modules.node.block.ImageBlock import ImageBlock as ibk
from modules.node.block.MarkdownB... | true |
4bce403c6e295b1d454051764fb9a64c40893730 | doreshnikov/itmo-ml | /lab03_svm/svm.py | UTF-8 | 1,380 | 2.859375 | 3 | [] | no_license | import numpy as np
from utils.metrics import accuracy
from lab03_svm.utils.kernels import apply_kernel
def predict(x, y, alpha, w0, kernel, xnew):
xs = apply_kernel(x, xnew, kernel)
return np.sign(alpha * np.multiply(np.mat(y).T, xs) - w0)
def score(x, y, alpha, w0, kernel, xnew, ynew):
# return accurac... | true |
0ef52e668ddd4ceb13217af6f4f7b7a2d8734a31 | saint-rivers/network-bash | /sw_cfg.py | UTF-8 | 1,262 | 2.6875 | 3 | [] | no_license | import getpass
import telnetlib
import sys
# arguments
HOST = '192.168.10.1'
pass1 = 'khmer123'
pass2 = 'khmer123'
filepath = "quick_sw_conf.txt"
# get commands from text file
commands_f = open(filepath, "r")
commands = commands_f.readlines()
commands_f.close()
# define functions
def use_password(password):
if... | true |
76b24356da6f798e27be3c066babd3a2b57a15e0 | majuber/Machine-Learning | /Linear Regression/Python Code/simple_linear_regression.py | UTF-8 | 2,254 | 3.46875 | 3 | [] | no_license | # Simple Linear Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Salary_Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 1].values
# Splitting the dataset into the Training set and Test set
from sk... | true |
c35acb03ce99bc10100277a1920856b928ed3349 | greenteabiscuit/MAXII-FTD2XX-macos | /polar_bar_stftdata.py | UTF-8 | 1,923 | 2.65625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pandas as pd
import math
import matplotlib.ticker as mticker
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
DATE = os.env... | true |
c8076f8ca6001cea4a5b4fdd0e2500d695582b28 | macalderonv/deep_learning | /proyecto2.py | UTF-8 | 2,555 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
"""
Spyder Editor
This is a temporary script file.
"""
eje_x = []
eje_y = []
eje_z = []
tiempo = []
ejex_cd = []
ejey_cd = []
ejez_cd = []
ejex_ci = []
ejey_ci = []
ejez_ci = []
ejex_pd = []
ejey_pd = []
ejez_pd = []
ejex_pi = []
ejey_pi = []... | true |
c8fd576cf62c8df5bb1e7a3156676adb2a18b69a | r-parvulescu/ro_parliament | /python/make_utterance_table.py | UTF-8 | 4,539 | 2.859375 | 3 | [] | no_license | #Started May 26, 2017
#ThrowOutEmpties.py
#ran in Python 3.x
""" Tools for collecting data off the Romanian Chamber of Deputies website: scraping the HTML, extracting relevant information, and dumping everything into a postgreSQL database. """
import misc_utilities as mu
import utterance_regex_functions as urf
import... | true |
7fccda251acb59948b06131e496556741a29cea4 | jryyz/PBC-Final-Project-Team-10 | /20190105介面.py | UTF-8 | 5,684 | 2.96875 | 3 | [] | no_license | from tkinter import*
from tkinter import messagebox
from random import randint
from tkinter import ttk
from pprint import pprint
#----------介面程式碼分隔線------------------------------------------------------------------------------------------
#第二視窗(選遊戲或電影)
def start():
window.destroy()
i = useroption.get()
if i == 0... | true |
3af8d8fe1131c6a80ff93c2c0e7dd8c02a58cd63 | spanickroon/Python-Tasks | /session_4/task_4_2.py | UTF-8 | 732 | 4.03125 | 4 | [] | no_license | """
Task 4.2
Implement a function which search for most common words in the file. Use
data/lorem_ipsum.txt file as a example.
def most_common_words(filepath, number_of_words=3):
pass
print(most_common_words('lorem_ipsum.txt'))
>>> ['donec', 'etiam', 'aliquam']
NOTE: Remember about dots, commas, capital letters etc.
""... | true |
ac9ee01de45a232260384d37a5fa4e6c2dd0153e | MasterShaw/tensorflow_mnist_nn_tensorboard_model-saver-restore | /code.py | UTF-8 | 6,585 | 3.03125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import os
import tensorflow.examples.tutorials.mnist.input_data as input_data
mnist=input_data.read_data_sets("MNIST_data/",one_hot=True)
# define how many units in each layers
n_input_layer = 28*28 # input payer
n_layer_1 = 500 #... | true |
038d2d4aa2e01859a9e7f9680b6b36a8833238cc | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_116/1929.py | UTF-8 | 2,757 | 2.859375 | 3 | [] | no_license | fname = 'A-large.in'
with open(fname) as f:
content = f.readlines()
total = int(content.pop(0))
case = 0
def get_value(matrix, x, y, previous=None):
if(matrix[x][y]=='T'):
return previous
if(matrix[x][y]=='.'):
return False
if(previous==None):
return matrix[x][y]
return ... | true |
d123c1f68efa3da36c8e136e06977a6d32ef1aa1 | MrHamdulay/csc3-capstone | /examples/data/Assignment_7/albjul005/util.py | UTF-8 | 2,187 | 4.0625 | 4 | [] | no_license | """Module for manipulating 4x4 arrays
Julian Albert
ALBJUL005
29 April 2014"""
def create_grid(grid):
'''create a 4x4 grid'''
for i in range(4):
grid.append([0,0,0,0])
return grid
def print_grid (grid):
""... | true |
e96d0dcedd57a4b8902cf81af0f498d68d62cf0e | HarunobuFunamoto/-AI | /corner/cre_image_label.py | UTF-8 | 3,991 | 3.03125 | 3 | [] | no_license | import cv2
import numpy as np
import random
from sklearn import cross_validation
# 以下は画像を読み込んで、回転、拡大縮小、平行移動する処理
def image_point(num_image, size_min, ang_max,tate,yoko, x1,y1,x2,y2,x3,y3,x4,y4):
# パラメーター一覧
# 生成する画像の数
#num_image = 1
# 以下の範囲内でランダムに画像を拡大、縮小、移動。
# 画像を縮小するときの最小%
#size_min = 70
... | true |
25598a11bdd5c60ea603ceb528b3cf7a877769af | shawnlower/ltp_restapi | /tests/testdata/movies/fetch.py | UTF-8 | 1,121 | 2.875 | 3 | [] | no_license | #!/usr/bin/python3
from rdflib import Graph, URIRef
from urllib.parse import quote, urlparse
url = 'http://dbpedia.org/resource/Category:Films_set_in_colonial_Australia'
g = Graph()
g.parse(url)
triples = list(g.triples((None,
URIRef('http://purl.org/dc/terms/subject'),
URIR... | true |
0d89563e481fb4e0f89a358b4ed7d0ae2d82b792 | firstkeaster/BigData_proj | /Over_length/map.py | UTF-8 | 950 | 2.734375 | 3 | [] | no_license | # !/usr/bin/env python
import sys
import string
import numpy
import csv
import argparse
import time
parser = argparse.ArgumentParser(description='BigData_Length_Query')
parser.add_argument('--column', type=list, default=[],
help='items which some cols should exclude')
args = parser.parse_args()
c... | true |
b16aa9dc9ea6d7b2fc7128e2b266b84242dd3e2e | yeyujujishou19/TensorFlow | /TensorFlow/53generateds.py | UTF-8 | 1,304 | 3.515625 | 4 | [] | no_license | #coding:utf-8
#0导入模块,生成模拟数据集
import numpy as np
import matplotlib.pyplot as plt
seed=2
def generateds():
# 基于seed产生随机数
rdm = np.random.RandomState(seed)
# 随机数返回300行2列的矩阵,表示300组坐标点(x0,x1)作为输入数据集
X = rdm.randn(300, 2)
# 从X这个200行2列的矩阵中取出一行,判断如果两个左边的平方和小于2,给Y赋值1,其余赋值为0
# 作为输入数据集的标签(正确答案)
... | true |
a755dc3f7464d70d829f5ab68585a3e1494131cb | crystal2001/lesson4again | /problem3.py | UTF-8 | 114 | 2.90625 | 3 | [] | no_license | english = 89
math = 95
history = 87
science = 84
average = english + math + history + science / 4
print(average) | true |
0657a61713817426e01e0a374a3453cbf28c487a | green-fox-academy/peterjuhasz | /week-4/Project/commands.py | UTF-8 | 4,030 | 3.421875 | 3 | [] | no_license | import sys
import csv
import time
import sys
from colors import red, green, yellow
from datetime import datetime
csv_input = "todo_list.csv"
csv_complete = "complete_list.csv"
def list_items(csvfile):
my_todo = open(csvfile, "r")
lines = csv.reader(my_todo, delimiter = "|")
print(' Priority: Descript... | true |
229605d1f80187acc19bf496ac60a29b0e35c55b | nordberg/fpl-team-generator | /player.py | UTF-8 | 1,661 | 3.046875 | 3 | [] | no_license | from dataclasses import dataclass, field
from enum import Enum
class Position(int, Enum):
GKP = 1
DEF = 2
MID = 3
FWD = 4
@dataclass
class Player:
id: int
name: str
position: Position
value: int
club: str
selected_by_percent: float
form: float
minutes_played: int = f... | true |
ae1a635c15c3e94a5fb18174d249724b42ea3dc8 | jinlong17/Tracking_Generation | /utils.py | UTF-8 | 3,476 | 2.609375 | 3 | [] | no_license | '''
@Descripttion:
@version:
@Author: jinlong li
@Date: 2020-07-09 15:52:53
LastEditors: jinlong li
LastEditTime: 2020-09-24 18:28:58
'''
import numpy as np
import torch
from torch.utils.data import DataLoader
from torchvision import transforms, datasets
import pdb
# 加载数据集
def load_data(resize,data,batch_size, nu... | true |
e31a3e86da8538d04c1ffa6df96dd24444664182 | bend-is/pystudy | /basics/lesson_5/task_7.py | UTF-8 | 1,848 | 3.640625 | 4 | [] | no_license | """
Создать (не программно) текстовый файл,
в котором каждая строка должна содержать данные о фирме:название, форма собственности, выручка, издержки.
Пример строки файла: firm_1 ООО 10000 5000.
Необходимо построчно прочитать файл, вычислить прибыль каждой компании, а также среднюю прибыль.
Если фирма получила убытки, в... | true |
109aa912143c153df154aaf533a319ac30e2b3ec | Anseik/algorithm | /A형 모의 역량평가/연습장.py | UTF-8 | 95 | 3.03125 | 3 | [] | no_license | arr = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]
test = arr[:]
test[0][1] = 100
print(test)
print(arr) | true |
f8b21be753127c21d37e0368271c028d124c0eba | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/1462.py | UTF-8 | 874 | 2.75 | 3 | [] | no_license | fin = open("B-large.in")
T = int(fin.readline())
fout = open('B_output.txt', 'w')
for t in range(1, T + 1):
cN = fin.readline().strip()
N = list(cN)
pos = -1
flag = True
for i in range(len(N) - 1):
if N[i] > N[i+1]:
flag = False
pos = i
break
if flag:... | true |
3639380f48b40569dda17eaa8f060615b9750a72 | lidongze6/leetcode- | /1049. 最后一块石头的重量 II.py | UTF-8 | 902 | 3.3125 | 3 | [] | no_license | class Solution:
def lastStoneWeightII(self, stones) -> int:
# 0-1背包DP
# 其实就是相当于将石子划分成尽量相等的两堆,也就是求sum//2容量的背包最大能装多少重量
sum1 = sum(stones)
target = sum1 // 2
l = len(stones)
f = [[False] * (target + 1) for i in range(l + 1)]
# 前i个石头装j重量能否装下
f[0][0] = True... | true |
9816ee3b72a8246ebf086860e961bb33be65bce4 | jurayev/algorithms-datastructures-udacity | /project2/stacks_queues_linked_list_problems/skip_i_delete_j.py | UTF-8 | 1,314 | 4.53125 | 5 | [
"MIT"
] | permissive | # LinkedList Node class for your reference
class Node:
def __init__(self, data):
self.data = data
self.next = None
# helper functions for testing purpose
def create_linked_list(arr):
if len(arr)==0:
return None
head = Node(arr[0])
tail = head
for data in arr[1:]:
ta... | true |
d32cee4cd31ec4b9cd5cb50db505e862e2ea09c5 | ncisrobert/Python | /week2/pules_line.py | UTF-8 | 780 | 3.28125 | 3 | [] | no_license | from graphics import *
import random
import time
datafile = open("data.txt")
data = datafile.read().split() #splits white space into a list
#float(xcor)
window = GraphWin("Onscreen", 500 , 500)
def main():
window.setBackground(color_rgb(255,255,255))
background = Rectangle(Point(0,0),Point(550,550))
back... | true |
f7dec4de8c0b4872c6a09847d5776dd1835fc7ce | JuliethOmbita/CodingBat_Python | /List-1/make_pi.py | UTF-8 | 225 | 3.6875 | 4 | [] | no_license | '''
Return an int array length 3 containing the first 3 digits of pi, {3, 1, 4}.
make_pi() → [3, 1, 4]
'''
def make_pi():
myList = []
myList.append(3)
myList.append(1)
myList.append(4)
return myList
| true |
ffdc19d87cfed9cc46c3a2406d35b0c33ca689ee | neuropycon/graphpype | /examples/plot_inv_ts_to_graph.py | UTF-8 | 10,900 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | """
.. _inv_ts_to_graph:
=========================================================
Compute Graph properties from a given connectivity matrix
=========================================================
The inv_ts_to_graph pipeline performs spectral connectivity and graph analysis
over time series. This workflow makes use... | true |
e59e1c2a739cdccc9332a8e64666110581d22e10 | iddi/sofia | /ssls-Sep-05-11/tokenize_smodel.py | UTF-8 | 2,373 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
#
# In comes a line
# Stable Model: "audiodev"("moo_587d8f98-4fea-4148-bbad-9fcc05c08e3a") "audiodev"("moo_637bfddd-886f-43e2-a4be-dc6854e88993")
#
# and need to split it by a single space, but strings inside the "" marks
# may contain spaces which should not count.
# Prints out the tokes line-by-l... | true |