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 |
|---|---|---|---|---|---|---|---|---|---|---|
b5e5c70d822597cc2503ca534ce63e549b2f6aec | ColeMoney/Year9Design_MISP | /tkinter.py | UTF-8 | 373 | 3.546875 | 4 | [] | no_license | #importing tkinter module into python so we can use
from tkinter import *
#Tk() makes a window
master = Tk()
def return_entry(en):
"""Gets and prints the content of the entry"""
content = entry.get()
print(content)
Label(master, text="Input: ").grid(row=0, sticky=W)
entry = Entry(master)
entry.grid(row=0, column... | true |
f16b59cb87f270f461a84e7841040d2ebd867ea2 | hodurie/Algorithm | /programmers/level1/두 정수 사이의 합.py | UTF-8 | 109 | 2.65625 | 3 | [] | no_license | def solution(a, b):
return sum([i for i in range(b, a+1)]) if a >= b else sum([i for i in range(a, b+1)]) | true |
51a02e2e29c0d2555b03cf8e3cc6992abb1d957c | shivamsingh361/Python_Beginners- | /encript.py | UTF-8 | 2,039 | 3.28125 | 3 | [] | no_license | from os import system,name
from time import sleep
class encript:
def fun(self, c, d):
if c.isupper():
return(chr(65 + (ord(c) - 65 + d)%26))
elif c.islower():
return(chr(97 + (ord(c) - 97 + d)%26))
else:
return c
def nuf(self, c, d):
if c.isupper():
return chr(90 - (90 - ord(c) + d... | true |
197742440b0ab7c1284adad780b10232219ab324 | VIRGIL-YAN/woquant | /strategy/31_低PB价值投资策略分享.py | UTF-8 | 20,216 | 2.71875 | 3 | [] | no_license | 该策略由聚宽用户分享,仅供学习交流使用。
原文网址:https://www.joinquant.com/post/11549
原文一般包含策略说明,如有疑问建议到原文和作者交流讨论。
原文策略源码如下:
'''
一 策略名称:低PB价值投资策略
二 策略概述:致力于筛选低市净率且财务指标向好的A股,做价值投资
三 策略基本内容:
1 选股:过滤筛选A股列表,并对符合条件的股票进行排序,主要包括:
1.1 状态过滤:过滤停盘、退市、ST及开盘涨停股;
1.2 财务筛选:筛选流通股本小于25亿股、市净率小于0.85、且营业收入同比增长率、净利润同比增长率、净资产... | true |
15cc81d22da363f1a06bea54e08d6e1549f8ba13 | kayette/Assignment-2_BSCOE-1-6 | /Assignment 2_NAME-AGE-ADDRESS.py | UTF-8 | 190 | 4.1875 | 4 | [] | no_license | name=input("\nEnter your name: ")
age=int(input("Enter your age: "))
address=input("Enter your address: ")
print(f"\nHi, my name is {name}. I am {age} years old and I live in {address}. \n") | true |
b80aaeaa5e26c2d1f5f6041b16919dcf2486fe01 | zhanxiangqian/salome | /aster_s/salome_tree.py | UTF-8 | 26,089 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Work with the Salomé study by adding elements to the Salomé object tree
"""
import os.path as osp
from pickle import dumps
from pickle import loads as ploads
from aster_s.utils import Singleton, log
def loads(pobj):
"""Return the object found in the string 'pobj' or None
if the str... | true |
32fddcd3ca532a973468bd5e3aff2ff19eb03106 | suprajaarthi/Favourite-Snippets | /prime even odd.py | UTF-8 | 416 | 2.890625 | 3 | [] | no_license | #Your code below
l=list(map(int,input().split()))
l=sorted(l)
x=[];y=[]
for k in range(len(l)):
for i in range(2,l[k]):
if(l[k]%i==0):
flag=0
break
else:
x.append(l[k])
for i in x:
l.remove(i)
for i in l:
if i%2==1:
x.append(i)
y.appe... | true |
f3e66f36300407acdb5c121f8482ce5e6096164e | SeonJongYoo/Algorithm | /Inflearn/Use_DataStructure/DataStructure_Anagram.py | UTF-8 | 1,415 | 4.03125 | 4 | [] | no_license | # 아나그램 - 딕셔너리 해쉬
# dictionary의 key는 알파벳, value는 알파벳의 개수
# key가 동일한 경우 value를 누적해야함
# dictionary 내장 함수 get('A', 0): key값 'A'에 value가 존재하면
# 그 value를 가져오고 없으면 0을 가져온다.
# 강의 코드
a = input()
b = input()
str1 = dict()
str2 = dict()
for x in a:
str1[x] = str1.get(x, 0) + 1
for x in b:
str2[x] = str2.get(x, 0) + 1
f... | true |
9db47c37e83c933a825ec6911902a9f6296b1117 | morganstanley/testplan | /examples/App/FXConverter/converter.py | UTF-8 | 4,660 | 3.125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | """
Converter application that:
1. Connects to an external service that provides FX exchange rates.
2. Accepts requests from clients i.e: 1000 GBP to be converted to EUR
3. Requests the currency rate from the FX rates service. i.e: 1.15
4. Responds to the client with the converted amount: i.e: 1150
"""... | true |
37b7b40477fa7ff1691e3d68508a6f516679e919 | sbrahma0/UMD--Geometric-vision-and-deeplearning | /SFM/Code/Part1/NonlinearTriangulation.py | UTF-8 | 1,062 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
sys.dont_write_bytecode = True
import numpy as np
import math
from scipy.optimize import least_squares
from LinearTriangulation import *
def NonLinearOptimization(param, P1, P2, pt1, pt2):
data = param.reshape(3,1)
data = np.vstack((data, [1]))
result = (pt1[0] - (np.matmul(P1[... | true |
ffd845833adf7f70a496a787631819844f48f3ee | uinput/deeplator | /deeplator/jsonrpc.py | UTF-8 | 1,187 | 2.890625 | 3 | [
"MIT"
] | permissive | import json
import urllib.request as request
JSONRPC_VERSION = "2.0"
HEADERS = {"content-type": "application/json"}
class JSONRPCBuilder():
def __init__(self, method, params):
self.method = method
self.params = params
def dump(self):
data = {
"jsonrpc": JSONRPC_VERSION,
... | true |
48066f9b2faf9e86b411a426d0ee95acae5d2395 | sathishmepco/Python-Basics | /basic-programs/vowels.py | UTF-8 | 270 | 3.65625 | 4 | [] | no_license | def main():
str = input('Enter any string :: ')
str = str.lower();
vowel_counts = {}
for vowel in 'aeiou':
count = str.count(vowel)
vowel_counts[vowel] = count
print(vowel_counts)
main()
'''
Enter any string :: aeiou
{'a': 1, 'e': 1, 'i': 1, 'o': 1, 'u': 1}
''' | true |
79ae25b0a9543f9c91ca95c9038f89347040a39f | LudovicDejean/workshopFineEquipe | /app.py | UTF-8 | 415 | 2.8125 | 3 | [] | no_license | import os
from tkinter import *
window=Tk()
window.title("Running Python Script")
window.geometry('550x200')
def run():
os.system('easy_facial_recognition.py --i known_faces')
text = Text(window)
text.insert(INSERT, "Press Q to quit the video.")
btn = Button(window, text="Start facial recognition", bg="black", f... | true |
ef6ec3989cc5e0b6418a0da93f2ca93276882f36 | MariiaSitnikova/education | /task1.py | UTF-8 | 274 | 3.375 | 3 | [] | no_license | if __name__ == '__main__':
ingredients = ["hleb", "pomidor", "mascorpone", "mayanez"]
i = 0
while i != len(ingredients):
ingredient = ingredients[i]
i += 1
print(ingredient)
for ingredient in ingredients:
print(i, ingredient) | true |
e937aa38f9f2a76199267caf05bba94c7f7f0791 | swain-s/lc | /-数组-和为S的两个数字.py | UTF-8 | 1,584 | 3.671875 | 4 | [] | no_license | # 问题描述
# 模板:
class SumOfTwoNum(object):
def __init__(self):
pass
# 二分查找,返回位置
def bin_search_(self, tar, arr, le, ri):
if len(arr) == 0:
return []
if ri - le <= 1:
if arr[le] == tar:
return [le]
elif arr[ri] == tar:
... | true |
83203bddd99c110d263ae9e40358530114fc6b9a | Bencpr/lightning_hydra_template | /src/losses/losses.py | UTF-8 | 1,874 | 2.765625 | 3 | [
"MIT"
] | permissive | from typing import Tuple
import torch
import torch.functional as F
from torch import nn
class DenseCrossEntropy(nn.Module):
# Taken from: https://www.kaggle.com/pestipeti/plant-pathology-2020-pytorch
def __init__(self):
super(DenseCrossEntropy, self).__init__()
def forward(self, logits, labels):... | true |
8ee3a12968e12df3965d392a30ccaf5d05d687f7 | S1mp41w3/Umuzi_Data_Engineering_Pre-Bootcamp_Excerceises | /task-10-dataEngineering-preBootCamp.py | UTF-8 | 547 | 3.78125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Umuzi Data Engineering Pre-Bootcamp
@author: Simphiwe Shongwe
@Git: S1mp41w3
@E-mail: Sim01Shongwe@gmail.com
Task 10
Write a function that takes in a string and then prints out all the vowels
in the string.
Make sure it can deal with capital letters and small letters.
"""... | true |
4fc7d26eb5e4a42181167f3761585dd4e2d50d2c | Artimi/waktu | /waktu/stats.py | UTF-8 | 2,084 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2.7
#-*- coding: UTF-8 -*-
from collections import deque
import pickle
import os
import time
class Stats:
"""Statistics class, handles records of an array"""
def __init__(self):
self.activityRecords = deque()
def appendActivityRecord(self, _activityRecord):
... | true |
13462237b8b5f2364b015d2481a91ce2f81a4db9 | drozd/python_HW | /Exam/parser.py | UTF-8 | 3,577 | 2.953125 | 3 | [] | no_license | import xlrd, csv, pandas
workbook = xlrd.open_workbook('corpus.xls')
sheet = workbook.sheet_by_index(0)
with open('corpus.csv', 'w', encoding='utf-8') as table_file:
writer = csv.writer(table_file, delimiter='\t', quotechar='|', quoting=csv.QUOTE_NONE, escapechar='\\')
for row_id in range(sheet.nrows):
... | true |
324b2f9c3f5751af21403e94abd471fdb2e935c8 | skywalker-lili/codingpractice | /CrackCodingInterveiw/16.6 Smallest Difference.py | UTF-8 | 1,119 | 3.875 | 4 | [] | no_license |
# coding: utf-8
# In[104]:
# 16.6 Smallest Difference
# ---- Solution ----
def smallest_diff(a, b):
# Sort the two arrays and have two pointers to move from both beginnings
# According to the relative value of two pointers, move one of them each step towards end
# Once no movement can be done, end the ... | true |
defa466ac2b2c9a4e672217eca17fe5c07fbcb20 | starry-sfeng/web_automation | /venv/common/launch_webdriver.py | UTF-8 | 997 | 2.625 | 3 | [] | no_license | # coding=utf-8
__author__ = "Starry_feng"
from selenium import webdriver
from time import sleep
from info import userInfo
class launch_app:
def __init__(self):
self.driver_location = r'C:\chromedriver_win32\chromedriver.exe'
self.info = userInfo.user()
self.url = self.info.server
def la... | true |
8b2663a46659fbccbffce27974cad91931c95e8b | crazcalm/NYC-opendata | /print_to_screen.py | UTF-8 | 3,167 | 3.8125 | 4 | [] | no_license | import os, sys
from call_database import call_db
def user_input(start_index, end_index, stack):
"""
This function will be called within the viewer functions,
and it will be used to deal with the user input
"""
#The user variable will be used to save the users response and
#to control ... | true |
4ae19ed7d6ba83653091259831671bb6ecebba7a | alexgraehl/TimeForScience | /Lab_Code/Python/template-py2.py | UTF-8 | 5,405 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
'''
This script should work on both python2
AND python3 directly,
as long as you have the 'future' module installed! (e.g.: "pip install future")
See here for details on making a python 2/3 script: http://python-future.org/compatible_idioms.html
Requires at least p... | true |
3fb3df352309533386cdc6b084af6d4253e2a60f | johncornflake/exercism | /python/simple-cipher/simple_cipher.py | UTF-8 | 1,350 | 3.4375 | 3 | [] | no_license | import string
from collections import deque
import math
import secrets
class Cipher:
def __init__(self, key=None):
self.key = key or self.generateCipher()
def encode(self, text):
pairs = self.getPairs(text)
return self.rotater(pairs, decode=False)
def decode(self, text):
p... | true |
d7ed52357c7665c4d95935011c5cf73f25db5a7d | reobebo/data-science-python | /define_plot_elements.py | UTF-8 | 889 | 3.09375 | 3 | [] | no_license |
# coding: utf-8
# In[4]:
import numpy as np
from numpy.random import randn
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
from matplotlib import rcParams
# In[5]:
get_ipython().magic('matplotlib inline')
rcParams['figure.figsize']=5,4
# # Defining axes, ticks, and grids... | true |
a0e46f803e748921b31625c0a0c4dc1a2c27fa0a | pavan-nadupuru/codeChefPractiseEasy | /MARCHA1.py | UTF-8 | 482 | 2.828125 | 3 | [] | no_license | import itertools
for _ in range(int(input())):
found = False
l=[]
n,m = map(int,input().split())
for __ in range(n):
l.append(int(input()))
for i in range(1,len(l)+1):
if(found):
break
allp = list(itertools.combinations(l,i))
for j in allp:
if... | true |
e00500c76f1558f21ce09bc9019ec5960d1de8f5 | jesrav/advent-of-code-2020 | /day8.py | UTF-8 | 3,205 | 3.453125 | 3 | [] | no_license | from pathlib import Path
from typing import List, Dict
import copy
def get_data(filename: Path) -> List[str]:
with open(filename, "r") as f:
data = f.readlines()
return data
class BootCode:
def __init__(self, actions_dict: Dict):
self.actions_dict = actions_dict
self.accumulato... | true |
322b35351cf4986793754326dcf314b92c4263e4 | Pedrexus/Vision1500 | /analysis/vision_algorithm/image_edition.py | UTF-8 | 5,225 | 2.578125 | 3 | [] | no_license | import os
import sys
import cv2
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from google.cloud.vision import types
from analysis.vision_algorithm import image_properties
from analysis.vision_algorithm._activate_api import client
from analysis.vision_algorithm.detect_color import filter_by_color
from... | true |
719501db3e6185d3b43f5cd5dc5fe8a4824680f9 | Wsaleh123/Python | /python-/Python/whileLoop.py | UTF-8 | 404 | 3.734375 | 4 | [] | no_license | Password = input("Please select a password: ")
password = input("Please enter the password to login: ")
while password!= Password:
if password == Password:
print("You are logged in! Welcome %s" %password)
else:
print("ERROR: Password was not correct. Try again")
password = input("Pleas... | true |
3dc94feddb47a38c70c2cf0d229f2933d85ce097 | cavalown/Py_AI_class | /matplotlib_3D.py | UTF-8 | 1,074 | 3.15625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
from mpl_toolkits.mplot3d.axes3d import get_test_data
# 設定視角0.5
fig = plt.figure(figsize=plt.figaspect(0.5))
#第一個子圖
ax = fig.add_subplot(1, 2, 1, projection='3d')
X = np.arange(-6, 6, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y) #... | true |
ac79e283e90b19b678ccd4bdf98ea194e4d653f2 | zpoint/Reading-Exercises-Notes | /core_python_programming/11/11-13.py | UTF-8 | 244 | 3.5 | 4 | [] | no_license | #a
def mult(x,y):
return x * y
#b
print reduce(mult,(x + 1 for x in range(int(raw_input('Enter a number to factorials\n')))))
#c
print reduce(lambda x,y:x * y,(x + 1 for x in range(int(raw_input('Enter a number to factorials\n')))))
| true |
cb97398c0e7fef901df7efc543ef87c7cee3352a | YanQinYuan/pyex | /countTxt.py | UTF-8 | 486 | 2.875 | 3 | [] | no_license | #coding = utf-8
import os
import glob
from collections import Counter
from countWord import getData
def countTxt(txtPath):
txt_path = glob.glob(txtPath + "/*.txt")
# path_save = txtPath + "/after"
for file in txt_path:
data = getData(file)
c = Counter(data)
res = c.most_common(... | true |
7fa37ff1950e73fc8a73c4dadaa49e5d06ce8312 | dyson-framework/dyson | /lib/dyson/vars/parsing.py | UTF-8 | 2,531 | 2.828125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | import jinja2
from six import string_types
from dyson.utils import selectors
def find_all_in(string, whole_string):
start = 0
while True:
start = whole_string.find(string, start)
if start == -1:
return
yield start
start += len(string)
def parse_keyvalue(arg):
... | true |
be942a2e5a067a3966c57b42156f92b27e3b60bb | joshsteveth/ADSP | /Homework1/1.py | UTF-8 | 2,740 | 3.375 | 3 | [] | no_license | from sin_func import *
from triangle_func import *
from util import *
from playwav import *
import matplotlib.pyplot as plt
import scipy.io.wavfile as wavfile
import numpy as np
#the under full range in db
#calculate c using formula from util.py
underRange = 25
c = calculateC(underRange)
#create 6 subplots
#left sid... | true |
4081fbfa5736e3c83b7947060d1156668b66ca51 | wanghan79/2020_Python | /陈佳莹2018012262/作业2.py | UTF-8 | 1,590 | 3.703125 | 4 | [] | no_license | """
Author:Chen Jiaying
Purpose:Generate random data set by decoration.
Created:10/6/2020
"""
import random
import string
def dataSampling(func):
def wrapper(datatype, datarange, num, *conditions, strlen=8):
result=set()
if datatype is int:
while len(result) < num:
it = ... | true |
594e7a1820b20bcb9b75beb8276e098496be76c2 | yuwendong/case-1 | /case/cron/identify/source.py | UTF-8 | 3,364 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import networkx as nx
sys.path.append('../')
from config import db
from model import BetweenessCentralityUser, Source # model.py建表
from time_utils import ts2datetime, datetime2ts
def Get_s(g, positive_m, source):
new_source, arrived_m, source= get_max_m(g, positive_m, ... | true |
653fb665d87f3ef8ef47680ec532620807f3ba29 | goatson/ml_dl_projects | /ml/service/db/__init__.py | UTF-8 | 1,442 | 2.84375 | 3 | [] | no_license | # 접속 함수
import pymysql
def insert_trans_log(oCode, tCode, oStr, tStr):
# 차후 db쪽 연결은 pooling이나 ORM 방식을 이용하여 최대 동접에 대한 안정적인 처리를 구현한다.
# 현재는 그냥 요청하면 접속, 쿼리, 접속해제순으로 처리
# 해당 접속법은 임시적이다.
connection = pymysql.connect(host='localhost', # = 127.0.0.1
user='root',
... | true |
6490c0f322820944b120a0aac02b0fbd1c86d16c | alexlafroscia/class-projects | /number-processing/number_processing/convert_sentence/replace_fractions.py | UTF-8 | 1,403 | 2.875 | 3 | [] | no_license | import re
from .replace_numbers import replace_basic_numbers, convert_to_ordinal, \
percentage_regex
from .utils import combine_words_for_sentence
fraction_regex = re.compile(r'(?P<prefix>\d*?)(?:(?<=\d)\s*)?' +
'(?P<numerator>\d+)\s?\\\?\/\s?' +
'(?P<denomi... | true |
f96c335f320c51011f1202a3e34043cb6242b0a8 | sschleic/azure | /TraceStepTemplates/SaveValuePyVariable.py | UTF-8 | 6,977 | 2.78125 | 3 | [] | no_license | ###################################################################################
# @file SaveValueGlobalConstant.py
# @brief TraceStepTemplate to save a given value into a set of global constants
#
# @author FDTech GmbH
# @date 2020-07-27
# @copyright FDTech GmbH intern
# @Version 1.0
#
# |-------... | true |
7c2b9fa168b0bdec20214418087580e401bcc51b | Santhosh-23mj/Simply-Python | /VulnerabilityScanner/07_VulnerabilityScanner.py | UTF-8 | 1,258 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3
"""
Program_7
The Most Basic Vulnerability Scanner!
"""
import socket
import os
import sys
def retBanner(ip,port):
s = socket.socket()
try:
s.connect((ip,port))
res = s.recv(1024)
return res
except Exception as e:
print("[-] Error - "+str(e))
retu... | true |
294d8e01c1f42e9b8154d1fe9be95d3127a70ac6 | KonradAdamczyk/VideoDeduplication | /winnow/storage/repr_migrate.py | UTF-8 | 3,099 | 2.625 | 3 | [
"MIT"
] | permissive | import logging
import os
from winnow.config import Config
from winnow.storage.lmdb_repr_storage import LMDBReprStorage
from winnow.storage.path_repr_storage import PathReprStorage
from winnow.storage.repr_key import ReprKey
from winnow.utils.repr import get_config_tag
logger = logging.getLogger(__name__)
class Path... | true |
6bc3bb9b7653b1624f08b23dd146183fd331cf8c | RainFZY/LeetCode-Practice | /665.非递减数列.py | UTF-8 | 667 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=665 lang=python3
#
# [665] 非递减数列
#
# @lc code=start
class Solution:
def checkPossibility(self, nums: List[int]) -> bool:
N = len(nums)
count = 0
for i in range(1, N):
if nums[i] < nums[i - 1]:
count += 1
# 提前剪枝
... | true |
d132ee43d0834ca75faf6d9b038951ade0b9d310 | anhaidgroup/py_entitymatching | /benchmarks/benchmark_blackbox_blocker.py | UTF-8 | 13,074 | 2.6875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | # Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.
import os
import sys
import py_entitymatching as mg
p = mg.get_install_path()
datasets_path = os.sep.join([p, 'datasets', 'example_datasets'])
bb = mg.BlackBoxBlocker()
o... | true |
bf9acda66675078219e61c21576c13b37f71ee3b | pmarathe25/Stock-Prediction | /dataCollector.py | UTF-8 | 3,376 | 2.984375 | 3 | [] | no_license | from yahoo_finance import Share
from scipy import stats
import sys
import math
import datetime
def getPERatio(stockName):
try:
stock = Share(stockName)
PERatio = stock.get_price_earnings_ratio()
except:
return None
return PERatio
def getPEGRatio(stockName):
try:
stock =... | true |
a230edd51959e198d33c67c4c3ad2e6cd4c0ef1b | fake-name/ReadableWebProxy | /WebMirror/OutputFilters/Booksie/BooksieSeriesPageFilter.py | UTF-8 | 8,128 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive |
import WebMirror.OutputFilters.FilterBase
import WebMirror.OutputFilters.util.MessageConstructors as msgpackers
from WebMirror.OutputFilters.util.TitleParsers import extractTitle
import bs4
import re
import time
from settings import BOOKSIE_REQUIRED_TAGS
from settings import BOOKSIE_MASKED_TAGS
################... | true |
937138aa330309238cd12ccf3a4cdea69f25fb9e | tanajis/python | /dataStructure/dynamic_programming/dynamic_fib.py | UTF-8 | 1,716 | 4.09375 | 4 | [] | no_license | #=============================================================================================
#!/usr/bin/env python
#title :dynamic_fib.py
#description :This is demo of dynamic programming with fibonacci series.
#author :Tanaji Sutar
#date :2020-Jan-28
#python_version :2.7/3
#Notes... | true |
7a35745463505d03022c3d5707528a5baca174d3 | AMDComputeLibraries/ComputeApps | /hpgmg-amp/finite-element/op/genregister.py | UTF-8 | 966 | 2.609375 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
import re
CREATE_RE = re.compile(r'PetscErrorCode OpCreate_(\w+) ?\(')
def mangle(name):
return name.lower().replace('_','-'), name
def build_ops(files):
ops = []
for src in files:
with open(src) as f:
for line in f:
m = CREATE_RE.match(line)
... | true |
02e76dc78609188250d2628aa785e78512ee1943 | jsqihui/lintcode | /Longest_Consecutive_Sequence.py | UTF-8 | 781 | 3.078125 | 3 | [] | no_license | class Solution:
"""
@param num, a list of integer
@return an integer
"""
def longestConsecutive(self, num):
# write your code here
hashmap = {num[i]: False for i in range(len(num))}
maxLength = 0
for key in hashmap:
if hashmap[key]:
continu... | true |
80f59c6036e23989df66b21ee569f450f9be6251 | marekboro/Warehouse-mng-tool | /console.py | UTF-8 | 3,480 | 2.890625 | 3 | [] | no_license | import pdb
import random
from models.product_type import ProductType
from models.brand import Brand
from models.product import Product
from models.stock import Stock
import repositories.product_type_repository as product_type_repository
import repositories.brand_repository as brand_repository
import repositories.produc... | true |
68dbf4d9d4033bbf29cdf0dd637b5190f206f0a9 | kuprogrammingclub/Weekly-Problems-2016-2017 | /Week01_Sep14/02_Beginner2/StefanMendoza/Beginner2.py | UTF-8 | 561 | 4.21875 | 4 | [] | no_license | '''
File: Beginner2.py
Author: Stefan Mendoza
Date: 2 September 2016
Description: Week 1 / Beginner 2 for KU Programming Club (2016-2017)
'''
def calculate(age):
return (23 - age)
print("How old are you?")
try:
age = int(raw_input("> "))
if age == 23:
print("We're the same age! Nice!")
elif... | true |
52f149c84bd8e539951a7a6e57c5cd024e84c9a2 | rakhtimc/mininet_mininext_project | /configs/r3/r3/r3_server.py | UTF-8 | 1,448 | 3.21875 | 3 | [] | no_license | import socket
# next create a socket object
s_h1 = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s_r2 = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
print "Socket successfully created at h1 server"
bind_ip = '0.0.0.0'
port_h1 = 1098
port_r2 = 1099
s_h1.bind((bind_ip, port_h1))
s_r2.bind((bind_ip, po... | true |
30c6d052f37ab58dbfc80ce354cb368d1eca85db | minond/reddit-sentiment | /server.py | UTF-8 | 1,159 | 2.609375 | 3 | [] | no_license | from flask import Flask
from flask import jsonify
from reddiment import sentiment
from reddiment.reddit import Reddit
import os
app = Flask(__name__)
reddit = Reddit()
@app.route('/')
def get_index():
return app.send_static_file('index.html')
@app.route('/sentiment/<string:obj>/<string:name>')
def get_sentimen... | true |
c6d492d22a7d042044df70fea1db0d3c22d26dcb | CardiacModelling/FourWaysOfFitting | /figures-supp/s8-pr5-issue/estimated-erev.py | UTF-8 | 368 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
#
# Show estimated reversal potentials
#
from __future__ import division
from __future__ import print_function
import os
import sys
sys.path.append(os.path.abspath(os.path.join('..', '..', 'python')))
import cells
for i in range(9):
E = cells.reversal_potential(cells.temperature(i + 1))
... | true |
a031cf07188b030fd2f62a91a875c51551611af2 | HuyaneMatsu/Koishi | /koishi/plugins/sex/lock.py | UTF-8 | 2,651 | 2.84375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | __all__ = ()
from hata import KOKORO
from .constants import SEX_RESET_AFTER
SEX_SPAM_LOCK = {}
class SexSpamLock:
"""
Sex spam lock used to avoid sex spam. Or you could say to promote it by not giving.
Attributes
-----------
entity_id : `int`
The locked entity's identifier.
exp... | true |
00f05bdaf2bac550cb4453ff773b7fd663fdc4af | knliao-southernco/substation_readings_manager | /substation_readings_manager/utils/date_functions.py | UTF-8 | 2,149 | 3.3125 | 3 | [] | no_license | from datetime import datetime, timedelta, date
from dateutil.relativedelta import relativedelta
import calendar
import pyodbc
from typing import Dict, List, Tuple
def get_last_month_date() -> date:
""" This function returns the date one month ago. This is for get_date_range_one_month
which then takes the firs... | true |
e3dd56cd8c48f007cce960646f711e5017c0bdd1 | arthurscience/multilingualtastic | /python/day2.py | UTF-8 | 1,473 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
#DIRECTIONS: Please follow along in the debugger:
import urllib2
import sys
a_list = ['one', 'two', 'three'] #Mutable! Ordered!
a_list.append('four')
a_list.insert(0, 'zero')
#Google: "built-in functions" $your_language
another_list = list('123')
#STOP/THINK: Why is one line in brackets and t... | true |
8f666bdf62b3604145f5bd74072fb8f377aafd15 | bafatthat/MyKindleTools | /epub2azw/utils.py | UTF-8 | 2,656 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import struct
import zipfile
from bs4 import BeautifulSoup
import re
class UtilsError(Exception):
pass
def int_bits(v, base='d'):
'''返回整数的位数。'''
if base == 'd':
b = 10
elif base == 'h':
b = 16
elif base == 'o':
... | true |
03e2243705137c70437466fccae2baec9966b229 | monu2017/leaning- | /app.py | UTF-8 | 188 | 3.109375 | 3 | [] | no_license | course = 'monu singh'
print('Monu' in course)
print(course.find('i'))
print(course.upper())
print(len(course))
print(course.replace('singh', 'kumar'))
print(course)
print('monu' in course) | true |
feafa577a80a24bd9162330fd65a551549bd3f90 | Prasad7R/Prasad | /numpy ex.py | UTF-8 | 225 | 2.78125 | 3 | [] | no_license | import numpy as n
a=n.array([[1,3,4],[6,7,4],[7,5,2]])
#b=n.array([[1,3,4],[6,7,4],[7,5,2]])
#print (n.dot(a,b))
#b=(a.ravel())
#print(b)
#print(a.ndim)
#print(b.ndim)
#b.shape=(3,3)
#print(b.ndim)
b=a.tranpose()
print(b) | true |
846deeedb0c5068b1297ef86089325bc5461b6fc | aikawame/hokas-extractor | /extractor.py | UTF-8 | 1,153 | 2.640625 | 3 | [] | no_license | import os
import pandas
import sqlite3
import urllib.request
import camelot
import settings
dfs = []
for filename in settings.pdf_filenames:
remote_url = settings.pdf_url + filename
local_path = settings.temp_dir + filename
if not os.path.exists(local_path):
print('Downloading PDF:', remote_url)
... | true |
afc6f5cbd0cbb938ed3506a7f4b0794230fc6705 | safaa125/SpacedPractice | /skeleton.py | UTF-8 | 818 | 3.296875 | 3 | [] | no_license | import time
import economics
#Introduction
class intro():
def mainIntro():
print("Welcome to the quiz!\nThere are three topics choose from.")
global choice
choice = input("\nCrypto, Economics or St John?\n>>")
intro.selection()
#Choice of Topics
def selection():
if choic... | true |
3d66637371477bf0fb9276d4a6085567550de2cd | maxherre/Python38_Projects | /Exercise_2_Odd_or_Even.py | UTF-8 | 1,013 | 4.3125 | 4 | [] | no_license | '''
from www.practicepython.org
completed on 29.10.2020
Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user.
Hint: how does an even / odd number react differently when divided by 2?
Extras:
- If the number is a multiple of 4, print out a different m... | true |
af2fadbc62d815d799572edb51ef86fd9f424c40 | RegOpz/RegOpzAPI | /Models/Document.py | UTF-8 | 2,617 | 2.765625 | 3 | [] | no_license | from Helpers.DatabaseHelper import DatabaseHelper
class Document(object):
def __init__(self, params=None):
if params != None:
self.id = params['id']
self.file = params['file']
self.uploaded_by = params['uploaded_by']
self.time_stamp = params['time_stamp']
... | true |
6c0fb358382f522f19ddc1b66aa298450c4a9777 | rmuppala113/ntpdemy | /tables.py | UTF-8 | 227 | 3.703125 | 4 | [] | no_license | mylist = [[1,2,3], [4,5,6], [7,8,9], ["a","b","c"]]
row1 = mylist[0]
row2 = mylist[1]
row3 = mylist[2]
row4 = mylist[3]
newlist = [row1[1:],row2[0],row3[1],row4[2]]
print(row1)
print(row2)
print(row3)
print(row4)
print(newlist) | true |
d1ebb3232e1aa0f894ee472a33813bb3efef3dca | GrPe/UMCS-Public | /Python/Python10/2.py | UTF-8 | 200 | 2.953125 | 3 | [
"MIT"
] | permissive | try:
a = int(input('podaj liczbę: '))
d = {'a': a}
print(d['b'])
except ValueError:
print("value error")
except KeyError:
print("key error")
except:
print('unknown')
raise | true |
0dbaeee9be4a1f19b28af448248c2d5c740c3dbd | skjuhell/AE_GAN | /recurrence_plots.py | UTF-8 | 254 | 2.703125 | 3 | [] | no_license | import numpy as np
def rec_plot(x):
dim = x.shape[0]
rec_mat = np.zeros(shape=(dim,dim))
for i in range(dim):
for j in range(dim):
rec_mat[i, j] = x[i]-x[j]
rec_mat[j, i] = x[i] - x[j]
return rec_mat
| true |
9416583b108cf460fa9456c4823ae3c2f35bedf2 | SaiTejasweeReddy/Python-ProgrammingAssignments | /ICE 3/DrawGameBoard.py | UTF-8 | 623 | 4.25 | 4 | [] | no_license | def print_horiz_line(): #defining a function for horizontal lines
print(" ---" * board_size)
def print_vert_line(): #defining a function for vertical lines
print("| " * (board_size + 1))
#this is the main function from where the actual execution starts
if __name__ == "__main__":
board_size = int(input("Wh... | true |
d7c389fd72490c604a7fb82d1699751817786ba1 | Dirker27/GamesBrowser | /nettest.py | UTF-8 | 1,670 | 3.390625 | 3 | [] | no_license | import socket
'''t_host = ''
t_port = 50000
t_backlog = 5
t_size = 1024
t_s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
t_s.bind((host,port))
t_s.listen(backlog)
while 1:
client, address = s.accept()
data = client.recv(size)
if data:
client.send(data)
client.close()
host ... | true |
df57c4a204a9aebeb9f512ad06a4c80a85d156f3 | tsaplina/machine-learning | /statement-svm.py | UTF-8 | 1,629 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 28 16:22:57 2019
@author: daria
"""
'''
Обучите классификатор с линейным ядром, параметром C = 100000 и random_state=241.
Такое значение параметра нужно использовать, чтобы убедиться, что SVM работает
с выборкой как с линейно разделимой. При более... | true |
66b482f6580c057b16ec8b20b9ef73fb5a93b3ee | Sunnysuh99/HelloPython03 | /untitled/project/v3/main.py | UTF-8 | 3,683 | 3.234375 | 3 | [] | no_license | import sys
from . import sjvo, sjsrv
class SungJukV3Main :
# 성적 처리서비스 객체 생성
sjsrv = sjsrv.SungJukService()
# 메뉴 표시
def displayMenu(self):
str_list = []
str_list.append(' -= 성적 처리 프로그램v3 =-\n\n')
str_list.append('**********************\n')
str_list.append('1 : 새로운 성적데이터 추가 \n'... | true |
1fbdfcf4c93ee867d424e32191c09868be687a1c | bradleyhd/netsim | /nodes_vs_repair_time.py | UTF-8 | 1,922 | 2.546875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import math
from scipy.optimize import curve_fit
def linear(x, a, b):
return a * x + b
def exponential(x, a, b, c):
return a * x**2 + b * x + c
def exponential(x, a, b, c):
return a * x**b + c
#plt.figure(num=None, figsize=(16, 12), dpi=300, facecolor='w', ed... | true |
fc3dd68040bfe441fc927d2e12e32ff09a846844 | Selvakumar030998/billa | /billa61.py | UTF-8 | 89 | 2.90625 | 3 | [] | no_license | #S
x11,y22=map(str,input().split())
for i in range(0,int(y22)):
print(x11[i],end="")
| true |
fd29708c49fbdce32c5171b90b8ab394acd89f12 | ppv-vldmr/ITMO | /Linear Algebra/Lab2.py | UTF-8 | 2,537 | 3.125 | 3 | [] | no_license | import math
import sys
def vectorMultiplication(NAME1, NAME2):
RES = []
x = float(NAME1[1] * NAME2[2] - NAME1[2] * NAME2[1])
y = float(NAME1[2] * NAME2[0] - NAME1[0] * NAME2[2])
z = float(NAME1[0] * NAME2[1] - NAME1[1] * NAME2[0])
RES.append(x)
RES.append(y)
RES.append(z)
return RES
d... | true |
7eb8b6bae73610ae46b49ce4c673d8b16c764c35 | daniel-reich/ubiquitous-fiesta | /76pRYoqrmEQQtFAME_12.py | UTF-8 | 615 | 3.484375 | 3 | [] | no_license |
def is_astonishing(num):
partitions = [ [int(left) , int(right)] for (left , right) in get_partition(str(num))];
for partition in partitions:
a,b = partition;
partition_sum = get_sequence_sum(a,b);
if (partition_sum == num):
return "{}-Astonishing".format("AB" if a < b else "BA");
return False... | true |
b59ba5b820c28cb442e0f0e2c134ef79fc6d73ed | jiaekim123/python-crawling | /crawling-terbook-find.py | UTF-8 | 1,070 | 2.84375 | 3 | [] | no_license | import csv
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://www.terbook.co.kr/shop/listtype.php?type=3")
bsObject = BeautifulSoup(html, "html.parser")
book_info = []
for list in bsObject.find_all('li', {'class':'sct_li'}):
book = []
# print(list)
print(list.find('d... | true |
1ceb5bb817e59a6e948c9cc2d76d41f58b0b6f05 | EdwardCheung99/TwitterBot | /bot.py | UTF-8 | 1,221 | 2.8125 | 3 | [] | no_license | import tweepy
import time
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_KEY = ''
ACCESS_SECRET = ''
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
nouns_file = 'nouns.txt'
used_nouns_f = 'usednouns.txt'
def get_nouns(nouns_file):
... | true |
492ee9a1bbedd8d0f433c1086684718d9a484627 | astroumd/admit | /admit/util/test/unittest_VLSR.py | UTF-8 | 1,803 | 2.625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
#
# Testing util/VLSR.py functions
#
# Functions covered by test cases:
# vlsr()
# vlsr2()
# read_vlsr()
import admit
import sys, os
import unittest
class TestVLSR(unittest.TestCase):
# initialization
def setUp(self):
self.verbose = False
self.testName = "Utili... | true |
8502f2a82fdf2701819b2c631f3c46982e6833cc | yaqubotics/hexa_rrt_slam | /obstacle_avoidance/scripts/VelocityController.py | UTF-8 | 4,996 | 2.734375 | 3 | [] | no_license | """
testing offboard positon control with a simple takeoff script
"""
import rospy
from mavros_msgs.msg import State
from geometry_msgs.msg import PoseStamped, Pose, Point, Quaternion, Vector3, Twist, TwistStamped
import math
import numpy
from std_msgs.msg import Header
from PID import PID
from tf.transformations impo... | true |
90ae8758700a3017189069d01198e1f084682403 | kateshostak/leetcode | /12_last_stone_weight.py | UTF-8 | 471 | 3.5625 | 4 | [] | no_license | from typing import List
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
stones.sort(reverse=True)
for i in range(len(stones) - 1):
stones.sort(reverse=True)
stones[i+1] = abs(stones[i] - stones[i+1])
return(stones.pop())
def main():
# Inpu... | true |
95ad6bbcd4a633fbe91c34f50bf4dd4f28b06916 | loTaipan/demos | /mqtt_matplotlib_graph0/limmat_fuehler.py | UTF-8 | 2,292 | 2.65625 | 3 | [] | no_license | # ref.: https://www.thethingsnetwork.org/forum/t/ttn-microclient/2680/4
# ref.: http://stackoverflow.com/questions/22495861/plotting-serial-data-in-python-how-to-pause-matplotlib-figure
import json
import paho.mqtt.client as mqtt
import numpy as np
from matplotlib import pyplot as plt
GRAPH_TITLE = "Limmat F\u00fchle... | true |
b48509204f701f9e4f5299c31a458a3562ae80fe | CooCoo/WebpageWatcher | /watcher.py | UTF-8 | 1,355 | 2.578125 | 3 | [] | no_license | __author__ = 'Daniel Dreier'
import urllib.request
import hashlib
import pickle
import smtplib
from email.mime.text import MIMEText
from config import Settings
def main():
with urllib.request.urlopen(Settings.url) as url:
s = url.read()
h = hashlib.sha256(s).hexdigest()
print(h)
try:
... | true |
557c831eb8526e5677903e6db40411e66080c46f | jamiurrahman/GuidedResearch | /Final_Accelerometer_And_Gyroscope_Together/Dataset_Creator.py | UTF-8 | 50,123 | 2.75 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
class Dataset_Creator:
# train_dataset = tf.data.Dataset.from_generator
# val_dataset = tf.data.Dataset.from_generator
# test_dataset = tf.data.Dataset.from_generator
# val_delta_t = []
# val_delta_alpha = []
# Normalizing Data
# Be... | true |
ed3f14208be33a0021f7df3257b3ba3f5c71b1ac | jushreder/Python_lessons_basic | /lesson01/home_work/hw01_easy.py | UTF-8 | 2,143 | 4.375 | 4 | [] | no_license |
__author__ = 'Шредер Ю.В.'
# Задача-1: Дано произвольное целое число (число заранее неизвестно).
# Вывести поочередно цифры исходного числа (порядок вывода цифр неважен).
# Подсказки:
# * постарайтесь решить задачу с применением арифметики и цикла while;
# * при желании решите задачу с применением цикла for.
# код п... | true |
06184d62ced49c112e4ccef2c860494a95369cc9 | DanielQFK/Python-Exercise | /Python-Exercise-04.py | UTF-8 | 299 | 4.1875 | 4 | [] | no_license | # Numbers
# some exercise about numbers
# 1.
print(5+7)
#The output = 12
# 2.
print(9-19)
#The output = -10
# 3.
print(8*6)
#The output = 48
# 4.
print(98/45)
#The output = 2.1777777777777776
# 5.
print(5**2)
#The output = 25
# 6.
print(((242/2)*(8**6))-(143.5*10))
#The output = 31717989.0
| true |
e98a87708aa0c978f01a1532accfc504c745980a | buckket/adventofcode | /2017/4/gold.py | UTF-8 | 442 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
import itertools
import collections
valid_passwords = 0
def is_valid(data):
c = []
for word in data:
c.append(collections.Counter(word))
if any([x == y for x in c for y in c if x is not y]):
return False
return True
with open("input.txt") as indata:
for li... | true |
f2d3cdf4a448fa319738acde5075f77d7e384144 | op07n/streamlit-example | /app/navigation_radios/home_radio.py | UTF-8 | 1,187 | 2.75 | 3 | [
"MIT"
] | permissive | import requests
from PIL import Image
from io import BytesIO
import streamlit as st
from app.abstract_classes.abstract_navigation_radio import AbstractNavigationRadio
TSDS_BANNER_URL = "https://raw.githubusercontent.com/thatscotdatasci/thatscotdatasci.github.io/master/assets/images/homepage_1800.jpg"
class HomeRad... | true |
9a018917b97d3cf4ce0998a298497792f9e7a85d | JingkaiTang/github-play | /point/bad_woman_or_big_woman.py | UTF-8 | 231 | 2.875 | 3 | [] | no_license |
#! /usr/bin/env python
def fact_or_government(str_arg):
next_thing(str_arg)
print('say_same_year_of_important_work')
def next_thing(str_arg):
print(str_arg)
if __name__ == '__main__':
fact_or_government('fact')
| true |
1a7304df05625fecfc8af6f4a55d328b249fb048 | brizjose/JBCodingDojo | /python_stack/python_fundamentals/ternary_operator.py | UTF-8 | 226 | 3.9375 | 4 | [] | no_license | # python has something called a ternary operator as an alternative to if statements
# syntax is: 'do this' if condition is true, else 'do that'
#example:
print('Coding Dojo' if stacks >= 3 else 'You are not Coding Dojo!')
| true |
3cf4bb37ccc01be6f2cb5d2f1b80ac04c3dcd205 | Helaluzzaman/python_practice1 | /Vs.code/htmlpagedata.py | UTF-8 | 309 | 2.734375 | 3 | [] | no_license | import urllib.request, urllib.error
from bs4 import BeautifulSoup
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input("Enter: ")
fhand= urllib.request.urlopen(url,context=ctx)
bdata = fhand.read()
html = bdata.decode()
print(html) | true |
59c1d504ef442cb1e5581793cf0122e8fd640ca6 | Aasthaengg/IBMdataset | /Python_codes/p04033/s422453236.py | UTF-8 | 233 | 3.546875 | 4 | [] | no_license | A = list(map(int, input().split()))
A.sort()
a = A[0]
b = A[1]
c = b-a
if a <= 0 <= b:
print("Zero")
elif a > 0:
print("Positive")
elif b < 0:
if c%2 == 1:
print("Positive")
else:
print("Negative")
| true |
b2940a0d0642645435a5e5d43adf83cf20dcda8a | adityavijay10/c141 | /main.py | UTF-8 | 2,844 | 2.703125 | 3 | [] | no_license | from flask import Flask,jsonify,request
import csv
from demographicflitering import output
from contentbasedfiltering import get_recomdations
all_movies=[]
with open('final.csv',encoding='utf-8')as f:
reader=csv.reader(f)
data=list(reader)
all_movies=data[1:]
# print(all_movies)
liked_movies=... | true |
c8d47e6bff4fcfeb59b214160007fec16f470ff7 | meenakshi-madan/ProgrammingPraxisSolns | /happy-new-year.py | UTF-8 | 666 | 3.828125 | 4 | [] | no_license | from __future__ import division
import itertools
"""
Problem statement:
As we begin the new year, we note that 109-8*7+654*3-2/1 = 2013. There are three other combinations of the numbers 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, in order, combined with the five operators NIL, +, -, * and / that also evaluate to 2013.
Your task i... | true |
3a84bca5471ee3b89f2a401b4846b9321bf95cca | Satertek/adventofcode2019 | /day4.py | UTF-8 | 1,288 | 3.4375 | 3 | [
"MIT"
] | permissive | import numpy as np
import sys
day4_in = np.loadtxt('day4_input.txt', dtype=int, delimiter='-')
PART_ONE = False
def has_adjacent_digits(password):
password = str(password)
for i in range(len(str(password))-1):
if (password[i] == password[i+1]):
if PART_ONE:
return True
... | true |
710fea2890b11d28254e4932c6dfa3fe3bd97333 | Lemon-Chad/Caravan | /cvn.py | UTF-8 | 2,339 | 2.71875 | 3 | [] | no_license | import os
import pickle
from Network import Network
import zipfile
import pathlib
import json
n = Network()
while True:
cmd = input("Caravan : ")
if cmd.startswith("upload "):
filename = cmd.replace("upload ", "", 1)
if not os.path.exists(filename):
print("-- File does not exist!");... | true |
64affd44a70385b85d941313f44866c7a082796d | acorg/seqgen | /seqgen/sequences.py | UTF-8 | 15,410 | 2.625 | 3 | [
"MIT"
] | permissive | import sys
from json import load
from random import choice, uniform
from dark.aa import AA_LETTERS
from dark.fasta import FastaReads
from dark.reads import Read
class Sequences(object):
"""
Create genetic sequences from a JSON specification.
@param spec: A C{str} filename or an open file pointer to read... | true |
7005f7e4701eae3a95fdca9e140f6021e062bd77 | TruVortex/Competitive-Programming | /ECOO/ecoo15r1p1.py | UTF-8 | 322 | 3.171875 | 3 | [] | no_license | from collections import defaultdict
for i in range(10):
cnt = defaultdict(int)
while (s := input().strip()) != 'end of box':
cnt[s] += 1
def f(x):
return (x + 6) // 7 * 13
print(sum(f(cnt[x]) for x in ['orange', 'blue', 'green', 'yellow', 'pink', 'violet', 'brown']) + cnt['red'] * 16... | true |
f94ed67a84da93660fe3336c341c119ca6e3d7b2 | tmantock/python | /hash.py | UTF-8 | 2,820 | 3.8125 | 4 | [] | no_license | class Node:
def __init__(self, key = None, value = None, next = None):
self.key = key
self.value = value
self.next = next
def getKey(self):
return self.key
def getValue(self):
return self.value
def getNext(self):
return self.next
def setNext(self, node... | true |
e614d30f8edc495b630bce9497c6add5f6713345 | n-ottavi-n/atelier1 | /Atelier2.py | UTF-8 | 6,480 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 7 14:54:44 2021
@author: notta
"""
import random
from math import sqrt
from datetime import date
#EXERCICE 1
def message_imc(imc):
"""renvoie une chaine decrivant l'imc"""
TAB_IMC=['denutriton ou famine','maigreur','corpulence normale','surpoi... | true |
b6b46edefaa4e925da8bc56f258dbf21936c1a78 | 1615961606/-test | /备份/1804爬虫/1803爬虫/第一周/第二天/作业/lagou.py | UTF-8 | 5,352 | 2.75 | 3 | [] | no_license |
#1.寻找目标url,分析目标url
#目标url:https://www.lagou.com/jobs/positionAjax.json?city=%E5%8C%97%E4%BA%AC&needAddtionalResult=false
# 参数由两部分组成:
# 1.query string:
# city: 北京
# needAddtionalResult: false
# 2.form data:
# first: false
# pn: 2
# kd: java
import urllib.request as request
import urllib.parse as parse
impor... | true |
df4cc6ee5a723e86f0f35344a4f589dc2438a7e7 | UrvashiBhavnani08/Python | /Electricity_bill.py | UTF-8 | 566 | 4.21875 | 4 | [] | no_license | unit = int(input("Enter the number of units consumed: "))
per = (unit*20)/100
if(unit>=0 and unit<=50):
unit *= 0.5
unit += per
print("Your Pay amount of Electricity bill is: ",unit)
elif(unit>50 and unit<=150):
unit *= 0.75
unit += per
print("Your pay amount of Electricity bill is: ",u... | true |