blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
2bd4c90ede61a29848ada992cf6f7fef9ef2b309 | willtownes/python | /science/helper_functions.py | UTF-8 | 2,175 | 3.34375 | 3 | [] | no_license | """Miscellaneous functions and code patterns that are useful in scientific computing"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gammaln
def pdf_factory(d):
"""Returns Chi-Distribution PDFs indexed by parameter d"""
def pdf_z(z,logscale=False):
"""Compute PDF of Chi... | true |
76687984e1c01d88c2719ee52077067d976dfd77 | zhongmb/suanfa | /leetcode/1035. 不相交的线.py | UTF-8 | 1,527 | 3.8125 | 4 | [
"Apache-2.0"
] | permissive | '''
我们在两条独立的水平线上按给定的顺序写下 A 和 B 中的整数。
现在,我们可以绘制一些连接两个数字 A[i] 和 B[j] 的直线,只要 A[i] == B[j],且我们绘制的直线不与任何其他连线(非水平线)相交。
以这种方法绘制线条,并返回我们可以绘制的最大连线数。
示例 1:
输入:A = [1,4,2], B = [1,2,4]
输出:2
解释:
我们可以画出两条不交叉的线,如上图所示。
我们无法画出第三条不相交的直线,因为从 A[1]=4 到 B[2]=4 的直线将与从 A[2]=2 到 B[1]=2 的直线相交。
示例 2:
输入:A = [2,5,1,2,5], B = [10,5,2,1,... | true |
ca4017261e62bca2757a6e6f43d0e6d37cac1d0b | FranciscoRamosO749/AprendaPython | /Acumulado.py | UTF-8 | 725 | 4.03125 | 4 | [] | no_license | #Autor: Francisco Ramos
#Fecha de creacion:23/09/2019
#las variables se declaran del trabajo con tipo explicito
acumulado=int(0)
numero=str("")
#el true como condicion de while se forma un
#ciclo infinito que no se rompera hasta que
#de forma explicita se utilice la instruccion break
while True:
num... | true |
aa9ebd6ede2492a844467cbae3ad1ec5712686b8 | pavank1996/KN_Internship | /Data.gov.in_MetaData Scraping.py | UTF-8 | 2,601 | 2.515625 | 3 | [] | no_license | import os, sys, time
import pandas as pd
import requests, json
from bs4 import BeautifulSoup
Export_Path = r"G:\sample progrmes"
URL = 'https://data.gov.in/ogpl_apis?page=0'
DataAll = pd.DataFrame()
Data_List = []
Response = requests.get(URL)
if Response.status_code == 200:
Soup = BeautifulSoup(Resp... | true |
7716a834285a7051e6fce13bedc40d2dd48395da | secure-zhang/learngit | /pyscrapy_exercise/练习/pc_03_正则.py | UTF-8 | 1,325 | 2.734375 | 3 | [] | no_license | import re
# str = '''asdasHello 123 456 World_This
# is a Regex Demo'''
# # result = re.match('^\w+.\d+.\d+.\w{2,10}.*\w$',str)
#
# result = re.search('.ello.*?(\d+.*\d).*o',str,re.S)
# print(result)
# print(result.group(1))
# print(result.span())
str = '''
<p class="content">
<a href="https://blog.csdn.net/dxyn... | true |
4544fefe70fb72ef8df32d3893d70332ad4489ac | SportsUnity/twitter_bot | /twitterflash.py | UTF-8 | 7,396 | 2.53125 | 3 | [] | no_license | import tweepy
import requests
import pymongo
import config
from datetime import datetime
from time import sleep, time, ctime
from random import randint
from celery import current_task
from celery.task.control import revoke
# import requests.packages.urllib3
# requests.packages.urllib3.disable_warnings()
import os
... | true |
f732a72d0e869828e1ff5dc65734f8003b76223c | phoenixxyang/leetcode_solution | /excel_column_number.py | UTF-8 | 505 | 3.328125 | 3 | [] | no_license | class Solution(object):
def titleToNumber(self, s): # 68ms
"""
:type s: str
:rtype: int
"""
if s == "":
return 0
num = 0
for i in range(0, len(s)):
num = num + 26**(i) * (ord(s[len(s) - i - 1]) - 64)
return num
if __name__ ==... | true |
1e568a5354107089a8b367fb418899fc6832e2d8 | mathewssabu/luminarpythonprograms | /pythoncore/flow controls/decision making/student.py | UTF-8 | 177 | 3.109375 | 3 | [] | no_license | totcls=int(input("enter total clses"))
atcls=int(input("enter attended clses"))
atnd=(atcls/totcls)*100
if(atnd>=75):
print("u r allowed")
else:
print("u r not allowed") | true |
746c190d48a8cfb1cbce589bda0966f86baa85ee | siirias/nemo_analysis | /latex_table.py | UTF-8 | 1,387 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import datetime as dt
import numpy as np
import pandas as pd
import os
import re
import netCDF4
from netCDF4 import Dataset
import xarray as xr
in_dir = '/scratch/project_2001635/siiriasi/smartsea_data/A001/'
files = os.listdir(in_dir)
files = [f for f in files if bool(re.match('2000.*shark.*nc... | true |
3d073dc1ae23a4d948d8b588c076b22cb0d8e977 | sambiak/tp13dec2017 | /habits.py | UTF-8 | 1,574 | 2.625 | 3 | [] | no_license | from random import shuffle
g = dict()
CHAUSSURE_GAUCHE = "chaussure_gauche"
CHAUSSETTE_GAUCHE = "chaussette_gauche"
CHAUSSURE_DROITE = "chaussure_droite"
CHAUSSETTE_DROITE = "chaussette_droite"
MONTRE = "montre"
PANTALON = "pantalon"
CEINTURE = "ceinture"
CHEMISE = "chemise"
PULL = "pull"
MANTEAU = "manteau"
CEINTURE =... | true |
154b51b5242c465c9835f39354f0dd9dee698770 | james88712/discordnewnewbot | /smartsv.py | UTF-8 | 1,416 | 2.53125 | 3 | [] | no_license | import discord, asyncio
import random
import datetime
from discord.ext import commands
import os
client = commands.Bot(command_prefix = '.')
@client.event
async def on_ready():
print(client.user.id)
print("봇이 시작되었습니다")
Game = discord.Game('유저들과 소통 중')
await client.change_presence(status... | true |
ee4e2db33fa8e7cbde5b0f7045e988e4a1abc751 | Sniccsnacc/Covid_modelling | /Parameters.py | UTF-8 | 1,473 | 2.5625 | 3 | [] | no_license | #%%
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
# region loading data and modifying
mat = pd.read_csv('Data2/Test_pos_over_time.csv', sep=';')
cases = np.array([mat.NewPositive[0:-2]]).squeeze().astype(int)
time = np.linspace(0, cases.size, cases.size)
sick = np.zeros(cases.size)
new... | true |
ea956a20cf4f40e7af3727de486ba5bde8b21310 | rodolfojbrandao/DataAnalysis | /TestInput.py | UTF-8 | 195 | 2.734375 | 3 | [] | no_license | N=8
NF = 100 #number of files
NP = 7382 #number of particles
ReadInput=[]
#Read input list ==================================
for i in range (N):
ReadInput.append([NF,NP,N,i])
print(ReadInput) | true |
66fe3de73b7402e7594a8ebad3cc8e921fb76d2b | LogicalFish/DiscordBot | /python/modules/nicknames/nickname_command.py | UTF-8 | 1,116 | 2.796875 | 3 | [] | no_license | import random
import config
from commands.command_superclass import Command
class CallmeCommand(Command):
"""
Command class for adding a nickname for the caller.
"""
def __init__(self):
super().__init__('nicknames')
self.parameters = self.parameters.format(config.configuration['nickn... | true |
2db7cc248ee21df7902e8533fc5c3468863950b1 | cycleseven/lunchbot | /lunchbot/emojis.py | UTF-8 | 1,542 | 2.875 | 3 | [
"MIT"
] | permissive | # Map of true/false (ie. yes/no) responses to appropriate Slack emoji names.
import random
emojis = {
True: [
"thumbsup",
"heart_eyes",
"heart_eyes_cat",
"grinning_face_with_star_eyes",
"ok_hand",
"muscle",
"100",
"sunglasses",
"money_mouth_fa... | true |
8a1985d20949c6641557fb486c0537bf52812de0 | allisonyee7/-csc202 | /ch5/bubble_sort.py | UTF-8 | 427 | 3.609375 | 4 | [] | no_license | def bubble_sort(a_list):
for pass_num in range(len(a_list) - 1, 0, -1):
for i in range(pass_num):
if a_list[i] > a_list[i + 1]:
temp = a_list[i]
a_list[i] = a_list[i + 1]
a_list[i + 1] = temp
a_list = [54, 26, 93, 17, 77, 31, 44, 55, 20]
a_list2 =... | true |
32befefbd0cafd51350eda50673e92c672c893c7 | YilingWang1997/Global-Soil-Virome | /GSV_MS_Figure3_GetValue_Script.py | UTF-8 | 817 | 2.703125 | 3 | [] | no_license | import gdal
import numpy as np
import sys
import pandas as pd
def CS_Transport(label_path):
reader= pd.read_csv(label_path, header=0, encoding='utf-8')
data=reader.values.tolist()
return data
def GetValue():
file1 = sys.argv[1]
label_path = r'$input.csv' #Location information included latitude ... | true |
ce4cf83a82c51e4f6230cf2994ffe2eac2f73a7d | tuji25/isle3hw | /assembler/assembler.py | UTF-8 | 9,183 | 3.21875 | 3 | [] | no_license | import os
import sys
def read_data():
"""
コマンドライン引数の一番目で指定されたファイルから読み取り、一行ずつリストにして返す。
コマンドライン引数が指定されなかった場合は、usageを表示してプログラムを終了する。
"""
if len(sys.argv) < 2:
print("usage: python3 assembler.py input-file [output-file]", file=sys.stderr)
exit(1)
path_in = sys.argv[1]
fin = ope... | true |
6a50c8ab2abba31e5ec7593718f87d862ea4cc98 | ItsBenms/Flask-API | /app.py | UTF-8 | 2,489 | 3.046875 | 3 | [] | no_license | from flask import Flask, jsonify, request, render_template
"""Flask APP to enable users to be displayed, added and deleted from an API"""
app = Flask(__name__)
users = [ # Users dictionary of the default users that can be added to
{
"id": 1,
"firstName": "George",
"lastName": "Bluth",
... | true |
f85d3ea3adb33f3c6ba15b061ee48fd2741ca45c | pgrandhi/pythoncode | /Class/MultiplicationTable.py | UTF-8 | 307 | 3.765625 | 4 | [] | no_license | print (" Multiplication Table")
print (" |", end='')
for j in range(1,10):
print(" ",j, end='')
print()
print ("---------------------------------------")
for row in range(1,10):
print(row, "|", end='')
for col in range(1,10):
print(format(row*col,"4d"),end='')
print()
| true |
20586176c927446ec0967bedc0de768f8b3c123a | edepanaf/fitting_text_distance | /build/lib/fitting_text_distance/fitting_vectorization/vector_from_dict.py | UTF-8 | 3,340 | 3.59375 | 4 | [
"BSD-3-Clause"
] | permissive | # © 2020 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
# !/usr/bin/env python3
# coding: utf-8
# Author: Élie de Panafieu <elie.de_panafieu@nokia-bell-labs.com>
from fitting_text_distance.tools.matrix_operations import *
class VectorFromDict:
""" Define a callable obj... | true |
a95d6be17df35a4ef447140e4e012d42c59d4c27 | julystone/keyou | /tkinter_pc/july_tkinter.py | UTF-8 | 779 | 3.171875 | 3 | [] | no_license | import tkinter as tk
root = tk.Tk()
root.title("Gobang")
X_scale = 800
Y_scale = 800
root.geometry("{}x{}".format(X_scale, Y_scale))
X_begin = 0
X_end = 700
Y_begin = 0
Y_end = 700
grid_scale = (X_end - X_begin) / 14
X_Pianyi = (X_scale - X_end) / 2
Y_Pianyi = (Y_scale - Y_end) / 2
canvas = tk.Canvas(root, bg="#CDAA7D... | true |
53858711d4a6d944570b88e38af93810bd4d10f7 | lucemia/euler | /5pr.py | UTF-8 | 604 | 3.25 | 3 | [] | no_license | from collections import Counter
def prime_factor(n):
for i in xrange(2, n/2+1):
if n % i == 0:
f = [i]
n /= i
while n % i == 0:
n /= i
f.append(i)
return f + prime_factor(n)
return [n]
def sol(n):
cs = []
for i in... | true |
c375507ca785c1ac1d451d8df95835a0fc3dd436 | harrisonnguyen/smart_study | /bayesian_nn.py | UTF-8 | 10,597 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.contrib import distributions
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
def _weight_prior(name, shape):
w = distributions.Normal(mu = tf.zeros... | true |
258feda7670528d42571c83f6d9bddc821107ecc | Ckongfu/mooc | /python3.7/父与子的编程之旅/第八章 转圈圈/测试题/2.py | UTF-8 | 49 | 2.859375 | 3 | [] | no_license | for i in range(1,6,2):
print (i,'Hi,Warren')
| true |
610ca4ad4b8441fcb02341b00d4f1c086296905b | Obeast87/python3.9 | /ALTTPR Folder Cleaner v.021.py | UTF-8 | 967 | 3.296875 | 3 | [] | no_license | #Deletes or trashes the ALTTPR folder and all it's contents (seeds/ROMs, screenshots, etc)
#Possilble Future Changes:
#Change it (or give an option) to only delete *.sfc files in said folder
#Show how many files were deleted/trashed
#Imported modules
import os
import shutil
from send2trash import send2trash
#Intro m... | true |
ba839189c89520afe3b64ceefe3ca7a0217fa748 | abramhindle/flann | /examples/example.py | UTF-8 | 581 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | import pyflann
from pyflann import *
from numpy import *
from numpy.random import *
dataset = rand(1000, 128)
testset = rand(100, 128)
testset2 = rand(100, 128)
flann = FLANN()
params = flann.build_index(dataset, algorithm="kdtree")
print params
result, dists = flann.nn_index(testset,5, checks=params["checks"])
flann.... | true |
4c64b470edbd4778545b28922848548dc0afad53 | reidbaker/barracudaRacko | /naiveAgent.py | UTF-8 | 1,329 | 2.765625 | 3 | [] | no_license | class naiveAgent(object):
def __init__(self,game_object):
"""
constructor for a naiveAgent
initializes all necessary data
"""
self.game = game_object
""" available data from game object
self.game_id = game_id
self.player_id = player_id
... | true |
0839ebb8978ce8c7396a70d776fbb5dbe6dcfcfc | amitko92/SpaceInvator | /Game.py | UTF-8 | 8,100 | 3.21875 | 3 | [] | no_license | import Utils
import time
class Game:
def __init__(self, pygame, title, background_img, width, height, icon_url, player, factory):
self.pygame = pygame
self.title = title
self.pygame.display.set_caption(self.title)
self.background_img = self.pygame.image.load(background_img)
... | true |
da39ef4cd05004b37aff426c3759de3bfce5cb47 | cml37/dos-push-notifications-tsr | /test/send_message.py | UTF-8 | 401 | 2.546875 | 3 | [] | no_license | import socket
UDP_IP = "192.168.1.255"
UDP_PORT = 20000
MESSAGE = "Hello, World! Push notifications in MS-DOS? You bet!!!"
print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)
print("message:", MESSAGE)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
sock.setsockopt(socket.SOL_SOCKET, s... | true |
d7687241e24bdb6add873d2e76fb92b44be41dd6 | Kh4l3tH/Schrittmotor | /Schrittmotor.py | UTF-8 | 5,621 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from SchrittmotorConst import *
from time import sleep
from time import time
class Schrittmotor():
def __init__(self, cmd, id, schritte, schrittmodus, steigung, rampentyp, rampe_hz_pro_ms,
reference_pin=None, umin_default=None, offset=0, inverted=False):
self.cmd =... | true |
55d62fc93760b51683f25fc2d3ceec532a4ce6d6 | ZHANG-Quentin/baruch-mfe-lab | /MTH9893/hw2/box.py | UTF-8 | 215 | 3.046875 | 3 | [] | no_license | #!/usr/bin/anaconda3/bin/python
import numpy as np
def box(Nbox, Nwindow):
"a box function"
h = np.zeros(Nwindow)
h[:Nbox] = 1.0 / Nbox
return h
if __name__ == "__main__":
print(box(4, 10))
| true |
a588f1244d6809cd004468557a5baf7302555275 | jeffknupp/flask_sandboy | /tests/test_sandboy.py | UTF-8 | 6,526 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | """Tests for sandboy."""
import json
import pytest
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.sandboy import Sandboy
from models import Machine, Cloud, db
@pytest.yield_fixture
def app(request):
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///d... | true |
52308113befbd90399c74e9898984cc43f8af6a4 | briangonzales10/mycode | /challenges/flaskj2/hostsb.py | UTF-8 | 1,245 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python 3
from flask import Flask
from flask import session
from flask import render_template
from flask import request
app = Flask(__name__)
app.secret_key = "playswithsquirrels"
groups = [{"hostname": "hostA","ip": "192.168.30.22", "fqdn": "hostA.localdomain"},
{"hostname": "hostB", "ip": "192.... | true |
ccf8969fece215d361508621a74757c72a929398 | apache/tvm | /python/tvm/topi/testing/reorg_python.py | UTF-8 | 2,293 | 2.5625 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"Zlib",
"LLVM-exception",
"BSD-2-Clause"
] | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | true |
17699069536ed05d803ec5fc70e567707ec7744f | faridsaud/ML-Snippets | /UnsupervisedLearning/HerarchicalClustering/Hierarchical Clustering Lab.py | UTF-8 | 7,270 | 4.09375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # Hierarchical Clustering Lab
# In this notebook, we will be using sklearn to conduct hierarchical clustering on the [Iris dataset](https://archive.ics.uci.edu/ml/datasets/iris) which contains 4 dimensions/attributes and 150 samples. Each sample is labeled as one of the three ty... | true |
20fdee23e85225f22cc3613c4a031f6d8c5e20b4 | Python3pkg/Circuits-Bricks | /circuits_bricks/app/config.py | UTF-8 | 6,750 | 2.765625 | 3 | [] | no_license | """
..
This file is part of the circuits bricks component library.
Copyright (C) 2012 Michael N. Lipp
.. moduleauthor:: mnl
"""
from circuits.core.handlers import handler
from circuits.core.components import BaseComponent
from circuits.core.events import Event
import os
try:
from configparser import ConfigP... | true |
57a7bee712c155ce7dea30aaeb116490a9b5f39a | belcocco/raspi | /raspi-gmail.py | UTF-8 | 1,455 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
#Raspberry Pi - GPIO Interface
#Check if exist new mail on gmail.com
#Use one led or two leds output
#Comment code that is not used
import RPi.GPIO as GPIO, feedparser
from time import sleep
###############
#Two Leds used#
###############
DEBUG = 1
USERNAME = "belcocco@gmail.com" # just th... | true |
cc95939bc15942c95e6b47f8186a062b08d39905 | jigarshah2811/Python-Programming | /Algo-DP/DP_Jumps.py | UTF-8 | 2,047 | 3.609375 | 4 | [] | no_license | board = [-1, 1, 1, 0, -2, 1, 1, 2, 0, -3, 1]
#index [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
d = dict()
def isSafe(index):
if index < 0 or index > len(board) - 1:
return False
else:
return True
"""
Method 1: Brute force, just add Jump value to index and see if we reach 0 for Win or continue!
... | true |
b19113849b1be9a65b3f1940a15f1a8a73488ef4 | wuxiaolianggit/data_generate_ocr | /gen_img.py | UTF-8 | 214 | 2.546875 | 3 | [] | no_license |
if __name__ == '__main__':
label_file = open('./data_set/train_set.txt', 'r')
while 1:
line = label_file.readline()
print(line.strip().split('\t'))
if not line:
break | true |
d387c3b177f0a2451961c3f7033065d45c5b8522 | jochigt87/PythonCrashCourse | /Chapter7/7-8.py | UTF-8 | 892 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Deli: Make a list called sandwich_orders and fill it with the names of
# various sandwiches. Then makes an empty list called finished_sandwiches. Loop
# through the list of sandwich orders and print a message for each order, such
# as I made your tuna sandwich is made, m... | true |
28bc4b8c908fa71af058525c43071acc8f78b7ab | egorandreevich/API_VK | /VK_API_ready.py | UTF-8 | 1,485 | 3.140625 | 3 | [] | no_license | import requests
from pprint import pprint
class User:
def __init__(self, i):
self.user_id_number = i
self.friends_dic = self.get_friends()
self.friends_set = set(self.friends_dic['response']['items'])
def get_friends(self):
params = {
'access_token': self.my_token,
... | true |
e1372df2c7e1dbcb2ae625e2e44891e1a7f931b8 | ria-ee/X-Road-EE-docs | /md2html.py | UTF-8 | 5,455 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# NB! Do not forget to copy all the necessary images!
import json
import re
import requests
import sys
HTML_START = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="github-markdown.css">
<style>
.markdown-body {{
box-sizing:... | true |
0d66935b901510c55d2b1d33a98cd8ef79375b1d | jovanzac/CS50-s-Introduction-to-Artificial-Intelligence | /Questions/questions.py | UTF-8 | 5,441 | 3.234375 | 3 | [] | no_license | import nltk
import sys
import os
import string
from numpy import log as ln
from numpy.core.defchararray import count
FILE_MATCHES = 1
SENTENCE_MATCHES = 1
def main():
# Check command-line arguments
if len(sys.argv) != 2:
sys.exit("Usage: python questions.py corpus")
# Calculate... | true |
2c5b981e9a368009401bf7952f245f7ef63c41a4 | lywhlao/Python-MutiThread-For-BaiDuBaiKe | /mutiThread/parser_thread.py | UTF-8 | 1,082 | 2.578125 | 3 | [] | no_license | # coding=utf-8
import Queue
import threading
from mutiThread import url_manager, html_parser
class ParserThread(threading.Thread):
def __init__(self, queue, lock, urls, parser, outputer, condition):
super(ParserThread, self).__init__()
self.queue = queue
self.lock = lock
self.urls... | true |
1eb35b91263c37698b57632e236c39e530f44177 | harshinibaskar/workout2 | /83.py | UTF-8 | 85 | 3.15625 | 3 | [] | no_license | k,i,j=input().split()
k,j=int(k),int(j)
if(i=="/"):
print(k//j)
else:
print(k%j)
| true |
9a62ecc49c4aaa472d4bca087e497001848ecab1 | PnuLikeLion9th/Summer_algorithm | /seongeun/2주차/필수문제/짝수와 홀수.py | UTF-8 | 152 | 3.5625 | 4 | [] | no_license | #짝수와 홀수
def solution(num):
if num % 2 == 0: #짝수는 2로 나누면 나머지 0
return "Even"
else:
return "Odd" | true |
43fd1b806d7c14ceebde4e67cc8b0520e9ac4a96 | dicao425/algorithmExercise | /LeetCode/reverseInteger.py | UTF-8 | 431 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
import sys
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
result = -int(str(-x)[::-1]) if x < 0 else int(str(x)[::-1])
if result > 2147483647 or result < -2147483648:
return 0
return result
def ma... | true |
c217c15f0219a59f508d29ca022afd8114256a0e | lrode061518/A_simple_interpreter | /main.py | UTF-8 | 3,959 | 3.34375 | 3 | [] | no_license | '''
grammer as below:
expr : term (( ADD | SUB ) term )*
term : factor(( MUL | DIV ) factor )*
factor : Integer | LPA expr RPA
'''
EOF, ADD, SUB, MUL, DIV = ( 'EOF', 'ADD', 'SUB', 'MUL', 'DIV' )
LPA, RPA = ( 'LPA', 'RPA' )
INTEGER = 'INTEGER'
class Token:
def __init__(self, type, value):
self.ty... | true |
e2f8f25e07a1f80981b2eaf78d5c3d8d58d1a005 | zheng1073/Grokking-the-Coding-Interview-Patterns-for-Coding-Questions | /Pattern: Cyclic Sort/FindAllDuplicateNumbers.py | UTF-8 | 602 | 4.09375 | 4 | [] | no_license | #Find All Duplicate Number (easy)
"""
We are given an unsorted array containing ‘n’ numbers taken from the range 1 to ‘n’. The array has some duplicates, find all the duplicate numbers
without using any extra space.
Time Complexity: O(N)
Space Complexity: O(1)
"""
def find_all_duplicates(nums):
i = 0
while i < le... | true |
82d6fc769d220577af985d929bc48e031bdf900e | georgejs/nasdaq_stock | /setup.py | UTF-8 | 1,668 | 2.71875 | 3 | [
"MIT"
] | permissive | from distutils.core import setup
long_description_text = "Nasdaq Stock: Stock data retriever\n \
========================= \n \
How to use \n \
--------------- \n \
>>>from nasdaq_stock import nasdaq_stock as ns\n \
or\n \
>>>from nasdaq_stock... | true |
6ea1bf7cbe0db1e74ee48ed73f36bdca30979f8f | flounderK/AdventOfCode2018 | /Day16/Day16.py | UTF-8 | 5,306 | 2.5625 | 3 | [] | no_license | import re
from collections import defaultdict
class Proc(object):
def __init__(self):
self.r0 = 0
self.r1 = 0
self.r2 = 0
self.r3 = 0
self.fuzzed_dict = defaultdict(set)
self.dict_by_sample = defaultdict(list)
self.opcode_map = dict()
def get_registers... | true |
b455afad0a5d6bac3906d34e49a15924c9e994d0 | Aasthaengg/IBMdataset | /Python_codes/p02735/s515152889.py | UTF-8 | 504 | 2.71875 | 3 | [] | no_license | import sys
INF = sys.maxsize
H, W = map(int, input().split())
m = []
for i in range(H):
m.append([x for x in input()])
dp = [[INF] * W for _ in range(H)]
dp[0][0] = 0 if m[0][0] == '.' else 1
for i in range(H):
for j in range(W):
for di, dj in [(0, 1), (1, 0)]:
ni = i + di
nj = j + dj
... | true |
7a156adea350b081bcf4a5f391d2bc6a4a3e2842 | nyroro/leetcode | /LC419.py | UTF-8 | 522 | 2.8125 | 3 | [] | no_license | class Solution(object):
def countBattleships(self, board):
"""
:type board: List[List[str]]
:rtype: int
"""
ret = 0
for i in xrange(len(board)):
for j in xrange(len(board[0])):
flag = board[i][j]=='X'
if i>0 and board[i-1][j... | true |
fc211f4f60a0e553df7f63ec7daa17d9d3f2c427 | bjia18/topic_modeling_lab | /sse_and_centroid.py | UTF-8 | 683 | 2.8125 | 3 | [
"MIT"
] | permissive | import clusters as clus
def sse(clusters, data):
sum = 0
for c in clusters:
centroid = calc_centroid(c, data)
for country in c:
sum+=pow(clus.pearson(data[country], centroid), 2)
return sum
def calc_centroid(c, data):
centroid = [0 for i in range(len(data[0]))]
for i in... | true |
ac471a7eef84ce791428de4f5b2ddf9666c611cd | lizeyubuaa/pengbeifudao | /week16/c_s_chat.py | UTF-8 | 1,250 | 2.765625 | 3 | [] | no_license | from socket import *
from threading import Thread
BS = 2048
def recv(name, conn):
while True:
data = conn.recv(BS)
if not data:
break
if data.decode('utf-8') == 'BYEBYE':
print("对方提议停止聊天,输入BYEBYE可终止...")
break
else:
print("%s: %s" % ... | true |
e244673f1f0fa4bf485fa530f1153c2721c810d0 | onsunsl/onsunsl.github.io | /note/demo/python_stdlib/Lib_http/demo_get2.py | UTF-8 | 335 | 2.65625 | 3 | [] | no_license | import client
c = client.HTTPConnection("httpbin.org")
c.set_debuglevel(1)
c.request("GET", "/get?name=GL&age=25")
resp = c.getresponse()
print(f"响应状态码:{resp.status}, 错误消息:{resp.reason}, http版本:{resp.version}")
print("响应头:", resp.msg)
print("返回数据:", resp.read().decode("utf-8"))
c.close()
| true |
b2890d3604d8ee71fb9a3d6d2bd14f40fd4df046 | MatthewScholefield/surro | /surro/game.py | UTF-8 | 2,163 | 2.765625 | 3 | [
"MIT"
] | permissive | import atexit
import pygame
from openal.audio import SoundSink
from pygame.surface import Surface
from surro.world import World
class Game:
def __init__(self):
pygame.init()
pygame.font.init()
pygame.display.set_caption("Surro")
atexit.register(pygame.quit)
self.songs = ... | true |
5261346f96e7520b6ef75a292b3d44a6f00d868c | fescrb/pywing | /__init__.py | UTF-8 | 5,193 | 2.65625 | 3 | [] | no_license | # Imports
from __future__ import print_function
import numpy
from numpy.random import randint
from enum import Enum
__all__ = ["common", "plot"]
class result(Enum):
CRIT = 16
HIT = 8
EVADE = 4
FOCUS = 2
BLANK = 1
def result_str(res):
str = ""
if res & result.BLANK:
str += "BLANK"
i... | true |
d50b488fceeca8a3365968bbad2215f47d627a7e | YSabarad/monopyly | /tests/test_get_out_of_jail.py | UTF-8 | 8,227 | 3.234375 | 3 | [
"MIT"
] | permissive | from monopyly import *
from testing_utils import *
class PlayerWhoGetsOutOfJail(DefaultPlayerAI):
'''
A player who performs the given action when in jail.
'''
def __init__(self, action):
self.action = action
def set_action(self, action):
self.action = action
def get_out_of_ja... | true |
5d3d1a86cf5378349d32d2ff4cb164628d1912dd | ttbrunner/blackbox_starting_points | /utils/saliency/visualization.py | UTF-8 | 1,660 | 3.1875 | 3 | [
"MIT"
] | permissive | # Copyright 2017 Google Inc. All Rights Reserved.
#
# 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 ag... | true |
321cbcaaf3ac895c245140b45320f111ef938035 | Digitiain/keto-recipes | /convert.py | UTF-8 | 1,387 | 3.671875 | 4 | [] | no_license |
'''
To do:
- Make float work as input for amount
- Offer user options in a better way
- Validate user input
- Immediately convert user input of measurement to variable name
- Maybe have ingredient as class or more complex dict, with each measurement within it
'''
originalmeasurement = input('What measurement are you... | true |
444fefa1735c8c27c3bb259debc63663ab65a6f6 | Sinclert/FaceRecognizer | /src/utils.py | UTF-8 | 6,784 | 2.84375 | 3 | [] | no_license | # Created by Sinclert Pérez & Silvia Barbero
import json
import math
import numpy
import os
import random
project_paths = {
'dataset': ['resources', 'datasets'],
'face_model': ['resources', 'face_models'],
'model': ['models'],
'scraping_c': ['configs', 'scraping'],
'training_c': ['configs', 'training'],
'vide... | true |
816a24f532c1864c57f9d85d9a50187b547674b2 | sakdag/covid-fake-news-clustering | /src/main.py | UTF-8 | 4,090 | 2.671875 | 3 | [
"MIT"
] | permissive | import argparse
import os
import src.config.config as conf
import src.preprocessing.preprocessing as prep
import src.preprocessing.vector_generation as vg
import src.clustering.clustering as clustering
if __name__ == '__main__':
dirname = os.path.dirname(__file__)
news_dataset_file_path = os.path.join(dirnam... | true |
656978c91ec8269ae1f02d827d6d6ae05ad2422b | zendus/ZAMS | /setupdatabase.py | UTF-8 | 533 | 2.6875 | 3 | [] | no_license | from sqldb import db, Student_details
#creates all the tables
db.create_all()
#create the role objects
user_johnmicheal = Student_details('2015030171704', 'Johnmicheal', 'Uzendu', 500, 'Computer Engineering')
user_ezinne = Student_details('2013030170111', 'Ezinne', 'Uzendu', 600, 'Medicine')
user_uche = Student_detai... | true |
2161e4e0e263b808a94935c80de6bee1d9e39ace | JulianKemmerer/Drexel-ENGR361 | /HW4/HW4.py~ | UTF-8 | 826 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
def playGame(numPairs): #Returns t(n)
#Create vector of correct size
cards = range(1,numPairs) + range(1,numPairs);
known = []
#while there are still cards
numTurns = 0;
while(len(cards) >0):
numTurns = numTurns +1
turnResult = takeTurn(cards,known)
cards = turnResult[0];
known = ... | true |
c3b23848a263773dedf95063ff3fb292e37e0741 | lychengrex/Movie-Recommender-Systems | /src/utils.py | UTF-8 | 2,116 | 3.09375 | 3 | [
"MIT"
] | permissive | import pandas as pd
from consts import (
PUNCTUATION,
SNOWBALLSTEMMER,
STOPWORDS,
META_DATA_PARQUET,
TRAIN_SET_PARQUET,
VALIDATION_SET_PARQUET,
TEST_SET_PARQUET,
)
def read_meta_data():
return pd.read_parquet(META_DATA_PARQUET, engine="fastparquet")
def read_training_data():
retu... | true |
5561ebad237190a548c82e31bdb3ea453a3c4195 | vekergu/ops_doc | /learn_python/python练习100题/002_利润计算.py | UTF-8 | 2,525 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#=============================================================================
# FileName:
# Desc:
# Author: 白开水
# Email: vekergu@163.com
# HomePage: https://github.com/vekergu
# Version: 0.0.1
# LastChange:
# History:
#=============... | true |
0d7bb61367a0d08a699c91b300f9c7a93dbe4f70 | rajan28/eno | /src/models.py | UTF-8 | 1,671 | 2.625 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
import os
import datetime
def get_env_variable(name):
try:
return os.environ[name]
except KeyError:
message = "Expected environment variable '{}' not set.".format(name)
raise Exception(message)
POSTGRES_HOST = get_env_variable("POSTGRES_HOST")
PO... | true |
e706987daa9afdbe445130143b1b95f8ebdf9632 | cwishart1/Ops401d2-Challenges | /Challenge5-encryption.py | UTF-8 | 2,723 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
# Script Name: Challenge-encryption
# Class Name: Ops 401
# Author Name: Cody Wishart
# Date of latest revision: 4/13/21
# Purpose: Encrypt or decrypt things
# Possible Improvements:
# Script readability
# Encryption ... | true |
f811279bac8ff780c80e5c71c6e7d021c2fb1261 | greatabel/puzzle_I_cracked | /3ProjectEuler/i126_150/i140fibonacci_golden_nuggets.py | UTF-8 | 1,821 | 3.828125 | 4 | [] | no_license | '''
Consider the infinite polynomial series AG(x) = xG1 + x2G2 + x3G3 + ...,
where Gk is the kth term of the second order recurrence relation Gk = Gk−1 + Gk−2,
G1 = 1 and G2 = 4; that is, 1, 4, 5, 9, 14, 23, ... .
For this problem we shall be concerned with values of x for which AG(x) is a positive integer.
The ... | true |
7a500a02a4f58cbb86cb5e2d4bdf076f5ad130ce | fincai/pythonDSA | /Recursion/recursive_makechange.py | UTF-8 | 481 | 3.15625 | 3 | [] | no_license | # optimal number of coins to make change
count = 0
def recursiveMC(coinValueList, change):
global count
count += 1
if change in coinValueList:
return 1
minCoins = change
for i in [c for c in coinValueList if c < change]:
numCoins = 1 + recursiveMC(coinValueList, change-i)
if... | true |
6f8ac6778699db08b16fe3aa98e7b0513891b4fb | Sounzgudlowd1/AML_Deep_Learning | /src/get_data.py | UTF-8 | 2,084 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 23 17:08:16 2018
@author: Erik
"""
from glob import glob
import cv2
import fnmatch
from sklearn.model_selection import train_test_split
import matplotlib.pylab as plt
import pandas as pd
import numpy as np
import random as rand
def get_file_paths(num_files = -1, randoml... | true |
a4ded24cb6539d10b479ccaff60fc2eab931b5d3 | p4int3r/Tools | /anti-XSS/application/core/engine.py | UTF-8 | 1,596 | 3.109375 | 3 | [
"MIT"
] | permissive | import urllib2
# from application.models.page import Page
from urlparse import urlparse
class Page(object):
'''
A class to store the page
'''
url = ''
html = ''
def __init__(self, url='', html=''):
self.url = url
self.html = html
pass
def get_html(self):
... | true |
7cdb27b056c5dbc563ecb2334c4f7ad4f6774043 | andmspy/stock | /stock/caculate_data.py | UTF-8 | 1,978 | 2.953125 | 3 | [] | no_license | import pandas
import time
import os
name = 't' + time.strftime("%Y%m%d", time.localtime())
path = './history_data/2019/excel/'
def get_csv_file(csv):
file = pandas.read_csv(csv)
trade = file['trade']
pb = file['pb']
file['pb_value'] = trade/pb
file['upper'] = file['trade'] > file['pb_value']
... | true |
de3e24a2417808f15124cc3b2894d2f25dbdc055 | doun-kwon/nomad-player | /main.py | UTF-8 | 979 | 2.53125 | 3 | [] | no_license | from module.migrator import BugsMigrator, YoutubeMigrator
from module.scrapper import MelonScrapper, BugsScrapper
def scrap():
# Bugs Scrapper
# - No login required
# - Scrap liked playlist
#
# scrapper = BugsScrapper(email='sample@naver.com', pw='sample')
# scrapper.scrap()
# Melon Scrap... | true |
19c4912d961ba4f4e2ca24c43b7e3bf59b065fc3 | tonylixu/Python-002 | /week03/homework1/PmapArgParser.py | UTF-8 | 3,214 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import argparse
import multiprocessing as mp
TOTAL_CPU = mp.cpu_count()
class PmapArgParser(object):
def __init__(self, _description=''):
self.parser = argparse.ArgumentParser(_description)
def parse_args(self):
return self.parser.parse_args()
def add_n... | true |
14602eab2a53f75c52368f717e20168d9d9590c6 | lauramiller512/Pygame-Tutorials | /jumping.py | UTF-8 | 1,190 | 3.171875 | 3 | [] | no_license | import pygame
pygame.init()
screen = pygame.display.set_mode((600, 600))
pygame.display.set_caption("Tower Defense")
isJump = False
jumpCount = 10
x = 40
y = 40
width = 40
height = 60
vel = 10 #movement speed of the character
run = True
while run:
pygame.time.delay(100)
for event in pygame.event.get():
if even... | true |
58516be778205228b198ad3649c91a117b08c15a | dongxietest/AIDP-ython | /01Pbase/day07/day07/demo4.py | UTF-8 | 1,042 | 3.953125 | 4 | [] | no_license | # def fun1():
# a = 1
# def fun2():
# print(a)
#
# return fun2
#
# fun1()
#压岁钱
def give_gife_money(money):
'''
给孩子压岁钱
:param money:压岁钱
:return: 孩子花钱购买物品的函数
'''
print('孩子得到了%s元' % money)
def child_buy(target,price):
'''
孩子花钱购买商品
:param target:想要买的商品
... | true |
e9f65c5c8e0aff24c05876ae333c080779f64627 | IvorryC/Book-Music-app | /python refresher/class_methods_two.py | UTF-8 | 641 | 3.515625 | 4 | [] | no_license | class Book:
TYPES = ("hardcover", "paperback")
def __init__(self, name, book_type, weight):
self.name = name
self.book_type = book_type
self.weight = weight
def __repr__(self):
return f"<Book {self.name}, {self.book_type}, weighting {self.weight}g>"
@classmethod
... | true |
f3cc85c51b01e11d67dc26ea0d459fdd26b8828a | gkuffel/covid19-tools | /covid19-etl/etl/ctp.py | UTF-8 | 9,269 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import csv
import re
from contextlib import closing
from datetime import datetime
import requests
from etl import base
from helper.metadata_helper import MetadataHelper
def format_location_submitter_id(country, province, county=None):
"""summary_location_<country>_<province>_<county>"""
submitter_id = "summ... | true |
dc4ef71a86c93b7e5c61fe7f83ee9415b2203341 | accg14/HAHA-humor-tweet-classifier | /load_vectors.py | UTF-8 | 837 | 2.953125 | 3 | [
"MIT"
] | permissive | import numpy as np
def load_npy(file_name):
"""
Loads word vector set from .npy file and .txt list of words
Both files must have same name (different extension).
Input:
- file_name: file path (without extension)
"""
fname_txt = file_name + '.txt'
fname_npy = file_name + '.npy'
... | true |
f622334c55999ec09b1948ee56c1a188878ccf0d | paulfrisby/Project-Euler | /Solutions/Project Euler - 026 - Reciprocal cycles.py | UTF-8 | 3,628 | 4.1875 | 4 | [] | no_license | # ------------------------------------------------------------------------------
# Project Euler - Problem 026 - Reciprocal cycles
# ------------------------------------------------------------------------------
# Problem Link: https://projecteuler.net/problem=026
# -----------------------------------------------------... | true |
37d0e0bb731423d28b15f5f353a9f3eb6ad531f9 | sanvedj/MayuriC2WT | /Daily Flash/week 4/day 2/MySolutions/Python/Program3.py | UTF-8 | 360 | 3.484375 | 3 | [] | no_license | print("\nFeet to cm")
feet=float(input("\nEnter distance in feet : "))
print("\nEquivalent distance of",feet," ft in cm is ",feet*30," cm \n\n")
'''
Output :
(base) mayuri@mayuri-PC:~/C2WT/Daily Flash/week 4/day 2/MySolutions/Python$ python3 Program3.py
Feet to cm
Enter distance in feet : 6
Equivalent distance... | true |
13adb5d93b2bcba482d9ac5c92e3de2eaee90764 | troyp/project-euler | /q28.py | UTF-8 | 1,534 | 3.84375 | 4 | [] | no_license | # Starting with the number 1 and moving to the right in a clockwise direction
# a 5 by 5 spiral is formed as follows:
#
# 21 22 23 24 25
# 20 7 8 9 10
# 19 6 1 2 11
# 18 5 4 3 12
# 17 16 15 14 13
#
# It can be verified that the sum of the numbers on the diagonals is 101.
#
# What is ... | true |
f12519a9f9f4476298f7ebb1f698aca476824b72 | gauchm/climata | /tests/test_snotel.py | UTF-8 | 2,037 | 2.625 | 3 | [
"MIT"
] | permissive | from .base import ClimataTestCase
from climata.snotel import (
StationIO, StationDailyDataIO, StationHourlyDataIO,
RegionDailyDataIO, ElementIO
)
class SnotelTestCase(ClimataTestCase):
def test_station(self):
data = StationIO(
basin='18010201',
)
self.assertGreater(len(... | true |
1a738e7c192dc7bd0220dedd27a65e84d774a448 | hwillmott/csfundamentals | /leetcode/290_wordpattern.py | UTF-8 | 661 | 3.3125 | 3 | [] | no_license | class Solution(object):
def wordPattern(self, pattern, str):
"""
:type pattern: str
:type str: str
:rtype: bool
"""
words = str.split(" ")
letters = list(pattern)
d = dict()
if len(words) != len(letters):
return False
... | true |
915de43694bdc88815aae96e021fc94bbab58337 | pdhung3012/confres | /other/CS574_SpeechScoring.py | UTF-8 | 6,210 | 2.640625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.svm import LinearSVC
from sklearn.tree import DecisionTreeClassifier,export_graphviz
from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier
from sklearn.preprocessing import OneHotEncoder, La... | true |
eada54ed0ed9e08fb586a52f4a4ff233ff0c8816 | wan-catherine/Leetcode | /problems/N1023_Camelcase_Matching.py | UTF-8 | 916 | 3.4375 | 3 | [] | no_license | class Solution(object):
def camelMatch(self, queries, pattern):
"""
:type queries: List[str]
:type pattern: str
:rtype: List[bool]
"""
res = []
for word in queries:
if self.check(word, pattern):
res.append(True)
else:
... | true |
6659c907fa5ab10dc4b5d807c9c2dac4ac9e478a | chenlongjiu/python-test | /evaluationReverse.py | UTF-8 | 1,588 | 3.296875 | 3 | [] | no_license | class Solution:
# @param tokens, a list of string
# @return an integer
def evalRPN(self, tokens):
def check(st, stack):
if len(stack) < 2:
return False
a1 = stack.pop()
a2 = stack.pop()
if st == "+":
stack.append(a2+a1)
... | true |
a01690950ae5914cbec9aeac219b77fc4cd75675 | doraKoreny/7W_get_anagrams_from_file | /6W_anagrams.py | UTF-8 | 348 | 3.203125 | 3 | [] | no_license | import sys
words = []
if len(sys.argv) > 1:
with open(sys.argv[1], "r") as my_file:
for row in my_file:
words.append(row[:-1])
print(words)
anagram_pairs = {}
for items in words:
for i in range(len(words)-1):
if sorted(words[i]) == sorted(items) and words[i] != items:
p... | true |
f324d8fefe702a7c49e5fef8cdea23dd55f2e632 | cu-swe4s-fall-2019/test-driven-development-jgkawell | /data_viz.py | UTF-8 | 3,076 | 3.453125 | 3 | [] | no_license | import os
import math_lib as ml
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use('Agg')
"""
This library contains a few plot functions
for lists of numeric values. Enables the saving
of plot files for boxplot, histogram, and combo
of the two.
"""
def boxplot(array, out_file_name):
"""
Create... | true |
eb430856637ca1ead60b2011c6e9c3091c228986 | Aasthaengg/IBMdataset | /Python_codes/p02802/s934857872.py | UTF-8 | 277 | 2.6875 | 3 | [] | no_license | n ,m = map(int,input().split())
ok = [False] * n
wa = [0] * n
for i in range(m):
p,s = input().split()
if s == 'AC':
ok[int(p)-1] = True
elif not(ok[int(p)-1]):
wa[int(p)-1] += 1
wa_sum = sum([wa[i] * ok[i] for i in range(n)])
print(sum(ok),wa_sum)
| true |
df3b30d824ae8893a16b7a1a61a159287b6b485e | NCAR/WPS-GEO-LocalFilter | /geo_localfilter.py | UTF-8 | 4,740 | 2.59375 | 3 | [] | no_license | #!/glade/u/apps/ch/opt/python/3.7.5/gnu/8.3.0/pkg-library/20200417/bin/python
"""
geo_localfilter.py
This script reads geo_em.d01.nc file and computes terrain slope
then performs soothing as needed.
The script was developed by:
Branko Kosovic, NCAR, 2020-10-12
"""
import sys
import os
from subprocess ... | true |
eb6c792f125f91be990ab565d4a408eadac1c774 | amusabji/Coursera | /1. Intro to python/final_exam.py | UTF-8 | 3,875 | 4.375 | 4 | [] | no_license | """
Project for Week 4 of "Python Programming Essentials".
Collection of functions to process dates.
Be sure to read the project description page for further information
about the expected behavior of the program.
"""
import datetime
def days_in_month(year, month):
"""
Inputs:
year - an integer betwee... | true |
0e7c81d61eab5004afaac660cc3d479cd18c8bca | Denimbeard/PycharmProjects | /Programs/Pile of Things/Algorithms/Quicksort.py | UTF-8 | 1,992 | 3.8125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
#
# =============================================================================
__author__ = 'Chet Coenen'
__copyright__ = 'Copyright 2020'
__credits__ = ['Chet Coenen']
__license__ = '/LICE... | true |
a84c0ec0c5195e6b2516400c4ea5f9ba625fb0ad | joanrue/pydynet | /utilities.py | UTF-8 | 1,085 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
def auc_roc(X,Y, ncrit):
"""
Returns the Area-Under-the-ROC-Curve
and the sensitivity (true positive rate; X,Y>0)
and specificity (1 - false positive rate; X,Y==0)
for a range of criteria based on quantile thresholding
-------------------------------------------------------... | true |
8f4014d8b5601091697c10567298bb94ac65b723 | Andrewjjj/Kattis | /Python3/1.6/Parking2/parking2.py | UTF-8 | 143 | 2.84375 | 3 | [] | no_license | a=int(input())
for _ in range(a):
input()
a=[]
a=[int(a) for a in input().split()]
b=max([i-min(a) for i in a])
print(b*2)
| true |
07f90b815225100f512d15962ef2aaadea6303fc | lftys2021/github-landing | /myvenv/Chapter5/10.반복문_while.py | UTF-8 | 398 | 3.71875 | 4 | [] | no_license | # 01. while 사용법
# - 반복 횟수가 정해지지 않았을 때 사용
# while 조건식:
# 반복할 명령
# 증감식
i = 0
while i < 10:
print(i, "번째 다짐, 나는 할 수 있다!")
i += 2
# 02. 무한루프
# while True:
# 반복할 명령
# if 조건식:
# break
while True:
x = input("please press q for exit.....")
if x == "q":
break
| true |
41f6f0b42b25c853d12fbde4c68dd61219491def | orhev/intelligent_system | /feedback_page.py | UTF-8 | 3,737 | 2.890625 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
class feedback_window(object):
def __init__(self):
self.q6 = IntVar()
self.q5 = IntVar()
self.q4 = IntVar()
self.q3 = IntVar()
self.q2 = IntVar()
self.q1 = IntVar()
self.q7 = IntVar()
self.score = 0
... | true |