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
7f166fc88eb1bdde3f58e6711e1b420d9070c498
Python
DenisFeoktistov/CasinoProject
/pythonProject/Состовляющие класса Casino/Interface.py
UTF-8
1,129
2.53125
3
[]
no_license
from RegistrationWindow import RegistrationWindow from CasinoWindow import CasinoWindow from LoginWindow import LoginWindow class Interface: def __init__(self): self.login_window = LoginWindow(self) self.registration_window = RegistrationWindow(self) self.casino_window = CasinoWindow(self)...
true
c698ea5dc43e2f61d1636ff3fbb8582ad966f97d
Python
3207-Rhims/100days-of-code-challenge
/codechef/sum.py
UTF-8
227
2.8125
3
[]
no_license
t=int(input()) for i in range(t): if 1<=t<=1000: line=input().split(" ") a,b=line a=int(a) b=int(b) sum=a+b if 0<=a<=10000 and 0<=a<=10000: print(sum)
true
8a8ca7923a0ec1a027a9e07e8ae42448ab94c105
Python
fredford/maze-generator
/src/maze.py
UTF-8
3,308
3.6875
4
[]
no_license
import random from src import cell RED = (255, 0, 0) BLUE = (0, 0, 255) WHITE = (255, 255, 255) class Maze: """Object used to represent a maze and the information needed to specify the dimensions, cells contained, start and finish. """ def __init__(self, size, scale): self.directions = {"above":(0...
true
d9f99e25b778b0bbca89c7c30fa998de65c9c1ac
Python
nswarner/poker
/hand.py
UTF-8
1,061
3.859375
4
[]
no_license
#!/usr/bin/python3 from card import Card from logger import Logger class Hand: hand = None def __init__(self, num_cards = 2): Logger.log("Hand: Creating a new hand with cards: " + str(num_cards)) self.hand = [] for i in range(0, num_cards): Logger.log("Hand: Calling add_c...
true
db0fc827e3e427abd38335ad0d1addf75aa5820d
Python
Kr0n0/tensorflow-metal-osx
/mnist.py
UTF-8
1,055
2.921875
3
[]
no_license
import tensorflow as tf from tensorflow import keras mnist = tf.keras.datasets.mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() y_train = y_train[:1000] y_test = y_test[:1000] x_train, x_test = x_train / 255.0, x_test / 255.0 x_train = x_train[:1000].reshape(-1, 28*28) x_test = x_test[:1000].reshape(-...
true
e0d7373dee703dc6a82273d0494fe8845fdac89f
Python
dejori/this-and-that
/NaiveBayes/bayes.py
UTF-8
5,220
3.25
3
[]
no_license
import sys, getopt import re import pickle from sets import Set from os import listdir from os.path import isfile, join class Bayes(object): def __init__(self, th=.9): self.tokens = {} self.pos_count = 0 self.neg_count = 0 def _train_token(self, token, pos): if token in self.t...
true
5a75b9d0d143945b0ce3c726977797b319ee538a
Python
lspence40/engineering4notebook
/python/LEDblinkPython.py
UTF-8
215
2.8125
3
[]
no_license
import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) pin = 4 GPIO.setup(pin, GPIO.OUT) sleep(1) for i in range(5): GPIO.output(pin, 1) sleep(.5) GPIO.output(pin, 0) sleep(.5) GPIO.cleanup()
true
5ddfc82dfe44aa966b9c0c01b1913a7b1343f525
Python
unknownboyy/GUVI
/code16.py
UTF-8
174
3.203125
3
[]
no_license
for _ in range(int(input())): n = int(input()) x = int((2*n)**0.5) if x*(x+1)//2==n: print('Go On Bob',x) else: print('Better Luck Next Time')
true
2630e21c0ae1861b8a642960c8297b0ebe5c1ce0
Python
domingoesteban/robolearn
/robolearn/torch/models/transitions/linear_regression.py
UTF-8
2,470
2.515625
3
[ "BSD-3-Clause" ]
permissive
import torch import torch.nn as nn from robolearn.torch.core import PyTorchModule from robolearn.utils.serializable import Serializable import robolearn.torch.utils.pytorch_util as ptu from robolearn.models import Transition from robolearn.torch.utils.ops.gauss_fit_joint_prior import gauss_fit_joint_prior class TVLGD...
true
16d97479b965679a0577708e215d05d34ac07311
Python
donzucchero/homework_week_2
/hw_week2_exc2.py
UTF-8
848
4
4
[]
no_license
def get_grades(): while True: try: grade = (int(input('Enter grade(2/3/4/5/6): '))) if grade in [2,3,4,5,6]: grades.append(grade) answer = input("Would you like to add another grade?(y/n): ") if answer == "n": b...
true
83c00da578e7bf8cc3d12c623f3f72f304ca4f5b
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_201/2167.py
UTF-8
1,014
3.546875
4
[]
no_license
def construct(n): right = 0 left = 0 if (n % 2 == 0): # even right, left = (n//2), max(0, (n//2 - 1)) else: right, left = (n//2), (n//2) return right, left def get_stall(n, m): if (n == m): return 0, 0 elif (m == 1): if (n % 2 == 0): # even return (n//2), max(0, (n//2 - 1)) else: # odd r...
true
f1b7429c6e376820133ce069e1bd9e04f74caa6e
Python
THUMNLab/AutoGL
/autogl/datasets/utils/conversion/_to_pyg_dataset.py
UTF-8
1,435
2.59375
3
[ "Apache-2.0" ]
permissive
import typing as _typing import torch import torch_geometric from autogl.data import Dataset, InMemoryDataset from autogl.data.graph import GeneralStaticGraph from autogl.data.graph.utils import conversion def to_pyg_dataset( dataset: _typing.Union[Dataset, _typing.Iterable[GeneralStaticGraph]] ) -> Dataset[t...
true
14321c1252e55e3b5f2ca03c6cc86c92da9f8795
Python
DeepikaSampangi/Addtnl
/minesweeper.py
UTF-8
553
3.359375
3
[]
no_license
def mine_sweeper(bombs , n_rows , n_cols): fields = [[0 for i in range (n_cols)] for j in range (n_rows)] for bomb_loc in bombs: (b_rows , b_cols) = bomb_loc fields[b_rows][b_cols] = -1 r_range = range (b_rows - 1 , b_rows + 2) c_range = range (b_cols - 1 , b_cols + 2) ...
true
8af62d2a3e958d39ecd1612dd211a6e71dbb5a35
Python
Krystiano8686/python_studia
/Zad_cw2/zad5.py
UTF-8
247
3.984375
4
[]
no_license
# ZAD5 a, b, c = input('Podaj 3 liczby: '), input(), input() a = float(a) b = float(b) c = float(c) if a <= 10 and a >= 0 and a > b and b > c: print("Wszystkie warunki zostały spełnione") else: print("Warunki nie zostały spełnione")
true
fcc68c10fe0694f29db5c638069f0a57d40cde9f
Python
Furricane/Camera
/on_motion_script.py
UTF-8
790
2.5625
3
[]
no_license
#!/usr/bin/python #!/usr/bin/env python import os, sys sys.path.append('/home/pi/PythonUtilities') import socketcomm os.chdir('/home/pi/Camera/') # Change working directory HostAddress = '192.168.1.92' HostPort = 44444 def notify_host(host_address, host_port, message): connectedstatus = False client, connec...
true
49a1e99006cdf9db11cde3e11626e18a44521700
Python
omazhary/dm-oscars
/OscarDataset/dataLoader.py
UTF-8
1,654
3.203125
3
[ "MIT" ]
permissive
import csv import numpy as np from sklearn import preprocessing # # converts a csv file to 2D array def csvToArray(filename): ret = [] with open(filename) as x: entryreader = csv.reader(x, delimiter=',') for row in entryreader: ret.append(row) return ret feat_train = csvToArray...
true
4166f89ca12e70242ed11f1f03ee78fbab1d371d
Python
kantmp/CAmodule
/getTick.py
UTF-8
1,716
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- ''' get the option tick 格式为 gettick tick.csv ''' import tables as tbl import os import tsData import pandas as pd import sys import getopt # __version__ = '0.1' baseurl = os.getcwd() def openHDFfile(hdf_file): ''' open the hdf5 file need in the cwd ''' try: fileh...
true
e432d08da4dfa64cedb982b46c48c3b47977e55d
Python
turovod/Otus
/8_Lesson8/oop/example2-mro-newstyle2.py
UTF-8
506
3.90625
4
[ "MIT" ]
permissive
""" In Python 2, search path is F, A, X, Y, B. With Python 3, search path should be : F, A, X, Y, B, Y, X and after removing « bad heads » : F, A, B, Y, X. """ class X(): def who_am_i(self): print("I am a X") class Y(): def who_am_i(self): print("I am a Y") class A(Y, X): def who_am_i...
true
dea2f65b6d7baedf2cbff2c73646c677df54d338
Python
C2SM-RCM/emiproc
/tests/test_country_mask.py
UTF-8
501
2.59375
3
[ "CC-BY-4.0" ]
permissive
import numpy as np from emiproc.utilities import compute_country_mask from emiproc.grids import RegularGrid def test_create_simple_mask(): arr = compute_country_mask( RegularGrid( xmin=47.5, xmax=58.5, ymin=7.5, ymax=12.5, nx=10, ...
true
c35343c6a2b725a53966247c10dd080809990177
Python
mvabf/URI_python
/ex_1061.py
UTF-8
745
3.390625
3
[]
no_license
diaInicial = int(input()[4:]) horaInicial, minutoInicial, segundoInicial = map(int,input().split(':')) diaFinal = int(input()[4:]) horaFinal, minutoFinal, segundoFinal = map(int,input().split(':')) diaTotal = diaFinal - diaInicial horaTotal = horaFinal - horaInicial if horaTotal < 0: horaTotal += 24 diaTot...
true
e99a9e53abe8f0329a95508d607c840883abb218
Python
igenic/deep-rl-ofc-poker
/rlofc/ofc_agent.py
UTF-8
1,507
3.625
4
[]
no_license
import numpy as np from treys import Card street_to_row = { 0: 'front', 1: 'mid', 2: 'back' } class OFCAgent(object): """An OFC decision maker.""" def place_new_card(self, card, board): """Return 0, 1, 2 for front, mid, back.""" pass class OFCRandomAgent(OFCAgent): """Place ...
true
3560f874cdf6bbddde48a3d8d59e7eb3d4ce7dc7
Python
starrrr1/traveltimeprediction
/traveltimecalc.py
UTF-8
2,332
2.75
3
[]
no_license
import sys import pandas as pd import datetime if __name__ == '__main__': weekend = ['03/07/2015','03/14/2015','03/21/2015','03/28/2015','04/04/2015'] df = pd.read_csv(sys.argv[1]) sortdf = df.sort(['V1','section']) sortdf['date'] = sortdf['V1'].apply(lambda x: x[:10]) xsortdf =...
true
1e4be08abc6d7687af8e2009642b2108a46f524c
Python
chrishefele/kaggle-sample-code
/SemiSupervised/analysis/src/col_vals.py
UTF-8
2,329
2.828125
3
[]
no_license
import sys INVERT_FLAG = False INVERT_THRESHOLD = 500000 # if more than this, use nonzero(1+(data+zeros)) vs the data TRAIN = "/home/chefele/SemiSupervised/download/competition_data/unlabeled_data.svmlight.dat" TRAIN_LINES = 1000000 line_counter = 0 col_vals = {} print "Reading:", TRAIN print "Reading line:", for ...
true
1e96763245ab65c1568641a3395421d5d778a65f
Python
olber027/AdventOfCode2020
/Day_16/Part2.py
UTF-8
3,018
3.734375
4
[]
no_license
''' Now that you've identified which tickets contain invalid values, discard those tickets entirely. Use the remaining valid tickets to determine which field is which. Using the valid ranges for each field, determine what order the fields appear on the tickets. The order is consistent between all tickets: if seat is t...
true
4a17aa26e827154a3f137dfc3c08159a6723825d
Python
Da1anna/Data-Structed-and-Algorithm_python
/基础知识/动态规划/贪心算法/20.3.17.py
UTF-8
5,094
4.1875
4
[]
no_license
''' 有一堆石头,每块石头的重量都是正整数。 每一回合,从中选出两块最重的石头,然后将它们一起粉碎。假设石头的重量分别为 x 和 y,且 x <= y。那么粉碎的可能结果如下: 如果 x == y,那么两块石头都会被完全粉碎; 如果 x != y,那么重量为 x 的石头将会完全粉碎,而重量为 y 的石头新重量为 y-x。 最后,最多只会剩下一块石头。返回此石头的重量。如果没有石头剩下,就返回 0。   提示: 1 <= stones.length <= 30 1 <= stones[i] <= 1000 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/last-s...
true
7211772918339234af209e4cb3785d55b2b57ee5
Python
NaveenKudari/Assignment_6
/Assignment_6.2.py
UTF-8
228
3.265625
3
[]
no_license
# coding: utf-8 # In[38]: list1=[3,21,98,203,17,9] mean = sum(list1)/sum([1 for i in list1]) value=0 for i in list1: value+=(i-mean)**2 variance=value/(sum([1 for i in list1])-1) print("variance is:"+" "+str(variance))
true
5ca048990621fc4c4d3872a071665349439c583d
Python
yaohongyi/identify_ui_test
/operate/operate_tool.py
UTF-8
12,637
2.640625
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # 都君丨大魔王 import time from selenium.webdriver import ActionChains from public import api from page_object.tool_page import ToolPage from page_object.case_page import CasePage class OperateTool: def __init__(self, browser): self.browser = browser self.too...
true
3a9f8e1c8f83185ce82b022d74d09428e6078fc3
Python
liliangqi/person_search_triplet
/__init__.py
UTF-8
579
2.671875
3
[ "MIT" ]
permissive
# ----------------------------------------------------- # Initial Settings for Taining and Testing SIPN # # Author: Liangqi Li # Creating Date: Apr 14, 2018 # Latest rectified: Apr 14, 2018 # ----------------------------------------------------- import time import functools def clock_non_return(func): @functools....
true
35cf46b77bf570c28ae3edcdc42615112bcec1d5
Python
atharrison/python-adventofcode2020
/day15/day15.py
UTF-8
944
3.53125
4
[ "MIT" ]
permissive
import copy class Day15: # started 0:12 after def __init__(self, data): self.data = data self.iterations = 2021 def solve_part1(self): turn_lookup = {} for idx, val in enumerate(self.data): turn_lookup[val] = idx + 1 print(turn_lookup) # first...
true
c483b4457c9cc8807e03406750b987d727c517aa
Python
saiprasadvk/pythonprogram
/workout/perimeter of a circle.py
UTF-8
591
4.4375
4
[]
no_license
Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a circle Ans:: class circle: def __init__(self,radius): self.radius = radius def perimeter(self): a = 3.14*(self.radius)**2 print("Area of a circle",a) ...
true
389b4cc1a23e9c787a31e515472804751350aa16
Python
nathanielanozie/anozie_tools
/py/na_addToLayer.py
UTF-8
2,688
2.953125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
##@file na_addToLayer.py Tools to find Maya scene transforms and put them into a display Layer. #@note ex put all the transforms in group1 into layer1. #@code import na_addToLayer as na @endcode #@code na.addToLayer( 'group1', ['transform'], 'layer1' ) @endcode # #@author Nathaniel Anozie import maya.cmds as cmds imp...
true
d3b37b9c6fe2a92e7936560463b4035cd335f410
Python
ideaqiwang/leetcode
/Array/39_CombinationSum.py
UTF-8
1,516
3.78125
4
[]
no_license
''' 39. Combination Sum Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order. The same number may be chosen from candidates an unlimited number of times. Tw...
true
5d26ac68e18555fecc365914261f24fc61a9567e
Python
imaginechen/EzaPython
/Email/SendEmail.py
UTF-8
838
2.890625
3
[]
no_license
import smtplib from email.mime.text import MIMEText # third-part smtp service mail_host = "applesmtp.126.com" # SMTP server mail_user = "eric_python_auto@126.com" # user name mail_pass = "qijzxcqj00838488" # passcode sender = 'eric_python_auto@126.com' # sender receivers = ['imaginechen@126.com', 'eric_python...
true
252d7096d8b2d216e97b575de5f52c522c57f50d
Python
dung-ngviet/LeetD
/LeetCode/DP/55/55.py
UTF-8
1,722
3.625
4
[]
no_license
from typing import List # class Solution: # def canJump(self, nums: List[int]) -> bool: # max = 0 # for i in range(0, len(nums)): # if i > max: return False # num = nums[i] # if i + num > max: max = i + num # if max > len(nums): return True # r...
true
b6903c86f398377444a9bb1812e662a7dac24f96
Python
linxumelon/examplifier
/netStat.py
UTF-8
3,464
2.765625
3
[]
no_license
import psutil import time import socket def get_global_stat(): stats = psutil.net_io_counters(pernic=False, nowrap=True) bytes_sent = stats.bytes_sent bytes_recv = stats.bytes_recv packets_sent = stats.packets_sent packets_recv = stats.packets_recv errin = stats.errin # total number of errors...
true
b3d743e915b7e2909f8260a7fa08fc556f8d14a5
Python
poke53280/ml_mercari
/Train_Index_Group.py
UTF-8
1,388
2.984375
3
[]
no_license
import pandas as pd import numpy as np id = [0,0,1,1,3, 0] d = [3,3,4,5,6, 3] s = [4,4,4,4,4, 4] ix = [7,2, 0, 3, 1, 4] t = ['A', 'B', 'C', 'D', 'E', 'C'] df = pd.DataFrame({'id': id, 'd' : d, 's': s, 'idx': ix, 't':t}) df # Group by id, d, s. Check t ordering. df_grouped = df.groupby(['id', 'd', 's']) for gr...
true
921d77f26ae0b97b936a7fbba071677d281dfcae
Python
Felienne/spea
/Python files/39 Week 7 - About Sets/06 test_set_have_arithmetic_operators/78855_01_code.step.py
UTF-8
500
3.5
4
[]
no_license
# class AboutSets(unittest.TestCase): def test_set_have_arithmetic_operators(self): beatles = {'John', 'Ringo', 'George', 'Paul'} dead_musicians = {'John', 'George', 'Elvis', 'Tupac', 'Bowie'} great_musicians = beatles | dead_musicians self.assertEqual(__, great_musicians) ...
true
2dfdab9376b8740407e15a91d1987f8adaa5ede9
Python
adamr2/dhutil
/dhutil/mongo_utils.py
UTF-8
1,077
2.515625
3
[ "MIT" ]
permissive
"""Python based utilities for the registration system.""" import os import json from urllib.parse import quote_plus from functools import lru_cache import pymongo CRED_DIR_PATH = os.path.expanduser('~/.datahack/') CRED_FNAME = 'mongodb_credentials.json' def _get_credentials(): fpath = os.path.join(CRED_DIR_PA...
true
4d1426383b3bb6382e8245a214c533032ea84e64
Python
Kaynelua/SUSH-SpectralSensor
/SpectralSensor.py
UTF-8
2,404
2.765625
3
[]
no_license
import smbus from I2C import write,read import time import math import numpy as np import bitstring as bs class SpectralSensor: def __init__(self): self.bus = smbus.SMBus(1) self.gain(2) # Set sensor gain def gain(self,level): if(level >=0 and level <=3): reg = read(self.bus,0x07) reg = reg & 0xCF ...
true
b076a489b8bda48899060faa8a055a05bea1da6a
Python
pthorn/eor-filestore
/eor_filestore/images/image_ops.py
UTF-8
3,162
2.765625
3
[]
no_license
# coding: utf-8 import os import errno import math from io import BytesIO from PIL import Image from ..exceptions import FileException, NotAnImageException import logging log = logging.getLogger(__name__) def get_image_format(file_obj): ext = os.path.splitext(file_obj.filename)[1] if ext.lower() in('.gif...
true
d28617d064b72c5690830654683948626338d579
Python
anastasia1002/my-labs
/lab8/lab8.1(2).py
UTF-8
288
3.140625
3
[]
no_license
x=float(input("x=")) y=float(input("y=")) z=float(input("z=")) def get_max(x,z): if x>z: return x else: return y sum=x+y dob=x*y def get_max(sum,dob): if sum>dob: return sum else: return dob u=max(x,z)+max(x+y,x*y)/max(x+y,x*y)**2 print(u)
true
a3c1d031f338227dd66c79bd2fc8c694275a139a
Python
georgetown-cset/ai-definitions-for-policymaking
/tests/test_query.py
UTF-8
2,386
2.53125
3
[]
no_license
import pytest from google.api_core.exceptions import NotFound from google.cloud import bigquery from bq import query, create_client from settings import DATASET, PROJECT_ID TOY_QUERY = """select * from unnest(array<struct<x int64, y string>>[(1, 'foo'), (3, 'bar')])""" ALT_TOY_QUERY = """select * from unnest(array<st...
true
0e6bc8babd9029fa1737979a87c7e8fdf99fa068
Python
covid-maps/covid-maps
/scripts/database_helper.py
UTF-8
292
2.828125
3
[]
no_license
from sqlalchemy import create_engine def load_engine(db_url): print('Connecting to the PostgreSQL database...') return create_engine(db_url, echo=False) def close_connection(session): if session is not None: session.close() print('Database connection closed.')
true
2cb83902d515adff0d8599e261579aa60d507e13
Python
ahmedhussiien/Disaster-Response-NLP-Pipeline
/data/process_data.py
UTF-8
3,693
3.0625
3
[]
no_license
# load, clean and save the datasets import pandas as pd from sqlalchemy import create_engine import argparse CATEGORIES_DEFAULT_FILENAME = './data/categories.csv' MESSAGES_DEFAULT_FILENAME = './data/messages.csv' DATABASE_DEFAULT_FILENAME = './data/labeled_messages_db.sqlite3' TABLE_NAME = 'labeled_messages' def lo...
true
432eda01889a1c14e18a28e61fecb57a1b84dbd9
Python
sedasugur/homeworks
/Learning from Data/HW1/lfd_1.py
UTF-8
4,716
2.75
3
[]
no_license
# -*- coding: utf-8 -*- #Seda SUGUR 150160130 import random iter_num=1000 learning_rate=0.01 m=[] sum_x=0 sum_y=0 m.append([]) m.append([]) with open('./regression_data.txt','r') as file: file.readline() a=0 lines=file.readlines() for line in lines: for word in line.split()...
true
c3647b2d8d7b5716d148060078d9f7ee5481c324
Python
ArtskydJ/project-euler
/020_FactorialDigitSum.py
UTF-8
188
2.875
3
[]
no_license
from math import * import string #from string import * n=factorial(100) s=format(n) sTemp="hi" x=0 for i in range(len(s)): sTemp=str.index(s,i) x+=int(sTemp) print(x)
true
5ede18c830281d936688bc7f3ff8f8e721b92607
Python
torenunez/ud120-projects
/datasets_questions/explore_enron_data.py
UTF-8
2,080
2.9375
3
[]
no_license
#!/usr/bin/python """ Starter code for exploring the Enron dataset (emails + finances); loads up the dataset (pickled dict of dicts). The dataset has the form: enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"] = { features_dict } {features_dict} is a dictionary of features associated with that pers...
true
abbf03ffe895b458704d292d01142d6e09504d2c
Python
Ackermannn/MyLeetcode
/src/edu/neu/xsz/leetcode/lcof/lcof37/Main.py
UTF-8
2,089
3.875
4
[]
no_license
#! usr/bin/env python3 from queue import Queue # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Codec: def serialize(self, root): """Encodes a tree to a single string. :type roo...
true
002af52aaabfbf3869840413fae4dcb4d9dc39fd
Python
LamThanhNguyen/HackerEarth-Solutions
/Fitting-Circles.py
UTF-8
142
3.46875
3
[]
no_license
t = int(input()) for i in range(t): a,b = map(int,input().split()) if(a >= b): print(a//b) elif(a<b): print(b//a)
true
f83143318388cad3273a0eb9cf962565c96da736
Python
thomasgauvin/LeetcodePractice
/leetcode-reverse-integer.py
UTF-8
446
2.859375
3
[]
no_license
def reverse(x: int) -> int: negative = False if x < 0: negative = True x = 0 - x x = str(x) result = "" for i in x: result = i+result result = int(result) if negative: result = -result if result > 2**31-2 or result < -2**31: result = 0 print(r...
true
c0eba7eb46ded6dc70201840d15bfd63b86e06b4
Python
onaio/tasking
/tests/models/test_locations.py
UTF-8
1,092
3.0625
3
[ "Apache-2.0" ]
permissive
""" Test for Location model """ from django.test import TestCase from model_mommy import mommy class TestLocations(TestCase): """ Test class for Location models """ def test_location_model_str(self): """ Test the str method on Location model with Country Defined """ n...
true
74ba6bab32b06a88d5c6f938b47627a808154a96
Python
Chandan-CV/school-lab-programs
/Program2.py
UTF-8
542
4.59375
5
[]
no_license
#Program 2 #Write a program to accept 2 numbers and interchange the values without using a temporary variable #Name : Adeesh Devanand #Date of Execution: July 17, 2020 #Class 11 a = int(input("Enter first number")) b = int(input("Enter second number")) a = a + b b = a - b a = a - b print("Interchanged value of the fir...
true
8169cca045bb096d8d290bae52a99ed0f07b93e0
Python
posuna19/pythonBasicCourse
/course2/week5/W5_01_arrange_name_test.py
UTF-8
881
3.859375
4
[]
no_license
import unittest from W5_01_arrange_name import rearrange_name class TestRearrange(unittest.TestCase): def test_basic(self): #Arrange username = "Lovecale, Ada" expectedName = "Ada Lovecale" #Act resultName = rearrange_name(username) #Assert self.assertEqual(...
true
9fd8e94a89212556fce1cb300a2627e72d611c5f
Python
dfarache/hackerrank
/loveLetterMistery/loveLetter.py
UTF-8
460
3.71875
4
[]
no_license
def apply_changes(string): number_of_changes = 0 length = len(string) low = 0 high = length-1 for index in range(int(length/2)): number_of_changes += abs(ord(string[low]) - ord(string[high])) high -= 1 low += 1 print(number_of_changes) def calculate_answers(): for i...
true
ef0dfd16468612e3f77bd995b10213dc22e43d3f
Python
anuragvij264/covid-social-distancing-scoring
/api/api_utils.py
UTF-8
1,086
2.53125
3
[]
no_license
from torchvision import transforms from PIL import Image import numpy as np import torch from model import CSRNet transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ]) def gen_img_cou...
true
4caf73f8a532f644161ac8ed84aa0f7bef99093a
Python
fanonwue/ScannerTool
/SmtpConfig.py
UTF-8
738
2.625
3
[ "MIT" ]
permissive
class SmtpConfig: def __init__(self, host: str, port: int, username: str, password: str, starttls: bool, mail_from: str): self.host = host self.port = port self.username = username self.password = password self.starttls = starttls if not mail_from: mail_f...
true
83bd2e6837094aa9cb7eeeb6261058ea5c0c7dc3
Python
YaojieLu/LAI_optimization
/MDP_class.py
UTF-8
4,541
3.015625
3
[]
no_license
""" We define an Markov Decision Process. We represent a policy as a dictionary of {state: action} pairs. """ import numpy as np def Ef(dL, gs, L, slope, dt): """ Given leaf area and stomatal conductance, return whole-plant transpiration """ return slope*(L+dL)*gs*dt def gsmax_sf(dL, L, s, slope, dt): "...
true
b1808f3ebe9420e737934a10f91b39d09a152a5a
Python
LuizaM21/Learn_python
/Python_server_testing/Genios_threads.py
UTF-8
1,306
2.828125
3
[]
no_license
from timeit import default_timer as timer import bs4 import urllib.request import ConfigData as config_data from multiprocessing import Process from Python_files_manipulation.CSVManipulation import CSVManipulation as csv_manipulation conf_data = config_data.ConfigData.get_instance() cube_types_file = conf_data.get_va...
true
b842b98dbbaabbd5a0f1a66ffe0246e88d5e1255
Python
Charlie-Ren/ML5525
/hw1-logistic.py
UTF-8
3,524
2.796875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[39]: import numpy as np, pandas as pd from matplotlib import pyplot as pl feat=pd.read_csv("IRISFeat.csv",header=None) label=pd.read_csv("IRISlabel.csv",header=None) idx=np.random.permutation(feat.index)# shuffle X_shuffle=feat.reindex(idx).to_numpy() y_shuffle=label.reinde...
true
3503bb1b4bf94a92d8df3bae82e7f3ad34eed40a
Python
0xfirefist/cryptopals
/l1-basics/chal4.py
UTF-8
718
3.484375
3
[]
no_license
# Detect single-character XOR from pprint import pprint from chal3 import decrypt # filter list based on printable character def filter(decryptedList): for decryptedString in decryptedList: for c in decryptedString: if c>126 : return True return False # this will return a ...
true
da07b99cb2bf9fd29fbd1ca213723ed82149c405
Python
m-niemiec/space-impact
/ship.py
UTF-8
2,189
3.546875
4
[]
no_license
import pygame from settings import Settings class Ship: """A class to manage the ship.""" def __init__(self, si_game): """Initialize the ship and set its starting positon.""" self.screen = si_game.screen self.screen_rect = si_game.screen.get_rect() self.settings = S...
true
456de6a70ade0e55c29d1c631b1dd33447409582
Python
dapr/python-sdk
/dapr/actor/runtime/context.py
UTF-8
4,721
2.546875
3
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
# -*- coding: utf-8 -*- """ Copyright 2023 The Dapr Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
true
269996c00984e84d54e9f0dd8f40e42de2e75cc2
Python
tehzeebb1/Project104
/read.py
UTF-8
136
2.6875
3
[]
no_license
import csv with open('height-weight.csv',newline='') as f: reader=csv.reader(f) file_data=list(reader) print(file_data)
true
869b66d8ac7825c08fa0c22ecf20cf0753744dab
Python
wills201/Challenge-Probs
/mergeindex.py
UTF-8
535
3.28125
3
[]
no_license
l1 = [1,7,3,4,9,3,8,6,8,9] l2 = [0,3,8,6,8,4,7,6,8,9] def mergeindex(l1,l2): idx = 0 while idx < len(l1): idx += 1 if l1[idx:] == l2[idx:]: return idx def mergeindex2(l1,l2): idx = 0 while idx < len(l1): idx += 1 if l1[idx] == l2[idx]: if l1[-1] ...
true
79ea7ac1fa5080ff2626a47bdbcad600254570c3
Python
TemistoclesZwang/HackerRank_e_URI
/URI judgeOnline/1771.py
UTF-8
3,119
3.40625
3
[]
no_license
class Numero: CLASSEB = list (range(1,16)) CLASSEI = list (range(16,31)) CLASSEN = list (range(31,46)) CLASSEG = list (range(46,61)) CLASSEO = list (range(61,76)) def __init__(self, numero, classe): self.numero = numero self.classe = classe def vali...
true
27dabaf21b0d96fb3ed72f62a63167969d8ce239
Python
john-hewitt/cs229-head-tracking
/util.py
UTF-8
13,590
2.828125
3
[]
no_license
import csv import json import os import numpy as np import sklearn as sk import re import cnn # globals mos = [0, 2, 6, 12] exps = ['R', 'N1', 'N2', 'P1', 'P2'] # file naming conventions id_reg = '[a-z]{2}[0-9]{5}' mo_reg = '(((2)|(6)|(12))mo)?' exp_reg = '((n1)|(n2)|(r)|(p1)|(p2))' tfname_reg = r'tracking_{}{}{}\.t...
true
7a88241a3037fbdf8e159972c08c6162dda7e3ca
Python
stefanct/avr-lib
/scripts/timers.py
UTF-8
5,130
2.546875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys, math, argparse, time from cdecimal import Decimal from prettytable import PrettyTable from common import * def main(*args): global verbose, long_width, timer_width, param_width, timer # docs: http://docs.python.org/dev/library/argparse.html#argparse.Argu...
true
1f39440ee996093565fb96452af0b457958c451b
Python
jasonyu0100/General-Programs
/2018 Programs/Dynamic Programming/WoodCutter/test.py
UTF-8
859
2.828125
3
[]
no_license
with open('input.txt') as f: length = float(f.readline()) positions = list(map(float,f.readline().strip().split())) cache = {} def woodCutter(positions, cost, start, end, sequence): if (start,end) in cache: return cache[(start,end)] allCuts = {} cutCost = (end - start) for cut in positions: if start < cut a...
true
21846fd3aeac2362aa4e46ea2dda5052997aef38
Python
bagherhussaini/matrix-multiplication-algorithms-runtime-comparison-python
/src/main.py
UTF-8
5,310
3.171875
3
[]
no_license
from time import time import numpy as np import pandas as pd import xlsxwriter def main(): n = [2 ** i for i in range(2, 10)] log = pd.DataFrame(index=[], columns=['N', 'Normal_Multiplication_Time', 'Divide_and_Conquer_Time', 'Strassen_Time']) normal_multiplication_durat...
true
ba48a58445f113708babc1f9247d9b8d50b38921
Python
Vincent105/python
/04_The_Path_of_Python/05_if/ch5_01_if.py
UTF-8
85
3.953125
4
[]
no_license
age = input('請輸入年齡:') if (int(age) < 18): print('You are too young.')
true
97d62992639a42ee5dbd7effd7c610e406635a04
Python
glasnt/emojificate
/tests/test_graphemes.py
UTF-8
530
2.828125
3
[ "BSD-3-Clause" ]
permissive
import pytest from emojificate.filter import emojificate def valid(emoji, title, fuzzy=False): parsed = emojificate(emoji) assert emoji in parsed assert 'alt="{}'.format(emoji) in parsed assert title in parsed if not fuzzy: assert 'aria-label="Emoji: {}'.format(title) in parsed def tes...
true
916768ecaf5ee6442a9c206c7c5557f2817bf2a7
Python
auretsky1/BasicPuzzleGame
/PuzzleGraphics.py
UTF-8
7,969
3.546875
4
[]
no_license
""" This class will be responsible for drawing the cubes to the game screen and updating the highlighting in accordance with which ones are on and off as well as where the user's mouse is located. These changes can be called as functions by an outside module or class with the relevant data needed to make a chan...
true
ff5c4826288f3f2ad76efbde8ba7a3aacbba34f9
Python
Kamilos1337/pp1
/03-FileHandling/18.py
UTF-8
181
3.53125
4
[]
no_license
tablica = [] with open("03-FileHandling/numbers.txt", 'r') as tekst: for line in tekst: tablica.append(int(line)) tablica.sort() for n in tablica: print(n, end=' ')
true
df1f8bfde2f60756578ee51d21c69cd47e07e9b7
Python
dolphingarlic/seniorrobotics2018
/test.py
UTF-8
831
2.625
3
[]
no_license
from src.robot import Robot from time import sleep ROBOT = Robot() print("Started") ROBOT.follow_until_next_node() sleep(10) ROBOT.stop() print("Stopped") ''' for i in range(40): print("L:"+str(ROBOT.left_colour_sensor.reflected_light_intensity)) print("R:"+str(ROBOT.right_colour_sensor.reflected_light_intens...
true
a2e14e94527a98bfa95424959cfbd5111e4ad6c5
Python
pirobtumen/pymediator
/test/test_mediator.py
UTF-8
1,598
2.90625
3
[ "BSD-3-Clause" ]
permissive
from pymediator import Event, EventHandler, Mediator def test_base_event(): assert Event.EVENT_NAME is '' def test_base_event_handler(): handler = EventHandler() res = handler.handle(Event()) assert res is None def test_mediator_register_event(): test_event_name = 'test_event' test_mediato...
true
1d774ffbb52a1629ea6a0d97d74b2672973e5865
Python
iCodeIN/competitive-programming-5
/leetcode/Two-Pointers/permutation-in-string.py
UTF-8
1,134
3.046875
3
[]
no_license
from itertools import permutations class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: if len(s1) > len(s2): print('here') return False di = {} for i in s1: di[i] = di.get(i, 0) + 1 ls1 = len(s1) di_sliding = {} for ...
true
dd15cc73c67fcc5a97e2ee77a7339d6f866dffa1
Python
CatalystOfNostalgia/hoot
/server/hoot/emotion_processing/compound_emotions.py
UTF-8
427
2.53125
3
[ "MIT" ]
permissive
from enum import Enum from enum import unique @unique class CompoundEmotion(Enum): """ Represents all possible compound emotions. """ optimism = 1 frustration = 2 aggressiveness = 3 anxiety = 4 frivolity = 5 disapproval = 6 rejection = 7 awe = 8 love = 9 envy = 10...
true
882973f64b9e2f292aaa052a78d88e4e744a4f34
Python
alan-yjzhang/AIProjectExamples1
/HW2/part1-convnet/modules/max_pool.py
UTF-8
3,554
2.796875
3
[]
no_license
import numpy as np class MaxPooling: ''' Max Pooling of input ''' def __init__(self, kernel_size, stride): self.kernel_size = kernel_size self.stride = stride self.cache = None self.dx = None self.mask = None def forward(self, x): ''' Forward...
true
024d3e1d7a83f8a2f7e10ad7e349e892e100b646
Python
vdrhtc/Two-qubit-AT-paper
/Pictures/Plotting/StationaryPlot.py
UTF-8
7,639
2.59375
3
[]
no_license
import pickle from numpy import * import matplotlib from matplotlib import ticker, colorbar as clb, patches matplotlib.use('Qt5Agg') from matplotlib import pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes class StationaryPlot: def __init__(self): with open("stationary.p...
true
8fe8f2b0f369781c4ce0b68602c09eb5f39eb147
Python
abhijit26110709/python
/decsitree_iris.py
UTF-8
1,564
3.546875
4
[ "MIT" ]
permissive
#!/usr/bin/env python # coding: utf-8 # In[ ]: from sklearn.datasets import load_iris import matplotlib.pyplot as plt from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score # In[3]: # now loading IRIS data only iris=load_iris() # In[4]: dir(iris) #exploring variable # In...
true
3ac7a45f1c93cbd04c8aa60fa845a050a822f114
Python
NilsJPWerner/autoDocstring
/src/test/integration/python_test_files/file_2_output.py
UTF-8
524
2.96875
3
[ "MIT" ]
permissive
from typing import Union, List, Generator, Tuple, Dict def function( arg1: int, arg2: Union[List[str], Dict[str, int], Thing], kwarg1: int = 1 ) -> Generator[Tuple[str, str]]: """_summary_ :param arg1: _description_ :type arg1: int :param arg2: _description_ :type arg2: Union[List[str...
true
bc712597c75c5f664f6a5c323f5aa183087917dd
Python
uniqxh/tensorflow
/pdes.py
UTF-8
1,714
2.578125
3
[]
no_license
#!/usr/bin/python import tensorflow as tf import numpy as np from PIL import Image from cStringIO import StringIO import images2gif #from IPython.display import clear_output, Image, display images = [] def DisplayArray(a, fmt='jpeg', rng=[0,1]): a = (a-rng[0])/float(rng[1] - rng[0])*255 a = np.uint8(np.clip(a, ...
true
68328f531f700bbf47394c47ef61c901de83237b
Python
achalddave/maskrcnn-benchmark
/maskrcnn_benchmark/utils/parallel/pool_context.py
UTF-8
1,860
3.015625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import multiprocessing as mp from collections.abc import Iterable _PoolWithContext_context = None def _PoolWithContext_init(initializer, init_args): global _PoolWithContext_context _PoolWithContext_context = {} if init_args is None: initializer(context=_PoolWithContext_context) else: ...
true
aed2c42eb01432869b16ea8df0495672658a1b46
Python
linhuaxin93/LearnPython
/matplotilb/matplotlib_05.py
UTF-8
557
3.484375
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.rcParams['font.family'] = 'SimHei' plt.rcParams['axes.unicode_minus'] = False #随机x,y各十个散点图 plt.subplot(2,2,1) x = np.random.rand(10) y = np.random.rand(10) plt.scatter(x, y) #柱形图 plt.subplot(2,2,2) x = np.arange(1, 6) y = np.array([13, 15, 1...
true
1af27c27ffeee246f5ec3b69728e96329eeb31f6
Python
gilReyes/SaphireSQL
/Programming Languages/syntaxAnalyzerworking.py
UTF-8
954
2.546875
3
[]
no_license
import ply.yacc as yacc #Getting the token from lexicalAnalyzer import tokens var = [[]] resultQueries = [] tracker = 0 def p_expression_table(p): 'expression : ID ASSIGNMENT LB ID RB LP IDS RP EOL' var[tracker].insert( 0, p[4]) #print('entering table') def p_expression_ids(p): '''IDS : IDS SEPARATO...
true
93cab0e0b143889fefbf1875811a0afc84383416
Python
khawajaosama/Algebra_Python
/algebra_4.py
UTF-8
2,376
3.1875
3
[]
no_license
#Dot Product from collections import defaultdict def dot(v,w): return sum([v_i*w_i for v_i,w_i in zip(v,w)]) print (dot([1,2,3],[4,5,6])) #Vector Product def vector_product(v,w): adder = defaultdict(int) for n_1,v_i in enumerate(v): for n_2,w_i in enumerate(w): if (n_1!=n...
true
9f8ef20552481f3811825e97136d7f15fcd30567
Python
dawnonme/Eureka
/main/leetcode/466.py
UTF-8
1,897
3.609375
4
[]
no_license
class Solution: def getMaxRepetitions(self, s1: str, n1: int, s2: str, n2: int) -> int: # hashtable to store the patterns patterns = {} # pointers on s1 and s2 p1, p2 = 0, 0 # number of occurance of s1 and s2 so far c1, c2 = 1, 0 # execute the loop when num...
true
752a66e25c86d705c8267dff31778a729bdea21f
Python
iotrusina/M-Eco-WP3-package
/xsafar13/locations/filters/filter_allc_forload
UTF-8
563
2.640625
3
[]
no_license
#!/usr/bin/python f1 = open("allCountries","r") while True: line = f1.readline() if line == '': f1.close() break sp = line.split(" ") if (sp[6] == "P"): print sp[2] + "\t" + sp[4] + "\t" + sp[5] + "\t" + sp[0] + "\t" + sp[7] + "\t" + sp[8] + "\t" + sp[14] if (sp[6] == "L") and (sp[7] == "RGN"...
true
d2466f2cd469e19567cafcc62b34b5cd32aacd37
Python
DDR7707/Final-450-with-Python
/Dynamic Programming/453.Longest Alternating Subsequence.py
UTF-8
678
4.125
4
[]
no_license
def LAS(arr, n): # "inc" and "dec" initialized as 1 # as single element is still LAS inc = 1 dec = 1 # Iterate from second element for i in range(1,n): if (arr[i] > arr[i-1]): # "inc" changes iff "dec" # changes inc = dec ...
true
50c12377804a67e387707bb55931766e8aaa591f
Python
SaurabhThube/Competitive-Programming-Templates
/FastExpo.py
UTF-8
141
3.21875
3
[]
no_license
def FastExpo(x,y,mod): res=1 while(y>0): if y&1: res=(res*x)%mod x=(x*x)%mod y/=2 return res
true
61ba73b0485e119a918e282f88308ee7704e51ef
Python
tonmoy50/Bangla-Sign-Language-Detection
/Model/d.py
UTF-8
721
3.96875
4
[]
no_license
import math # Function to check # palindrome def isPalindrome(s): left = 0 right = len(s) - 1 while (left <= right): if (s[left] != s[right]): return False left = left + 1 right = right - 1 return True # Function to calculate # the sum of...
true
5d96e42ed110d4d14db6d9513d4f7ec19fa08509
Python
programmer-666/Codes
/Python/Tensorflow/tnf1.py
UTF-8
2,295
3.09375
3
[ "MIT" ]
permissive
import pandas as pd import seaborn as sb import matplotlib.pyplot as plt import tensorflow as wtf from tensorflow.keras.models import Sequential # çalışılacak katmanları belirtir from tensorflow.keras.layers import Dense # modele katmanları eklemek için from sklearn.model_selection import train_test_split from sklearn....
true
6a5c06800c91495b5fe95c83d72abac65fa3afd9
Python
Shobhit05/Hackerranksolutions
/Python/mobileno.py
UTF-8
161
2.96875
3
[]
no_license
N=int(input()) a=[] for i in range(0,N): c=raw_input() c=c[-10:] a.append(c) a.sort() for j in a: print("+91"+" "+j[:5]+" " +j[-5:])
true
19fb562b91c7094da27b52527eeb2a5cc5773677
Python
jesusalvador2911/AdmonODatos
/2.13/2.13.py
UTF-8
242
2.53125
3
[]
no_license
import pickle nombre = "Bartolo" apellido = "Andropolis" edad = 20 soltero = False salario =8523.20 registro= [nombre, apellido,edad,soltero,salario] archivo = open("ArchivoX.txt","wb") pickle.dump(registro,archivo) archivo.colse()
true
51de96aff7508305f260cf886de56c2f5d33a9c0
Python
RevansChen/online-judge
/Codewars/8kyu/5-without-numbers/Python/test.py
UTF-8
118
2.5625
3
[ "MIT" ]
permissive
# Python - 3.6.0 test.describe('Basic test') test.it('Should return 5') test.assert_equals(unusual_five(), 5, 'lol')
true
9d19104c37108c01e35bf007c449fd0a5033cedf
Python
geyang/plan2vec
/plan2vec/scratch/td_lambda.py
UTF-8
2,449
2.921875
3
[]
no_license
import numpy as np from params_proto.neo_proto import ParamsProto class Args(ParamsProto): gamma = 0.9 lam = 0.9 T = 20 N = 20 # truncation for TD(λ) def td_lambda(): el_rewards = np.zeros(Args.T) el_states = np.zeros(Args.T) # We fix the G_t to the left side, and focus # on comput...
true
effd2e6a01eb9a715eb2ca287d00fa134fdf2474
Python
CCALITA/CNNthings
/week10/10_3.py
UTF-8
1,982
3.015625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import tensorflow as tf boston_housing=tf.keras.datasets.boston_housing (train_x,train_y),(test_x,test_y)=boston_housing.load_data() #数据归一化处理 x_train=(train_x-train_x.min(axis=0))/(train_x.max(axis=0)-train_x.min(axis=0)) x_test=(test_x-test_x.min(axis=0))/(test_x...
true
42e0bbba8ed554a6b5f49904383bc057e6c7d6c5
Python
PaulB99/Tessa
/new/lines.py
UTF-8
7,707
3.390625
3
[]
no_license
# Imports import cv2 import matplotlib.pyplot as plt import numpy as np import scipy.ndimage import scipy.stats # Line class class Line(object): vertical_threshold = 30 def __init__(self, m, b, center, min_x, max_x, min_y, max_y): ''' m: slope b: y-intercept center: cente...
true
4e5369318ad362551632d48abfa4e4f0f23782d3
Python
401-python-final/wheres_my_bus_backend
/api_caller/views.py
UTF-8
11,512
2.875
3
[]
no_license
from django.shortcuts import render from django.http import HttpResponse, JsonResponse from rest_framework.views import APIView #import speech_recognition as sr import requests import time import json with open('bus_routes/finalRoutesAndIds.json') as all_routes: route_data = json.load(all_routes) print(route...
true
bce12d9ab605840040a770164a47bc653c32c599
Python
samuxiii/prototypes
/aigym/cartpole/cartpole.py
UTF-8
4,104
3.359375
3
[ "MIT" ]
permissive
import os import random import gym import numpy as np from collections import deque from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam from time import sleep class Agent: def __init__(self): self.memory = [] self.epsilon = 1.0 #exploration rate ...
true