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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a04a8a4a266a3ccd0c1b12666bc4bff06aa9ea54 | Python | Irstenn/pythonProject3 | /methods.py | UTF-8 | 465 | 3.65625 | 4 | [] | no_license | import random
from pathlib import Path
# choice of a leader using random method
# members = ['Stenn', 'BAm', 'Henry', 'Michel']
# leader = random.choice(members)
# print(leader)
class Dice:
def roll(self):
first = random.randint(1, 6)
second = random.randint(1, 6)
return first, second
di... | true |
0147442dc5b1e1fbe686d69875200c10c7262190 | Python | pyocd/pyOCD | /test/unit/test_graph.py | UTF-8 | 3,197 | 2.796875 | 3 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | # pyOCD debugger
# Copyright (c) 2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# ... | true |
316f50f0ab753207e0800c8447be5b5a57c381cb | Python | yuzhenpeng/Genome-annotation-pipeline | /scripts/kegg_anno.py | UTF-8 | 237 | 2.671875 | 3 | [] | no_license | from sys import argv
kegg_dict={x.split()[0][1:]:x.split()[1] for x in open(argv[1]) if x.startswith('>')}
diamond_dict={x.split()[0]:x.split()[1] for x in open(argv[2])}
for x in diamond_dict:
print(x+'\t'+kegg_dict[diamond_dict[x]])
| true |
8054cbd620d97192f351d0eea8035925690b96f4 | Python | leogeier/mc_uptime | /app/password.py | UTF-8 | 652 | 3.734375 | 4 | [] | no_license | import hashlib
import secrets
def generate_salt(len):
"""Returns salt of length len consisting of letters and numbers."""
abc = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
chars = []
for i in range(len):
chars.append(secrets.choice(abc))
return ''.join(chars)
def has... | true |
c8c493a73bd631ebfb06bb191f42dde9f47f41a4 | Python | KanduriR/pyspark-learning | /pyspark-RDD/customer_expd.py | UTF-8 | 758 | 2.796875 | 3 | [] | no_license | from pyspark import SparkContext, SparkConf
import csv
conf = SparkConf().setMaster('local').setAppName('customerExpenditure')
sc = SparkContext(conf=conf)
def getKeyValue(line):
# each entry has comma seperated values of <custid, transaction id, amount>
data = line.split(',')
return (data[0], float(data... | true |
389ea21c54be4d26059db64bb38e617b9183b0b7 | Python | apoclyps/code-co-op-interview-cake-apple-stocks | /stocks/stock_calculator.py | UTF-8 | 991 | 4.03125 | 4 | [
"Unlicense"
] | permissive |
class StockCalculator(object):
""""StockCalculator calculates the highest maximum profit for a given list
of historic stock prices.
"""
def __init__(self, stock_prices):
self.stock_prices = stock_prices
def get_max_profit(self):
"""Calculates the maximum profit from `stock_prices`... | true |
4947ad718a5f345e1a551a1224b2048cf01f4ec7 | Python | oscar457/my-notes | /Python/Scraping using Python/BeautifulSoup1.py | UTF-8 | 435 | 2.828125 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import ssl
import re
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter - ')
html = urlopen(url, context=ctx).read()
soup = BeautifulSoup(html, "html.parser")
... | true |
5a2e2a6ef30d2f32cb567bbb29a9c5ea6124559f | Python | martyw/finance | /securities/cash_flow_schedule.py | UTF-8 | 3,529 | 3.125 | 3 | [
"MIT"
] | permissive | """Cash flow class plus generator.
TODO: extend with date shifts for bank holidays/weekends
"""
from datetime import date
from typing import List
from utils.date.add_months import add_months
from utils.date.date_shifts import DateShiftNone
from utils.date.yearfrac import DayCountConvention
class CashFlow:
def __... | true |
445140edcaef056196f084084e069083fd2274a2 | Python | diamondstone/project-euler | /python/pe43.py | UTF-8 | 1,529 | 3.578125 | 4 | [] | no_license | from math import sqrt,factorial
def isprime(n): #returns 1 if n is prime, 0 if n is composite
if n<2:
return None
if n<4:
return 1
t=int(sqrt(n))
for i in range(2,t+1):
if n % i == 0: return 0
return 1
def numtobasef(num,l): # computes the l-"digit" "base" factorial represe... | true |
67a944930e0217647b660e701e445e8193403e15 | Python | kanehekili/MediaInfoGui | /src/MediaInfoGui.py | ISO-8859-1 | 1,502 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: iso-8859-15 -*-
'''
Created on Nov 25, 2011
Vernnftige GTK Oberflche fr media info
@author: kanehekili
'''
import subprocess
import sys
from subprocess import Popen
VERSION="@xxxx@"
def readMediaInfo(type,filename):
nameValid=False
if len(filename)>3:
result=Popen(["mediainfo",filenam... | true |
5897b654e576cef6e05f015e9cb1946104fe870e | Python | EricWangyz/Exercises | /Exam4Job/WZYH/wzyh0919.py | UTF-8 | 473 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/19 15:59
# @Author : Eric Wang
# @File : wzyh0919.py
n = int(input())
if n <= 5000:
s = 1
for i in range(2, n+1):
s *= i
while s % 10 == 0:
s /=10
s %= 100000
pr... | true |
5df104f705bf496e60c4c53ec03c0a2cdf8c93fa | Python | podhmo/individual-sandbox | /daily/20180103/example_dict/02diff.py | UTF-8 | 654 | 2.8125 | 3 | [] | no_license | import csv
from join import innerjoin
from dictknife.guessing import guess
with open("data/users.csv") as rf:
users = guess(list(csv.DictReader(rf)))
with open("data/users2.csv") as rf:
users2 = guess(list(csv.DictReader(rf)))
rows = innerjoin(users, users2, left_on="id", right_on="id", suffixes=("", "2"))
f... | true |
f5c3af7271df82ac923c09cd201bcdd9a7d04621 | Python | alifakoor/quera_fundamental_python | /gerdoo.py | UTF-8 | 271 | 2.859375 | 3 | [] | no_license | n, x, y = map(int, input().split())
if n % x == 0:
print(n // x, 0)
else:
for i in range(n // x):
result = -1
rest = n - ((i+1) * x)
if rest % y == 0:
result = str(i+1) + ' ' + str(rest // y)
break
print(result) | true |
f008eff754eac2d446011c13752e7e7e9cebd60f | Python | dotmido/Udacian | /Udacian.py | UTF-8 | 912 | 3.46875 | 3 | [] | no_license | class Enrollment:
def __init__(self,enrollstring):
self.enrollstring = enrollstring
class Udacian:
def __init__(self,name,city,enrollment,nanodegree,status):
self.name = name
self.city = city
self.enrollment = Enrollment('Cohort2')
self.nanodegree = nanodegree
... | true |
64f407d41e56dfa4233eee03c2475bd6e2422c99 | Python | Zach41/LeetCode | /119_pascal_triangle_ii/solve.py | UTF-8 | 418 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding : utf-8 -*-
class Solution(object):
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
ans = []
for i in range(rowIndex + 1):
ans.append(1)
for j in range(i-1, 0, -1):
... | true |
29b98eeec15c7ba12e3f39f3f9e94f7389c31e3d | Python | league-python-student/level0-module1-AmazingEma | /_03_if_else/_5_circle_calculator/circle_calculator.py | UTF-8 | 1,083 | 4.25 | 4 | [] | no_license | # Write a Python program that asks the user for the radius of a circle.
# Next, ask the user if they would like to calculate the area or circumference of a circle.
# If they choose area, display the area of the circle using the radius.
# Otherwise, display the circumference of the circle using the radius.
#Area =... | true |
43a3a72a0bf9713cdc6661a969916c40afd7f28c | Python | tlevine/socrata-music | /extract.py | UTF-8 | 3,678 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python2
import os
import string
import csv
import json
from unidecode import unidecode
import collections
DATA = 'data'
OUTPUT_FILE = open('socrata.csv', 'w')
OUTPUT_FIELDS = [
# Identity
u'portal',
u'id',
u'name',
u'description',
# Dates
u'createdAt',
u'publicationDate'... | true |
d62cfe6ef7b253292338930b2d8930d75ca41f0a | Python | alexandraback/datacollection | /solutions_5738606668808192_0/Python/Adensur/solution.py | UTF-8 | 960 | 3.265625 | 3 | [] | no_license | def readFile(f):
with open(f) as handle:
T=int(handle.readline())
string=handle.readline().split(" ")
N=int(string[0])
J=int(string[1])
return (T,N,J)
T,N,J=readFile("C-small-attempt0.in")
print T,N,J
N=16
J=50
#division by 11: sum of even digits has to be equal to t... | true |
e5b80fbe4f243a9a72de1ff1f2f576895779026c | Python | Kartavian/Projects | /pushcode/brickbreakclone/main/__init__.py | UTF-8 | 3,823 | 3.171875 | 3 | [] | no_license | # Attempt at brick breaker
import random
import turtle
# Main Window
import winsound
bb = turtle.Screen()
bb.title("BrickBreakClone")
bb.bgcolor("black")
bb.setup(width=800, height=600)
bb.tracer(0)
# Player Paddle
paddle = turtle.Turtle()
paddle.speed(0)
paddle.shape("square")
paddle.color("blue")
paddle.shapesize(... | true |
3d290ed93b998dbbf9902cefc26b3b0b6883795b | Python | carolinux/fractals | /iterative_fractal_generator.py | UTF-8 | 2,944 | 3.171875 | 3 | [] | no_license | import math
from matplotlib import pyplot as plt
import numpy as np
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def unit_vector(p1, p2):
p3 = Point(p2.x - p1.x, p2.y - p1.y)
magnitude = math.sqrt(p3.x * p3.x + p3.y * p3.y)
return Point(p3.x/magnitude, p3.y/m... | true |
8e10baa97cf6e28846fb235a563bf46e9f8d9fab | Python | CafeVisthuset/Caf-Visthuset | /database/models.py | UTF-8 | 37,977 | 2.65625 | 3 | [] | no_license | from django.db import models
from Economy.models import Employee
from .choices import *
from .validators import validate_booking_date, validate_preliminary
from datetime import date, timedelta, datetime
from django.core.exceptions import ValidationError, ObjectDoesNotExist,\
MultipleObjectsReturned
from django.cont... | true |
eacd62bb84ddcc16e5aa3e3f051bd321ed26b82f | Python | superpipal-yi/PlayGround | /LeetCode/maxiRec.py | UTF-8 | 864 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 22:55:26 2017
@author: zhang_000
"""
def maximalSquare(matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if not matrix:
return 0
dp = [[0]*len(matrix[0]) for i in range(len(matrix))]
for i in... | true |
c3f492d2116c4a59f39eb60eca68a99fe0b3ddfb | Python | EnotYoyo/LabTester | /swi_prolog.py | UTF-8 | 2,165 | 2.921875 | 3 | [] | no_license | import pexpect
def get_output(prolog, command):
"""
:param prolog: prolog process
:param command: command to execute
:return: tuple (ret, result): ret = 'true.' or 'false.', result = prolog output with out 'true.'/'false.' in the end
"""
expects = ['true.', 'false.']
prolog.sendline(comman... | true |
a7f6266c61ca98c28e5ea1a2804e8a74d18bc963 | Python | f4Ro/data_compression | /benchmarking/compression/compression_benchmarks.py | UTF-8 | 1,172 | 2.703125 | 3 | [] | no_license | from tensorflow.keras.models import Model
from typing import Any
from benchmarking.compression.benchmarks.compression_ratio import get_compression_ratio
from benchmarking.compression.benchmarks.reconstruction_error import get_reconstruction_error
def run_compression_benchmarks(encoder: Model, model: Model, data: Any... | true |
72c8027a454a738797f121c89339b1c25f176379 | Python | Ahmed--Mohsen/leetcode | /Single_Number.py | UTF-8 | 389 | 3.328125 | 3 | [
"MIT"
] | permissive | """
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
"""
class Solution:
# @param A, a list of integer
# @return an integer
def singleNumber(self, A):
m... | true |
ddab370158f5cc706f61144273f7e2ad58817d00 | Python | viking-sudo-rm/nn-automata | /legacy/parity.py | UTF-8 | 3,465 | 2.921875 | 3 | [] | no_license | from __future__ import division, print_function
import torch
from torch import nn
import torch.nn.functional as F
from discrete_rnn import NormalizedDiscreteSRN, RandomizedDiscreteSRN, RegularizedDiscreteSRN
from utils import RNNModel
def make_strings(num_examples, string_length):
probabilities = torch.Tensor(n... | true |
6a00f0ca9fa632aab7f9c362b3f647c6682c5507 | Python | swadhikar/python_and_selenium | /python_practise/Interview/threads/images/thread_locker.py | UTF-8 | 1,269 | 3.53125 | 4 | [] | no_license | from contextlib import contextmanager
from threading import Lock, Thread, current_thread
from time import sleep
# Run a function
# The function must be protected by thread lock
# After the function gets executed, the lock should be released
sum_of_values = 0
@contextmanager
def acquire_thread_lock():
lock = Loc... | true |
262df7fd4b6d30c5e5bb3c405a5a0e1f49a7430c | Python | kavya64102/python-projects | /resuction_backtracking/backtracking1.py | UTF-8 | 2,632 | 2.9375 | 3 | [] | no_license | import time
board = [
[0,2,0,0,0,0,0,0,0],
[0,0,0,6,0,0,0,0,3],
[0,7,4,0,8,0,0,0,0],
[0,0,0,0,0,3,0,0,2],
[0,8,0,0,4,0,0,1,0],
[6,0,0,5,0,0,0,0,0],
[0,0,0,0,1,0,7,8,0],
[5,0,0,0,0,9,0,0,0],
[0,0,0,0,0,0,0,4,0]
]
def print_board(board_:list):
for row in range(len(board_)):
... | true |
97214bc6b6d80a80e2d94fdadccb5e5fc2c5d027 | Python | alsyuhadaa/POST-TEST-3 | /PERULANGAN.py | UTF-8 | 184 | 4.375 | 4 | [] | no_license | n = int(input("Masukkan nilai N = "))
for x in range(n):
if(10 ** x > n):
break
else:
print("Nilai yang terkecil dari 10^x terkecil dari N adalah",10 ** x) | true |
cc82d6d9f44da1b7a58ccb7cd2f9e091b1d50762 | Python | FAREWELLblue/AID1912_personal | /day10/thread_lock.py | UTF-8 | 366 | 3.515625 | 4 | [] | no_license | '''
thread_lock.py lock方法解决同步互斥
'''
from threading import Thread,Lock
a=b=0
lock=Lock()
# 线程函数
def value():
while True:
lock.acquire()
if a!=b:
print('a=%d,b=%d'%(a,b))
lock.release()
t=Thread(target=value)
t.start()
while True:
lock.acquire()
a+=1
b+=1
loc... | true |
a3e67b70a1af2b341c854d2a7185ac91e1cdd9de | Python | wendyrvllr/Dicom-To-CNN | /dicom_to_cnn/model/petctviewer/RoiElipse.py | UTF-8 | 2,777 | 2.890625 | 3 | [
"MIT"
] | permissive | import matplotlib.patches
import numpy as np
import math
from dicom_to_cnn.model.petctviewer.Roi import Roi
class RoiElipse(Roi):
"""Derivated Class for manual Elipse ROI of PetCtViewer.org
Returns:
[RoiElipse] -- Roi Elipse Object
"""
def __init__(self, axis:int, first_slice:int, last_slice... | true |
e43f5e0218b4b122fe5be2d15aa23356196510c6 | Python | bruno-alves7/TRYBE-sd-07-restaurant-orders | /src/track_orders.py | UTF-8 | 1,570 | 3.171875 | 3 | [] | no_license | from collections import Counter
class TrackOrders:
def __len__(self):
return len(self.orders)
def __init__(self):
self.orders = []
def add_new_order(self, costumer, order, day):
return self.orders.append({"a": costumer, "b": order, "c": day})
def get_most_ordered_dish_per_co... | true |
6561d0a551258777477041e4f6894b1f892c5975 | Python | jack09581013/StereoMatchingNN | /test/test_sympy.py | UTF-8 | 108 | 3.046875 | 3 | [] | no_license | import sympy as sy
x = sy.Symbol('x')
y = sy.Symbol('y')
f = x / (x + y)
f_prime = f.diff(x)
print(f_prime) | true |
9a8aba5297c50a7e1e678bdc9c62ca7307d8c6ab | Python | SrinuBalireddy/Python_Snippets | /10_organizing files/renamingfiles.py | UTF-8 | 951 | 3.0625 | 3 | [] | no_license | # Write your code here :-)
#! python 3
# renamefiles.py - rename dates with american dates format MM-DD-YYYY date format to
# europena DD-MM-YYYY
"""
1. find all the text files in the folder
2. create a regex to find the data match and replace them with the req data format
"""
import os,re,shutil
... | true |
3be0d8b05fccc8e3630d08c555d807da76a636cd | Python | vignesh14052002/dartgame | /dart.py | UTF-8 | 4,367 | 2.8125 | 3 | [] | no_license | import pygame,math,pygame.locals
pygame.init()
font = pygame.font.Font('FreeSansBold.ttf', 20)
font1 = pygame.font.Font('FreeSansBold.ttf', 200)
font2 = pygame.font.Font('FreeSansBold.ttf', 100)
screen = pygame.display.set_mode((0,0), pygame.locals.RESIZABLE)
w, h = pygame.display.get_surface().get_size()
cx,cy... | true |
ca8cc1cb39a34802e2204ed5723dc702b6549e06 | Python | bdastur/notes | /python/kivyapp/sampleapp/main.py | UTF-8 | 4,336 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from kivymd.app import MDApp
from kivymd.uix.button import MDFlatButton
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from kivy.lang.builder import Builder
from kivy.clock import Clock
impor... | true |
86b1bc90619e3e64f5dc4529aeb5bb49b59136bb | Python | Saint-Aspais-MELUN/exo-13-bns-term | /tests/test_exercice2.py | UTF-8 | 590 | 2.828125 | 3 | [] | no_license | from exercices.exercice2 import *
def test_plus_ou_moins_succes():
plus_ou_moins.nb_mystere = 25
plus_ou_moins.input = lambda x: 25
output = []
plus_ou_moins.print = lambda x,y: output.append((x,y))
plus_ou_moins()
assert output == [("Bravo ! Le nombre était ", 25),
("Nombre d'essais: ",1... | true |
2d6bba3845e9a6d9ca5bede7b291406dca164cb2 | Python | UnSi/2_GeekBrains_courses_algorithms | /Lesson 3/hw/task8.py | UTF-8 | 850 | 4.125 | 4 | [] | no_license | # 8. Матрица 5x4 заполняется вводом с клавиатуры, кроме последних элементов строк.
# Программа должна вычислять сумму введенных элементов каждой строки и записывать ее в последнюю ячейку строки.
# В конце следует вывести полученную матрицу.
MATRIX_SIZE = 4
matrix = [[] for _ in range(MATRIX_SIZE+1)]
for i in range(M... | true |
17160a6f46f1b2b99b5d7ca3784d97b39539494e | Python | nesllewr/web_crawling | /Week2/challenge2.py | UTF-8 | 540 | 3.96875 | 4 | [] | no_license | data = ["조회수: 1,500", "조회수: 1,002", "조회수: 300", "조회수: 251",
"조회수: 13,432", "조회수: 998"]
sum =0
print("LV1. 리스트 안에 있는 데이터 출력하기")
for i in data:
print(i)
print("LV2. 리스트 안에 있는 데이터에서 숫자만 추출하기")
for i in range(len(data)):
print(int(data[i][5:].replace(",","")))
print("LV3. 조회수 총 합 구하기")
f... | true |
d685a25497c55be7e9ebe0b13b60d4fb0347f1a0 | Python | UU-IMAU/Python-for-lunch-Notebooks | /PFL_03_Jupyter_examples/Leo/libplot.py | UTF-8 | 5,548 | 2.609375 | 3 | [] | no_license |
import libtimeseries
def define_global_map(fig, sps=None):
"""
creates and returns GeoAxes in Orthographic projection,
"""
import matplotlib
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
# Plate Carree
myproj3 = ccrs.PlateCarree()
#myproj3 = ccrs.Mollwe... | true |
ac7f72e0d7df3d7d52493ef51d8f930739e475e0 | Python | Manasajagannadan/Digital_Signal_Processing | /DFT and DTFT/dft.py | UTF-8 | 843 | 2.84375 | 3 | [] | no_license | from scipy import signal
import cmath
import numpy as np
import matplotlib.pyplot as plt
j=cmath.sqrt(-1)
x=[0,1,4,23,45,50,5,4,2,1,0,0]
N=8
y=[]
n=np.linspace(-np.pi,np.pi,N)
for n in range(0,N):
sum=0
for k in range(0,len(x)):
sum=sum+x[n]*np.exp(-j*2*3.14*k*n)/N
y.append(sum)
print("\nx[n]:-",x)#... | true |
7ec778fd7110fe0b8225fd9a6fb4ea0e2306418a | Python | BadShahVir/Assignment-Submission | /Day 1/1st_assi.py | UTF-8 | 192 | 3.84375 | 4 | [] | no_license | #is operator------------
a=2.66 #float value
b="Kanhaiya" #string value
c = b
print(a is c) #False
print(b is c) #True
#is not operator
print(a is not c) #True
print(b is not c) #False | true |
d763e2f231bdc49b7ccf43c37cad53a1e1d9996a | Python | Tifinity/LeetCodeOJ | /345.反转字符串中的元音字母.py | UTF-8 | 600 | 3.3125 | 3 | [] | no_license | class Solution(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
"""
yuan = ['a', 'i', 'u', 'e', 'o', 'A', 'E', 'I', 'O', 'U']
i,j = 0, len(s)-1
s = list(s)
while i<j:
print(i,j)
if s[i] in yuan and s[j] in yuan:... | true |
df839cb1fac46ff8ccb4bb9eefd2df98e0241578 | Python | mythic-ai/summercamp2021 | /embedded/projects/touch.py | UTF-8 | 1,950 | 3.3125 | 3 | [] | no_license | # Touch sensor example
# - Mythic Summer Camp 2021
#
# Connections:
# - Pin 4 - I2C SDA -> OLED (onboard module), laser distance sensor, and IMU
# - Pin 15 - I2C SCL -> OLED (onboard module), laser distance sensor, and IMU
# - Pin 22 - GPIO out -> Beeper, inverted
# - Pin 25 - GPIO out -> White LED (onboard module)
... | true |
2149b40f79dada81600d5e41ef820eed1f73cb7a | Python | realllcandy/USTC_SSE_Python | /练习/练习场1/test2.py | UTF-8 | 762 | 3.28125 | 3 | [] | no_license | import tkinter as tk
window=tk.Tk() #实例化一个窗口
window.title('my window') #定义窗口标题
window.geometry('400x600') #定义窗口大小
var=tk.StringVar()
l=tk.Label(window,bg='yellow',width=20,height=2,text='empty')
l.pack()
def print_selection():
l.config(text='you have selected'+var.get())#让对象l显示括号里的内容
... | true |
afaf11fa92cdde250908712d16ae9359e12a3b24 | Python | johnhw/jhwutils | /jhwutils/tick.py | UTF-8 | 3,325 | 2.546875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | import IPython.display
import contextlib
from contextlib import contextmanager
total_marks = 0
available_marks = 0
def reset_marks():
global total_marks, available_marks
total_marks = 0
available_marks = 0
def js_summarise_marks():
global total_marks, available_marks
if available_marks == 0:
... | true |
0b9c2d0edc9697a11abf2174f76a1d24a717ddd1 | Python | kmittmann/Bot | /util/MathExtended.py | UTF-8 | 1,184 | 3.9375 | 4 | [] | no_license | import math
import numpy
'''
Created on Sep 28, 2013
@author: Karl
'''
def distance(x1, y1, x2, y2):
"""Returns distance between point (x, y) and character icon"""
return math.sqrt(((x1 - x2) ** 2) + ((y1 - y2) **2))
def triangleAngle(x1, y1, x2, y2, x3, y3):
"""
Returns angle of triangle in radia... | true |
c7bd9ca862bf622d701b3f0757f3a6da13da08ee | Python | ghozlan/wltv-pycore | /saving_figures.py | UTF-8 | 297 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 16 12:47:39 2015
@author: Hassan
"""
import matplotlib.pylab as plt
import numpy as np
def plot():
plt.subplot(2,1,1)
plt.plot((np.arange(10))**2)
plt.subplot(2,1,2)
plt.plot((np.arange(10))*2)
plot()
plt.savefig('test2.png') | true |
0adc04c7ccea340a2fef392d3e5f91524c0fad4c | Python | joelouismarino/amortized-variational-filtering | /util/plotting/audio_util.py | UTF-8 | 1,596 | 3.203125 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
try:
import librosa
except ImportError:
raise ImportError('Writing audio output requires the librosa library. '+ \
'Please install librosa by running pip install librosa')
def convert_tensor(audio_tensor):
"""
Converts a a tensor of audio samples ... | true |
4f99d6b062e5031ed568239c5b5097aaab8bcaad | Python | Thereodorex/skillsmart_1 | /level1/squirrel.py | UTF-8 | 261 | 3.484375 | 3 | [] | no_license | def squirrel(n):
"""
получает параметром целое неотрицательное число N,
возвращает первую цифру факториала N
"""
res = 1
for i in range(2, n+1):
res *= i
return int(str(res)[:1]) | true |
ec1bf8d20a21bcc2b44b408c1051977ce2431439 | Python | elouiestudent/NLTK | /Boggle.py | UTF-8 | 4,234 | 3.109375 | 3 | [] | no_license | #!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
import sys
import math
class TrieNode(object):
def __init__(self, data):
self.data = data
self.children = set()
self.isLeaf = False
def add_child(self, obj):
self.children.add(obj)
def readIn(str):
b = list... | true |
6a9290f0a5a85b1111e1a5a5428ce5c502f5d97d | Python | Aasthaengg/IBMdataset | /Python_codes/p03477/s842404533.py | UTF-8 | 154 | 3.71875 | 4 | [] | no_license | a, b, c, d = list(map(int, input().split()))
A = a + b
B = c + d
if A == B:
print('Balanced')
elif A > B:
print('Left')
elif A < B:
print('Right')
| true |
ed1a0e2727f0cffee260d11d11804c0567c6f439 | Python | ASEVlad/begining | /text with max wrong words.py | UTF-8 | 3,872 | 3.734375 | 4 | [] | no_license | def Change_text(text):
'''
function change all words in text
function work only for russian language
:param text: text in which we change all words
:return: text with changed words
'''
def Max_change_word(word):
'''
function change max quantity letters in word
functio... | true |
ce49087ff855cd8c944d36e0cf974c7792827487 | Python | coolsnake/JupyterNotebook | /new_algs/Graph+algorithms/Coloring+algorithm/solver.py | UTF-8 | 15,472 | 2.71875 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | import logging
import sys
import cvxpy
from mosek.fusion import *
from algorithm_helper import *
def compute_vector_coloring(graph, sdp_type, verbose, iteration=-1):
"""Computes sdp_type vector coloring of graph using Cholesky decomposition.
Args:
graph (nx.Graph): Graph to be processed.
... | true |
c2a18337a909adb0e81395209609564e59f362f8 | Python | anthonyyuan/FGTD | /scripts/caption_generation/generate_captions.py | UTF-8 | 19,676 | 3.265625 | 3 | [
"MIT"
] | permissive | import random
random.seed(0)
import pandas as pd
import numpy as np
from tqdm import tqdm
""" Creating sets for categorizing """
# Facial Structure
face_structure = {"Chubby", "Double_Chin", "Oval_Face", "High_Cheekbones"}
# Facial Hair
facial_hair = {"5_o_Clock_Shadow", "Goatee", "Mustache", "Sideburns"}
# Hairs... | true |
04fa3d14d24adf30faf787b84d40e0a3bc54ef58 | Python | jasseratops/PSUACS | /ACS502/ACS502_HW5/ACS502_HW5_Q5_Ultrasound.py | UTF-8 | 711 | 2.71875 | 3 | [] | no_license | import numpy as np
from numpy import exp, sqrt
import sys
def main(args):
I_Eth = 841.
f = 3.9
alphaBar_soft = .30 *f
alphaBar_Bone = 8.70 *f
alphaBar_Eth = 0.0044 *(f**2)
print (IAbs(I_Eth,4.,alphaBar_soft))
print (IAbs(I_Eth, 4., alphaBar_Bone))
I_init = backwards(I_Eth, 6., alphaBa... | true |
32c453fc0e61d20fdd8cd01ce08bd7bfd856e3de | Python | xjr7670/book_practice | /Python_Crash_Course/chapter15/different_dice.py | UTF-8 | 792 | 3.75 | 4 | [] | no_license | import pygal
from pygal.style import DarkSolarizedStyle
from die import Die
# 创建一个D6和一个D10
die_1 = Die()
die_2 = Die(10)
# 掷几次骰子,并将结果存储在一个列表中
results = []
for roll_num in range(50000):
result = die_1.roll() + die_2.roll()
results.append(result)
frequencies = []
max_result = die_1.num_sides + die_2.num_sides... | true |
1ee3e2707c6cc8898f8f7a795bd3ff2a33d1db05 | Python | jrc98-njit/CalculatorJRC | /src/Stats/StandardDeviation.py | UTF-8 | 259 | 2.96875 | 3 | [] | no_license | import math
from Stats.Variance import variance
from Calc.SquareRoot import squareroot
def standardDeviation(data):
numValues = len(data)
if (numValues == 0):
raise Exception('empty list passed to list')
return squareroot(variance(data))
| true |
2f50f1b75b4841f674f69413d78d49ac7a03b277 | Python | chpiano2000/taxi_management | /module/user.py | UTF-8 | 835 | 2.546875 | 3 | [] | no_license | from os import get_terminal_size, name
from .dbdriver import db
class user():
def __init__(self, name, gmail, sex, password, histories):
self.name = name
self.gmail = gmail
self.sex = sex
self.password = password
self.histories = histories
pass
def add_usr(s... | true |
a734320b7c5665e3a2b0dd9e50e8ab53ede9f25e | Python | ishirav/draw-and-learn | /lessons/1/part-4.circles.py | UTF-8 | 258 | 2.90625 | 3 | [
"MIT"
] | permissive | from draw import *
w = Window(title=__file__)
w.circle(400, 300, 280, color='lightgrey', fill='lightgrey')
w.circle(50, 50, 20)
w.circle(150, 150, 60, color='green', thickness=10)
w.circle(300, 300, 100, color='violet', fill='pink', thickness=3)
w.wait()
| true |
7acd7d0bcd6f450fb4bdd8326ddba592853678db | Python | Aikyo/python | /yangji/color/col.py | UTF-8 | 256 | 2.53125 | 3 | [] | no_license |
def get_crane():
di = {}
di['locked'] = False
di['feifei'] = False
di['xiaoma'] = color(di)
return di
def color(di):
if di.get('feifei'):
return 'kkkkk'
else:
return 'meiyoufeifei'
d = get_crane()
print(d)
| true |
93d5f976af8b946269c7d5489db2bc313c383900 | Python | heycoolkid/my-first-blog | /python_intro.py | UTF-8 | 134 | 3.65625 | 4 | [] | no_license | def hi(name):
print("Hi"+name+"!")
girls=["Bev", "Hilary", "Daria","Janet"]
for name in girls:
hi(name)
print("Next girl") | true |
7003a35635a04a4c69e87dce54ca2c9be0ba2e46 | Python | lukasreimer/RevitPythonScripts | /RevitPythonScripts/HorizontalVerticalSplit.py | UTF-8 | 4,040 | 3.078125 | 3 | [
"MIT"
] | permissive | """Split all pipes into horizontal and vertical pipes."""
from __future__ import print_function
import math
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
import Autodesk.Revit.DB as db
import Autodesk.Revit.UI as ui
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
im... | true |
d23f570bf94731ede97debd6bd1ee9ed3f760d72 | Python | cycle13/SimulationAnalysis | /cloud_RHcrit_spread.py | UTF-8 | 1,907 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset
from SkewT_archer import Lv, cpd, getQ
from STASH_keys import temp_key, pthe_key
def alphaL(T, p):
"""
A scaled rate of change in the saturation specific humidity with temperature
"""
alpha = dqsatdT(T, p)
alpha_L = (1. ... | true |
d1f13e636da4561babbaa676e0c08ff8448d9dab | Python | Majroch/vulcan-api | /vulcan/_homework.py | UTF-8 | 1,502 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from datetime import datetime
from related import (
IntegerField,
StringField,
DateField,
ChildField,
immutable,
to_model,
)
from ._subject import Subject
from ._teacher import Teacher
from ._utils import sort_and_filter_date
@immutable
class Homework:
"""
Ho... | true |
80540cd25f720fba921a8ae226c2f4c5ff469124 | Python | JaredAhaza/Password-Locker | /test_users.py | UTF-8 | 865 | 3.015625 | 3 | [
"MIT"
] | permissive | import unittest
from user import User
class TestUser(unittest.TestCase):
@classmethod
def SetupUserClass(cls):
"""
sets up the user class
"""
print("setup class")
@classmethod
def tearDownClass(cls):
"""
runs after each test
"""
print("teardown class")
def setUp(self):
... | true |
20fc7cc98dec99ee5956df29a2c3a3cf4b641ba1 | Python | musurca/Haddock | /nmea.py | UTF-8 | 8,350 | 2.5625 | 3 | [
"MIT"
] | permissive | '''
nmea.py
Converts Sailaway API data to NMEA sentences for communication
with nautical charting software.
'''
import socket
import threading
import sys
from datetime import datetime, timedelta
from rich.console import Console
from rich.markdown import Markdown
from sailaway import sailaway, saillog
fro... | true |
33f588129cd8d9d59e78475937a89a990550d731 | Python | MaximCosta/API_Binance | /XRP.py | UTF-8 | 1,312 | 2.671875 | 3 | [] | no_license | import datetime
from time import sleep, time
from binance.client import Client
import smtplib
import ssl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
APIKey = "YOUR-TOKEN"
SecretKey = "YOUR-TOKEN"
client = Client(APIKey, SecretKey)
symbol = 'XRPEUR'
quantity = ... | true |
c8cda7f82142c6613ba5bdc94f1cf7e21d674edb | Python | gyang274/leetcode | /src/0700-0799/0743.network.delay.time.py | UTF-8 | 873 | 3.21875 | 3 | [] | no_license | from typing import List
from collections import defaultdict
import heapq
class Solution:
def networkDelayTime(self, times: List[List[int]], N: int, K: int) -> int:
"""dijkstra algorithm, O(E + VlogV).
"""
# define graph G(E, V)
graph = defaultdict(set)
for u, v, w in times:
graph[u].add((v... | true |
a5ba06f726bce774496061b06d96c54492fd1955 | Python | namphung1998/Fall-2019-Independent-Study-Question-Answering | /squad_experiments/bidaf/layers.py | UTF-8 | 8,000 | 3.15625 | 3 | [
"MIT"
] | permissive | """
This module contains layers to be used in the BiDAF
(Bi-directional Attention Flow) for question answering
model (Seo et al, 2016)
Author: Nam Phung
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
from util import mas... | true |
f69561ab238a9dc9219c2997fed6521bcd5669b6 | Python | CESARO23/Programacion_Competitiva | /RPCs/RPC02-19/fridge.py | UTF-8 | 253 | 3.328125 | 3 | [] | no_license | dg = [0]*10
pos = valor = 999999
s = input()
for i in range(len(s)):
dg[ord(s[i])-48] += 1
for i in range(1,10):
if(dg[i]<valor):
pos = i
valor = dg[i]
if(dg[0]<valor):
print(10**(dg[0]+1))
else:
print(str(pos)*(valor+1)) | true |
813864cd6c134ca42dd81ee2d144de58cca943a7 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2/dandyandy/pancakes.py | UTF-8 | 202 | 3.515625 | 4 | [] | no_license | T = int(raw_input())
for curcase in range(1,T+1):
S = raw_input() + '+'
count = 0
for i in range(0, len(S)-1):
if S[i] != S[i+1]:
count += 1
print "Case #" + str(curcase) + ":", count
| true |
75345638b8c7fdf2b3ecdfb9f1bd6528f238fc16 | Python | ZhuYuHe/oxford-cs-deepnlp-2017-practical-2 | /utils/data_utils.py | UTF-8 | 5,478 | 2.59375 | 3 | [] | no_license | import urllib.request
import zipfile
import lxml.etree
import os
from collections import Counter
import codecs
import math
import random
import re
from utils.model_utils import UNK, UNK_ID, PAD, PAD_ID
from sklearn.model_selection import train_test_split
def download_data():
#TODO: if line doesn't... | true |
b22f37599300be70a101bc206a52e769843e7bca | Python | hyplabs/forecast-redacted | /backend/price_updater.py | UTF-8 | 32,147 | 2.59375 | 3 | [] | no_license | from typing import Optional
import time
import sys
import logging
from datetime import datetime, timedelta
import asyncio
import statistics
import random
import signal
from sqlalchemy import func
import aiohttp
from models import db, User, Exchange, RoundResult, RoundStatus, Round, BetType, BetResult, Bet, BalanceCha... | true |
bdf7b228917f4a421a7f0291f21ef6560c56336a | Python | dansoh/python-intro | /python-crash-course/exercises/chapter-14/14-2/game_functions.py | UTF-8 | 4,609 | 2.828125 | 3 | [] | no_license | import sys
from time import sleep
import pygame
from bullet import Bullet
from rectangle import Rectangle
def check_keydown_events(event, ai_settings, screen, stats, ship, rectangle, bullets):
"""Respond to keypresses."""
if event.key == pygame.K_DOWN:
ship.moving_down = True
elif eve... | true |
fb20839656b30c50f279f4baf69be722ae6222b1 | Python | Sherin1998/1-assignment-5 | /1ass5.py | UTF-8 | 785 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
#1
d={}
a=dict(d)
type(a)
# In[3]:
#2
d={'foo':42}
d
# In[ ]:
#3
.List are represented by [] while dictionaries by {}.
. Elements can be of any datatypes while key values in dictionary cant be mutable datatypes
. Elements in lists are accessed by index values... | true |
5dddaf3a4a32b76067896f9af1ae337ca611fe12 | Python | iwataka/google-code-jam | /2019/qualification_round/cryptopangrams.py | UTF-8 | 1,449 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
import string
def factor(n, N):
if n % 2 == 0:
return 2, n // 2
min = 3
# improve performance by this statements (but failed somewhy)
# min = n // N
# if min % 2 == 0:
# min += 1
for i in range(min, N, 2):
if n % i == 0:
return i, n ... | true |
7ff09e62327b206b35307fe4c1e00f7008057e10 | Python | jxie0755/Learning_Python | /LeetCode/LC129_sum_root_to_leaf_numbers.py | UTF-8 | 3,169 | 4.25 | 4 | [
"MIT"
] | permissive | """
https://leetcode.com/problems/sum-root-to-leaf-numbers/
LC129 Sum Root to Leaf Numbers
Medium
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the total sum of all root-to-leaf n... | true |
24927c1d5ccab7305bcb5612129319698c8d5929 | Python | CTPUG/mdx_staticfiles | /tests.py | UTF-8 | 2,352 | 2.640625 | 3 | [
"ISC"
] | permissive | from unittest import TestCase
from xml.etree import ElementTree
import xmltodict
from markdown import Markdown
from mdx_staticfiles import (
DjangoStaticAssetsProcessor, StaticfilesExtension, makeExtension)
class XmlTestCaseMixin(object):
""" Helper class for asserting that XML documents describe the same ... | true |
b05abbea14fe01191afab18dd6e20ff64323ec9f | Python | ochirovaur2/get_jira_hanged_issues | /utilities_dir/functions/timer.py | UTF-8 | 332 | 3.109375 | 3 | [] | no_license | import time
def timer(timer=4):
while timer >= 0:
days = timer // (60 * 60 * 24)
hours = (timer % (60 * 60 * 24) ) // 3600
minutes = ( (timer % (60 * 60 * 24) ) % 3600 ) // 60
sec = ( (timer % (60 * 60 * 24) ) % 3600 ) % 60
print (f"Sleep: {days}:{hours}:{minutes}:{sec}")
time.sleep(1)
timer... | true |
ae1a18c639f862e96bfa74403872deed3e84e122 | Python | tuulos/disco | /tests/test_mapresults.py | UTF-8 | 774 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | from disco.core import result_iterator
from disco.test import TestCase, TestJob
class MapResultsJob(TestJob):
partitions = 3
@staticmethod
def map(e, params):
yield e + '!', ''
@staticmethod
def reduce(iter, params):
for k, v in iter:
yield k + '?', v
class MapResult... | true |
f18bed9e29f72bc34b0ea21ffbce287bd8f69b0b | Python | AndrewAct/DataCamp_Python | /Preprocessing for Machine Learning in Python/Feature Engineering/01_Encoding_Categorical_Variables_Binary.py | UTF-8 | 965 | 3.625 | 4 | [] | no_license | # # 6/24/2020
# Take a look at the hiking dataset. There are several columns here that need encoding, one of which is the Accessible column, which needs to be encoded in order to be modeled. Accessible is a binary feature, so it has two values - either Y or N - so it needs to be encoded into 1s and 0s. Use scikit-learn... | true |
a59c8fefd740602f56f9d85445cbac44765c7cde | Python | AlimKhalilev/python_tasks | /laba14.py | UTF-8 | 491 | 3.84375 | 4 | [] | no_license | def powerOfTwo(n):
count = 0
d = 1
while d <= n:
count += 1
d = d * 2
return count
def getNumber01(num):
while type:
getNumber = input('Введите число ' + num + ': ')
try:
getTempNumber = int(getNumber)
except ValueError:
print('"' + ge... | true |
cfae5ffc7a4135aea162a97b90f0c64ad521e3b0 | Python | shireknight/simplemath | /simplemath.py | UTF-8 | 2,006 | 3.8125 | 4 | [] | no_license | import sys, os
import random
class App():
# $$ indicates properties
# all other vars indicated with $
name = ''
right_answers = 0
def __init__(self):
if not self.name:
self.name = raw_input('Enter your name: ')
hello = 'Hello ' + self.name + ', Would you like to try a m... | true |
a22b8dd52836586a76d856556ae9046e95295876 | Python | Microos/py-faster-rcnn | /loss_tracker2.py | UTF-8 | 2,999 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
import matplotlib.pylab as plt
import numpy as np
import re
from scipy import interpolate
def get_log_data(filename):
with open(filename, 'r') as f:
lines = f.readlines()
lines = [l.strip() for l in lines]
return lines
def get_iter_loss(data):
iter = []
loss = [... | true |
4558f5cd7f9fcbff629cc865c6e3cd672bd91665 | Python | legroman/PythonLessons | /task_3.py | UTF-8 | 548 | 4.46875 | 4 | [] | no_license | # Програма вітання
age = 0
# перевіряю щоб вводили тільки цифри (щоб трохи ускладнити)
while True:
getAge = input("Скільки вам років? ")
if getAge.isdigit():
age = int(getAge)
break
else:
print("Недопустимі символи!!!")
print("Спробуйте ще раз:")
if age < 16:
print("При... | true |
04e9ffaae28c79809ffccccd7db1c51e2bfdb27b | Python | Yi-Wei-Lin/Tibame_AI_Project | /userdata/WilliamHuang/code/模型訓練與預測/mMySQL.py | UTF-8 | 924 | 2.796875 | 3 | [] | no_license | import pymysql
link = pymysql.connect(
host = "請輸入host",
user = "請輸入名稱",
passwd = '請輸入密碼',
db = "請輸入db",
charset = "utf8",
port = int("請輸入port")
)
cur = None
def dbConnect():
global cur
# link.ping(reconnect=True)
cur = link.cursor()
# link.commit()
def dbDisconnect():
link.close()
... | true |
efd9ce0a63df79b07056daaeab21573ef5c1cbfe | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc024/C/4638196.py | UTF-8 | 723 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
import bisect
a = ord('a')
def solve(n, k, s):
if n // 2 < k:
return False
d = {}
t = [0] * 26
for c in s[:k]:
t[ord(c) - a] += 1
u = ' '.join(list(map(str, t)))
d[u] = 0
for i in range(1, n - k + 1):
t[ord(s[i - 1]) - a] -= 1... | true |
37d1e31b9c4782e46c63e46864e4dc8fd09642b7 | Python | tonyonce2017/python-learning | /day1/login.py | UTF-8 | 861 | 2.921875 | 3 | [] | no_license | import json
with open("acount.json", "r") as f:
acounts = json.load(f)
f.close
count = 0
while count < 3:
name = input("请输入用户名: ")
passwd = input("请输入密码: ")
if name in acounts.keys():
# 判断是否锁定
if acounts[name]["useable"] == "false":
print("您的账户已被锁定, 请联系系统管理员!")
... | true |
81d13c81f0c7d41c886742202a2bcbcbb6c916ba | Python | bitcsdby/Codes-for-leetcode | /py/Distinct Subsequences.py | UTF-8 | 524 | 2.71875 | 3 | [] | no_license | class Solution:
# @return an integer
def numDistinct(self, S, T):
ls = len(S)
lt = len(T)
if lt == 0:
return 1
if lt > ls:
return 0
dp = []
for i in range(ls+1):
dp.append([1]+[0]*lt)
for i in range(1,l... | true |
e63ce9d97eae2c6cbd0f728b0c6e2ba876242a3a | Python | Nagato35/acmp-solutions | /solutions/773.py | UTF-8 | 153 | 3.34375 | 3 | [] | no_license | print('Vvedite vo skolko raz Gulliver bolshe liliputov')
a = int(input())
print('Vvedite skolko nuzno matrasov')
b = int(input())
print('Vsego nuzhno', a * a * b, 'matrasov liliputo') | true |
23a0c5fe658cdb7e8705dd99f62f54d2f028b2d4 | Python | YoungBear/LearningNotesYsx | /python/code/func_move.py | UTF-8 | 280 | 3.4375 | 3 | [] | no_license | #!/usr/local/bin/python3
# -*- coding: utf-8 -*-
def move(n, a, b,c):
if n > 1:
move(n-1, a, c, b)
print("# " + a + " --> " + c)
move(n-1, b, a, c)
else:
print("# " + a + " --> " + c)
#print("move...")
pass
move(3, 'A', 'B', 'C')
| true |
83802867084827ef07235c2105fe70dcefb30753 | Python | readablecoding/Python_Studying | /Day0604/Test04.py | UTF-8 | 201 | 3.625 | 4 | [] | no_license | import time
print("CountDown!")
time.sleep(1) #프로그램을 숫자 만큼 중단
for i in range(1, 4):
print(4-i)
time.sleep(1)
print(0)
print("The end")
"""
CountDown!
3
2
1
0
The end
""" | true |
3f4fc3af5dc11516257f4f4f48c15244bde3e5ea | Python | wsdm-cup-2017/lettuce | /utils/dataset_loader.py | UTF-8 | 1,149 | 2.71875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
import os
from collections import defaultdict
class DatasetLoader(object):
def __init__(self, dataset_dir):
self.nationality_kb = self._load_kb_file(os.path.join(dataset_dir, 'nationality.kb'))
self.nationality_train = self._load_train_file(os.path.join(dataset_dir, 'natio... | true |
0e2c37ed803d4e3bf8cc7ee26363c2174c870aac | Python | hgarg1010/hacker_rank_python | /list_comp.py | UTF-8 | 158 | 3.015625 | 3 | [] | no_license | x = 2
y = 2
z = 2
n = 3
l = [
[i, j, k]
for i in range(x + 1)
for j in range(y + 1)
for k in range(z + 1)
if (i + j + k) != n
]
print(l)
| true |
c9ff4c32abc135bcc9c4aa38e247068de00a4029 | Python | lemingsen/7529tp2 | /tests/test_grafosimple.py | UTF-8 | 5,946 | 2.75 | 3 | [] | no_license | import unittest
import types
from src.grafosimple import GrafoSimple
class TestGrafoSimple(unittest.TestCase):
def test_vacio(self):
grafo = GrafoSimple()
self.assertEqual(0,grafo.cantidadNodos())
self.assertEqual(0,grafo.cantidadArcos())
self.assertEqual(0,len(list(grafo.a... | true |
f7a7e3662a3b6f1c68cad94d3e1de1d607c97985 | Python | cranelli/aQGC_Signal | /Analysis/test/scripts/Signal_Couplings.py | UTF-8 | 13,014 | 2.546875 | 3 | [] | no_license | from ROOT import TFile
from ROOT import TH1F
from ROOT import TGraph
from math import sqrt
from array import array
QGC_HISTOGRAM_DIRS=[("LM","../Histograms/LepGammaGammaFinalElandMuUnblindAll_2015_5_3/LM0123_Reweight/"),
("LT", "../Histograms/LepGammaGammaFinalElandMuUnblindAll_2015_5_3/LT012_Reweigh... | true |
01dd3a847cbd473c5fa16202497887bb709963a0 | Python | prerak-patel/sqlalchemy-challenge | /app.py | UTF-8 | 4,122 | 2.65625 | 3 | [] | no_license | # 1. import Flask
from flask import Flask
import sqlalchemy
import numpy as np
import datetime as dt
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm ... | true |
caff0c9e3fd33aee72e8c3cbd0489a7615030b93 | Python | HyeockJinKim/DecoCLI | /decocli/mbr/cmd.py | UTF-8 | 1,136 | 2.828125 | 3 | [
"MIT"
] | permissive | import types
class Command:
def __init__(self, _func: types.FunctionType, default: dict=None):
if default is None:
default = dict()
self.func = _func
self.param_names = _func.__code__.co_varnames
self.default_param = default
self.check_default_param()
def c... | true |
2681bef65bc533c79e205fe5a3a355ff16ec0ec5 | Python | hujimori/pyplayer | /main_frame.py | UTF-8 | 3,000 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import wx
import wx.grid
from gdata import *
import gdata.youtube
import gdata.youtube.service
class MainFrame(wx.Frame):
def __init__(self, id, title):
wx.Frame.__init__(self, id, title = "Youtube Player", size = wx.Size(1000, 400))
pan = wx.Panel(self, -1)
# 検索結果を表示するテーブル
self.ta... | true |