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
bba2bde4b46d718f64ecb2c6799c8f281e873626
Python
antekpiechnik/projekt-rw-agh
/src/pyxmldict.py
UTF-8
10,067
2.96875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import os import re import string import time import sys # dictionaries origin_bits = ['gr.', 'łc.', 'fr.', 'niem.', 'ang.'] # the main class for containing the definitions along with the examples/origin and so on class WordDefinition: # the simplest of all constructors...
true
648fc05000e6ae8c613422a390ff367689f7c27c
Python
cgat-developers/cgat-flow
/obsolete/pipeline_rnaseqtranscripts.py
UTF-8
82,536
3.0625
3
[ "MIT" ]
permissive
"""================================= RNA-Seq Transcript Build pipeline ================================= The rnaseq transcript build pipeline attempts build a variety of gene sets from reads mapped to a reference genome. This pipeline works on a single genome. Overview ======== The pipeline assumes the data derive...
true
88752a56c4cf29ddfc76a9c34875cb615f8f24bc
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_212/198.py
UTF-8
1,457
3.21875
3
[]
no_license
import math def splitAndList(inp): ret = [] s = inp.split(' ') for i in range(len(s)): ret.append(int(s[i])) return ret def splitAndDict(f, inp): ret = {} s = inp.split(' ') s2 = f.split(' ') for i in range(len(s)): ret[s2[i]] = int(s[i]) return ret def c2(gr...
true
6bd4e1a24a2750432eec32dc6e7df783ba5c4bb6
Python
miguelsuau/modified-ml-agents
/ml-agents0.3/python/unitytrainers/coma/trainer_test.py
UTF-8
26,303
2.5625
3
[ "Apache-2.0" ]
permissive
# # Unity ML Agents # ## ML-Agent Learning (PPO) # Contains an implementation of PPO as described [here](https://arxiv.org/abs/1707.06347). import logging import os import numpy as np import tensorflow as tf from unityagents import AllBrainInfo from unitytrainers.buffer import Buffer from unitytrainers.coma.models i...
true
29b3d489d21ab311bb395fd33a1e00fef18d983b
Python
Ocean-11/TF_stixels
/data/crop_image.py
UTF-8
2,026
3.09375
3
[]
no_license
''' * * crop_image() * * Purpose: crops an images folder using prescribed x limits * * Output: Cropped directory containing the cropped images * * Written by: Ran Zaslavsky 04-12-2019 ''' # imports import glob, os import matplotlib.image as mpimg import tkinter as tk from tkinter import filedialog import shutil de...
true
4c1e2aaa697d3c02bc93e153d93738ea1a4d2664
Python
huyquangbui/buiquanghuy-web-c4e23
/web2/hw/study1.py
UTF-8
251
3.3125
3
[]
no_license
# Learn how to convert string to dictionary using json library. import json a_string = "{'ola':'amigo','grazie':'italian','gracias':'spanish','merci':'french','danke':'german'}" into_a_dict = json.loads(a_string) print(into_a_dict) # khong chay duoc
true
c4984640725fa682aea5a753589dc8a270fc2992
Python
Amankhalsa/pythonHero
/venv/Py_hero/my_dict.py
UTF-8
2,387
4.0625
4
[]
no_license
print("This is a dictionary Eng to Punjabi:") print("user for word meaning eng to pbi") my_dict={"Happy":"ਖੁਸ਼", "Healthy":"ਤੰਦਰੁਸਤ", "Clever":"ਚਲਾਕ", "Wise": "ਸਮਝਦਾਰ", "Laborious":"ਮਿਹਨਤੀ", "Honest":"ਇਮਾਨਦਾਰ", "Brave":"ਬਹਾਦਰ", "Rich":"ਅਮੀਰ", "Kind":"ਦਯਾਲੁ", "Intelligent":"ਤੇਜ"} # user_input=input("enter...
true
882374d7b9d30a0e70431b15725e40d894440bc3
Python
mallik141/nike-bot
/main.py
UTF-8
12,301
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Buy stuff from nike.com/launch Useful endpoints at https://api.nike.com /launch/launch_views/v2/?filter=productId(...) Find whether can buy an item /merch/skus/v2/?filter=productId%28...&filter=country%28US%29 Find SKUs of different sizes of items ----------------...
true
6207f3cae55531003437be5b36bfeb155ddab39e
Python
alaypatel07/dmbi
/information_gain/entropy.py
UTF-8
3,409
3.328125
3
[]
no_license
# Algorithm # Develop a data structure for the node # Each node has the following parameters # Name # data # attribute - optional # values - optional # Requires further inspection # children [] # start the algorithm with a root node...
true
bb65ebe8af720b9a1ed80f73321a111320f00ac7
Python
bennettp123/advent-of-code
/2017-day09/garbage.py
UTF-8
1,800
3.46875
3
[ "MIT" ]
permissive
#!/usr/bin/env python def process(s, depth=0): if s.startswith('<'): # is garbage pos = 0 garbage_count = 0 while True: pos += 1 if s[pos] == '!': # skip next char pos += 1 garbage_count += -2 c...
true
a11f4cf504938d3b73f924123a6c625542405459
Python
mikeshihyaolin/linkcode
/703. Kth Largest Element in a Stream.py
UTF-8
1,550
4.71875
5
[]
no_license
# 703. Kth Largest Element in a Stream.py # Design a class to find the kth largest element in a stream. # Note that it is the kth largest element in the sorted order, not the kth distinct element. # Your KthLargest class will have a constructor which accepts an integer k and an integer array nums, # which contains i...
true
0cef25e475d7ffc2c92e32c36f1133414d28c9ef
Python
mmal73/30-days-code
/05.py
UTF-8
201
2.703125
3
[]
no_license
import math import os import random import re import sys if __name__ == '__main__': n = int(input()) for i in range( 1,11 ): print( str( n ) + " x " + str( i ) + " = " + str( n*i ) )
true
6fbd50a01d3c7cf03a590a1e116220a34ce5eaab
Python
padamcs36/Chapter-1
/ArrayIndex.py
UTF-8
527
4.03125
4
[]
no_license
from array import * arr = array('i',[]) a = int(input("enter the length of the array: ")) for i in range(a): x = int(input("Enter number of values :")) arr.append(x) print(arr) val = int(input("Enter the number to search: ")) count = 0 for e in arr: if e == val: print("The index...
true
dac9fb55d01019203776cff8861be28767d6f38b
Python
ashwin2509/Leetcode
/Amazon/LongestPalindromicSubstring.py
UTF-8
1,012
3.296875
3
[]
no_license
import collections import heapq class Solution: def longestPalindromicSubstring(self, string): dp = [[0 for _ in range(len(string))] for _ in range(len(string))] res = '' ml = 0 for i in range(len(string)): dp[i][i] = 1 ml = 1 res = string[i] ...
true
6a2965b4e5e9a2fd034d9d10479e7a62408a77b0
Python
ka9594/GUVI_codekata
/H_S2_11.py
UTF-8
120
2.9375
3
[]
no_license
n = input() #x = set(map(int,input().split())) x = n.split(' ') for i in range(len(x)): print(x[i][::-1],end=" ")
true
42b09381df3df7ac911acf7d95983cb3bdbc5a98
Python
Hyunjong1461/python
/200215/한수.py
UTF-8
400
3.03125
3
[]
no_license
def 한수 (a): cnt=0 for i in range(1,a+1): str1=str(i) arr=[] for j in range(len(str1)): arr.append(int(str1[j])) if len(arr)<=2: cnt+=1 elif len(arr)==3: for k in range(len(str1)-2): if arr[k]-arr[k+1]==arr[k+1]-arr[k+2]:...
true
54683e2fd3e8eadde2b106d180d092854a050de6
Python
gauravaror/programming
/numDecodings.py
UTF-8
920
2.90625
3
[]
no_license
class Solution: def numDecodings(self, s: str) -> int: self.ans = 0 self.cache = {} def back(st): if len(st) == 0: self.ans += 1 self.cache[st] = 1 return 1 ans = 0 if st[0] != "0": if st[1:] ...
true
16acb04afcdbdbac8a04f0139d3fdd9ed9481b87
Python
MathisBurger/adventofcode-solutions
/day1/part2/main.py
UTF-8
508
3.390625
3
[]
no_license
def getArrayFromFile(): with open('array2.txt', 'r', encoding='utf-8') as file: raw = file.read() return raw.split('\n') def calculate(number_array): for i in number_array: for x in number_array: for y in number_array: if (int(i) + int(x) + int(y)) == 2020: ...
true
b42480879b0bcc295f9ad455542187644ee8ed30
Python
nsudhanva/mca-code
/Sem3/Python/functions/comprehension.py
UTF-8
462
4.0625
4
[ "MIT" ]
permissive
x = [1,2,3,4,5,6,7,8] y = 'YOUWOTM8' even = lambda x: x % 2 == 0 square = lambda x: x ** 2 print([square(i) for i in filter(even, x)]) # given alist of number create a new list which conntains number multiploes by 3 + 2 print([(i * 3) + 2 for i in x]) # create a list of lower chars given upper print([i.lower() for i...
true
6f2ae35bc14eaa9226f82dccc362a0a49623eed5
Python
davidcorne/Project_Euler
/problem359.py
UTF-8
235
2.640625
3
[]
no_license
#!/usr/bin/env python # Written by: DGC import time t_start = time.time() print("RUNNING PROBLEM XXX") print("\n") def room(floor, room): person = 0 return person print("run time:"), print(str(time.time()-t_start))
true
9bf907a854059a18db1f45aaf7afde4014c43a87
Python
gopiprasad008/GUVI_CODEKATA_PYTHON_CODE
/minimum number of characters to be inserted to convert it to palindrome.py
UTF-8
67
2.828125
3
[]
no_license
import random s = str(input()) print(random.choice([len(s)-1, 0]))
true
31c9d8fecc7fd1feceb32f5ed726cb772a0c3f7a
Python
shengrihui/tianchi
/test/05BackPropagetion_02.py
UTF-8
1,326
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jun 2 18:52:29 2021 @author: 11200 """ import torch import matplotlib.pyplot as plt def forward(x): return w1*x*x+w2*x+b def loss(x,y): y_pred=forward(x) return (y_pred-y)**2 x_data=[1.0,2.0,3.0] y_data=[2.0,4.0,6.0] w1=torch.tensor([10.0]) w1.requires_grad...
true
3a00dee3df2a685185e78340420fc9292bb9fe59
Python
BaronAlina/Python_topic1-2-3-branching
/prob.py
UTF-8
66
2.84375
3
[]
no_license
a=int(input()) h=a%86400//3600 m=a%3600//60 s=a%60 print(h, m, s)
true
2d70bce7158e0a3015f7d7fe7f5cda99b5ec991b
Python
Vizanth/projects
/nested loop2.py
UTF-8
129
3.375
3
[]
no_license
print("Hello",end="") print(" World") for i in range(5): for j in range (5): print(j,end="") print()
true
859674c1946f751f944d2ae3576f2d94457b0347
Python
mrmundt/pyomo
/pyomo/contrib/cp/tests/test_step_function_expressions.py
UTF-8
19,693
2.65625
3
[ "BSD-3-Clause" ]
permissive
# ___________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2022 # National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and # Engineering Solutions of ...
true
f574783eb5f2b5a8505e37eecc9ee31c8df5487f
Python
Arindam26/Python_Practice_scripting
/fibonacci_lambda.py
UTF-8
620
4.46875
4
[]
no_license
"""Fibonacci series with lambda """ # from functools import reduce # # # fib_series = lambda n: reduce(lambda x, _: x + [x[-1] + x[-2]], range(n - 2), [0, 1]) # fib_series = lambda n: reduce(lambda x, _: x + [x[-1] + x[-2]], range(n - 2), [0, 1]) # # for i in range(20): # print("Fibonacci series upto {}".format(i)...
true
eea4c426675f1d90a7d70e2429e4fbc8a9dc3b0d
Python
Aasthaengg/IBMdataset
/Python_codes/p03723/s824229232.py
UTF-8
1,004
3.0625
3
[]
no_license
#!/usr/bin/env python3 import sys def solve(A: int, B: int, C: int): ans = 0 s = set() while True: if A % 2 == 1 or B % 2 == 1 or C % 2 == 1: print(ans) break newA = B / 2 + C / 2 newB = A / 2 + C / 2 newC = A / 2 + B / 2 A = newA ...
true
21d2de5719fafd94605f31bc07231644f4be18c5
Python
anatolio-deb/vpnmupd
/tests/test_module01.py
UTF-8
1,240
2.90625
3
[]
no_license
from datetime import datetime from unittest import TestCase from vpnmupd import versions class TestClass01(TestCase): """Software dependency versions compared""" def setUp(self) -> None: super().setUp() self.any_string = "Some string containing v1.1.1" def test_case01(self): """...
true
9cfc919153b3986291a994b75ccdb44f89a0b1fe
Python
crphub2/madness
/guessgame.py
UTF-8
499
3.8125
4
[]
no_license
import random print("guess any number between 0-20") x=random.randint(0,20) z='yes' print(x) while 'true': print("if output is less than guess type'l'or grater type'g' or found type anything") le=str(input()) if le=='l': y=random.randint(0,x) print(y) x=y elif le==...
true
edd7b04420048a57a97972a2166e4024ea4d8b44
Python
PJK-me/online-menu
/menus/models.py
UTF-8
997
2.625
3
[]
no_license
from django.db import models class Menu(models.Model): """ Menu Model """ name = models.CharField(max_length=55, unique=True) description = models.TextField(max_length=255) created_date = models.DateField(auto_now_add=True) updated_date = models.DateField(auto_now=True) def __str...
true
c66d31cbfb0a65a9278653b1f95c41181b0120eb
Python
Jenionthenet/Week-2
/Day-1/table_class.py
UTF-8
728
3.3125
3
[]
no_license
class Table: def _init_(self): self.height = 0.0 self.shape = "" self.width = 0.0 self.material = "" self.color = "" self.function = "" # height and width are in feet table = Table() table.height = 1 table.shape = "oval" table.width = 2 table.material...
true
5eda1fb41efdc3b54114f0b7b0e20bcb0556aacd
Python
emmabehr/Python-mini-projects
/Day 10 - Magic 8 Ball/eightball.py
UTF-8
805
3.65625
4
[]
no_license
# Ask Magic 8 Ball questions and let it answer import random questions = {} answers = ['It is certain', 'It is decidedly so', 'Without a doubt', 'Yes, definitely', 'You may rely on it', 'As I see it, yes', 'Most likely', 'Outlook good', 'Signs point to yes', 'Yes', 'Reply hazy, try again', 'Ask again later', 'Bette...
true
8b7a0eed80e819d765c3a5bb9fc370c14879eff8
Python
naswfd/sysadmin
/bmi_function
UTF-8
797
3.515625
4
[]
no_license
#!/usr/bin/env python3.6 def gather_info(): height = float(input("What is your height ? (inches or meters)")) weight = float(input("What is your weight ? (pounds or kilograms)")) system = input("measurements in metric or imperial ?").lower().strip() return (height, weight, system) def calculate_bmi(height, we...
true
574a5ddd2a4fbf686f56ed51f3a9eac6a75d90d8
Python
shibakid/what_is_my_number_game
/m_game.py
UTF-8
2,381
3.09375
3
[]
no_license
m=[] n=[] for i in range(0,10000): m.append(str(i)) for i in m: n.append(list(i)) for i in n: while len(i)!=4: i.insert(0,'0') posib=n def test(sol,tester): sol_1=sol[:] test_1=tester[:] corr_all_num=0 while test_1: j=test_1.pop() for i in sol_1: if j==i: corr_all_num+=1 ...
true
b03df0a4c8bb77887de2971d2874eb052439ddee
Python
charliedmiller/coding_challenges
/can_place_flowers.py
UTF-8
1,687
3.859375
4
[]
no_license
# Charlie Miller # Leetcode - 605. Can Place Flowers # https://leetcode.com/problems/can-place-flowers/ # Written 2020-12-05 """ Greedily place flowers whenever you can. Not placing when you can flowers will always result in punishment Iterate over the flowerbed, keep track of the remaining flowers. Decrement remainin...
true
b28528e74e31c26e829d033af43b193b7ce01787
Python
rogandz/HdT5
/simulacion.py
UTF-8
1,239
3.25
3
[]
no_license
import random import simpy semilla = 42 # semilla para la generacion de randoms totalProcesos = 25 # procesos que se deben realizar para terminar la simulacion intervaloProcesos = 10.0 # intervalo en que se generar los procesos def generarProcesos(env, number, interval, memory, resource): # parametros: enviroment; nu...
true
89690daeb425afb3554b3f094eab743097b52d5a
Python
jidhu/code
/Python/arith.py
UTF-8
447
3.625
4
[]
no_license
import cs50 print("x is ", end="") x=cs50.get_int() print("y is ", end="") y=cs50.get_int() print("{} plus {} is {}".format(x,y,x+y)) print("{} minus {} is {}".format(x,y,x-y)) print("{} time {} is {}".format(x,y,x*y)) print("{} divided by {} is {}".format(x,y,x/y)) print("{} divided by {} is {:.55f}".format(x,y,x/y...
true
94d8caa41d75c2b8f79c170d07b89600921246b0
Python
vendanner/tensorflow-example
/CV/dogsOrCat/VGG16/VGG16app3.py
UTF-8
2,123
2.625
3
[]
no_license
""" 训练时也要去计算卷积基,要用 GPU 计算,CPU 计算力不够 """ import os from keras.preprocessing.image import ImageDataGenerator from keras import optimizers from keras import models from keras import layers from keras.applications import VGG16 base_dir = '../dataSet/cats_and_dogs_small' train_dir = os.path.join(base_dir, 'train') validat...
true
0935ce6787f8bf5ac74cecf6520226ecc8d01996
Python
hamdimuzakkiy/firedetection
/code/classification.py
UTF-8
2,190
2.578125
3
[]
no_license
__author__ = 'hamdiahmadi' import scipy from sklearn import svm import excel import numpy as np import copy def readDataSet(file): data,classes = excel.readDataSet(file) return data, classes def getClassifier(datatraining, kernels, error): x,y = readDataSet(datatraining) # clf = svm.SVC(kernel = kern...
true
650a2d13f7ead3ccd6d51cff9cbd1969ed3494e6
Python
tomasd/application-event-logger
/eventloggertests.py
UTF-8
1,683
2.625
3
[]
no_license
import unittest import sqlalchemy as sa import sqlalchemy.orm as orm import eventlogger from sqlalchemy.ext.declarative import declarative_base Model = declarative_base() class MyEvent(eventlogger.EventObject, Model): __tablename__ = 'myevent' param = sa.Column(sa.String(255)) class EventLoggerTest(unitte...
true
5e21a8586c65761e979342be311bee44bfd71c9b
Python
Omarabdul3ziz/CodeSteps-3.0
/nestedloops/02_pyramid.py
UTF-8
500
3.484375
3
[]
no_license
# ##1 # print("#", end="") # print("#", end="") # print("#", end="") # print("#", end="") # ## 2 # for j in range(5): # print("#", end="") # print(" ") # for j in range(5): # print("#", end="") # print(" ") # for j in range(5): # print("#", end="") # print(" ") for i in range(5): # i = rows for j i...
true
af6fffeed4c8ae7f9183cb3486afe27fc07fa27b
Python
BayanbaevIlyas/Lesson1
/Lesson2/Lesson3/bot/mybot.py
UTF-8
1,118
2.5625
3
[]
no_license
#Это бот, который работает со списком учениковфывыфв import telebot import list3 token = '462539917:AAFdizUx-8GpepdUfNfhwKsv4g3d4n2j3M4' bot = telebot.TeleBot(token) @bot.message_handler(content_types = ['text']) def check_message(message): if message.text == 'список студентов': for student in l...
true
f262b225a1d797960b03825ecbcd92130d419240
Python
JsFlo/SharedCapsNet
/test.py
UTF-8
4,058
2.53125
3
[]
no_license
import tensorflow as tf import numpy as np from Model import Model import argparse from tensorflow.examples.tutorials.mnist import input_data from utils import create_dirs_if_not_exists MNIST = input_data.read_data_sets("/tmp/data/") parser = argparse.ArgumentParser() # REQUIRED parser.add_argument('--checkpoint_dir'...
true
93a13f6ca2a66c13faca19fb94a8980230b57cee
Python
GhostofAdam/RLtree
/controller.py
UTF-8
13,692
2.515625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from simpleDT import * from data import * import math import graphviz from progressbar import * # hyperparameters # for decision tree min_impurity_split = 0.0 # for reward calculation k = 0.9 record_num = 20 class Config(): def __init__(self, option_size=None...
true
4994d429c3709c68a6765c7877b106c4c2b71dd4
Python
JayMackay/PythonCodingFundamentals
/[Session 1] Basic Syntax & String Manipulation/[2] If Statements/07 random_number2.py
UTF-8
335
4.375
4
[]
no_license
import random user_name = input("Hello! What is your name?") number = random.randint(1, 10) print(f"Well, {user_name}, I am thinking of a number between 1 and 10.") guess = int(input("Take a guess: ")) if guess == number: print(f"Good job, {user_name}! You guessed my number.") else: print("Wrong, better luc...
true
c7fb6eace28d58d84443d8b8268fc5338476dc43
Python
kbsezginel/nanocar-misc
/molecules/surface-diffusion/initialize/molecule_on_metal_slab.py
UTF-8
4,042
2.734375
3
[ "MIT" ]
permissive
""" Place given molecules on a metal slab parallel to xy-plane. Molecule information is read from molecules.yaml and surface nformation is read from surfaces.yaml. - A metal slab is generated parallel to xy-plane acoording to info given in surfaces.yaml. - The molecule is aligned to xy-plane by two given vectors. - The...
true
da4017fe38c187a91ad40a817596aee839f8b370
Python
murbard/multinomial
/multinomial/__init__.py
UTF-8
3,042
3.859375
4
[ "MIT" ]
permissive
from random import randint # Return n chooses k, can (and should be) cached def binomial(n, k): """ Computes n chooses k :param n: number of items to choose from :param k: number of items chosen :return: n chooses k """ if 2 * k > n: return binomial(n, n - k) if k < 0 or k > n:...
true
621b35d5fbe728db50d6593274e06c29a73ba97d
Python
basil1408/EE5644_Exam_2
/Q2.py
UTF-8
4,656
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Nov 22 12:37:26 2019 @author: Basil """ import numpy as np import pandas as pd import matplotlib.pyplot as plt data_train = np.loadtxt('Q2train.csv',delimiter=',') data_test = np.loadtxt('Q2test.csv',delimiter=',') plt.plot(data_train[:,1],data_train[:,2],'.',m...
true
a08f794501113404a5cf1c0af2da8d49be6741ea
Python
ShijiZ/Python_Learning
/Crossin/Crossin37.py
UTF-8
221
2.8125
3
[]
no_license
score = { 'Xiaofeng': 95, 'Duanyu': 97, 'Xuzhu': 89 } print score['Duanyu'] print score for name in score: print score[name] score['Xuzhu'] = 91 score['Murongfu'] = 88 del score['Xiaofeng'] print score
true
1657b472c0d1614f4346ff5c23e4329016a108ac
Python
wirelessjeano/py4kids
/lesson-16-gui/dash/dash-06_core_components.py
UTF-8
7,018
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- import dash import dash_core_components as dcc import dash_html_components as html import dash_table import plotly.graph_objs as go from datetime import datetime as dt import pandas as pd df_solar = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv') external_st...
true
08bc54e6fa8244ea7503d5bd15b7c1af99cf6e57
Python
nguyengiapphuongduy/ppl-181
/Week 7 AST/q2/src/test/ASTGenSuite.py
UTF-8
965
3.078125
3
[]
no_license
import unittest from TestUtils import TestAST from AST import * class ASTGenSuite(unittest.TestCase): def test_simple_declaration(self): """Simple program: int a,b """ input = """int a;""" expect = str(Program([VarDecl(Id("a"),IntType())])) self.assertTrue(TestAST.test(input,expect,...
true
39a53ea9eb811934225f55255fc3631d824cf265
Python
DonaldWhyte/fileprocessor
/fileprocessor/filterers.py
UTF-8
4,255
3.15625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""Contains all built-in Filterer classes.""" import collections import fnmatch import os from fileprocessor.abstracts import Filterer class ExcludeListFilterer(Filterer): """Filterer which filters files based on glob patterns.""" def __init__(self, excludeList): """Construct instance of Exclude...
true
34da046bd16af965e4b22c94a7de690efc4df4c2
Python
Python2Game/Chicken_invaders
/chicken_invaders.py
UTF-8
2,408
2.859375
3
[]
no_license
import pygame import sys import time import random from settings import Settings from me import Ship from button import Button from button import Game_Over import game_functions as gf from pygame.sprite import Group from game_stats import GameStats from scoreboard import Scoreboard from scoreboard import Quit_State ...
true
62c0a67710fbdc8a1fd65a2430beb02525a0d112
Python
remorsecs/FoolNLTK
/fool/dictionary.py
UTF-8
1,146
3.046875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*-coding:utf-8-*- from fool import trie class Dictionary(): def __init__(self): self.trie = trie.Trie() self.weights = {} self.sizes = 0 def delete_dict(self): self.trie = trie.Trie() self.weights = {} self.sizes = 0 def add_dict(...
true
606601041eeae281aa0edac8f850681b710109a4
Python
Dinghow/OS_Homework
/hw_2_memory_management/page_replacement.py
UTF-8
3,433
3.25
3
[]
no_license
import random # Block class class Block: def __init__(self,time): # page of this block self.page = -1 # Accessed or not self.accessed = False # Record the access order self.time = time # Create a stimulator class class Simulator: def __init__(self): # C...
true
b29971b42eb8eea150d1635be5ef8be1a7218776
Python
emilydolson/avida-spatial-tools
/dev/environment_generator.py
UTF-8
10,874
2.859375
3
[ "MIT" ]
permissive
#!/usr/bin/python #WORK IN PROGRESS - do not use! #This program allows you to automatically generate environment files with #complex spatial resource layouts import argparse import random from math import sqrt, log, floor, ceil from avidaspatial import * def get_args(cli=[]): parser = argparse.ArgumentParser(de...
true
8bed71c11dc7a18a95cd923e3d2de30a903ab9a4
Python
JeroMe9496/support
/PYTHON/10.Seba-Apps/graphics/operator_calc/operatus.py
UTF-8
1,955
3.734375
4
[ "MIT" ]
permissive
# IMPORTS # ----------------------------------------- import tkinter as tk import random # THE WINDOW OBJECT # ----------------------------------------- win = tk.Tk() # Position and size of the window X x Y + W + H # win.geometry(f"400x420+760+330") # Prevents window resizing (if you want) # win.resizable(False, F...
true
c3b280af7fab39c48ddd7030e3138566780f03b0
Python
Cermo/Python-Mini-Progs
/LoanVSSaving.py
UTF-8
3,200
3.265625
3
[]
no_license
import pylab class CreditShoper(object): def __init__(self, account_balance, interest_rate, price, repay, period): self.account_balance = account_balance self.interest_rate = interest_rate self.price = price self.repay = repay self.period = period self.itemsBought =...
true
49f38789bf939b9a099a0b904e7bc3e50b775c3d
Python
loganwong/boggle
/game.py
UTF-8
4,386
3.015625
3
[]
no_license
from random import randint, shuffle from arrayutils import arrayContent,arrayCopy import BinarySearch as bs DICE = [ ['a','a','e','e','g','n'], ['a','b','b','j','o','o'], ['a','c','h','o','p','s'], ['a','f','f','k','p','s'], ['a','o','o','t','t','w'], ['c','i','m','o','t','u'], ['d','e','i',...
true
bf0b8054783bdb675ef60a6ce20c12e6666434fc
Python
PedroG-8/Secure-domino
/secure-domino/smartcards/cc_functs.py
UTF-8
5,315
2.59375
3
[]
no_license
import sys import PyKCS11 as pk import PyKCS11.LowLevel as pkll from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.serialization import load_der_public_key from cryptography.hazmat.primitives.asymmetric import ( padding, rsa...
true
d3d9db774eaf061d7c9aabaccb6be51de35066a3
Python
phatboyle/programs
/graphics/bounceWithGameClass.py
UTF-8
4,366
3.125
3
[]
no_license
import pygame import random import math import os class Game(object): def __init__(self): #initializer, sets up pygame, window and tools pygame.init() self.screenHeight=600 self.screenWidth=600 self.blue=(0,0,255) self.red=(255,0,0) self.black=(0,0,0) self.cl...
true
f3deb3adf0011c251c40b705d0db2af6d3f51b1d
Python
nickovic/rtamt
/rtamt/semantics/abstract_interpreter.py
UTF-8
533
2.59375
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Sep 23 2019 @author: Dejan Nickovic """ from abc import ABCMeta from rtamt.exception.exception import RTAMTException class AbstractInterpreter(object): """ Abstract Operation: template for any monitoring operation """ __metaclass__ = ABCMeta NOT_IMPLEMEN...
true
dc56e57712b409a83b4fef4c367a24f9dab464d0
Python
NAD777/Game-pygame
/game.py
UTF-8
40,499
2.609375
3
[]
no_license
import pygame as pg import json import os from math import ceil from copy import copy from sys import argv from time import time DEBUG = 0 horizontal_borders = pg.sprite.Group() vertical_borders = pg.sprite.Group() all_sprites = pg.sprite.Group() player_group = pg.sprite.Group() border_group = pg.sprite.Group() enem...
true
b02088ad5000f068c18a5f9f4a2327ef31188bc8
Python
Janbolotnr/ch2part1-task7
/decision7.py
UTF-8
159
3.921875
4
[]
no_license
x = int(input("Enter number: ")) if x > 0: print(x, "is positive") elif x == 0: print(x, "is ZERO") else: print(x, "is negative")
true
b92e6669d39aeb6afbd5b31b4a03279bfa970057
Python
compunutter/script-compare
/public/usercontent/602cb45e-1e38-4f3b-8b7d-0f571e98ee2a/Simon_BannerProgram.py
UTF-8
331
2.921875
3
[]
no_license
banner_input = "TJ | Christopher Thompson III" place = banner_input.find("|") first, second = banner_input[0:place-1], banner_input[place+2:] first_s, second_s = "*"*(len(first)+4), "*"*(len(second)+4) constructed = "{} {}".format(first_s, second_s) print("{}\n* {} * * {} *\n{}".format(constructed, f...
true
d882ae262bcbd187577208d622e9494f3ef53a5e
Python
mveselov/CodeWars
/tests/kyu_7_tests/test_replace_all_items.py
UTF-8
602
3.3125
3
[ "MIT" ]
permissive
import unittest from katas.kyu_7.replace_all_items import replace_all class ReplaceAllTestCase(unittest.TestCase): def test_equal_1(self): self.assertEqual(replace_all([], 1, 2), []) def test_equal_2(self): self.assertEqual(replace_all([1, 2, 2], 1, 2), [2, 2, 2]) def test_equal_3(self)...
true
8d7d8d16edcdb37787be6cd52902f032e3ecdd76
Python
davenquinn/figurator
/figurator/captions.py
UTF-8
1,813
2.8125
3
[]
no_license
from __future__ import print_function from os import path from re import compile from click import echo def parse_markdown(fobj): """ Parse captions to a dict generator """ key = None val = "" for line in fobj: if line.startswith("##"): if key is not None: yi...
true
c6fda1c9eb3a57ab9197b57eff03fe89541d2118
Python
ehsu0407/set-game
/card.py
UTF-8
1,147
3.84375
4
[]
no_license
__author__ = 'Eddie' S_COLOR = ["red", "green", "purple"] S_SHAPE = ["diamond", "squiggle", "oval"] S_SHADING = ["solid", "empty", "striped"] S_NUMBER = ["one", "two", "three"] class Card: """ This class contains all the information for a card. """ def __init__(self, color, shape, shading, number): ...
true
9a0d57e6d2766d5114d9c594c93f2a8d89fae1d4
Python
Shanyao-HEU/PTA-PAT
/pat-b/1055.py
UTF-8
947
2.796875
3
[]
no_license
N, K = [int(i) for i in input().split()] num_every = N // K stu_hei = {} for i in range(N): stu, hei = input().split() stu_hei[stu] = int(hei) def sortRule1(x): stu = x[0] hei = x[1] return hei, -ord(stu[0]), -ord(stu[1]), -ord(stu[2]) sort_stu_hei = sorted(stu_hei.items(), key=sortRule...
true
a971fb32ce35dcf43da353d3253ef1199c243209
Python
6igsm0ke/Introduction-to-Programming-Using-Python-Liang-1st-edtion
/CH05/EX5.55.py
UTF-8
870
4.1875
4
[]
no_license
# 5.55 (Turtle: chessboard) Write a program to draw a chessboard, as shown in # Figure 5.6b. import turtle turtle.speed(0) turtle.penup() turtle.goto(-150, 120) turtle.left(45) turtle.pendown() black = False for i in range(1, 9): for j in range(1, 9): turtle.begin_fill() turtle.circle(30, steps=4) ...
true
c4674b4169d8c0f0743a93581aadc8401c349bc8
Python
SabiulSabit/Socket-Programming
/TermProject/011171220_webserver.py
UTF-8
1,439
2.921875
3
[]
no_license
# import socket module from socket import * serverSocket = socket(AF_INET, SOCK_STREAM) # Prepare a sever socket # Fill in start host = '127.0.0.1' port = 4444 # for https print('Ready to serve...') serverSocket.bind((host, port)) serverSocket.listen(5) # Sets socket to listening state with a queue ...
true
39311b8d3573ec002715f60cfdb6100332ba41a3
Python
MuhamedHekal/Data-Analysis-Professional-Udacity
/US Bike Share/bikeshare.py
UTF-8
6,608
3.96875
4
[]
no_license
import time import pandas as pd CITY_DATA = { 'ch': 'chicago.csv', 'ny': 'new_york_city.csv', 'w': 'washington.csv' } def get_filters(): """ Asks user to specify a city, month, and day to analyze. Returns: (str) city - name of the city to analyze (str) mon...
true
e9f20b5dff353bab795160b89bf173414493025f
Python
JuniorMSG/python_study
/study_project/deep_learning/ppp.py
UTF-8
3,709
2.84375
3
[]
no_license
import os import cv2 from glob import glob import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers (train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data() train_labels = train_labels[:1000] tes...
true
212c35345a952b8033d9fe02681e9027d5f4953d
Python
copenlu/check-worthiness-pu-learning
/nn.py
UTF-8
3,875
2.765625
3
[]
no_license
import torch import numpy as np from torch import nn class NonNegativePULoss(nn.Module): def __init__(self, prior: float, beta: float = 0., gamma: float = 1.0): """Non-Negative positive unlabelled risk estimator. This code is highly adapted from https://github.com/kiryor/nnPUlearning/blob/master/...
true
de845884e253cde7bc5301bf9a026eb51ad33e06
Python
jdahm/pyxflow
/pyxflow/DataSet.py
UTF-8
19,177
3.1875
3
[]
no_license
""" File to interface with XFlow *xf_DataSet* objects in various forms The *DataSet* module contains the primary interface for XFlow's *xf_DataSet* structs, which contain information on XFlow solutions. This includes the state, which is the traditional type of CFD solution; the adjoint; and many other things. Two ve...
true
c7028ebf8003929f7ed9773320f77035031a1528
Python
ykang/tools-for-data-science-course
/2021年春天/2020310844/home_work.py
UTF-8
340
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed May 26 20:44:48 2021 @author: Always """ import jieba sentence = '我爱自然语言处理' # 创建【Tokenizer.cut 生成器】对象 generator = jieba.cut(sentence) # 遍历生成器,打印分词结果 words = '/'.join(generator) print(words) 我/爱/自然语言/处理
true
d2b5e3acae5c7ca8e8dcdc6caf07e802a2932239
Python
praveena2j/Face-Recognition
/facedetect/utils.py
UTF-8
523
3.25
3
[]
no_license
# Common Utility functions for face detection library import os # Creates a directory if it doen't exists def createDir(aDirPath): # If directory does not exist create it if not os.path.exists(aDirPath): os.makedirs(aDirPath) # Deletes a file if it exists def deleteFile(aFile): try: os.rem...
true
96c9dbdab45818e74714b5e2b2c49f60b0c09bb3
Python
arthurbarton/pykrotik
/app/pykrotik.py
UTF-8
3,731
2.515625
3
[]
no_license
#!/usr/bin/env python3 """Backup a list of mikrotiks""" import os import sys from os import path from datetime import datetime, timedelta, date import argparse import logging import paramiko import yaml def _do_paramiko_exec(pclient: paramiko.SSHClient, cmd: str) -> tuple(): """Perform the exec on the P client - ...
true
0e737808fc06b3aabdcc3e35d51e04ce7eb90281
Python
Mardoqueu-Pimentel/P2019.1_PAA_SEM1
/src/p20191_paa_sem1/graph.py
UTF-8
4,384
2.9375
3
[ "MIT" ]
permissive
from collections import defaultdict from dataclasses import dataclass from itertools import product from typing import Dict, List, Set, TypeVar import networkx as nx import numpy as np T1 = TypeVar('T1') T2 = TypeVar('T2') def reverseDict(d: Dict[T1, T2]) -> Dict[T2, Set[T1]]: newDict = {} for k, v in d.items(): ...
true
e709d7fae89b8608b7aeb87e2343b106a23bc306
Python
linlufeng/LufengLearnPython
/PycharmProjects/lession8/hello3.py
UTF-8
1,237
3.921875
4
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*- # Python 异常处理 ''' 使用except而不带任何异常类型 你可以不带任何异常类型使用except,如下实例: try: 正常的操作 ...................... except: 发生异常,执行这块代码 ...................... else: 如果没有异常执行这块代码 以上方式try-except语句捕获所有发生的异常。但这不是一个很好的方式,我们不能通过该程序识别出具体的异常信息。因为它捕获所有的异常。 ''' ''' 使用except而带多种异常类型 你也可以使用...
true
1f35ccd377bf223c1d6ec67cb415e98e6f010ca8
Python
SU-NCS/yesler_python
/src/challengesold/__init__.py
UTF-8
483
4.03125
4
[]
no_license
import random def challenge_1(): guess = None num = random.randint(1,10) for i in range(10): guess = input("Give me a number between 1 and 10") guess = int(guess) if guess == num: return True elif guess < num: print...
true
7752f5477e62db0fe4239bd7bab1b49a66524778
Python
dfsbora/ct213
/lab2/path_planner.py
UTF-8
6,472
3.828125
4
[]
no_license
from grid import Node, NodeGrid from math import inf import heapq class PathPlanner(object): """ Represents a path planner, which may use Dijkstra, Greedy Search or A* to plan a path. """ def __init__(self, cost_map): """ Creates a new path planner for a given cost map. :param...
true
6e5cf13888502c45cdf81a9af6bccb30d4fb9ae5
Python
MuLx10/Broly
/Social/RedditScrapper.py
UTF-8
1,687
2.71875
3
[ "MIT" ]
permissive
import praw import config import random class RedditScrapper(object): """docstring for RedditScrapper""" def __init__(self): super(RedditScrapper, self).__init__() self.reddit = praw.Reddit(client_id = config.REDDIT_API_CLIENT_ID, client_secret = config.REDDIT_API_CLI...
true
7682ce827cef19cfd3d176a705f73539b233d2db
Python
Townjj/Machine-Learning
/Chapter_4/book_431.py
UTF-8
9,283
3.015625
3
[]
no_license
import numpy as np import math import copy def entro(D): ''' 计算信息熵 输入:数据集D 输出:数据集D的信息熵 ''' a_num = 0 b_num = 0 a = 0 b = 0 result = 0 for item in D: if item[-1] == '好瓜': a_num += 1 if item[-1] == '坏瓜': b_num += 1 a = a_num/len(D) b = b_num/len(D) ...
true
abd4817c3018522c9c99a9df5691f5dc1dd056cc
Python
agabedn/zadania_domowe_python
/zad_1.3.py
UTF-8
1,181
3.75
4
[]
no_license
""" Napisz trzy programy, które dla podanych liczb: wzrostu w cm i masy ciała w kg obliczą i wypiszą współczynnik BMI, oraz podsumowanie informujące o stanie/zaleceniach. (Informacje o BMI: wzór, interpretację wyników, proszę znaleźć samodzielnie). Programy mają różnić się sposobem interakcji z użytkownikiem. """ # BMI...
true
d0d41085d8d2bb47151ef4fed4533fa62ecfd116
Python
sixfunctors/SUMRY2016
/SCM/UnusedCode.py
UTF-8
6,154
2.890625
3
[]
no_license
### NO LONGER NEEDED ### ## Defines a weighting on a complex class WeightedComplex(dict): def __init__(self, comp, wlist): self.deg = comp.deg i = 0 for simp in comp: if (len(wlist) <= i): print("Invalid Weighting!") break self[simp] ...
true
4a3c5f51b51d3f2aa6da29f9a0961344b9c38d0c
Python
kamaluddin-babar/py4e
/ex_04_02.py
UTF-8
369
3.796875
4
[]
no_license
def computepay(h,r): if h > 40: temp1 = 40.0*r temp2 = (h-40.0)*r*1.5 pay = temp1 + temp2 else: pay = h*r return pay hours = input("Enter Hours:") rate = input("Enter Rate:") try : h = float(hours) r = float(rate) except: print("Error, please enter numeric input...
true
aabca5398a4dd69731a62754972a30204b87b987
Python
meghdeepj/patrol_rl
/prac_code/car_env.py
UTF-8
411
3.234375
3
[]
no_license
#OpenAI Gym basics #Create Environment for cart-pole import gym import time env = gym.make('CartPole-v0') env.reset() for i in range(1000): env.render() env.step(env.action_space.sample()) time.sleep(.02) env.close() """ import gym env = gym.make('CartPole-v0') env.reset() for _ in range(1000): env.render() ...
true
65124f92d28fab2c5b4b291f43a5f66a496705a5
Python
sinamoqadam/GeneticAlgorithm-8Queen
/main.py
UTF-8
1,290
3.875
4
[ "MIT" ]
permissive
# Application of genetic algorithm on 8queen problem from geneticAlgorithm import initializeRandomPopulation, crossover, mutation, sortPopulation, countThreat from queenBoard import printBoard populationSize = 20 # Number of chromosomes chromosomeSize = 9 # Number of queens (genes in each chromosome) iterations = 100...
true
b6f221560a5fc3193465da8468a6bbe914961832
Python
reviewboard/reviewboard
/reviewboard/admin/validation.py
UTF-8
1,554
2.96875
3
[ "MIT" ]
permissive
from django.core.exceptions import ValidationError from django.utils.translation import gettext as _ def validate_bug_tracker(input_url): """Validate a bug tracker URL. This checks that the given URL string contains one (and only one) `%s` Python format specification type (no other types are supported). ...
true
e103cdb58c1c064c0e96d1304bf716020759feb8
Python
poyrazb/thomson-problem
/thomson_problem.py
UTF-8
1,188
3
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Apr 6 09:44:02 2020 @author: souzam """ import tensorflow as tf import numpy as np import numpy.linalg as la import matplotlib.pyplot as pl from mpl_toolkits.mplot3d import Axes3D import time import os # Uncomment this to hide all the ugly status messages #...
true
d7134344b5cf2041809b3ee260ce54ddeb8aee9d
Python
GlintW/Intern.MT
/simple-tensorflow-demo/4.demos/5.lossTest.py
UTF-8
7,468
3.578125
4
[ "MIT" ]
permissive
""" 损失函数 loss 预测值(predict)(y)与已知答案(target)(y_)的差距 | -> 均方误差 MSE Mean Squared Error tf.reduce_mean(tf.square(y, y_)) loss最小 -> | -> 交叉熵 Cross Entropy tf.reduce_sum(tf.where(tf.greater(y, y_), if_true, if_false)) | -> 自定义 -tf.reduce_mean(y_ ...
true
6462913b76276254a2a86cfea3ab367525ffe039
Python
abrahampost/adventofcode
/day5/part2.py
UTF-8
682
3.828125
4
[]
no_license
def to_binary(letters, i): return i.replace(letters[0], "0").replace(letters[1], "1") with open("input.dat", "r") as file: highest = 0 seats = set() for line in file.readlines(): row = int(to_binary(("F", "B"), line[:7]), base=2) column = int(to_binary(("L", "R"), line[7:10]), base=2) ...
true
ab760ec03961385277e7396daf1b0e07414debf4
Python
msiplab/EicEngLabIV
/gauss_kmeans.py
UTF-8
5,685
3.078125
3
[ "MIT" ]
permissive
"""GaussianFeaturesWithKmenasモジュール Copyright (c) 2020, Shogo MURAMATSU, All rights reserved. """ import numpy as np import pandas as pd from sklearn.cluster import KMeans from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LinearRegression from sklearn.pipeline import make_pipeline f...
true
fd886af60e58fe5d9762d9e6259fa8fb0a0265ee
Python
petrokn/LocalizationTDOA
/src/client/microphone_proxy.py
UTF-8
1,814
2.796875
3
[ "MIT" ]
permissive
import logging import socket import time from cPickle import dumps class MicrophoneProxy: def __init__(self, server_address, server_port, id): self.__server_address = server_address self.__server_port = server_port self.id = id self.__message_check_len = 65535 - 28 - 36 sel...
true
d40be9db458b97173ae7ca036c0da8b48eca1250
Python
sean578/advent_of_code
/2015/14/14.py
UTF-8
1,002
3.421875
3
[]
no_license
input_data = open('input.txt', 'r') time = 2503 def get_data(line): the_data = {} line_as_list = line.strip('\n').strip('.').split(' ') the_data['speed'] = int(line_as_list[3]) the_data['go_time'] = int(line_as_list[6]) the_data['stop_time'] = int(line_as_list[13]) return the_data def calc_di...
true
aaaeb46df4c07cd9554d4e7445e5c899c37e810d
Python
ankitgoyalgithub/churn
/health_assessment/Lib/healthassessment.py
UTF-8
7,069
2.59375
3
[]
no_license
import pandas as pd import numpy as np import math import random import datetime as dt class HealthAssessment: def __init__( self, ID, target, churn_date, snapshot_date, target_window=8, metrics_col=[] ): self.use_case = "Gainsight" self.ID = ID self.target = target sel...
true
60a9bb0c093b9f9b556f8e0869caaa1ce64dcb11
Python
JohnGoure/python-crash-course
/Chapter-5/conditional-tests.py
UTF-8
468
3.546875
4
[]
no_license
pepperoni = 'pepperoni' sausage = 'sasauge' toppings = ["pepperoni", "sasauge", "supreme", "mushrooms"] print("Is pizza topping == 'pepperoni'? I predict True.") print(pepperoni == 'pepperoni') print(pepperoni == 'sasuage') if (len(toppings) > 3): print("There are a lot of toppings.") if (pepperoni in toppings a...
true
83623bbc230a790014987203d3d83d3c5b957524
Python
chisaipete/flow
/process_progression.py
UTF-8
2,480
2.59375
3
[]
no_license
#!/usr/bin/env python from notes import google_sheets import json from pprint import pprint from datetime import datetime def convert_to_date(timestamp): return str(datetime.utcfromtimestamp(int(timestamp)/1000).strftime('%m/%d/%Y')) def convert_to_lbs(kgs): # rounds results to .5 lb granularity (matches pla...
true
b399960880022f324fea470a02546406999cfc6f
Python
koonerts/algo
/py-algo/grokk-tci/top-k-elements.py
UTF-8
11,535
4.3125
4
[]
no_license
from heapq import * import math def find_k_largest_numbers(nums, k): min_heap = [] for num in nums: if len(min_heap) < k: heappush(min_heap, num) elif num > min_heap[0]: heappushpop(min_heap, num) return min_heap def find_Kth_smallest_number(nums, k): """ ...
true