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 |
|---|---|---|---|---|---|---|---|---|---|---|
93b01d91f5796ee538b48081eda28509f9b66fef | jon-drew/python_practice | /calculate_interest_payments.py | UTF-8 | 412 | 3 | 3 | [
"MIT"
] | permissive | monthlyInterestRate = annualInterestRate/12
monthlyPayment = 0
newbalance = balance
while newbalance > 0:
monthlyPayment += 10
newbalance = balance
month = 1
while month <= 12 and newbalance > 0:
newbalance -= monthlyPayment
interest = monthlyInterestRate * newbalance
newbalance... | true |
032a5d7ca6eadfdf280f7810a06478c5fb2b5ee2 | hacheG/AirBnB_clone_v2 | /models/place.py | UTF-8 | 1,413 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3
"""This is the place class"""
from models.base_model import BaseModel, Base
from sqlalchemy import Column, String, Integer, ForeignKey, Float, Table
from sqlalchemy.orm import relationship, backref
import os
class Place(BaseModel):
"""__tablename__ = 'places'
city_id = Column(String(60), Fo... | true |
0e89a6e1cbfebafe7ef3f764e46795fde5eedb12 | eujuu/Algorithm | /baekjoon/1547 공.py | UTF-8 | 210 | 3.1875 | 3 | [] | no_license | M = int(input())
arr = [1, 2, 3]
for i in range(M):
x,y = map(int, input().split())
idx1 = arr.index(x)
idx2 = arr.index(y)
arr[idx1], arr[idx2] = arr[idx2], arr[idx1]
print(arr[0])
| true |
841c92581b0c516a96fd4f98e2311928dd4e7b5d | QuinnFargen/CodeWarKata | /movezeroend.py | UTF-8 | 1,635 | 3.359375 | 3 | [] | no_license |
array = ["a",0,0,"b",None,"c","d",0,1,False,0,1,True,0,3,[],0,1,9,0,0,{},0,0,9] #),["a","b",None,"c","d",1,False,1,3,[],1,9,{},9,0,0,0,0,0,0,0,0,0,0]
array = [1,2,0,1,0,1,0,3,0,1]
def move_zeros(array):
if array == []:
return array
# if array[-1] == 0:
# array = array[0:-1]
num0 = array.co... | true |
22e2c15cc9ee87e7113e636ad64c54851210ab45 | graphcore/popart | /python/popxl/python_files/ops/slice.py | UTF-8 | 6,668 | 2.890625 | 3 | [
"MIT",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
from typing import Optional, Tuple, Union, List
import popart._internal.ir as _ir
from popxl.context import get_current_context, op_debug_context
from popxl.tensor import Tensor
from .utils import check_in_graph
INT_MIN = -(2 ** 31)
INT_MAX = 2 ** 31 - 1
@op_d... | true |
356b7f5150ede30f4f0d056697d1b4e1016c6b13 | cash2one/xai | /xai/brain/wordbase/verbs/_bobble.py | UTF-8 | 447 | 2.703125 | 3 | [
"MIT"
] | permissive |
#calss header
class _BOBBLE():
def __init__(self,):
self.name = "BOBBLE"
self.definitions = [u'If a piece of clothing or material bobbles, it develops small balls of threads on its surface: ', u'to drop or almost drop a ball that you are trying to catch or stop: ']
self.parents = []
self.childen = []
sel... | true |
5ba9799098d09d1efc0ae597b638ef18acdc605e | yaqi-tian/settracker | /settracker/util.py | UTF-8 | 1,291 | 2.71875 | 3 | [] | no_license | import os
import sys
def confirm(message, yes_answers=('y', 'yes')):
answer = prompt(message, converter=lambda result: result.lower())
return answer in yes_answers
def prompt(message, converter=None):
if not message.endswith(' '):
message = f'{message} '
result = None
while not result:
... | true |
c54c194dfd98710f244e8d4bd4b6deb36b2aab9e | hpandya22/Search-Engines | /a1/phrase_search.py | UTF-8 | 7,918 | 3.921875 | 4 | [] | no_license | """ Assignment 1
You will modify Assignment 0 to support phrase queries instead of AND queries.
The documents are read from documents.txt.
The queries to be processed are read from queries.txt.
Assume all multi-word queries are phrase queries. E.g., the query "why did
the" should be processed as a phrase, not a conj... | true |
ad447fcb129262737488fb00eed203c7e4186f75 | simphys/exercises | /SimPhys_W5/ising_old2.py | UTF-8 | 7,000 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding:utf-8 -*-
# Author: Sebastian Weber, 5 PI Universitaet Stuttgart
from __future__ import division
from libs.simlib import Plotter
import numpy as np
'''
=== SETUP ===
'''
n = 4
J = 1
H = 0
TStart = 1
TStop = 5
TStep = 0.1
MCSteps = 1000
k = 1
np.random.seed(42)
useExact = True
useMC = ... | true |
81f9b81e87b646e467ce75480b146fcad41868c6 | julia-rolemberg/ml-studies | /ANN/ann.py | UTF-8 | 1,651 | 2.765625 | 3 | [] | no_license | import numpy as np
from sklearn.datasets import load_iris
from sklearn.linear_model import Perceptron
import tensorflow as tf
from tensorflow import keras
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
# Where to save the figures
PROJECT_ROOT_DIR = "."
CHAPTER_ID = "ann"
IMAGES_PATH = os.path.join(... | true |
3e9d5336ba57e529db4efead75cb7a5c762fc374 | mellomaths/processor | /memory/memory.py | UTF-8 | 481 | 2.671875 | 3 | [] | no_license | from processor.instructions.set.instruction_set import Instruction
from program.program import Program
from processor.process import Process
class Memory:
def __init__(self, size: int) -> None:
self.size = size
self.process = None
def load_program(self, program: Program):
pid = 0
... | true |
cf4bdf5776c3c3a71a9584aaab6738752eb5cbae | hqs2212586/startMyPython3.0 | /第五章-面向对象/26 内置方法.py | UTF-8 | 1,052 | 4.28125 | 4 | [] | no_license | # 参考地址:http://www.cnblogs.com/linhaifeng/articles/6204014.html
# item系列
class Foo:
def __init__(self, name):
self.name = name
def __getitem__(self, item):
# print('getitem...')
#print(item)
return self.__dict__.get(item) # 字典get方法有则取值,无也不会报错
def __setitem__(self, key, va... | true |
5e2da4a58b7bf79fdbf5c78633311d11e6ec467d | duoduo369/leaning-frontend | /simple_server/simple_server/utils.py | UTF-8 | 584 | 2.578125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import re
django_request_header_prefix = re.compile('^HTTP_')
def get_request_header(request, header_name, default=''):
"""Helper method to get header values from a request's META dict, if present."""
if request is not None and hasattr(request, 'META') and header_name in request.META:
... | true |
367711f282d0cdd7154950961dc0d9d4646ddcf8 | makcg/HomeWork | /HW9/Lesson 3 Task 1.py | UTF-8 | 711 | 3.984375 | 4 | [] | no_license | import math
def find_flat(flat_number, flats_per_floor, floors_count):
flats_per_entrance = flats_per_floor * floors_count #кол-во кварти в подъезде (кв на этаж*кол-во этажей)
entrance_number = math.ceil(flat_number / flats_per_entrance) #подъезд (квартира / кол-во кв в подъезде)
floor_number = math.ceil(... | true |
6fc2a9957336cc9e7d2aa9dad099fb30a5db0a6b | apxii/apx | /ydu/ydu.py | UTF-8 | 2,979 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Обновление данных в DNS на Яндексе
'''
import urllib
import urllib2
import argparse
import json
def YandexGetDomainRecords(token,domain):
headers = {}
headers ["PddToken"] = token
url = "https://pddimp.yandex.ru/api2/admin/dns/list?domain={0}".format(domain)
... | true |
fe62a008dcba76dd66fa7072695b03b68d15a1d7 | tys-github/deep-table | /deep_table/nn/layers/activation.py | UTF-8 | 841 | 2.703125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
class ReGLU(nn.Module):
"""
References:
Shazeer et al., "GLU Variants Improve Transformer," 2020.
https://arxiv.org/abs/2002.05202
"""
def reglu(self, x: Tensor) -> Tensor:
assert x.shape[-1] % 2 ==... | true |
65cf1af2f3b63041f204d90e38cda37f14d4bbec | jonathanshuai/python-basics | /basic-stats/power_simulations.py | UTF-8 | 1,563 | 3.171875 | 3 | [] | no_license | import numpy as np
import scipy.stats
from matplotlib import pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
def get_samples(p, n):
return np.random.binomial(n, p) / n
def run_ab_test(p_a, p_b, n_total=1000, bucket_ratio=0.5, alpha=0.05):
z_low = scipy.stats.norm.ppf(alpha / 2)
z_high = sc... | true |
caa523e36f910d08da46835b6834b8fbb90ba0ec | zihengh1/SHT31_sensor | /data_upload.py | UTF-8 | 2,187 | 2.71875 | 3 | [] | no_license | import smbus
import sys
import time
import httplib, urllib
sys.path.append('/home/pi/rpi/i2c_sensor_test')
#****************************************************
# Set Pin No, ThingSpeak Key
#********************************************... | true |
fabaecbb957750253b213459bf9b71b8e3f6c6ad | ynrng/leetcode | /done/350_Intersection_of_Two_Arrays_II.py | UTF-8 | 465 | 3.375 | 3 | [] | no_license | class Solution(object):
@staticmethod
def intersect(nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
s = set(nums1).intersection(set(nums2))
inter = []
for i in s:
inter.extend([i]*min(list(nums1).c... | true |
7aa77b57cf3e93c6463ef98562a2d36a8eb98240 | tishyakasliwal/covid-SIR-model | /final seir model.py | UTF-8 | 3,500 | 2.8125 | 3 | [] | no_license |
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
import turicreate
def deriv(y, t, N, beta, gamma, delta, alpha_opt, rho):
S, E, I, R, D = y
def alpha(t):
return s * I/N + alpha_opt
dSd... | true |
99d6e55fce3f952a399e27e8940e1304c6e13ce2 | zy506596364/study_ui | /Qlabel控件基本使用.py | UTF-8 | 2,142 | 3.078125 | 3 | [] | no_license | # coding=utf-8
# author:yi.zhang
"""
QLabel 控件
setAlignment() 设置文本的对齐方式
setIndent() 设置文本缩进
text() 获取文本内容
setBuddy() 设置伙伴关系
setText() 设置文本内容
selectedText() 返回所选择的字符
setWordWrap() 设置是否允许换行
---------------------------------------------
QLabel常用的信号(事件)
1. 当鼠标滑过QLabel控件时触发:LinkHovered
2. 当鼠标单击QLabel控件时触发:linkActivated
"""
... | true |
a32b971de03f18d1fcd3026c404076ef1e6dc06b | DaanMiddelkoop/SjaarsRekken | /bank.py | UTF-8 | 1,886 | 3.21875 | 3 | [] | no_license | import random
from piece import Piece
default_pieces = [
Piece("RED", "RED", "RED", 6),
Piece("BLUE", "BLUE", "BLUE", 6),
Piece("GREEN", "GREEN", "GREEN", 6),
Piece("YELLOW", "YELLOW", "YELLOW", 6),
Piece("PURPLE", "PURPLE", "PURPLE", 6),
Piece("RED", "RED", "YELLOW", 5),
Piece("RED", "RED... | true |
3fd9c18bf39b08e00ae15d92fb5968e7d4d53179 | LenyPython/freeCodeCamp | /sciCompPython/prob_calculator.py | UTF-8 | 894 | 3.296875 | 3 | [] | no_license | import copy
import random
from random import randint
class Hat:
def __init__(self, **kwargs):
self.contents = [color for color,
times in kwargs for _ in range(times)]
def draw(self, number):
if number > len(self.contents):
return self.contents
pop... | true |
d7bab5a1ce40d811c0520469ccad820f6bed0ff1 | EdwinLovo/Classify | /bot/pictureDownloader.py | UTF-8 | 3,215 | 2.625 | 3 | [] | no_license | import requests
from PIL import Image
import io
from time import sleep
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options imp... | true |
f3751c11ddefe82573798fc4ff3cc5b46d88dc18 | michaeljlove/Cancer_classifier | /helper/Data.py | UTF-8 | 7,147 | 3.5625 | 4 | [
"MIT"
] | permissive |
import pandas as pd
from pandas.plotting import scatter_matrix
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import itertools
class Dataset:
'''This class is created and optimized by Prince Canuma for the Wisconsin Breast Cancer Database (January 8, 1991)
Github profile: https:/... | true |
cc3a42e17862990ae0640d8475c63f25088b1c58 | teiche/asi | /telescope/simulator.py | UTF-8 | 2,320 | 2.765625 | 3 | [] | no_license | import random
from ..utils.xmlrpc import RPCAble, rpc_method
class TelescopeSimulator(RPCAble):
# Degrees per update
RA_SPEED = .1
DEC_SPEED = .1
def __init__(self):
super(TelescopeSimulator, self).__init__()
self.cur_ra = 0
self.cur_dec = 0
... | true |
3415390e0c7029432840aeddaea8d7148177d4e8 | EtiennePerot/kozo | /src/kozo/roles/message_injector.py | UTF-8 | 3,301 | 2.65625 | 3 | [] | no_license | import socket
from kozo import Role
MESSAGE_TYPES = {
'event': lambda x: x.sendEvent,
'order': lambda x: x.sendOrder,
'log': lambda x: x.sendLog
}
class MessageInjector(Role):
def localInit(self):
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.bind((self['bindAddress'], self['bi... | true |
6f26f28e218973f57fc1c53c1ad11d4ffab63ae8 | lianglee123/leetcode | /剑指Offer/11~20/11.旋转数组的最小数字.py | UTF-8 | 490 | 3.515625 | 4 | [] | no_license | from typing import *
class Solution:
def minArray(self, numbers: List[int]) -> int:
l, r = 0, len(numbers)-1
while l < r:
mid = (l+r)//2
if numbers[mid] < numbers[r]:
r = mid
elif numbers[mid] > numbers[r]:
l = mid + 1
... | true |
772a730fdc80ce6e753067ba90aaf4dd517166e9 | Sylafari/Stock-Web | /quotes/models.py | UTF-8 | 234 | 2.53125 | 3 | [] | no_license | from django.db import models
class Stock(models.Model):
ticker = models.CharField(max_length=10)
price = models.CharField(max_length=10, default="")
def __str__(self):
return self.ticker
return self.price | true |
b1e44bf9d4dab48a36a242c4aa83f168bc66e9ef | vladmonea/super_simple_stock_market | /src/calculate.py | UTF-8 | 766 | 3.234375 | 3 | [] | no_license | def gbce(stocks):
if len(stocks) == 0:
return "N/A"
stock_prices = 1
for stock in stocks:
stock_prices *= stock.market_price
return stock_prices ** (1 / len(stocks))
def dividend_yield(stock):
if stock.market_price <= 0:
return "N/A"
last_dividend = stock.last_dividend ... | true |
a3be6b62ce4a15c027c27423db7a848280ab91ad | gremmie/m209 | /m209/drum.py | UTF-8 | 6,836 | 3.296875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright (C) 2013 by Brian Neal.
# This file is part of m209, the M-209 simulation.
# m209 is released under the MIT License (see LICENSE.txt).
"""This module contains the Drum class for the M-209 simulation."""
import collections
from . import M209Error
class DrumError(M209Error):
"""Exception class for al... | true |
ae944b9ebdbe4b652df96232502e40d11aabc6b8 | Oleksii-Kshenskyi/purple_tools | /test/unit/utils/time/test_checks.py | UTF-8 | 3,111 | 2.703125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"0BSD"
] | permissive | import unittest
from datetime import timedelta
from scripts.utils.time.checks import is_valid_time_string
from scripts.utils.time.checks import is_valid_duration_string
from scripts.utils.time.checks import is_of_type
class TestTimeChecks(unittest.TestCase):
def setUp(self):
pass
def test_checks_time_stri... | true |
b2036df1e1a59d050d48ff14f2716f0f3497af94 | shibendu/Learning-Deep-Learning | /xor/logistic.py | UTF-8 | 741 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
import numpy as np
x = tf.placeholder(np.float32, [None, 2])
W = tf.Variable(tf.zeros([2,1]))
b = tf.Variable(tf.zeros([1]))
y = tf.nn.sigmoid(tf.matmul(x, W) + b)
y_ = tf.placeholder(np.float32, [None, 1])
#cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices = [1... | true |
938d7a497a3d399f06e219958beea02a64a5037f | RokPopov/learning-python | /ch6_exercise8.py | UTF-8 | 864 | 4.375 | 4 | [] | no_license | """Interesting Facts
Try to create a dictionary that has a listing of people and includes one interesting fact about each of them. Display
each person and their interesting fact on the screen. From there, alter a fact about one of the people on the list.
Also, add an extra person and corresponding fact to the list. Dis... | true |
69a523609303bb8bdf24bf0a47b4e6f5ea65d7a4 | IoDmitri/Python-Datastructures-and-Algorithims | /TheAlgorithims/Queue.py | UTF-8 | 557 | 3.4375 | 3 | [] | no_license | from LinkedList import LinkedList
class Queue:
def __init__(self):
self._ls = LinkedList()
self.size = 0
def __str__(self):
return "Queue contains:{0}".format(self._ls)
def __iter__(self):
return self
def next(self):
if not self.isEmpty():
j = self.dequeue()
return j
else:
raise StopItera... | true |
3d241967d9647ee72f3fbe46abde95a9ec5cbea4 | Abhijeet3686/hackerrank-runner | /runner.py | UTF-8 | 326 | 3.703125 | 4 | [] | no_license | n = int(input("Enter number of elements: "))
a = input("Enter the array of elements: ").split()
a = sorted(a)
#print(max(a))
m = a[0]
for i in a:
if m<i:
m = i # finding the largest number
#print(m)
m1 = a[0]
#print(m)
for i in a:
if m1 < i and i < m:
m1 = i # finding the 2nd largest number
prin... | true |
07cb2ea6633d901686148958cfcfd494272c7fb7 | tanzimJUCSE/Basic_Python_Code | /Dictionary(Key=List)(print only 2 after decimal point)/mean_of_student.py | UTF-8 | 248 | 3.125 | 3 | [] | no_license | from statistics import mean
n=int(input())
student=dict()
for _ in range(n):
name=input()
math,phy,chem=(float(input()) for _ in range(3))
student[name]=[math,phy,chem]
take=input()
ans=mean(student[take])
print('{:.2f}'.format(ans))
| true |
a9fcdabef03afcff8c6706178523f909fdbcbad8 | FedericaLionetto/UZHMLWorkshop2020-NLP | /helper_functions/plot_grouped_box.py | UTF-8 | 442 | 2.921875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import seaborn as sns
def plot_grouped_box(df,feat_x,feat_y,filename):
"""
Plot the distribution of feat_x for different values of feat_y.
"""
plt.figure(figsize=(6,6))
sns.set(style="whitegrid")
ax = sns.catplot(data=df, x=feat_x, y=feat_y, kind='box', palette='... | true |
907a9a035f1ff895a58159c87c7d6dba25426bcc | KeeMeng/hkoi | /01001.py | UTF-8 | 839 | 2.8125 | 3 | [] | no_license | import re
while True:
string = str(input())
if "\endinput" in string:
print("\endinput")
break
splitted = string.split("\par")
join = ""
for i in splitted:
i = i.replace("\\\\", "\\")
length = len(re.findall("(?<!\\\)\"", i))
if length % 2 == 1:
re... | true |
91642a7d15eacd8916f28fd3a4fec49c60638704 | emiliafrost/Project | /split.py | UTF-8 | 1,158 | 2.703125 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
import os
def read_file(i,filename):
with open(filename, 'r') as f:
line = f.readline()
index = 0
while line:
information = line.split(' ')
identifier = information[0]
if identifier.find('/') != -1:
identifier = ... | true |
bdfc73bf8536c00072a0d93b33cf7dcca28a14d4 | RayGonzalez/FormalAnalysis | /Miscelaneous/Game Theory.py | UTF-8 | 1,574 | 3.40625 | 3 | [] | no_license | import random
import matplotlib.pyplot as plt
StoresR = []
ResultsR = []
ResultsU = []
StoresU = []
countWeek = []
#number of weeks to run the simulation
Weeks = int(raw_input("Enter the number of weeks:"))
for i in range(0,Weeks):
countWeek.append(i+1)
def runRandom(Weeks):
for x in range(0,499):
... | true |
de45ffb948e90fb6ec59f582adb7e427ebd34f9f | anderav1/sha-256-hashing | /main.py | UTF-8 | 5,340 | 3.359375 | 3 | [] | no_license | import hashlib
import itertools
import os
import time
# file generation function from project 2
def generate_file(file_name: str, file_size: int):
with open(file_name + '.txt', 'wb') as file:
file.write(os.urandom(file_size))
#
# task 1
#
def sha256_file_hash(file_name: str):
with open(file_name + ... | true |
688074c2f777a9f3804df43a26e7034169e0397a | pedrosiracusa/caryocar | /caryocar/models/cwn.py | UTF-8 | 8,396 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Coworking Networks
"""
import networkx
import itertools
from collections import Counter
__author__ = "Pedro Correia de Siracusa"
__copyright__ = "Copyright 2018"
class CWN(networkx.Graph):
"""
Class for coworking networks. Extends networkx Graph class.
... | true |
5c08ca4caa270ee382424f769f9f95bf7a30b1ba | ankitgupta1729/Holmusk_Assignment | /Holmusk_Assignment.py | UTF-8 | 17,470 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## <center> $\textbf{Flat Price Prediction}$
# In[246]:
# I have used the dataset("resale-flat-prices-based-on-approval-date-1990-1999.csv")
# for the flat price prediction by considering the number of rooms
# according to the rules of Singapore Housing and Development Boa... | true |
e141c706672dd666319c597bc19006a982c4f0f5 | drpatel30/ops435-a1 | /a1_drpatel30.py | UTF-8 | 8,562 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
'''OPS435 Assignment 1 - Fall 2019
Program: a1_drpatel30.py
Author: "Dhyeykumar Patel"
The python code in this file (a1_drpatel30.py) is original work written by
"Dhyeykumar Patel". No code in this file is copied from any other source
except those provided by the course instructor, including an... | true |
3b54342261c2c86a52ca3397391e449b0aa2e2d3 | Lua-Lapin/school | /python実験/5-2.py | UTF-8 | 735 | 3.140625 | 3 | [] | no_license | # read_list=["overlap.dat","unique.dat"]
# out = "wc.txt"
inread = input()
read_list = []
while inread != "wc.txt":
read_list.append(inread)
inread = input()
else:
out=inread
out_list=[]
text = "{} : {} 文字, {} 語, {} 行"
for read in read_list:
char=0
word=0
line=0
with ope... | true |
2b9c0fe166a4cea26e1bae60e58cc810720990e8 | a1ip/my_check | /devbook/bludiste/maze.py | UTF-8 | 3,257 | 3.328125 | 3 | [] | no_license | from itertools import product
from random import shuffle, randrange
from operator import add
DISTANCE = 10 # Rozestup mezi body bludiště
WIDTH, HEIGHT = DISTANCE * 30, DISTANCE * 30 # Bludiště by mělo být násobkem DISTANCE
SIZE = max(HEIGHT, WIDTH)
ORTHO = [(DISTANCE,0), (0,DISTAN... | true |
3f4848099fc83a67c9cb3496866eea4f7bc595ef | tnet/cmdlineutils | /trailingspaces.py | UTF-8 | 720 | 2.890625 | 3 | [] | no_license | import click
from common import *
@click.command()
@click.argument('files', nargs=-1)
def main_function(files):
"""Removes trailing spaces and trailing tabs from any file"""
if len(files)==0:
raise UserInputError("At least one file must be provided")
for file in files:
lines = []
... | true |
32756e4db6a7f4d23b83c3fff5b9d974c158e078 | SnowballSH/Snow-lang | /SnowLang/parser/parser.py | UTF-8 | 10,183 | 2.734375 | 3 | [] | no_license | from .nodes import *
from ..lexer.tokens import Token
from ..errors.error import *
from ..lexer.cogs.symbols import ref
ref = {v: k for k, v in ref.items()}
COMPARISONS = ("LT", "GT", "LTEQ", "GTEQ", "DBEQ", "NOTEQ")
class Parser:
def __init__(self, tokens):
self.tokens = iter(tokens)
self.curr... | true |
9e9c1773b21dd22d68776ba1d3b0c5a5e4e14021 | gghcode/practice-problem-solving | /src/leetcode/first-unique-character-in-a-string/main.py | UTF-8 | 1,024 | 3.25 | 3 | [] | no_license | class Node:
def __init__(self, idx):
self.next = None
self.prev = None
self.idx = idx
def __str__(self):
return f'{self.idx}'
class Solution:
def firstUniqChar(self, s: str) -> int:
def remove(node):
node.next.prev = node.prev
node.prev.next ... | true |
1f88cd6319592699d3dedd209e038899ab1fdaa3 | alteryx/featuretools | /featuretools/feature_base/features_serializer.py | UTF-8 | 6,035 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | import json
from featuretools.primitives.utils import serialize_primitive
from featuretools.utils.s3_utils import get_transport_params, use_smartopen_features
from featuretools.utils.wrangle import _is_s3, _is_url
from featuretools.version import FEATURES_SCHEMA_VERSION
from featuretools.version import __version__ as ... | true |
844e9ecfd24dfbaf4fe804f0033262ee09e9ec90 | shnehna/object_study | /object/Person.py | UTF-8 | 395 | 4.25 | 4 | [] | no_license | class Person:
def __init__(self, new_name):
# self.name = "Tom"
self.name = new_name
print("这是一个初始化方法")
def eat(self):
print("%s 小猫爱吃鱼" % self.name)
def drink(self):
print("%s 小猫要喝水" % self.name)
def __str__(self):
return "toString()"
tom = Person("To... | true |
f36f45a907f59cec2edc81a1ca2ee7cecf1db542 | DayWD/RPS-project | /generators.py | UTF-8 | 1,313 | 3.234375 | 3 | [] | no_license | import math
"""~~~~~~DON'T TOUCH~~~~~~"""
multiplier = 1597
c = 51749
m = 244944
"""~~~~~~~~~~~~~~~~~~~~~~~"""
seed = 123
def G(counter):
global seed
tab = [seed]
for i in range(0, counter):
tab.append((multiplier * tab[i] + c) % m)
seed = tab[len(tab) - 1]
tab.pop(0)
return tab
de... | true |
238bf3667ea7a6c39d2a4cc163356748ca0d1dc3 | DeBerit/python_program | /4irad.py | UTF-8 | 2,603 | 2.703125 | 3 | [] | no_license | plan = [" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "]
p = ["x","o"]
t = 0
def kordinat(x,y):
return plan[x + (y*7)]
game = True
pw = [0,0]
while game:
for i in range(0,6):
gfx = "|".join(pl... | true |
d2f1a48bc97d427fa2f0548090c5c86d8f315699 | AlphaWoll/IT_camp | /onc.py | UTF-8 | 680 | 2.78125 | 3 | [] | no_license | #import signal
#def timeout_handler(signal, frame):
# raise Exception('Time is up!')
#signal.signal(signal.SIGALRM, timeout_handler)
def Kliker()
import sys
import select
import msvcrt
import time
chek = True
while chek:
print("Накликайте 30 раз чтобы разбудить спящую обезбяну")
start = time.tim... | true |
87d7cf1faad6c8ca7f767b3cc6d4eb8c08be4810 | agrove25/CS131 | /proj/server.py | UTF-8 | 8,212 | 2.546875 | 3 | [] | no_license | import asyncio
from time import time
import json
import sys
server_id = None
clientList = {} # [name] = (name, x, y, time)
serverList = {'Alford': 8880,
'Ball': 8882,
'Hamilton': 8884,
'Holiday': 8886,
'Welsh': 8888}
serverConnections = {'Alford': ('Hamilton... | true |
b9e89bf7e9ba195cabcfc187ac341e33c46b6113 | Sal2468/from_sg | /Python/my_workings/count_vowels.py | UTF-8 | 614 | 3.296875 | 3 | [] | no_license | # Bir kelimenin içerisindeki sesli harfleri bulmak için kullanılır
def count_vowels(txt):
return sum([1 for x in txt.lower() if x in 'aeiou'])
def count_vowels(txt):
return sum(c in "aeiou" for c in txt)
def count_vowels(txt):
vowels = "aeiou"
num_vow = 0
for i in txt:
if i in vowels:
num... | true |
fc5e28fac4698d96ae4c2398eecc744c604b98b7 | myliu/python-algorithm | /leetcode/strobogrammatic_number_iii.py | UTF-8 | 849 | 3.015625 | 3 | [] | no_license | class Solution(object):
def strobogrammaticInRange(self, low, high):
"""
:type low: str
:type high: str
:rtype: int
"""
pairs = [('0', '0'), ('1', '1'), ('8', '8'), ('6', '9'), ('9', '6')]
def dfs(low, high, tmp, left, right):
if left > right:
... | true |
932594486c43f85ad6b05e73594d723d548427a6 | bmy4415/deep-learning-study | /Assignment/Assignment2/Utils/layer_utils.py | UTF-8 | 16,044 | 3.0625 | 3 | [] | no_license | import numpy as np
from Utils.data_utils import plot_conv_images
def conv_forward(x, w, b, conv_param):
"""
Computes the forward pass for a convolutional layer.
Inputs:
- x: Input data, of shape (N, H, W, C)
N : Input number
H : Height
W : Width
C : Channel
- w: We... | true |
ce7a2ff9f2b853b684cdbcde3ab48fb0908d81a9 | Stanislas0/DC-Recovery-JPEG | /dc_recovery.py | UTF-8 | 12,267 | 2.78125 | 3 | [
"MIT"
] | permissive | """
DC recovery from DC-free JPEG images.
Author: Qinkai ZHENG
Email: qinkai.zheng1028@gmail.com
"""
import cv2
import argparse
import numpy as np
def read_image(image_path):
"""
Read an image and convert it in gray scale.
:param image_path: string, path of image file
:return: image: ndarray, gray sc... | true |
9221ef3ccb3586de5979b43a754aa4926ed1b376 | Leeo1124/pythonDemo | /src/com/python/demo/if_Demo.py | UTF-8 | 296 | 3.71875 | 4 | [
"Apache-2.0"
] | permissive | '''
Created on 2016年7月27日
@author: Administrator
'''
age = 20
if age >= 6:
print('teenager')
elif age >= 18:
print('adult')
else:
print('kid')
#只要x是非零数值、非空字符串、非空list等,就判断为True,否则为False
x = -1
if x:
print('True') | true |
f70ecc0cd6ce5382ac9dc1eebff73d9698b0b7dc | jeredding/wishbone | /wishbone/module/diskout.py | UTF-8 | 4,052 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# diskout.py
#
# Copyright 2014 Jelle Smet <development@smetj.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the ... | true |
299589000c5356c4fef5949035e0ccd0e9af4844 | leimaosheng/Testproject | /car.py | UTF-8 | 1,878 | 3.453125 | 3 | [] | no_license | class Car():
def __init__(self,make,model,year):
"""初始化汽车的描述信息"""
self.make=make
self.moduel=model
self.year=year
self.odometer_reading=0
def get_descriptive_name(self):
"""返回整洁的描述性信息"""
long_name=str(self.year)+" "+self.make+" "+self.moduel
return... | true |
8be851749005732519c82b72d3b7796187b59edc | DayGitH/Python-Challenges | /DailyProgrammer/DP20160408C.py | UTF-8 | 2,212 | 3.984375 | 4 | [
"MIT"
] | permissive | """
[2016-04-08] Challenge #261 [Hard] magic square dominoes
https://www.reddit.com/r/dailyprogrammer/comments/4dwk7b/20160408_challenge_261_hard_magic_square_dominoes/
# Description
An NxN magic square is an NxN grid of the numbers 1 through N^2 such that each row, column, and major diagonal adds up
to M = N(N^(2)+1... | true |
4a40fe7cca059bc5f47042583370b5c31f373fc4 | pawlactb/portmantout | /portmantout.py | UTF-8 | 1,552 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python3
from cs451.Node import Node
from cs451.Search import BFS, DFS
from PortmantoutNode import PortmanteauNode, PortmanteauNodeGenerator, PortmantoutNode
import re
import concurrent.futures
import traceback
def read_word_list(path, ignoreRegExp=None):
words = []
f = open(path, r"r")
print("O... | true |
50841778bc0d60517775915582251c22f1a6a32b | shen-huang/selfteaching-python-camp | /exercises/1901100017/1001S02E05_array.py | UTF-8 | 404 | 3.078125 | 3 | [] | no_license | oringin = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
oringin.reverse()
str1 = ', '.join(str(i) for i in oringin)
str2 = str1.replace(", ","")
str3 = str2[2:8]
l1 = list(str3)
l1.reverse()
str4 = "".join(l1)
number = int(str4)
number2 = bin(number)
number8 = oct(number)
number16 = hex(number)
print(oringin)
print(str1)
print(str2)... | true |
5207c0cb867e547e68343434f730c1af24f7bef5 | aarmros/pinholeGUI | /signalGen3.py | UTF-8 | 10,768 | 2.984375 | 3 | [] | no_license | import csv
import numpy as np
import matplotlib.pyplot as plt
from math import *
import eqtools
import time #for testing runtime
"""
Sep 22, 2017 - Version 2 adds flux interpolation along with the helper functions magAngle and
aveEmiss
Sep 30 2017 - Version 3 magAngle now takes arrays, passing arrays is faster be... | true |
b9515b8266f8517f74c1f41b3a124a404d660921 | akkharin1/6230405347-oop-labs | /lab4-oop-623040534-7/lab4_extra.py | UTF-8 | 246 | 3.796875 | 4 | [] | no_license | list_num = input("Enter the list of numbers(delimited by a comma):").split(",")
print(num)
try :
index = int(input("Enter an dex:"))
print(list_num[index])
except IndexError :
print("The list has no element at index %d."% index) | true |
e95759f93ee41a1eae9ce169515a3623a2093a74 | yoongyoonge/python_100Q | /code/2. data_graph/024.py | UTF-8 | 373 | 3.5 | 4 | [] | no_license | import pandas as pd
# dictionary를 데이터프레임으로 변환
dict_data = {'c0':[1,2,3], 'c1':[4,5,6]}
df = pd.DataFrame(dict_data, index=['r0', 'r1', 'r2'])
print(df, "\n")
# 데이터프레임을 CSV 파일로 저장
df.to_csv("./code/2. data_graph/output/df.csv")
# 데이터프레임을 Excel 파일로 저장
df.to_excel("./code/2. data_graph/output/df.xlsx") | true |
de3afb3846de164ef03e768d44aa08805170f30e | tzejan/programming-challenge-practices | /practice8.py | UTF-8 | 455 | 3.5625 | 4 | [] | no_license | #happy numbers
def happyNumber(n):
prevNum = set()
totalSum = 0
while n != 1 and n not in prevNum:
prevNum.add(n)
while n != 0:
ones = n % 10
totalSum += ones * ones
n /= 10
n = totalSum
totalSum = 0
print n, prevNum
... | true |
5223fa7f9435ce159dee40680df05348ecb1c854 | Seeker1911/python-candidate-challenge | /challenge.py | UTF-8 | 3,638 | 4.34375 | 4 | [] | no_license | """ The following are a few challenges to try out.
Purpose: To see how you think through logical problems and communicate.
Resources: Use anything you want including StackOverflow, Google, and the interviewers.
You can import any module that this platform supports.
Take as much time as you need, ask all t... | true |
1c677091ac25c59a0ab3ef6ef6b6956052f22caa | akiniwa/cpp_numerical | /symplectic/run.py | UTF-8 | 552 | 2.859375 | 3 | [] | no_license | class C1:
def __init__(self):
print 'C1'
x = 3
def __del__(self):
print 'del'
class C2(C1):
def __init__(self):
print 'C2'
def call(self):
a = 4
self.ddd = 6
return a
def __del__(self):
print 'C2del'
a = C1()
print a.x
b = C2()
print ... | true |
2427620acc9794ffceb6fd97f089cc0b05f489b8 | coppelia517/orlov | /tests/seir/ui/browndust/initial.py | UTF-8 | 3,656 | 2.640625 | 3 | [
"MIT"
] | permissive | """ BrownDust Initial Class """
import logging
# pylint: disable=E0401
from seir.element import elements
from seir.element import Component
logger = logging.getLogger(__name__)
TEST_PATH = {
'eclipse': 'initial/eclipse',
'skip': 'initial/skip',
'close': 'initial/close',
'server': 'initial/sever',
... | true |
b7b64f44799e9c3ab3e94f066ba67d3db92cb2b2 | MafihlwaK/Pre-Bootcamp-coding-Challenges-python- | /Task 5.py | UTF-8 | 410 | 4.4375 | 4 | [] | no_license | def triangle_area(a, b, c):
perimeter = a + b + c
s = perimeter / 2
area = (s*(s-a)*(s-b)*(s-c))**0.5
return area
side1 = float(input("Enter the length of the first side: ") )
side2 = float(input("Enter the length of the second side: ") )
side3 = float(input("Enter the length of the third side: ") )
ar... | true |
6e82e1a62028cfd393e7094aae9069737a0c0802 | pj0620/acca-video-series | /accalib/animations.py | UTF-8 | 1,476 | 2.921875 | 3 | [
"MIT"
] | permissive | from manimlib.imports import *
from manimlib.constants import *
class EllipsesFlash(AnimationGroup):
CONFIG = {
"line_length": 0.2,
"num_lines": 12,
"flash_radius_x": 0.3,
"flash_radius_y": 0.3,
"line_stroke_width": 3,
"run_time": 1,
}
def __init__(self, poi... | true |
c318fb8ad89e94b049e7e6e880c1b298faf9caad | Radha2020-py/Decision-tree-predictive-analysis | /Predict PartyFinal report.py | UTF-8 | 14,060 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Predict party affiliation based on voting record
#
# In[1]:
#Import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
get_ipython().run_line_magic('matplotlib', 'inline')
#Surpress the warnings
import warnings
warnings.... | true |
785ffe9067034fbe8748c6db5e08093a732011b3 | dethi/ClickMolette | /Source/ClickMolette.py | UTF-8 | 4,303 | 3 | 3 | [] | no_license | # -*-coding:Utf-8 -*
"""Simulateur de clique molette,
Version 0.1.5,
Réalisé par Deutsch Thibault,
Plus d'info sur http://www.thionnux.fr/
"""
from Tkinter import *
import win32api
import win32con
import pythoncom
import pyHook
class Interface(Frame):
"""Cette classe gère l'ensemble de l'interface graphique.... | true |
c912909cb45f739a30212ecf704fe8c16a231e1b | itobey/fddb-calories-exporter | /exporter.py | UTF-8 | 2,131 | 2.515625 | 3 | [] | no_license | import pandas as pd
from datetime import datetime
from sqlalchemy import create_engine, text
import requests
import os
# download 'tagebuch' csv from fddb.info
url = 'https://fddb.info/db/i18n/exporter/?lang=de&action=diary&type=csv'
fddb_user = os.environ['FDDB_USER']
fddb_pw = os.environ['FDDB_PW']
headers = {'cooki... | true |
e48d38cc73818844eb96da4f44edf7bac8bb672b | swejunhyeok/Semantically-important-point-agumentation | /train_utils/keepfo.py | UTF-8 | 1,642 | 2.625 | 3 | [] | no_license | import numpy as np
import torch
class KeepFO():
def __init__(self, criterion, args):
self.args = args
self.beta = args.keepfobeta
self.criterion = criterion
def keepfo(self, images, targets, bbox):
beta = self.beta # hyperparameter
# size of image
I_x, I_y = ... | true |
a8e133d7cdcf86fc4f35b76f02fac26d3fd0b949 | theangelsofwar/InterveneTheInterview | /movingZeroes.py | UTF-8 | 548 | 3.234375 | 3 | [
"MIT"
] | permissive | def moveZeroes(self, nums):
counter = 0;
for i in nums:
if i != 0:
nums[counter]=i
counter+=1;
for i in range(counter, len(nums)):
nums[i]=0
#second option uses tuples
def moveZeroes(self, nums):
i = 0
for j in range(len(nums)):
nums[i],i= (nums[j], i+1) if nums[j]!=0 else (nums[... | true |
1de9d1501fcab39dfc48c67dcec6fedbce4e802c | SIakovlev/udacity_deepRL_p1_navigation | /src/environment.py | UTF-8 | 2,744 | 2.890625 | 3 | [
"MIT"
] | permissive | from unityagents import UnityEnvironment
import numpy as np
class BananaEnvironment:
def __init__(self, file_name=None, **kwargs):
self.__env = UnityEnvironment(file_name=file_name, seed=1234) # create environment
self.__brain_name = self.__env.brain_names[0]
self.__env.reset()
sel... | true |
12543c32d815b26f15ec1fb8cbe9295e66376101 | michaelonjack/nostalgia-website | /nostalgia.py | UTF-8 | 11,575 | 2.703125 | 3 | [] | no_license | import os
import webapp2
import jinja2
import random
from urllib2 import urlopen
from urllib2 import Request
from auth import authenticate
from json import load # decodes retrieved JSON
from google.appengine.ext import ndb
# Set up the jinja environment
template_dir = os.path.join(os.path.dirname(__file__),'templates... | true |
66c8e5369917b3d4459e9a4561795ac415c690d1 | StewedChickenwithStats/Answers-to-Python-Crash-Course | /chap3/3-5.py | UTF-8 | 415 | 3 | 3 | [
"MIT"
] | permissive | people=['mom','dad','sister']
print(people[2].title()+" cannot attend this dinner.")#无法赴约的人
people[2]='brother'
print("Dear "+people[0]+", I'd like to invite you to have dinner with me on Friday at my home.")
print("Dear "+people[1]+", I'd like to invite you to have dinner with me on Friday at my home.")
print("Dear "+... | true |
d15a4400e1b75ecf454cfe1819368a77d453502a | SHTOOLS/SHTOOLS | /pyshtools/utils/datetime.py | UTF-8 | 752 | 3.140625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Date and time utils for SHTOOLS
"""
import datetime as _datetime
def _yyyymmdd_to_year_fraction(date):
"""Convert YYYMMDD.DD date string or float to YYYY.YYY"""
date = str(date)
if '.' in date:
date, residual = str(date).split('.')
residual = float('0.' + residual)
else:
re... | true |
7e2f5286a95651f78a02d375439ab3f3535f05a1 | lukaspestalozzi/Master_Semester_Project | /game/game_starter.py | UTF-8 | 2,826 | 2.515625 | 3 | [
"MIT"
] | permissive | import logging
import datetime
from time import time
import sys, os
for p in ['/'.join(os.getcwd().split('/')[:-1])]: # Adds the parent folder (ie. game) to the python path
if p not in sys.path:
sys.path.append(p)
# print('PATH:', sys.path)
from game.tichu import (HumanInputAgent, SimpleMonteCarloPerfec... | true |
137fe68dc0a64760e18e0f7972c6bd995e6c3bb7 | gy19yh/GeogFile | /assessment2.py | UTF-8 | 4,054 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 15 19:51:59 2019
@author: Administrator
"""
import csv
import random
import matplotlib
import agentframework2
import matplotlib.pyplot
###### Set the variables ########
#num_of_agents = 5000
# allow user to set the number of bateria and check whe... | true |
bcd83ec6d067fc190ad6f36ca5527082a865e1d7 | Bokutai/bokutai | /gfx/charBMP.py | UTF-8 | 1,394 | 2.953125 | 3 | [] | no_license | # coding: utf8
'''
Bitmap fonts generating
todo:
'''
import sys
if len(sys.argv) < 4:
print 'Usage: python %s [text_file] [color] [bmp_name]' % sys.argv[0]
exit()
from PIL import Image, ImageFont, ImageDraw
#read text
f = open(sys.argv[1], 'r')
text = f.read().decode('utf8')
text = text.split('\n')
f.close()... | true |
eb7c13cc16de42badd7b4753ec6dc8eca6381b2e | dagongji10/LeCode | /scripts/41.py | UTF-8 | 899 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 6 20:04:22 2020
@author: Administrator
"""
'''
题目:
找到一组未排序的数组中没有出现的最小的正整数
思路:
因为要判断元素是否在数组中,如果用list来判断那么时间复杂度肯定超过O(n),考虑将list变成集合set再去判断
'''
class Solution:
def firstMissingPositive(self, nums):
if nums==[]:
return 1
... | true |
1e2ebc6492b14a15c8fc3550ff0714da5a62f5f2 | jblairkiel/UA-CS-150 | /final/ilgop/matrix.py | UTF-8 | 519 | 3.8125 | 4 | [] | no_license | def main():
mat = eval(input("Give me a matrix of positive integers: "))
compute(mat)
def compute(items):
largest = sum(items[0])
for i in range(0, len(items),1):
for j in range(0, len(items[i]),1):
if (largest <= sum(items[i])):
largest = sum(items[i])
pri... | true |
5c06f38268c207c3e983b82ad582c17fc5c6a60a | briworkman/Hash-Tables | /applications/word_count/word_count.py | UTF-8 | 660 | 3.578125 | 4 | [] | no_license | def word_count(s):
# Implement me.
lower_string = s.lower()
split_string = [''.join([c for c in w if c.isalpha() or c == "'"])
for w in lower_string.split()]
cache = {}
for i in split_string:
if i not in cache:
cache[i] = 1
elif i in cache:
... | true |
8332af66970da4d56e627c4f97a80b26aaaf9a6e | morojenoe/Risha | /src/ast_visitors/semantic_analysis/tools.py | UTF-8 | 4,608 | 2.625 | 3 | [] | no_license | import logging
from .symbol_table_types import *
import src.risha_ast
def make_function(function_definition):
identifier = function_definition.name.to_string()
return_type = _get_variable_type(
src.risha_ast.SimpleDeclaration(function_definition.return_type,
No... | true |
3d6720818a4d4024ade4b4706f3a7c322f76baa7 | lhd0320/AID2003 | /official courses/month01/day07/exercise02.py | UTF-8 | 555 | 3.828125 | 4 | [] | no_license | dict_epidemic_information={}
while True:
area=input("请输入疫情地区:")
if area == "":
break
else:
confirmed = int(input("请输入该地区确诊人数:"))
cured = int(input("请输入该地区治愈人数:"))
dict_epidemic_information[area]=[confirmed,cured]
sum_confirmed=0
for area,info in dict_epidemic_information.item... | true |
858ac5ea54a1826bed6d7bcdcdb750d8c209d127 | edelzamora/To-Do-List-webapp | /app.py | UTF-8 | 3,905 | 2.546875 | 3 | [] | no_license | from flask import Flask, redirect, url_for, render_template, request, session, flash
from datetime import timedelta
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import FlaskForm, Form
from wtforms import StringField, SubmitField, PasswordField, BooleanField, validators
from wtforms.validators import DataRequ... | true |
badd0a0008efc17d6a88f1338b97c0f32113318f | aniketverma-7/CO_OS_LAB | /FCFS_ZERO_AT.py | UTF-8 | 1,524 | 3.515625 | 4 | [] | no_license | '''
Author : ANIKET VERMA
Enroll : 0827CO191012
FCFS with zero arrivial timw
takeInput() -> takes input form user
waiting() -> calculate total waiting time
turntime -> calculate turn around time
printData() -> print all process with waiting and turn around time in tabular form.
Process -> represent class of al... | true |
37027ef7a8a0c609a7e2175483436f3fe6772f74 | nyucusp/gx5003-fall2013 | /wkk229/assignment3/problem3.py | UTF-8 | 2,546 | 3.3125 | 3 | [] | no_license | #problems - extracting the data (names and authors) from the text
# problem2-calculating the Erdos number.
import Queue
import string
import itertools
#I am going to use queue data structure to store intermediate results asI transverse th egraph as follows:
#Enqueue the root node
#dequeue a node to examine it
#if t... | true |
40d9aeae03f81e00c48c6bbee42918ad34aed3bb | printfll/ArtificialIntelligence-CSCI561 | /HW1 + Samples/script/hw1cs561s16.py | UTF-8 | 10,446 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import copy
import os
########## first part init implementation #############
def initAlg(line):
global algType
algType=int(line)
def initPlayer(line):
global player
player=line
def initCutOff(line):
global cutoff
cutoff=int(line)
########## end first part init ##########... | true |
d16ecfe2b8101e43e0efc4799c81bc25209e7e9c | yururyuru00/atcoder | /acing_contest/B.py | UTF-8 | 355 | 2.875 | 3 | [] | no_license | import numpy as np
def main():
with open('../in.csv', 'r') as r:
args = list(r.readlines())
N = int(args[0].rstrip())
a = np.array([int(i) for i in args[1].rstrip().split(' ')])
c = 0
for i, val in enumerate(a):
if((i+1)%2 == 1 and val%2 == 1):
c += 1
print(c)
if ... | true |
a29f6a236f20e9777ca22936c43dad0fe66bc280 | opnumten/frustrated-random-walk | /src/get_hitting_distances.py | UTF-8 | 684 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import os
def get_distances(hitting_time_file_name, distance_file_name):
assert(os.path.exists(hitting_time_file_name))
reader = open(hitting_time_file_name, "r")
lines = reader.readlines()
reader.close()
writer = open(distance_file_name, "w")
for i in range(len(lines)):
distance = lin... | true |
fec815e9ee6ff67746260a7476e07cc3a9c16530 | carlosxl/sudoku-solver | /utils.py | UTF-8 | 6,177 | 2.953125 | 3 | [] | no_license | # -*- coding: utf8 -*-
from termcolor import colored
import copy
import numpy as np
DEBUG = False
ALL = set(range(1, 10))
class GridPrinter(object):
V2H = 3 # One V spans 3-time space as one H
TL = '┏'
TR = '┓'
BL = '┗'
BR = '┛'
H = '━' * V2H
V = '┃'
TC = '┳'
RC = '┫'
BC =... | true |
09ea8d39acda9e8724cee6a647807f155427cebd | Atraindra/Kattis | /HappyPrime.py | UTF-8 | 795 | 3.5 | 4 | [] | no_license | import math
def sumSquares(n):
ans = 0
while(n > 0):
ans += int(n%10)**2
n /= 10
return ans
def isPrime(n):
for i in range(2,int(math.sqrt(n)+1)):
if n%i == 0:
return False
return True
num = int(input())
for i in range(0,num):
line = list... | true |