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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c740b0a5e8ffaa9d7f02ed6dadd4985ec7c52622 | Python | vl4di99/Udemy_Learn-To-Code-in-Python-3-Beg-to-Adv | /C33.py | UTF-8 | 1,621 | 3.5 | 4 | [] | no_license | import requests
import json
import random
import html
quit_app=""
correct_answers_count = 0
incorrect_answers_count = 0
while(quit_app!="quit"):
request_api = requests.get("https://opentdb.com/api.php?amount=1&category=12&difficulty=easy&type=multiple")
requests_text = request_api.text
quiz_json = json.loa... | true |
db3b96e53db147b88bd2f0bcb3a6b1963111446a | Python | AZ015/design_patterns | /Behavioral/command/editor/html_document.py | UTF-8 | 306 | 3.234375 | 3 | [] | no_license | class HtmlDocument:
def __init__(self):
self._content: str = ""
def make_bold(self):
self._content = f'<b> {self._content} </b>'
@property
def content(self):
return self._content
@content.setter
def content(self, content):
self._content = content
| true |
d860fb27eebc107275b96289d593758528bfb2d9 | Python | KaustavKabi/Practical-Homies | /Credits.py | UTF-8 | 1,022 | 2.9375 | 3 | [] | no_license | from tkinter import *
from os import getcwd
from PIL import ImageTk, Image
class Credits():
def __init__(self, master):
self.root = Toplevel(master)
app_width = 600
app_height = 400
screen_width = self.root.winfo_screenwidth()
screen_height = self.root.winfo_screenheight()
self.root.geometry(... | true |
28e516d670be4410cc61b5c0a93fe46d35b20641 | Python | zzz136454872/leetcode | /fairCandySwap.py | UTF-8 | 537 | 3.203125 | 3 | [] | no_license | from typing import *
class Solution:
def fairCandySwap(self, A: List[int], B: List[int]) -> List[int]:
A.sort()
B.sort()
target=sum(A)-sum(B)
target=target//2
j=0
for i in range(len(A)):
want=A[i]-target
while j<len(B)-1 and B[j]<want:
... | true |
59c31cc23c74aa613254d07354af4bc70bbacc82 | Python | surendhar-code/Python-Programs | /Basic Programs/cube_sum_of_squares.py | UTF-8 | 152 | 4.0625 | 4 | [] | no_license | n=int(input("Enter the n value : "))
sum=0
for i in range(1,n+1):
sum+=i*i*i
print("Cube sum of first {0} natural numbers is : {1}".format(n,sum))
| true |
b665682da685720190309bb8167e9933def4a2d3 | Python | bluicezhen/Marmot | /server/public/func/password_hash_salt.py | UTF-8 | 201 | 2.8125 | 3 | [] | no_license | from datetime import datetime
from hashlib import sha256
def password_hash_salt(password: str, time: datetime) -> str:
return sha256(f"{password}:{time.timestamp()}".encode("utf-8")).hexdigest()
| true |
263add45b347120ad6b40ed859febec50e42a4c6 | Python | inkychris/3dprinting | /cura/profiles/curaprofile.py | UTF-8 | 1,506 | 2.796875 | 3 | [
"MIT"
] | permissive | import argparse
import pathlib
import zipfile
script_dir = pathlib.Path(__file__).parent.resolve()
PROFILE_EXT = '.curaprofile'
def directory(path):
path = pathlib.Path(path)
if not path.is_dir():
raise ValueError(f'path is not a directory: {path}')
return path
def cura_profile(path):
path... | true |
130f6ceb27047d96c38d818884a799b202bb08ca | Python | johnwickakash12/python_code | /lambda123.py | UTF-8 | 31 | 2.828125 | 3 | [] | no_license | a=lambda x,y:x-y
print(a(2,3)) | true |
4f0b8759126b1be90e3db9dd2bb4b6756c580540 | Python | kimurakousuke/MeiKaiPython | /chap06/list0612a.py | UTF-8 | 156 | 4.40625 | 4 | [] | no_license | # 反向遍历并输出字符串的所有字符(利用reversed函数)
s = input('字符串:')
for ch in reversed(s):
print(ch, end='')
print()
| true |
074f35ae16749466ae6796cd363c822321470971 | Python | cattegrin/Faith | /venv/Scripts/update_google_sheet.py | UTF-8 | 924 | 2.75 | 3 | [] | no_license | import sys
import gspread
from oauth2client.service_account import ServiceAccountCredentials
def update_sheet(player_rsn):
player_rsn = sys.argv[0]
# use creds to create a client to interact with the Google Drive API
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.co... | true |
e6d0c44e0cbe834de02b136fd3e8a86f76ba3723 | Python | Neeraj-kaushik/Geeksforgeeks | /Array/Rotation.py | UTF-8 | 251 | 3.625 | 4 | [] | no_license | def rotation(li):
min = 1000
for i in range(len(li)):
if li[i] < min:
min = li[i]
loc = i
print("The array is rotated ", loc, "Times")
n = int(input())
li = [int(x) for x in input().split()]
rotation(li)
| true |
fb87d3c7564ff4d1937f7f94bbc5847dd8a0937b | Python | pydemos/test | /08面向对象/hm_14_士兵突击_01_枪类.py | UTF-8 | 1,350 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Keawen
'''
soldier Gun
name model
gun bullet_count
__init__self() __init__(self,model ):
fire(self) shoot(self):
'''
class Gun:
def __init__(self ,model):
#1枪的型号
self.model = model
#2子弹的数量
self.bullet_count =... | true |
6490fa2608055fb98854698793df4d032f37fe31 | Python | SpikeInterface/spikeextractors | /spikeextractors/baseextractor.py | UTF-8 | 24,122 | 2.640625 | 3 | [
"MIT"
] | permissive | import json
from pathlib import Path
import importlib
import numpy as np
import datetime
from copy import deepcopy
import tempfile
import pickle
import shutil
from .exceptions import NotDumpableExtractorError
class BaseExtractor:
# To be specified in concrete sub-classes
# The default filename (extension to... | true |
8cd564997ea53d214ab828b5ae6f38551ac1d767 | Python | SunRiseGG/EmbSystemsLab2 | /FFTThread2.py | UTF-8 | 1,340 | 2.96875 | 3 | [] | no_license | import threading
import time
import math
class FFTThread2(threading.Thread):
def __init__(self, x, F_Re, F_Im):
threading.Thread.__init__(self)
self.x = x
self.N = len(x)
self.F_Re = F_Re
self.F_Im = F_Im
def run(self):
print('Starting thread2 for fft')
... | true |
d5fdaf87dc053078fd46a456417cb0a96601b792 | Python | Aasthaengg/IBMdataset | /Python_codes/p02851/s522861811.py | UTF-8 | 354 | 2.78125 | 3 | [] | no_license | from collections import defaultdict
N, K, *A = map(int, open(0).read().split())
x = [0] * (N + 1)
for i in range(N):
x[i + 1] = x[i] + A[i]
y = [(x[i] - i) % K for i in range(N + 1)]
ctr = defaultdict(int)
ans = 0
for j in range(N + 1):
ans += ctr[y[j]]
ctr[y[j]] += 1
if j - K + 1 >= 0:
... | true |
5df122b85efad4d66bc5fbbdb55d9f4afe98ed01 | Python | mathivanansoft/algorithms_and_data_structures | /algorithms/dynamic_programming/longest_subsequence.py | UTF-8 | 1,101 | 3.9375 | 4 | [] | no_license | # Find the longest subsequence in array in which the elements in subsequence
# are consecutive
def longest_subsequence(arr):
dt = {}
for elmnt in arr:
dt.update({elmnt: False})
start = -1
end = -1
maximum = 0
data = 0
for index, elmnt in enumerate(arr):
if dt.get(elmnt) is... | true |
8d97a6f20cbeaaa42109baf346e38b04dbaf71ea | Python | koushalkh/Image-Organizer | /app/create_table.py | UTF-8 | 359 | 2.59375 | 3 | [] | no_license | import sqlite3 as sql
def create_table():
con=sql.connect('USERINFO.db')
# print("haha")
con.execute("DROP TABLE IF EXISTS USER")
con.execute("CREATE TABLE USER(username TEXT PRIMARY KEY NOT NULL,password TEXT NOT NULL)")
c=con.cursor()
con.execute("INSERT INTO USER(username,password) VALUES('admin','admin')")
... | true |
75b87ffba71ae89ac6bb1d6de6d1ca438e672c3e | Python | Guilherme-Galli77/Curso-Python-Mundo-3 | /Exercicios/Ex082 - Dividindo valores em várias listas.py | UTF-8 | 812 | 4.75 | 5 | [] | no_license | #Exercício Python 082: Crie um programa que vai ler vários números e colocar em uma lista.
# Depois disso, crie duas listas extras que vão conter apenas os valores pares
# e os valores ímpares digitados, respectivamente. Ao final, mostre o conteúdo das três listas geradas.
lista = list()
par = list()
impar = list()
w... | true |
c9216ef83e76bda92822735a6cb23958422bc1dd | Python | lemonferret/positron_loops | /ecut.py | UTF-8 | 1,160 | 2.546875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import copy as copy
name = "k15_a3.106_ecut"
data=pd.read_csv(name, delim_whitespace=True, skipinitialspace=True, engine="python", skiprows = 0, skipfooter =1, header = None)
Ecut = np.arange(200, 550, 10)
F = copy.deepcopy(data[3][1:])
E =... | true |
f133a2e6c122d342f24595e22ddcb98504e0927a | Python | michaelerne/adventofcode-2019 | /day_06.py | UTF-8 | 2,949 | 2.71875 | 3 | [] | no_license | from functools import partial
from os.path import basename, splitext
from typing import List, Tuple, Dict, Set
import networkx as nx # type: ignore
from lib import solve
DAY: int = int(splitext(basename(__file__))[0].split('_')[1])
SOLVE = partial(solve, DAY)
def part_a(graph: nx.Graph) -> int:
return sum(nx.... | true |
3b472f67d7d60cd0b8cc4d4554178873a243e155 | Python | Aaatresh/LetNet | /letnet_fixed_multilayer.py | UTF-8 | 11,867 | 3.125 | 3 | [
"MIT"
] | permissive | """
Script to apply LET approach to image reconstruction on diffusercam lensless cameras.
The parameters C and tau, (the linear coeffecients and standard deviation respectively) are fixed across all layers. These parameters
can be made a parameter for each layer by extending this program.
This bas... | true |
05bbce3792d19294a23760f1ce5bdf418048d044 | Python | sxu11/Algorithm_Design | /Array/2dSearch/P200_NumberofIslands.py | UTF-8 | 1,581 | 3.75 | 4 | [] | no_license |
'''
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input:
11110
11010
11000
00000
Output: 1
Ex... | true |
1a8b69f28877c4acaaad6fa607f90d5c63e35a6e | Python | Wang-Zekun/ichw | /pyassign1/planets.py | UTF-8 | 1,684 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 6 17:51:30 2018
@author: wangzekun
"""
import turtle
import math
def CreatePlanet(name,size,posx,color):
name = turtle.Turtle()
name.speed(0)
name.color(color)
name.shape("circle")
name.shapesize(size,size,1)
name.penup()... | true |
61860c780a74fd568062a83ce9ae60aaab3c6b27 | Python | AnMik/practice | /practice_1/year.py | UTF-8 | 394 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
def main():
year = raw_input("Enter year:")
if year == "exit":
return
try:
year = int(year)
if (not year % 4 and year % 100) or not year % 400:
print('Leap year')
else:
print('Common year')
main()
except Exception:... | true |
4b5becb609b280c31981cea9a6b4defb37173cba | Python | BarryZM/dig-text-similarity-search | /py_scripts/preprocessing/filter_trusted_sources.py | UTF-8 | 1,535 | 2.640625 | 3 | [
"MIT"
] | permissive | # <editor-fold desc="Basic Imports">
import os.path as p
from argparse import ArgumentParser
import sys
sys.path.append(p.join(p.dirname(__file__), '..'))
sys.path.append(p.join(p.dirname(__file__), '../..'))
# </editor-fold>
# <editor-fold desc="Parse Command Line Options">
arp = ArgumentParser(description='Append a... | true |
643055a4a4bd5318d5985ae0f080a6b875f0025a | Python | priyankarnd/Python-Training | /classes.py | UTF-8 | 1,829 | 4.4375 | 4 | [] | no_license | #Defining a class
class MyClass:
a = 10
b = 20
x = MyClass()
print(x.a)
print(x.b)
class Person :
#1. constructor
def __init__(self, firstName, lastName, age):
self.firstName = firstName
self.lastName = lastName
self.age = age
#2. Methods
def fullName(self):
r... | true |
c413717766630170f7c1ed0c04a06445de5172d1 | Python | alanveloso/ufpa-graphs-2017 | /boruvka_algorithm.py | UTF-8 | 3,261 | 3.265625 | 3 | [
"MIT"
] | permissive | class graph:
vertex = ['A','B','C','D','E','F','G','H']
edge={ 'A':{'C': 6, 'D': 12},
'B':{'D': 7, 'E':14},
'C':{'A': 6, 'D': 9, 'F': 16, 'G': 3 },
'D':{'A': 12, 'B': 7, 'C': 9, 'E': 11},
'E':{'B': 14, 'D': 11, 'F': 5 , 'H': 18 },
'F':{'C': 16, 'E': 5, 'G': 8, 'H': 13},
'G':{'C':3 ,'F': 8, 'H... | true |
d3376f2f9e4757933237322ebc195ef1a85bab52 | Python | sjanav/learnpython | /summer_2021/TuplePractice.py | UTF-8 | 101 | 3.296875 | 3 | [] | no_license | import pprint
a = (1,2,3,4)
b = (1,3,3,4,)
pprint.pprint(a)
pprint.pprint(b)
print(bool(a == b)) | true |
c3c57cd83926b8d8905182a1dd792cf51afbcf64 | Python | migueLib/fundus2sex | /src/e2e_utils/compare_labels.py | UTF-8 | 127 | 2.90625 | 3 | [] | no_license | def compare_with_true(data, true):
""""Uses a series for the true"""
return data.apply(lambda x: x == true, axis=0)
| true |
070402bb9900871ccf9a11bb3bb4facbcc1c8361 | Python | FredC94/MOOC-Python3 | /UpyLab/UpyLaB 5.02 - Manip tuples - ADN.py | UTF-8 | 1,459 | 4.3125 | 4 | [
"MIT"
] | permissive | """ Auteur = Frédéric Castel
Date : Avril 2020
Projet : MOOC Python 3 - France Université Numérique
Objectif:
On représente un brin d’ADN par une chaîne de caractères dont les caractères sont parmi les quatre suivants :
'A' (Adénine), 'C' (Cytosine), 'G' (Guanine) et 'T' (Thymine).
Écrire une fonc... | true |
a4274e4f4846a442be34eac9b5a0eaa3b4319a37 | Python | jsmolina/z88dk-tutorial-sp1 | /build/scenarioparse.py | UTF-8 | 540 | 2.578125 | 3 | [] | no_license |
print("uint8_t map[25][32] = {")
with open('pacmansce.csv', 'r') as f:
for linenum, row in enumerate(f):
if(linenum == 0):
continue
if(linenum == 25):
break
resultcols = []
cols = row.split(',')
for i in range(1, len(cols)):
x = int(cols[... | true |
804f8754ad28de14a255a6a02b3b97a1f804e1f3 | Python | Rafabaring/SpringBoard | /Guided_capstone/sqlManager.py | UTF-8 | 2,156 | 2.671875 | 3 | [] | no_license | import psycopg2
import pandas as pd
import config as cfg
class Database:
def __init__(self):
self.hostname = cfg.HOSTNAME
self.username = cfg.USERNAME
self.password = cfg.PASSWORD
self.database = cfg.DATABASE
def connect(self):
postgree_connection = psycopg2.connect... | true |
e0739e932dd9b5bc96d94dd85c15155a2ca36be6 | Python | rvanvenetie/stbem | /src/quadrature.py | UTF-8 | 8,869 | 2.828125 | 3 | [
"MIT"
] | permissive | import numpy as np
from .quadrature_rules import (gauss_log_quadrature_rule,
gauss_sqrtinv_quadrature_rule,
gauss_x_quadrature_rule,
log_log_quadrature_rule, log_quadrature_rule,
sqrt_quadrature_... | true |
00e542545974f3d446c6c5f2d23fce4926c7218b | Python | b-oppon-work/Python-Training | /wk4sem1/worksheet4-Q2.py | UTF-8 | 484 | 4.4375 | 4 | [] | no_license | # 2.Write a function that prompts students for how many credits they have.
# Print whether or not they have enough credits for graduation (At UoW 360 credits are needed for graduation).
def students_credit_checker(score):
if (score >= 360 ):
print("Congrats, you made it")
else :
print("Sorry y... | true |
b5eedb33669209ad106e6023147f7f6a8e6d3630 | Python | daniel-reich/ubiquitous-fiesta | /mwGt38m3Q3KcsSaPY_23.py | UTF-8 | 56 | 3.015625 | 3 | [] | no_license |
def increment_items(lst):
return [i+1 for i in lst]
| true |
8bce8f58d2959e3a619053447e76a8eef85b2357 | Python | shivkumarsah/python-code-test | /Solution_ShivKumarSah_5years.py | UTF-8 | 1,766 | 3.46875 | 3 | [] | no_license | #! /usr/bin/python
# -*- encoding: ASCII -*-
# Author - Shiv Kumar Sah
# Date - 16 June 2014
# Company max share price calculation from CSV file
# Program takes CSV file as STDIN for data
# Output
# <company>:<year>:<march>
import sys # Sys for stdinp , stdout
import csv # CSV parser
def read_csv_conve... | true |
fb7239b42b3c6e95e97636f86df6f256b358bdea | Python | lyj-cooyun/CodingGame | /ColorFightAI/colorfight.py | UTF-8 | 10,164 | 2.5625 | 3 | [
"MIT",
"GPL-3.0-only"
] | permissive | import requests
import json
import os
import random
import threading
hostUrl = 'https://g.fallin.dev/'
def CheckToken(token):
headers = {'content-type': 'application/json'}
r = requests.post(hostUrl + 'checktoken', data=json.dumps({'token':token}), headers = headers)
if r.status_code == 200:
ret... | true |
7e396a30ab4ad79c5416960adb1d551f49d7d184 | Python | 23b00t/chatbot | /chatbot.py | UTF-8 | 1,137 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
def chatbot():
zufallsantworten=["Oh, wirklich", "Interessant ...", "Das kann man so sehen", "Ich verstehe ..."]
reaktionsantworten = {"hallo": "Hallo du!",
"geht": "Was verstehst du darunter?",
"essen": "Ich habe leider keinen Geschmackssinn :(",
"spaß":... | true |
300bf60f010cee662e297dac5d93b8f62ab4cef5 | Python | ni/nixnet-python | /nixnet/system/_collection.py | UTF-8 | 1,449 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
try:
from collections.abc import Iterable, Sized # python 3.3+
except ImportError:
from collections import Iterable, Sized # python 2.7
import typing # NOQA: F401
from nixnet import _cprops
class... | true |
f6c4ffbaf2260be3c0bb7d32f4de28c6bab2d8e6 | Python | gitGUAP/Sem5 | /MathematicalPackages/МППИван/lab1IvanPy.py | UTF-8 | 753 | 3.421875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import csv
with open("tsv.tsv") as tsvfile:
tsvreader = csv.reader(tsvfile, delimiter = "\t")
for line in tsvreader:
tsv = line
a = float(tsv[0])
b = float(tsv[1])
c = float(tsv[2])
print(a,b,c)
delta = 0.01
x1 = np.arange(-10.0, -1.0, delta)
y1 = ... | true |
cb1a310f54829870180bee77485ec6b78173be2f | Python | daniel2012600/indicator | /indicator/library/download_gcs_file.py | UTF-8 | 604 | 2.625 | 3 | [] | no_license | from google.cloud import storage
import os
class gcs_download:
_storage_client = None
def __init__(self, jsonkey):
self._storage_client = storage.Client.from_service_account_json(
jsonkey)
def download_file(self, bucket_name, fpath, destination_name):
if len(fpath) == 0:
... | true |
87e87abc6bcedda29a349fb945fd45541e8a681a | Python | AirborneRON/Python- | /chatbot/chatBot.py | UTF-8 | 1,980 | 3.625 | 4 | [] | no_license | file = open("stop_words")
stopList = file.read().split("\n")
file.close()
# how to open up my plain text file, then create a variable to stuff the read file into
#seperating each element of the list by the return key
#then close
# all responses should start with a space before typing
print(" Hello ")
response =... | true |
67450b9347ee8fdd27f8bc76607f35e9bb441c8c | Python | CodeMaxx/CS386-AI-Lab | /practice/lab9/rollno_lab5/kmeans.py | UTF-8 | 13,943 | 3.28125 | 3 | [] | no_license | from math import *
import random
from copy import deepcopy
import numpy as np
def argmin(values):
return min(enumerate(values), key=lambda x: x[1])[0]
def avg(values):
return float(sum(values))/len(values)
def readfile(filename):
'''
File format: Each line contains a comma separated list o... | true |
f393e291b964045173d745cff81ee2fd6e2824f7 | Python | marnixvds/ucaccmet2j_python | /precipitation_calculations_MvdS.py | UTF-8 | 3,213 | 3.609375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import json
#Load JSON file into a list of dictionaries
with open('precipitation.json') as file:
precipitation_data = json.load(file)
#Make a dictionary with stations from CSV file
with open('stations.csv') as file:
stations = {}
headers = file.readline()
for line in file:
... | true |
921e93f3d03ab704f6db0927c0533dda0cce1ff6 | Python | trinhvanson1997/rasa | /train_nlu.py | UTF-8 | 630 | 2.546875 | 3 | [] | no_license | from rasa_nlu import config
from rasa_nlu.model import Interpreter
from rasa_nlu.model import Trainer
from rasa_nlu.training_data import load_data
def train (data, config_file, model_dir):
training_data = load_data(data)
trainer = Trainer(config.load(config_file))
trainer.train(training_data,num_threads=3... | true |
ce4b685cf551097cfe75546f71775acb8b1e693e | Python | rmhsilva/CS110-Assignments-Python | /week02/rainbow.py | UTF-8 | 1,149 | 3.25 | 3 | [
"MIT"
] | permissive | import turtle
from turtle import *
wn = turtle.Screen()
def HSB2RGB(hues):
hues = hues * 3.59 #100转成359范围
rgb=[0.0,0.0,0.0]
i = int(hues/60)%6
f = hues/60 -i
if i == 0:
rgb[0] = 1; rgb[1] = f; rgb[2] = 0
elif i == 1:
rgb[0] = 1-f; rgb[1] = 1; rgb[2] = 0
elif i == 2:
rgb[0] = 0; rgb[1] = 1; rg... | true |
233f18c1bf333e12ba3520ee88fb382145047e57 | Python | ju-sh/abbrv.jabref.org | /combineJournalLists.py | UTF-8 | 874 | 3.21875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | #!/usr/bin/python
# Python script for combining several journal abbreviation lists
# and producing an alphabetically sorted list. If the same journal
# names are repeated, only the version found last is retained.
#
# Usage: combineJournalLists.py outfile infile1 infile2 ...
import sys
import fnmatch
import os
outFil... | true |
99f3abddd4f5c00e310663adb772fe52203b0198 | Python | Namrata96/automatic-essay-and-grammar-scoring | /lstm_codefiles/lstm_classify_batch_test.py | UTF-8 | 5,755 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 24 13:57:51 2018
@author: nam
"""
from keras import backend as K
from keras import losses
from keras.optimizers import RMSprop, SGD, Adam
from keras.models import Model
from keras.layers import Input, Embedding, Dense, Bidirectional, LSTM,Dropout
im... | true |
976cf5b5e9936162f3fa1a744f59d80cdf0517d5 | Python | kkikori/0723_analysis | /create_dummy_discussion/test.py | UTF-8 | 1,623 | 2.65625 | 3 | [] | no_license | import fetch_api
import simplejson as json
import csv
from pathlib import Path
def _csv_convert(thread_data):
posts_list = []
header = ["post_id", "sentence_id", "parent_id", "user_id", "title", "body"]
posts_list.append(header)
for post in thread_data["posts"]:
user_id = post["user"]
... | true |
b51fdcaec7d34ba2da5fa62dd1fe7061160edd4e | Python | AnvarM/python_algorithms | /sort_algorithms/big_array.py | UTF-8 | 343 | 3.5625 | 4 | [] | no_license | import random
def get_big_array():
big_array = []
for i in range(499999):
big_array.append(int(random.random()*499999))
return big_array
def get_big_array_with_range_of_values():
big_array = []
for i in range(499999):
big_array.append(random.randint(0,9)) # integers will be [0..9]... | true |
ae76abfb456dbd45746a861a93905f61e0484171 | Python | aguscerdo/183DB-phantombots | /maps/make_new_map.py | UTF-8 | 296 | 3.1875 | 3 | [] | no_license | import csv
import os
def make_map(n):
pos = [[i, j] for i in range(n) for j in range(n)]
file_name = '{0}x{0}.csv'.format(n)
with open(file_name, 'w') as file:
for t in pos:
file.write("{},{}\n".format(t[0], t[1]))
return file_name
if __name__ == '__main__':
n = 6
make_map(n) | true |
bddf968a265c35095b721ae4fe340f2bceeb1ba6 | Python | v-datnvt2/Destroyer-v1.0 | /main.py | UTF-8 | 1,741 | 3.015625 | 3 | [] | no_license | import turtle
import time
import math
import random
import os
import time
from threading import Thread
import threading
from heros import Heros
from border import Border
from monster import Monsters
from score import Score
def isCollision(t1, t2):
d = math.sqrt(math.pow(t1.xcor() - t2.xcor(), 2) + math.pow(t1.ycor... | true |
2c992440756b5d2beda0ef1a0b4ce52b71c3bccd | Python | chuubastis/CSC121 | /Lessons/mongCSC121midterm2.py | UTF-8 | 609 | 3.765625 | 4 | [] | no_license | scores = []
scoreLen = len(scores)
for i in range (0,7):
score = int(input("Give a students test score:"))
scores. append(score)
print(scores)
scores.sort()
print("The highest score is:" ,scores[-1])
passScores =[]
i = 0
for i in scores:
if i >= 70:
passScores.append(i)
passnum = len(passScores)
... | true |
8e5570207454a5aa4f5b25bf5e08333497962c12 | Python | anupam2505/Code-Practice | /PlayerOrder.py | UTF-8 | 721 | 3.15625 | 3 | [] | no_license |
n = int (raw_input())
mat = []
for a0 in xrange(n):
S = list(str(raw_input()))
mat.append([])
mat[a0].append(a0+1)
for i in S:
mat[a0].append(i)
list = []
def matrix(mat,n, list):
ind =0
if (len(mat)==0):
return list
if (len(mat)==1):
list.append(mat[0][0])
... | true |
0778ccfd4830cb34d032acaf51f4dfd764f07cb3 | Python | marlonrenzo/A01054879_1510_assignments | /A3/character.py | UTF-8 | 1,300 | 4.375 | 4 | [] | no_license | def get_character_name():
"""
Inquire the user to provide a name.
:return: a string
"""
name = input("What is your name?").capitalize()
print(f"Nice to meet you {name}\n")
return name
def create_character() -> dict:
"""
Create a dictionary including attributes to associate to a ch... | true |
75f5d0e5d150542eaa40044f61dca5172463c1e3 | Python | ms-kim520/Coding_Study | /swea_5122_linkedlist.py | UTF-8 | 639 | 3 | 3 | [] | no_license | T=int(input())
for test_case in range(1,T+1):
N,M,L = map(int,input().split())
#N=수열의 길이, M = 추가횟수, L = 인덱스 번호
lst = list(map(int,input().split()))
for _ in range(M):
info = list(input().split())
character = info.pop(0)
info = list(map(int,info))
idx=info[0]
if ch... | true |
503f113d246ca8fc41439aaf8c569e41010b8cdf | Python | e-dang/Web-Games | /tests/functional_tests/pages/home_page.py | UTF-8 | 567 | 2.859375 | 3 | [
"MIT"
] | permissive | from .base_page import BasePage
class HomePage(BasePage):
def has_correct_title(self):
return super().has_correct_title(None)
def has_correct_header(self):
return super().has_correct_header(None)
def select_game_using_cards(self, game):
id_map = {
'snake': 'snakeCard'... | true |
c940d0480aa2ab3a562acc7d72015970fbbf7d89 | Python | cassandrami/Server-Proxy | /proxy/proxy.py | UTF-8 | 5,994 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import sys
import itertools
import socket
import threading
from threading import Thread
from socket import socket as Socket
'''
class thread(threading.Thread):
def __init__(self, data):
threading.Thread.__init__(self)
self.data = data
def run(self):
''... | true |
6731b3c59aadff0bc3178867e795d8dc1d55f44d | Python | WojciechBogobowicz/UWr-Math-Students-Finder-with-SQL | /main.py | UTF-8 | 1,934 | 3.15625 | 3 | [] | no_license | import PySimpleGUI as sg
from logic import Logic
from windows import Windows
"DarkPurple"
'Topanga'
sg.theme('DarkTeal2')
l = Logic()
w = Windows()
layout = [
[sg.Button(' Aktualizuj baze '), sg.Button('Sprawdz aktualizacje ')],
[sg.Button('Znajdź wspólne grupy '), sg.Button('Zapisani na p... | true |
4a3c7d30e7ebe3ffdf6ff2ed69d300234bf05642 | Python | houchenAlan/Deep-Learning | /attention/test1.py | UTF-8 | 1,281 | 2.734375 | 3 | [] | no_license | from keras.datasets import imdb
from keras.preprocessing import sequence
from keras.layers import Dense,Embedding,SimpleRNN
from keras import Sequential
import matplotlib.pyplot as plt
max_feature=10000
max_len=500
batch_size=32
print('Loading data...')
(input_train,y_train),(input_test,y_test)=imdb.load_data(num_words... | true |
fcb88de2a179f1ceceb03e9a414ccbb479b88942 | Python | raunakbhupal/FingerCounting-OpenCV | /Finger_counting.py | UTF-8 | 3,160 | 2.796875 | 3 | [] | no_license | import cv2
import numpy as np
from sklearn.metrics import pairwise
background =None
acc_weight = 0.5
roi_top=20
roi_bottom=300
roi_right =300
roi_left=600
def cal_acc_weight(frame,acc_weight):
global background
if background is None:
background=frame.copy().astype('float')
return None
c... | true |
13f65f6e3e82c7095b5b1e793b816b28b987de48 | Python | jthunt13/Cambridge-Analytic-Facebook-Data-Mining | /src/dataClean/decodeTxt.py | UTF-8 | 833 | 2.546875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import os
os.getcwd()
def reEncodeDirectory(f):
for i in range(len(f)):
# strip .txt off of file names
fname = f[i].replace(".txt","")
# open file to write too
f2 = open(fname + "ascii.txt","w")
# open file to decode and decode it and write it to another... | true |
3c53406ee712adb6b8c1b6b07c79d195bd3b58ba | Python | basakrajarshi/Anaheim-Road-NAM | /anaheim_test_2.py | UTF-8 | 4,462 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 2 23:59:37 2018
@author: rajar
"""
import matplotlib.pyplot as plt
import networkx as nx
import operator as op
import numpy as np
import time
start_time = time.time()
# Read and store the graph for the weighted data
# Anaheim-flow-3.txt
graph1 = ... | true |
f6f392ee74d49df96ade6eb7ccd3028929a4baca | Python | xw310/CS536 | /SVM Problems/svm1.py | UTF-8 | 1,021 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python3
#-*-coding:utf-8-*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
X = np.c_[(1, 1), (-1, -1), (-1, 1), (1, -1)].T
y = [-1, -1, 1, 1]
poly_svc = svm.SVC(kernel='poly', degree=2, coef0=1).fit(X, y)
Gaussian_svc = svm.SVC(kernel='rbf').fit(X, y)
x_min, x_max = X[:, 0].... | true |
084592a03e76ce95f6405af62aefcb2da4745abe | Python | yr0901/algo_yeeun | /SWEA/문제풀이/sw_1961.py | UTF-8 | 705 | 2.9375 | 3 | [] | no_license | #숫자 배열 회전
import sys
sys.stdin=open('input.txt','r')
tcase=int(input())
for tc in range(tcase):
N=int(input())
arr=[list(input().split()) for _ in range(N)]
new=[[0 for _ in range(N)] for _ in range(N)]
anwlist=[]
for n in range(3):
for x in range(N): #90도 돌리기
for y in range(N):... | true |
7f29c94df267a6b67dab8220a8a891aabcdc8281 | Python | Ww2Zero/show-you-my-codes | /016/py016.py | UTF-8 | 1,103 | 3.265625 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# author: Ww2Zero
# Date: 2017/02/26
# Time: 12:57
# Blog: Ww2zero.github.io
# Function description
#**第 0016 题:** 纯文本文件 numbers.txt, 里面的内容(包括方括号)如下所示:
# [
# [1, 82, 65535],
# [20, 90, 13],
# [26, 809, 1024]
# ]
import json
import xlwt
class txtToXls(object)... | true |
55f9f43f0862cbf25747e33298ec7fc1f76ee6b2 | Python | RadioAstronomySoftwareGroup/pyuvdata | /pyuvdata/uvflag/uvflag.py | UTF-8 | 168,093 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Primary container for radio interferometer flag manipulation."""
import copy
import os
import pathlib
import threading
import warnings
import h5py
import numpy as np
from .. import p... | true |
f206235eac078aa0894c71a9cab2ba1a0c815ed8 | Python | Nilutpal-Gogoi/DataStructures-Algorithms | /Recursion In Python/2. IterationVsRecursion/5. Search First Occurence Of A Number.py | UTF-8 | 896 | 4.34375 | 4 | [] | no_license | # Implement a function that takes an array "arr", a "testVariable" (containing the
# number to search) and "currentIndex" (containing the starting index) as parameters.
# This function should output the index of the first occurrence of testVariable in arr.
# If testVariable is not found in arr it should return -1.
# I... | true |
5c7221192a98935ae0583c4ee279589dcae73539 | Python | sadfire/mafia_bot | /Tests/TimerTest.py | UTF-8 | 367 | 2.5625 | 3 | [] | no_license | import time
from GameView.Timer import Timer
def timer_test():
timer = Timer(seconds=10,
callback_process=lambda h: print(h, "Process"),
callback_stop=lambda h: print(h, "Stop"),
args=("World", "Condor"))
timer.start()
while True:
time.sleep(1... | true |
9e5b0148de6033e608c8e66f9aa8921d72d9206f | Python | abishekravi/guvipython | /pro24.py | UTF-8 | 281 | 2.703125 | 3 | [] | no_license | #a
ni=int(input())
n1=2**ni
list1=[]
for i in range(0,n1):
l=bin(i)[2:].zfill(ni)
if(len(l)<len(bin(2**ni-1)[2:])):
list1.append([l.count("1"),l])
else:
list1.append([l.count("1"),l])
list1.sort()
for i in range(len(list1)):
print(list1[i][1])
| true |
03353bd32fc76b41108d70e6c9841d6857ae0f64 | Python | fedebatti/Boxing-Atari-Deep-Reinforcement-Learning | /Reinforce/montecarlo.py | UTF-8 | 1,466 | 3.03125 | 3 | [] | no_license | import gym
from obs_preprocessing import observation_preprocessing
from reinforce_agent import reinforce_agent
#MonteCarlo Rollout implementation to play the full episode
def montecarlo_rollout(agent, env, training=True):
#Variables init
steps_list = []
reward_accumulator = 0
step_index = 0
done = ... | true |
4c4313b3fb221c4875eb5d62cba5af7c0d70bc98 | Python | crystal80314/DMMT | /實習判官-A數值(每群組玩過的劇本數).py | UTF-8 | 1,255 | 2.890625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime
####import json檔案
data="https://judicial-intern.dmmt.design/api/v1/group_story_ships?fbclid=IwAR0YSAzg_DpezpZSe-cp59oSHuC_yNtKLl-PetnwlLvHqx0p01_IudUrO_I"
raw_df= pd.read_json(data)
df= raw_df.loc[:,["group_id","story_id","created... | true |
08bd4eb284b3114ed4166ff63f4d3dbaa922df6d | Python | JQmainblack/XOJ | /Crawler/HDU.py | UTF-8 | 2,991 | 2.734375 | 3 | [] | no_license | import urllib.request, urllib.parse
import http.cookiejar
from bs4 import BeautifulSoup
import re
class HDU:
def __init__(self):
self.index_url = 'http://acm.split.hdu.edu.cn/'
self.login_url = self.index_url + 'userloginex.php?action=login'
self.submit_url = self.index_url + 'submit.php?action=submit'
self.... | true |
8e91bb7491478516ab6cd8331ae82371dceabdb4 | Python | impatmcb/report-automation | /training_resource_management/extravars.py | UTF-8 | 2,632 | 3.015625 | 3 | [] | no_license | # Determine the date of the class
def classdate(number):
return (datetime.date.today() + datetime.timedelta(days=(number-datetime.date.today().weekday()))).strftime("%m/%d")
nextmon, nexttue, nextwed, nextthu, nextfri = classdate(7), classdate(8), classdate(9), classdate(10), classdate(11)
# Get coaches for eac... | true |
d54f10c3c7742e0df8fe9e3eec5cd5f1b6fddce1 | Python | gbtami/flexx | /flexx/app/funcs.py | UTF-8 | 21,511 | 2.65625 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Functional API for flexx.app
"""
import os
import sys
import json
from .. import webruntime, config, set_log_level
from . import model, logger
from .model import Model
from .session import manager
from .assetstore import assets
from .tornadoserver import TornadoServer
from ..event import _loop
reprs = json.dump... | true |
28ebb6a230ece56b4c3ed0de11466de605e43f5c | Python | ichko/differentiable-simulation | /notebooks/pong_gym/data.py | UTF-8 | 1,048 | 2.984375 | 3 | [] | no_license | import random
import numpy as np
import gym
def get_single_sequence(seq_len):
env = gym.make('PongDeterministic-v4')
env.reset()
env.seed(0)
actions, observations, rewards, done = [], [], [], []
for _ in range(seq_len):
# stay, up, down
action = random.choice([1, 2, 3]) # env.ac... | true |
d390291804915f3511e2cea8838a104aa7cad27d | Python | Sam-ONeill/ComputerVisionTheBasics | /ISL-Detection/Hand-Detection-master/Fingers.py | UTF-8 | 11,902 | 2.578125 | 3 | [] | no_license | from Detector import HandDetector
import cv2
import math
import numpy as np
handDetector = HandDetector(min_detection_confidence=0.7)
webcamFeed = cv2.VideoCapture(0)
while True:
status, image = webcamFeed.read()
handLandmarks = handDetector.findHandLandMarks(image=image, draw=True)
count = 0
letter =... | true |
eaaefcae83961578231c4cd29a24440f63b93d1d | Python | surrealwork-dev/TF-Tutorials | /wFmConv.py | UTF-8 | 5,781 | 3.203125 | 3 | [] | no_license | # Necessary architecture to implement calculation of the weighted
# Frechet mean.
import numpy as np
import doctest
def enforce_bounds(theta):
'''Ensures that theta remains within the interval [-pi,pi].
>>> enforce_bounds(-4)
2.2831853071795862
>>> enforce_bounds(-np.pi)
-3.141592653589793
>>... | true |
821a19b7416ea15e6bf50cbd14524289b51e0da0 | Python | GlennGuan/learn_cookbook | /chapter7/7_10.py | UTF-8 | 2,568 | 3.859375 | 4 | [] | no_license | #. 在回调函数中携带额外的状态 p239
# 回调函数可以携带额外的状态以便在回调函数内部使用。
# 调用一个回调函数
def apply_async(func, args, *, callback): # 线程,进程 定时器。
# compute the result
result = func(*args)
# invoke the callback with the result
callback(result)
def print_result(result):
print('Go:', result)
def add(x, y):
return x + y
apply_async(add, ... | true |
734c5b8f5fb62b861d5c6563e875d1aa57a21ebd | Python | neurips2020submission11699/metarl | /src/metarl/sampler/sampler.py | UTF-8 | 3,727 | 3.15625 | 3 | [
"MIT"
] | permissive | """Base sampler class."""
import abc
import copy
class Sampler(abc.ABC):
"""Abstract base class of all samplers.
Implementations of this class should override `construct`,
`obtain_samples`, and `shutdown_worker`. `construct` takes a
`WorkerFactory`, which implements most of the RL-specific functiona... | true |
f34a776661ddc463692bbc0641cd7510fe46b381 | Python | MiYoShi8225/cohabi-api | /db/util.py | UTF-8 | 325 | 2.765625 | 3 | [] | no_license | import json
def get_db_dsn(path: str) -> str:
with open(path) as f:
acskey = json.load(f)
db_acs = acskey['database']
return 'mysql://{user}:{passwd}@{host}/{dbname}'.format(
user=db_acs["user"],
passwd=db_acs["passwd"],
host=db_acs["host"],
dbname=db_acs["db"],
... | true |
2c4f2f6186d5eb07da5a9cbe36ce3ab8d814e8f9 | Python | MysteriousSonOfGod/asyncframeworks | /official/qt5frames/examples/layouts.py | UTF-8 | 3,049 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (c) Sebastian Klaassen. All Rights Reserved.
# Distributed under the MIT License. See LICENSE file for more info.
from asyncframes import Frame, hold, sleep
from qt5frames import *
from asyncframes.pyqt5_eventloop import EventLoop
@MainWindow(size=(200, 100), title="Central Layout ... | true |
cf7815596cf00315b42703cf9d29f77818fa3498 | Python | redswallow/project-euler | /p23.py | UTF-8 | 668 | 3.09375 | 3 | [] | no_license | def divisors(n):
l=[]
for i in range(1,n):
if n%i==0:l.append(i)
return l
def abundant(n):
return sum(divisors(n))>n
ans=[]
'''
abundant_num=filter(abundant,range(1,28123))
#print abundant_num
file=open("p23.data","w")
for l in abundant_num:
file.write(str(l)+'\n')
'''
file=open("p23.data... | true |
fac765bb35a23d18fd9e5850e81f1be95af11181 | Python | xyt556/geothermal_image_classification | /CNN_test.py | UTF-8 | 3,921 | 2.53125 | 3 | [] | no_license | ### July 2021
### Taken from https://towardsdatascience.com/neural-network-for-satellite-data-classification-using-tensorflow-in-python-a13bcf38f3e1
### Ideas: Need labeled training data
### Need to take geologic map and rasterize it (or certain lables of it)
### 1. Turn of Jupyter Notebook
### 2. Import Geologic map... | true |
54e3cf09b15f967ad6dbcad7b808283e4e5616e3 | Python | bulmasen/learn-to-program | /GB_LearnProgramming/Python_Programming/lesson-05/homeWork-lesson05_5.py | UTF-8 | 970 | 3.5 | 4 | [] | no_license | # Создать (программно) текстовый файл, записать в него программно набор чисел,
# разделенных пробелами. Программа должна подсчитывать сумму чисел в файле и
# выводить ее на экран.
from random import randint, random
from functools import reduce
from os.path import abspath
s1 = 'proc_file.txt'
with open(s1, 'w') as pr... | true |
e63dfffb7bfa1358b5514ce9a736604cdbfa867e | Python | Bradley999/Street-Sprinter | /Street_Sprinter.py | UTF-8 | 28,334 | 2.828125 | 3 | [] | no_license | import random
import pygame
import os
import time
WIDTH = 600
HEIGHT = 1000
FPS = 30
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
vec = pygame.math.Vector2
WHITE = (255, 255, 255)
#ASSET FOLDER
game_folder = os.path.dirname(__file__)
img_folder = os.path.join(game_folder, "img")
pygame.init()
pygame.mixer.... | true |
450d30a25a79d6d945a7eec2462548a545ef6454 | Python | mackmason/hw3-p | /main.py | UTF-8 | 338 | 4.21875 | 4 | [] | no_license | # Author: Mack Mason mjm8542@psu.print
def digit_sum(n):
if(n > 0):
remainder = (n % 10)
return remainder + digit_sum(n//10)
else:
return 0
def run():
userInt = input("Enter an int: ")
userInt = int(userInt)
digitSum = digit_sum(userInt)
print(f"sum of digits of {userInt} is {digitSum}.")
if... | true |
33d207855d7ab1d38faa3b7dfce7155eaac74fe1 | Python | china-university-mooc/Python-Basics | /ChapterI/Exercise/I.2-1-Temperature-Conversion.py | UTF-8 | 237 | 3.390625 | 3 | [] | no_license | str = input()
if str[-1] in ['C', 'c']:
f = eval(str[:-1]) * 1.8 + 32
print('{:.2f}F'.format(f))
elif str[-1] in ['F', 'f']:
c = (eval(str[:-1]) - 32) / 1.8
print('{:.2f}C'.format(c))
else:
print('输入格式错误') | true |
b2f31153aff0c01fbfaa33e4a3168ad982216c6c | Python | Ryan-Rhys/Heteroscedastic-BayesOpt | /objectives.py | UTF-8 | 4,548 | 3.4375 | 3 | [
"MIT"
] | permissive | # Copyright Ryan-Rhys Griffiths 2020
# Author: Ryan-Rhys Griffiths
"""
This module contains objective functions for heteroscedastic Bayesian Optimisation. Train objectives represent the
noise-corrupted values that a model will observe within the BO loop. Exact objectives represent the ground truth
black-box objective b... | true |
ecf5bd25e3d4ab769385fd52a5bf8b98bc6cd497 | Python | infinitel8p/forex_exch_calculator | /main.py | UTF-8 | 5,114 | 2.71875 | 3 | [] | no_license | from kivymd.uix.screen import MDScreen
from kivymd.app import MDApp
from kivy.uix.image import Image
from kivymd.uix.button import MDFillRoundFlatIconButton, MDFillRoundFlatButton
from kivymd.uix.textfield import MDTextField
from kivymd.uix.label import MDLabel
from kivymd.uix.toolbar import MDToolbar
import requests
... | true |
794a95255a3457723e3aa93ef4e06a168fd8bb27 | Python | TheRaven5520/Die-Module | /Die.py | UTF-8 | 1,338 | 3.484375 | 3 | [
"MIT"
] | permissive | from datetime import datetime
import random
class Die:
def __init__(self, numSidesP = 6, sidesP = [], weightP = []):
if sidesP == []:
for i in range(1,numSidesP + 1):
sidesP.append(i)
self.sides = sidesP
if weightP == []:
weightP = [1]*numSide... | true |
98a4dd0ab3882176dd538cb667d4e7656dfbf8f8 | Python | dataAlgorithms/data | /python/fileIO_iterOverFixedSizedRecords.py | UTF-8 | 394 | 3.03125 | 3 | [] | no_license | In [3]: !more somefile.txt
111111
222222
333333
444444
555555
666666
In [4]: from functools import partial
In [5]: with open('somefile.txt', 'rb') as f:
...: records = iter(partial(f.read, 3), b'')
...: for r in records:
...: print(r)
...:
b'111'
b'111'
b'\r\n2'
b'222'
b'22\r'
b'\n33'
b'33... | true |
f33a272d71d4eb2c38ae3e97f714a17024a919c5 | Python | Kaiquenakao/Python | /Coleções Python/Exercicio10.py | UTF-8 | 344 | 4.1875 | 4 | [] | no_license | """
10. Faça um programa para ler a nota da prova de 15 alunos e armazene num vetor calcule
e imprima a média geral
"""
import statistics
notas = []
for i in range(1,5):
nota = float(input(f'Aluno{i}:Insira a sua nota:'))
if nota < 10 and nota > 0:
notas.append(nota)
print(f'Média geral: {stat... | true |
e88d74192c4e8dee4e868f88bc5945f596b67079 | Python | abhiksark/Machine-Learning | /machine learning/hotstar/solution.py | UTF-8 | 7,877 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 18:05:45 2017
@author: abhik
"""
import numpy as np
import pandas as pd
import re
import matplotlib.pyplot as plt
from external_functions import printing_Kfold_scores
from sklearn.svm import SVC
test_data = pd.read_csv("test_data.csv")
train_da... | true |
13d462d614a0e198309ba1cda84c9113ac71dbba | Python | Ahiganbana/Datacrt | /src/fighter.py | UTF-8 | 4,964 | 2.828125 | 3 | [] | no_license | import numpy as np
import math
import random
from matplotlib import pyplot as plt
from firecontrolradar import FireControlRadar
from cplane import Plane
class Fighter(Plane):
"""
战斗机
具有的动作:
直线 转弯 爬升 俯冲 筋斗 上升转弯
"""
def __init__(self, id, init_data):
#初始化数据
self.init_data = init_... | true |
7e63ab81ae42d4ba9bc246cb5d3fe87c3a9e052c | Python | billster2006/Module5 | /While loops/input_while.py | UTF-8 | 265 | 4.1875 | 4 | [] | no_license | # list to store guesses
empty_list = []
# user input
guessed_number = int(input('Enter a number between 1 and 100.'))
while 1 <= guessed_number >= 100:
int(input('Enter a number between 1 and 100.'))
empty_list.append(guessed_number)
print(empty_list)
| true |
1e310564a9e420b8efe8efbaa04d5130186ab9d5 | Python | fac3d/EveMarket | /market_file_import.py | UTF-8 | 1,623 | 2.890625 | 3 | [] | no_license | #trying to import all market items for sale in a station
import requests
import json
import pandas as pd
import numpy as np
import product_total_sold from functions
import product_total_added from functions
from datetime import timedelta, date, datetime
Amarr = '10000043'
Hek = '10000042'
Jita = '10000002... | true |
98e69163e49a26e50d1808f71cb4b10484f807ac | Python | nianien/algorithm | /src/main/python/leetcode/editor/cn/AddBinary.py | UTF-8 | 1,412 | 3.59375 | 4 | [] | no_license | # 67.add-binary
# 给你两个二进制字符串,返回它们的和(用二进制表示)。
#
# 输入为 非空 字符串且只包含数字 1 和 0。
#
#
#
# 示例 1:
#
# 输入: a = "11", b = "1"
# 输出: "100"
#
# 示例 2:
#
# 输入: a = "1010", b = "1011"
# 输出: "10101"
#
#
#
# 提示:
#
#
# 每个字符串仅由字符 '0' 或 '1' 组成。
# 1 <= a.length, b.length <= 10^4
# 字符串如果不是 "0" ,就都不含前导零。
#
# ... | true |
ab7a3a0655ba6ad179a6f9f700cb64d7a75ff563 | Python | Safery/pyplots | /price.py | UTF-8 | 626 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import time
import requests
import numpy as np
import matplotlib.pyplot as plt
from sys import argv
script, infile = argv
k = 1
v = []
x = []
while True:
req = requests.get("http://coinbase.com/api/v1/prices/historical?page="+str(k))
if req.status_code == 200:
with open(infile,'a') a... | true |
e9f8e4082d29e91fb7bdb23ee1f7f822bd4be6ed | Python | tankman89/pycharmprojects | /division.py | UTF-8 | 585 | 3.859375 | 4 | [] | no_license | # !/usr/bin/python3
# -*- coding:utf-8 -*-
# author:tank_man time:2018/4/7
print('给我两个数字,我将把他们两个相除!')
print("输入'退出'退出!")
while True:
first_number = input('\n请输入第一个数字')
if first_number == '退出':
break
second_number = input('\n请输入第二个数字')
if second_number == '退出':
print('\n回头见!')
b... | true |