blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1f8f7c6d5994d527f94d66164b9ef67fa869fcb4 | Python | CHETANYA20/hackerrank-1 | /loops.py | UTF-8 | 133 | 2.953125 | 3 | [] | no_license | import sys
# https://www.hackerrank.com/challenges/python-loops
for i in range(0, int(sys.stdin.readline().strip())):
print i * i
| true |
16e61baedfb27ac6688320e25750d12b5940dc7d | Python | Kevinwty0107/Computational-Physics | /HW1-6 Conjugate Gradient Method for Solving Linear Equations.py | UTF-8 | 3,682 | 3.46875 | 3 | [] | no_license | # 利用共轭梯度法求解方程组
import math
import matplotlib.pyplot as plt
N = 100 # 阶数
class matrix_value: # 这一段定义了稀疏矩阵中的每一个值的结构
def __init__(self, x, y, value):
self.row = x
self.column = y
self.number = value
class sparse_matrix: # 矩阵从1开始,这一段定义了矩阵的结构
def __init__(self, x, y):
self.row... | true |
ce348230241415a6db9959e88a6835e3a74038a4 | Python | pedropacn/BD-2019-1-VGDB | /app/models.py | UTF-8 | 1,130 | 2.859375 | 3 | [] | no_license | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from app import login_manager
from app.database.Object import Object
class User(UserMixin, Object):
"""
User class
"""
id = None
email = None
username = None
first_name = None
l... | true |
258956e97c06e526ad7d6442d1a8cf31a5b30bc8 | Python | valagab/Bingo | /game.py | UTF-8 | 1,991 | 3.71875 | 4 | [] | no_license | from player import Player
from human_player import HumanPlayer
import random
class Game:
def __init__(self):
self.numbers = {n for n in range(1, 91)}
num_of_players, num_of_cards = self.ask_for_params()
self.players = []
self.done_win_conditions = []
for i in range(0, num_of... | true |
980ce4e8661b411c5a952e3f2c190b4662cf1a04 | Python | wrwnuck/CSC-138-Computer-Networks-and-Internets | /socket_2.py | UTF-8 | 3,687 | 2.703125 | 3 | [] | no_license | from socket import *
import ssl
import base64
msg = "\r\n I love computer networks!"
endmsg = "\r\n.\r\n"
# Choose a mail server (e.g. Google mail server) and call it mailserver
mailserver = 'smtp.gmail.com' #Fill in start #Fill in end
port = 587
# Create socket called clientSocket and establish a TCP c... | true |
6394e3f8dfa94a2133b01a8593ac6f918a655463 | Python | Ank0re/my-first-blog | /python_intro.py | UTF-8 | 196 | 3.140625 | 3 | [] | no_license | def hi(name):
print ('Hallon '+ name+'!')
cats = ['Herman', 'Pompoen', 'Roosje', 'Neeg']
for name in cats:
hi(name)
print('Volgende kat')
for i in range(1,7):
print(i)
| true |
dfecde7d64739252e410dc3f0a72ec286af260cd | Python | mkseth4774/ine-guide-to-network-programmability-python-course-files | /excjunk.py | UTF-8 | 183 | 3.328125 | 3 | [
"MIT"
] | permissive | num = 99
try:
print('You entered ' + num + ' for your number!')
except TypeError:
print('Houston, we have a problem...')
print('...but who cares, let us keep rolling on!!!')
| true |
eab81f37edd6380cea30d7a4eaf2fe9d3a051929 | Python | mathause/mutils | /mutils/water_vapor.py | UTF-8 | 9,837 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Mathias Hauser
# Date: 07.2015
from functools import wraps
import numpy as np
import warnings
# definitions
# Abbr. | Name | Unit
# -------+---------------------------------+-----------
# e | partial pressure | [P... | true |
b17af29647dc20f82258cc85c8baf57704cece80 | Python | edurainbow/python_pj | /2019/201910/绘制图形.py | UTF-8 | 1,692 | 3.328125 | 3 | [] | no_license | #__author:"Peter"
#date:2019/11/14
'''
# import turtle
# turtle.screensize(1570,817)
# turtle.write("hello天朝",font=("微软亚黑",20,"normal"))
# turtle.showturtle()
# turtle.circle(50,steps=20)
# turtle.done()
# '''
# import turtle
# turtle.screensize(1570,817)
# turtle.write("hello天朝",font=("微软亚黑",20,"normal"))
# turtle.sho... | true |
05a07e54e35bfd0c5c2ffe65d8ce9350d506e4c9 | Python | likejazz/jupyter-notebooks | /deep-learning/keras-shape-inspect.py | UTF-8 | 2,898 | 3.0625 | 3 | [] | no_license | # %% Load data from IMDB
from keras.preprocessing import sequence
from keras.models import Sequential, Model
from keras.layers import Dense, Embedding, Input
from keras.layers import LSTM, GlobalMaxPooling1D, Flatten, Concatenate, merge, concatenate
from keras.datasets import imdb
import numpy as np
max_features = 20... | true |
8f26040fac86485faa847cd889f370f0f356d11f | Python | jluispcardenas/scheme_interpreter | /scheme_interpreter/utils.py | UTF-8 | 963 | 3.296875 | 3 | [
"MIT"
] | permissive | ## JL Cardenas
## Author jluis.pcardenas@gmail.com
from .pair import Pair
class Utils:
def __init__(self):
pass
@staticmethod
def is_atom(o):
return isinstance(o, Pair) == False
@staticmethod
def get_type(o):
if isinstance(o, Pair):
return "pair"
elif isinstance(o, str):
return "at... | true |
d2c530eb19adf230a11255b111d7698e981d16ed | Python | ach5948/Project-Euler | /p007.py | UTF-8 | 212 | 3.265625 | 3 | [] | no_license | def isprime(x):
sqrt = int(x ** 0.5) + 1
return all(x % i for i in range(2, sqrt))
def main(n):
pnum = 1
check = 2
while pnum < n:
check += 1
if isprime(check):
pnum += 1
return check
| true |
7b1f887f282ce7006a65f90dc1ab955c43dcd5c3 | Python | nisarg-ss/project_euler | /problem_006.py | UTF-8 | 111 | 3.21875 | 3 | [] | no_license | n=100
sum_of_squares=(n*(n+1)*((2*n)+1))/6
square_of_sum=((n*(n+1))/2)**2
print(square_of_sum-sum_of_squares) | true |
4e17d6cc0424c3b12d6bec03f687560ed689a416 | Python | lorenzobellino/Codejam-2021 | /qualification Round/Cheating Detection/codejam5.py | UTF-8 | 370 | 3.109375 | 3 | [] | no_license | T = int(input())
P = int(input())
for z in range(T):
risposte= []
cazzi = []
for i in range(100):
ll = str(input())[:1001]
risposte.append([int(x) for x in ll])
for r in risposte:
sum=0
for c in r:
sum+=c
cazzi.append(sum)
print("Case ... | true |
428dd39b2000923e2673134169fb74552e6ad758 | Python | unnoticable/Python-for-Everybody | /Programming4Everybody/week6_quiz.py | UTF-8 | 701 | 3.78125 | 4 | [] | no_license | # Q1
str1 = "Hello"
str2 = "there"
bob = str1 + str2
print bob
# Hellothere choose A
# Q2
x = '40'
y = int(x) + 2
print y
# 42
# Q3
x = 'From marquard@uct.ac.za'
index = x.find('q')
print index # 8
print x[8]
# Q4
atpos = x.find('@')
sppos = x.find('.',atpos)
# print atpos :13
# print sppos :17
host = x[atpos+1:sp... | true |
1871d994e3f8f1b1c2ffa21eb4a79477358e8f64 | Python | twer4774/TIL | /Crawling/3_Library/python_crawler_5.py | UTF-8 | 1,505 | 3.03125 | 3 | [
"MIT"
] | permissive | #-*-coding:UTF-8-*-
import re
import requests
import lxml.html
import time
def main():
#여러페이지를 크롤링하기위해 Session사용
session = requests.Session()
response = session.get('http://www.hanbit.co.kr/store/books/new_book_list.html')
urls = scrape_list_page(response)
for url in urls:
response = sess... | true |
d2484a1ab6ebe72cc606764efa36cfbc29ab41c1 | Python | jacooob/Cs415Elevator | /World.py | UTF-8 | 1,453 | 3.109375 | 3 | [] | no_license | import pygame
import constants
import Building
import People
# controls the base world and the current level
ELEVS = constants.ELEVS
FLOORS = constants.FLOORS
class World():
#sprite lists for each part of the level
elevator_list = None
Building_list = None
people_list = None
background = None
def __init__(sel... | true |
dbba26d63847a6be074aa175b102654e85cfca30 | Python | ariewahyu/oil-palm-detection | /xml_to_yolo.py | UTF-8 | 1,530 | 2.75 | 3 | [] | no_license | # -*- coding; utf-8 -*-
# author: www.pinakinathc.me
import argparse
import os
import glob
import xml.etree.ElementTree as ET
def main(xml_filepath, output_dir):
xml_filename = os.path.split(xml_filepath)[-1]
yolo_gt = ""
tree = ET.parse(xml_filepath)
root = tree.getroot()
print (root)
size =... | true |
cd4083ef5badb19c8cd0265d0f6173d2331aa3a7 | Python | neelamy/Algorithm | /Graph Theory/Random/DoubleWeights_SRM685.py | UTF-8 | 1,222 | 3.5 | 4 | [] | no_license |
class DoubleWeights:
def minimalCost(self, w1, w2):
w1 = list(w1); w2 = list(w2)
for ind, i in enumerate(w1):
i = map(lambda x : 0 if x=='.' else int(x),list(i))
w1[ind] = i
for ind, i in enumerate(w2):
i = map(lambda x : 0 if x=='.' else int(x),list(i))
w2[ind] = i
key = [(100, 100)] * len(w1... | true |
406e36bcff2429592f817d0372069bb75415b0aa | Python | cmontalvo251/Python | /plotting/threeD_round3.py | UTF-8 | 2,738 | 2.828125 | 3 | [] | no_license | # Import data
import time
import numpy as np
import plotly.graph_objects as go
def frame_args(duration):
return {"frame": {"duration": duration},
"mode": "immediate",
"fromcurrent": True,
"transition": {"duration": duration, "easing": "linear"},
}
# Generate curve d... | true |
7f9bb640395f250dde598eb57732019ee7036076 | Python | argetamorina/CodingDojo-Bootcamp | /Python-Django/OOP/MathDojo/mathdojo.py | UTF-8 | 1,766 | 3.703125 | 4 | [] | no_license | class MathDojo(object):
def __init__(self):
self.result = 0
def add(self, *nums):
for num in nums:
self.result += num
return self
def subtract(self, *nums):
for num in nums:
self.result -= num
return self
print MathDojo().add(4... | true |
ce0c52d944cf07ba3a99ebac144de57f3fdbee30 | Python | grejojoby/dsip-experiments | /circularlinear.py | UTF-8 | 682 | 3.09375 | 3 | [] | no_license | x1=[2,1,-2]
x2=[1,2,-1]
print("Input 1: ",x1)
# x1 = list(map(int,input().split(",")))
print("Input 2: ",x2)
# x2 = list(map(int,input().split(",")))
lengthX1 = len(x1)
lengthX2 = len(x2)
n = lengthX1 + lengthX2 - 1
for i in range(n-lengthX1):
x1.append(0)
for i in range(n-lengthX2):
x2.append(0)
id1 = []
id2 = [... | true |
b696466ba88b354b169586caec7104471b3c67c9 | Python | xwlee9/python | /python/keras_study/3.minist.py | UTF-8 | 1,731 | 2.84375 | 3 | [] | no_license | import numpy as np
from keras.datasets import mnist
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.optimizers import SGD, Adam
from keras.regularizers import l2
(x_train, y_train), (x_test, y_test) = mnist.load_data()
print(x_train.shape)
print(... | true |
7e0e500c951ded7142c1bc92c39dc9d9e65dbbbc | Python | flipsyde59/trrp_1 | /source.py | UTF-8 | 15,671 | 2.609375 | 3 | [] | no_license |
def auth():
# Так как модули используются только в этой функции, что б память не засорять импорт здесь
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ... | true |
9aeddc19deb4af587ac072bc1a5122215d63f845 | Python | IverMartinsen/Chairs | /chairs_per_person.py | UTF-8 | 349 | 3.78125 | 4 | [] | no_license | f = open("reservations")
for reservation in f:
name, number = reservation.split(",")
try:
chairs_per_person = 50 / int(number)
except ValueError as error:
print(error)
except ZeroDivisionError:
chairs_per_person = 0 / int(9)
print("{} will get {} chairs per person".form... | true |
f153391ab197313c118b8e559de8b2bfa562e364 | Python | Navyashree008/if_else_2 | /swathis_code_2.py | UTF-8 | 297 | 3.34375 | 3 | [] | no_license | sum = 0
i = 1
while i<=100:
print(i)
sum = sum+i
i = i+1
print(sum)
sum = 0
average = 0
n = 1
while n<=11:
weight=int(input("enter weight"))
sum=sum+weight
n=n+1
average=sum/n
print(sum)
print(average)
if average%5==0:
print("5 se multiple hai")
else:
print("nahi hai") | true |
f83a5629870976480bc85259f0e1e58670ed7795 | Python | yubozhao/BentoML | /tests/unit/_internal/runner/test_runner.py | UTF-8 | 1,234 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import logging
import pytest
import bentoml
from bentoml._internal.runner import Runner
class DummyRunnable(bentoml.Runnable):
@bentoml.Runnable.method
def dummy_runnable_method(self):
pass
def test_runner(caplog):
dummy_runner = Runner(DummyRunnable)
assert dummy_runner.name == "dummyrun... | true |
4b1252b2102be8a193ffd4254478e778de689a3b | Python | MariosTheof/AdaBoost-Implementation-for-spam-filtering | /main.py | UTF-8 | 3,755 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 27 23:12:33 2018
@author: marios
"""
#Based on this paper : http://rob.schapire.net/papers/explaining-adaboost.pdf
#Using enron spam database
import pandas as pd
import os
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.mo... | true |
ba1c59d7ecc055d6dbc363cd048a018720fee036 | Python | htyeh/CaeVige | /kasiski_crack.py | UTF-8 | 7,952 | 3.09375 | 3 | [] | no_license | ######### approach #########
### FIND KEY LENGTH ###
# ...
### CRACK KEYS ###
# Following steps for each possible key length
# 1. For each position: try all keys, create a list of keys from most to least probably depending on freq. analysis
# 2. Cut each list to the first n elements
# 3. Brute force through the filtere... | true |
d18a705ccef9c161871cddb5f798b322aa031c93 | Python | ohsu-comp-bio/g2p-aggregator | /harvester/feature_enricher.py | UTF-8 | 9,475 | 2.53125 | 3 | [] | no_license | import json
import requests
import os
import mutation_type as mut
import logging
import re
import copy
import gene_enricher
import protein
def _enrich_ensemble(feature, transcript_id, exon, provenance_rule):
""" get coordinates from ensembl
curl -s 'http://grch37.rest.ensembl.org/lookup/id/ENST00000275493... | true |
dca51b6898abfbd91e7b2db76f5a0382c641f49f | Python | fpicot/adventofcode | /easter_031.py | UTF-8 | 358 | 3.234375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
count=0
input_file = "easter_03.input"
#Mise au propre de l'input
input = [[int(x) for x in line.rstrip('\n').split()] for line in open(input_file)]
#Verification des triangles
for list in input:
list.sort()
if (list[0] + list[1]) > list[2]:
count += 1
print('Nombr... | true |
26d54be778d271cf6f640d697a5f88f8efe0cc69 | Python | evalldor/verpy | /verpy/maven/pom.py | UTF-8 | 2,094 | 2.546875 | 3 | [] | no_license | import typing
import re
from pyparsing import makeXMLTags, SkipTo, Word, alphanums, Group, Empty, ZeroOrMore, htmlComment
import bs4
import xmltodict
from pprint import pformat
class EffectivePom:
"""To determine the depenencies of an artifact, an 'Effective POM' has to
be built."""
def __init__(self):... | true |
ddd7d3d8e58bacc9302fa59f03ad89b10138ef75 | Python | Aasthaengg/IBMdataset | /Python_codes/p02407/s158307840.py | UTF-8 | 240 | 3.265625 | 3 | [] | no_license | n = int(input())
y =list(map(int,input().split()))
x = list()
for i in range(n-1,-1,-1):
arry = y[i]
x.append(arry)
for i in range(n):
if(i == n-1):
print('{}'.format(x[i]))
else:
print(x[i],end=' ')
| true |
3bbf52283980726036b94210ad472d2172f4c24b | Python | luyiyun/SlideSurvival | /plot.py | UTF-8 | 2,285 | 2.515625 | 3 | [] | no_license | import os
import sys
import json
import matplotlib.pyplot as plt
import pandas as pd
def test_plot():
test_reses = []
for i in range(10):
res_path = './RESULTS/zoom20_rr%d/' % i
test_file = os.path.join(res_path, 'test.json')
with open(test_file, 'r') as f:
test_res = json... | true |
173e2904f027525a8d35fec345c319a2f1326289 | Python | mscaudill/openseize | /src/openseize/filtering/mixins.py | UTF-8 | 12,118 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | """This module contains filter mixin classes endowing filters with the
abiility to plot their impulse and frequency responses to a Matplotlib
figure called the 'Viewer'.
For usage, please see opensieze.filtering.iir or fir modules
"""
import typing
from typing import Optional, Sequence, Tuple
import matplotlib.pyplot... | true |
3909dbd1ddf42328f77c8e4788135532aaf694a6 | Python | bernardocuteri/wasp | /tests/wasp1/AllAnswerSets/checker_16.test.py | UTF-8 | 525 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | input = """
% An example for which a wrong version of the quick model check caused
% answer sets to be missed.
% Simplified and slightly modified version of checker.15.
:- not p14.
:- not p24.
:- p15.
p14 | p2 :- not p5, p24.
p1 | p15 | not_p18 :- not p5, p24.
p24 | p8 :- p24, p2, not p25.
p21 | p5 | p11 | p25 :-... | true |
6321dab37c35ded627782c60c8a457e89786041a | Python | shachakz/marshmallow_numpy | /tests/test_numpy_field_simple.py | UTF-8 | 586 | 2.609375 | 3 | [
"MIT"
] | permissive | import pytest
import numpy as np
from marshmallow_numpy import NumpyField
@pytest.fixture()
def field() -> NumpyField:
return NumpyField()
def test_field_serialize(field: NumpyField):
res = field._serialize(np.zeros((3, 3)))
assert res == {'data': [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], 'dt... | true |
900e081fea1feb5fcce93a1ea9d525c53dcca880 | Python | ebeilmann/DixieStateUniversity | /cs3310/tobase10.py | UTF-8 | 295 | 3.40625 | 3 | [] | no_license | alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.?! \t\n\r"
def tobase10(string):
v=0
for char in string:
p=alphabet.find(char)
if p>=0:
v*=len(alphabet)
v+=p
return v
def main():
instr="hello"
print tobase10(instr)
main()
| true |
23aa3b3c49d42c1288fcdefa5c943ee6dc15c26a | Python | smartparrot/general_algorithm | /viterbi_algorithm.py | UTF-8 | 2,874 | 2.828125 | 3 | [] | no_license | import numpy as np
import random
#时间步长
T = 9
h = 5
S = ['p','a','n','d','a']
np.random.seed(0)
data = np.random.rand(h,T)
print('data',data)
# 当前节点的最优父节点的行号,行号是标签序列从上到下排列 0,1 ...,len(h)-1,时间t=0(或j=0)的一列节点没有父节点
BP = [[None for _ in range(T)] for _ in range(h)]
BP = np.array(BP)
# print(BP[1])
# print(BP)
# print(np.a... | true |
1fc12e6c9b3b028e5bd8eb0e59e593e507dcf008 | Python | dongting/sdnac | /sdnac/policy/policy.py | UTF-8 | 1,891 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from model import *
import json_parser as parser
import json # for debugging
TYPES = ['subject', 'resource', 'action', 'environment'] # corresponds to model.py
class PolicyEngine(object):
def __init__(self, policy_file):
self.fast_match = dict()
self.pobj = parser.Parser(policy_file)
sel... | true |
42a1af4349083e79c502244bd546e1cf673a7461 | Python | 17Ayaan28/SENG3011_200OK | /PHASE_1/API_SourceCode/GCP_function_code/nlogs.py | UTF-8 | 1,052 | 2.546875 | 3 | [] | no_license | import pyrebase
import requests
def logs(request):
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.pocoo.org/doc... | true |
6b739845eaeaa87bdc8ca3beb02eb9383359055d | Python | Takuma-Ikeda/other-LeetCode | /src/easy/answer/minimum_subsequence_in_non_increasing_order.py | UTF-8 | 715 | 3.5 | 4 | [] | no_license | from typing import List
class Solution:
def minSubsequence(self, nums: List[int]) -> List[int]:
result = []
desc = sorted(nums, reverse=True)
for idx, val in enumerate(desc):
result.append(val)
if sum(result) > sum(desc[idx + 1:]):
break
r... | true |
a2d0577acc62c72c2ebba16337ad06341baad65f | Python | AlicePorton/Common_Spider | /v1/query_wikileaks.py | UTF-8 | 4,063 | 2.671875 | 3 | [] | no_license | import json
import re
import requests
from bs4 import BeautifulSoup
"""
从wikileaks中下载指定文件,入口函数为
`get_all_pages(pages, query_email)`
前面是需要爬取的页数, 后面是指定查询的语句
例如, 爬取`arron@email.com`前121页内容,
输入 `get_all_pages(121, "arron@hbgary.com")
"""
__index = 0
def is_valid(content):
return True if content.status_code ==... | true |
36997f05e1b2cabecc2ada2662ee95b80d8bc7d2 | Python | ahmedbelalnour/python | /learning_examples/dictionary.py | UTF-8 | 1,224 | 4.03125 | 4 | [] | no_license | #!/usr/bin/python3
regionCode_D={}
regionCode_D["Cairo"] = "02"
regionCode_D["Alex"] = "03"
print(regionCode_D) #{'Alex': '03', 'Cairo': '02'}
#Mapping: You can use dictionaries to map one set of values to another:
phonebook_D= {
"Cairo office":"2468",
"Alex office":"1357",
"Zag office": "123456789"
}
print(phonebo... | true |
dd0455ab38ab2a45d117e09af124e19fea6db9dc | Python | KalebVR/EDT-Micromouse | /Prototype/Prototype.py | UTF-8 | 2,721 | 3.34375 | 3 | [] | no_license | '''
Chicago EDT MicroMouse
Fall 2020
Author: Kaleb Vicary-Rzab
'''
import RPi.GPIO as io
import time
io.setwarnings(False)
io.setmode(io.BCM)
# Ultrasonic Ranger Right Pins
# GND, ECHO, TRIG, VCC
TRIG_1 = 23
ECHO_1 = 24
# Ultrasonic Ranger Left Pins
# GND, ECHO, TRIG, VCC
TRIG_2 = 22
ECHO_2 = 27
# Motor Pins
# ... | true |
f68f12eaf1e5974d2169ae67ba1a92b153fce4a7 | Python | Zeonho/LeetCode_Python | /archives/38_Count_and_Say.py | UTF-8 | 1,666 | 4 | 4 | [] | no_license | """
38. Count and Say
Easy
1054
8204
Add to List
Share
The count-and-say sequence is the sequence of integers with the first five terms as following:
1. 1
2. 11
3. 21
4. 1211
5. 111221
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 121... | true |
d5d85df09344073782ccd969b1847c9e85c8473a | Python | share-with-me/flask_ex | /upperajax.py | UTF-8 | 386 | 2.546875 | 3 | [] | no_license | #uses ajax to convert the inputted text to uppercase
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template("formajax.html")
@app.route('/convert', methods = ['POST'])
def convert(data):
return request.form['text'].upper()
if __name__ == '__main_... | true |
1488c8131278bc16925c6d828c1e2ce2a2d3660f | Python | anas21-meet/Meet-yl1 | /inheritance.py | UTF-8 | 1,165 | 3.734375 | 4 | [] | no_license | from turtle import*
import turtle
turtle.bgcolor('yellow')
class Ball(Turtle):
def __init__(self,r,color,dx,dy,shape):
Turtle.__init__(self)
self.r=r/10
self.color(color)
self.dx=dx
self.dy=dy
self.penup()
self.shape('circle')
def move(self,screen_width,screen_height):
self.screen_width=screen_width
... | true |
8cedff86f7a230840e1486cdf613ea06add5db97 | Python | PMantovani/ai-demo | /02_classifier_more_features.py | UTF-8 | 655 | 3.75 | 4 | [] | no_license | from sklearn import svm
# E se tivéssemos mais características (features)?
# Simplesmente aumentaríamos a dimensionalidade do problema, mas é tão simples quanto adicionar mais um campo :)
# -------- Característica #1
# | ----- Característica #2
# | | -- Característica #3
# | | |
# [ 0 0 0 ] <- amostra ... | true |
02128ff5e111af0757b2c5b344ef94b48f562e15 | Python | portrain/Brickflow | /brickflow.py | UTF-8 | 1,573 | 2.671875 | 3 | [] | no_license | import click
from pprint import PrettyPrinter
from core import Plan
_version = '0.1.0'
@click.group(context_settings=dict(help_option_names=['-h', '--help']))
@click.version_option(version=_version)
def cli():
pass
@cli.command('plot')
@click.option('--layout', type=click.Choice(['neato', 'dot', 'twopi', 'cir... | true |
1f064402ef94a8051a96b7dc4f7529b6e01446ac | Python | claudiordgz/udacity--data-structures-and-algorithms | /P2/problem_1.py | UTF-8 | 2,925 | 4.15625 | 4 | [] | no_license | """
Calculate the floored square root of a number
Args:
number(int): Number to find the floored squared root
Returns:
int: Floored Square Root
"""
import timeit
def sqrt_multiplication(number):
start = 0
end = number
while start <= end:
midpoint = (start + end) // 2
... | true |
cd64c43095fa0f44f8b150f427fb685d0e9228ed | Python | denisstasyev/Computational_Mathematics | /PracticalTask1/source/solutions_comparison_2.py | UTF-8 | 3,299 | 3.0625 | 3 | [] | no_license | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
# Различные значения h
hs = [10**-1, 7.5*10**-2, 5*10**-2, 2.5*10**-2,
10**-2, 7.5*10**-3, 5*10**-3, 2.5*10**-3,
10**-3, 7.5*10**-4, 5*10**-4, 2.5*10**-4, 10**-4]
lenhs = len(hs)
# drawing... | true |
c98ecc9895079c331410b9eecaabb33f3a443724 | Python | yeff-bridges/CodeSamples | /MachineLearning/FromScratch/FromScratchModule/Performance.py | UTF-8 | 5,625 | 3.5 | 4 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
def true_positive(y, y_hat):
'''
:param y: y-values that were used to train model
:param y_hat: y-values predicted by the model
:return: True Positive - number of times the model correctly predicted positive
'''
return np.sum(y & y_hat)
d... | true |
58ff3a696099824d38de6a9372a4b1aa73b55912 | Python | Swarajk7/Deep-Learning | /DogBreed/utils.py | UTF-8 | 1,466 | 2.890625 | 3 | [] | no_license | from tqdm import tqdm
import pandas as pd
import numpy as np
import cv2
from sklearn.model_selection import train_test_split
from keras.preprocessing.image import ImageDataGenerator
def read_all_training_file(train_folder, label_file, image_size=90):
train_info = pd.read_csv(label_file)
labels_series = pd.Ser... | true |
dd540f0554b2f14c7c2dc0277d9c7499d24fca55 | Python | robocorp/robotframework-lsp | /robocorp-python-ls-core/src/robocorp_ls_core/libs/robotidy_lib/robotidy/utils.py | UTF-8 | 13,951 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import ast
import difflib
import os
import re
from enum import Enum
from functools import total_ordering
from typing import Iterable, List, Optional, Pattern
import click
try:
from rich.markup import escape
except ImportError: # Fails on vendored-in LSP plugin
escape = None
from robot.api.parsing import Com... | true |
43561b9e07f62ef39dc8facbb35d14fc01f8747a | Python | MountLee/code-toolkit | /parallel-computing/basic-tools/python/example3.py | UTF-8 | 841 | 2.90625 | 3 | [] | no_license | ############### try a package called joblib ################
import numpy as np
# instantiate and configure the worker pool
# from pathos.multiprocessing import ProcessPool
# pool = ProcessPool(nodes=4)
from joblib import Parallel, delayed
import time
if __name__ == '__main__':
# pool = ParallelPool(nodes=4)
B... | true |
d15dc1428628efc6938adbcb2ee1bb6990d7877f | Python | pankajmech/Codeforces-Problems | /0812C-Sagheer-and-Nubian-Market.py | UTF-8 | 467 | 2.734375 | 3 | [] | no_license | N,S = map(int,raw_input().split())
nums = list(map(int,raw_input().split()))
lo = 0
hi = N
while lo <= hi:
mid = (lo+hi)/2
temp = []
for i in range(N):
temp.append((i+1)*mid+nums[i])
temp = sorted(temp)
cur = 0
for i in range(mid):
cur += temp[i]
if cur <= S:
lo = mid+1
else:
hi = mid-1
... | true |
0017c32189faa30a6262266194a2426114b915c1 | Python | shehzi001/amr-ss | /amr_bugs/src/amr_bugs/wallfollower_state_machine.py | UTF-8 | 8,089 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
"""
This module provides a single construct() function which produces a Smach state
machine that implements wallfollowing behavior.
The constructed state machine has three attached methods:
* set_ranges(ranges): this function should be called to update the range
rea... | true |
bf527e7bc6c40b5110b9d6fe275155bac4f0dfd2 | Python | chandru4ni/captionTool | /python_utils.py | UTF-8 | 362 | 2.734375 | 3 | [] | no_license | import json
import sys
import os
def read_json(t_file):
j_file = open(t_file).read()
return json.loads(j_file)
def save_json(json_dict, save_name):
with open(save_name, 'w') as outfile:
json.dump(json_dict, outfile)
def open_txt(t_file):
os.system('pwd')
f = open(t_file, 'r')
txt_file = f.readlines... | true |
f7eaadb3ee801b8011e2fddd03a055902f2da614 | Python | sohanjs111/Python | /Week 3/For loop/Practice Quiz/question_2.py | UTF-8 | 608 | 4.6875 | 5 | [] | no_license | # Question 2
# Fill in the blanks to make the factorial function return the factorial of n. Then, print the first 10 factorials (from 0 to 9) with
# the corresponding number. Remember that the factorial of a number is defined as the product of an integer and all
# integers before it. For example, the fac... | true |
ab6f1d44552e8564243adb3148aab223eec83207 | Python | yeung66/leetcode-everyday | /py/350.两个数组的交集-ii.py | UTF-8 | 1,442 | 3.625 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=350 lang=python3
#
# [350] 两个数组的交集 II
#
# https://leetcode-cn.com/problems/intersection-of-two-arrays-ii/description/
#
# algorithms
# Easy (43.54%)
# Likes: 176
# Dislikes: 0
# Total Accepted: 43.3K
# Total Submissions: 99.4K
# Testcase Example: '[1,2,2,1]\n[2,2]'
#
# 给定两个数组,编写一个函数来计算... | true |
1b64195bca80d9a3fcf9ff161385712ac3d46736 | Python | tspolli/exercises | /exercises_part_II/point-to-point distance.py | UTF-8 | 3,219 | 3.390625 | 3 | [] | no_license | """TEST - DISTANCE BETWEEN DECIMAL DEGREES
1.OPEN FILE
2.READ LINE BY LINE OF FILE
3.SPLIT BY ","
4.WRITE HEADER IN FILE
5.TAKE 3RD, 4TH, 5TH AND 6TH POSITIONS FOR EACH LINE
6.MAKE CALCULATION OF POIN TO POINT DISTANCE FOR EACH LINE
7.WRITE LINE BY LINE INCLUDING THE NEW FIELD DISTANCE IN FILE """
import math
import ... | true |
dfd759cf49919d1b117620ac55b227bf5a632e5b | Python | takumiw/AtCoder | /ABC144/D.py | UTF-8 | 226 | 3.453125 | 3 | [] | no_license | import math
a, b, x = map(int, input().split())
if a ** 2 * b / 2 <= x:
f = 2 * (a ** 2 * b - x) / a ** 3
print(math.degrees(math.atan(f)))
else:
f = 2 * x / (b ** 2 * a)
print(90 - math.degrees(math.atan(f))) | true |
f884f49397984df9b075dac8fd0d8f41f363688f | Python | YaBoris/ITEA | /lesson_06/lesson_06_task_01/main.py | UTF-8 | 877 | 3.4375 | 3 | [] | no_license | from lesson_06.lesson_06_task_01.my_list import MyList
def work_with_list(list_for_check, list_for_check2):
list_for_check.append(9)
list_for_check.insert(2, 54)
list_for_check.append('List')
list_for_check.insert(5, 31)
list_for_check.append(19)
list_for_check.pop(7)
list_for_check.insert... | true |
220678c16b45f98bf1d670a464661e35557e2ee4 | Python | smanus79/netacademia | /python-beginner/4.ora/csvclient.py | UTF-8 | 1,776 | 2.875 | 3 | [] | no_license | import urllib3
import csv
import random
import json
'''
http = urllib3.PoolManager()
r = http.request('GET', 'http://api.ipify.org')
print(r.data)
'''
def generateData():
data = {"dht22": [], "lm35" : []}
for x in range(0, 10):
data['dht22'].append(random.randint(10,20))
data['lm35'].append(r... | true |
f510efd1ef0f6b638531fa0430113e5d727e04d1 | Python | Cazs/pmn | /python/script.py | UTF-8 | 708 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import requests
#i =0;
#def testMethod(arg):
#return arg;
#i=i+1;
#print("Execution(%s) result of Python testMethod: %s", i, arg);
#testMethod('value');
#s = input('enter str');
s = sys.argv[1];
def send_simple_message():
return requests.post(
"https://api.m... | true |
08fc704881829eda500233ab7c03613e6ce432df | Python | chenhy97/virtual_routing | /E/test.py | UTF-8 | 1,825 | 2.515625 | 3 | [] | no_license | from E.basic_E import *
import socket
from struct import *
import time
import multiprocessing as mp
MY_IP = '127.0.0.1'
def send_Session_layer(data_IP,data_PORT):#dest_name新设一个点
time.sleep(2)
talk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
src_ip = MY_IP
addr = (data_IP,data_PORT)
talk.conn... | true |
b63f9ffe60022dc413e4e7b63887302afb4ded2f | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_2_1/Godfath3r/1b-a.py | UTF-8 | 1,882 | 3.265625 | 3 | [] | no_license | from pprint import pprint
input_filename = 'A-large.in'
output_filename = 'A-large.out'
def are_all_chars_in(number, string):
for ch in reversed(number):
if ch in string:
string.remove(ch)
else:
return False
return True
numbers = ["ZERO", "ONE", "TWO", "... | true |
80500a5a04c3f3a2339f29f69afc5027fd8a8eec | Python | fiskpralin/Tota | /terrain/hole.py | UTF-8 | 1,043 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
from math import *
from matplotlib.patches import Circle
from collision import *
from functions import *
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.path import Path
from obstacle import *
class Hole(Obstacle):
"""
A hole in the ground, right now used to mark that ... | true |
859c5f1ed848c7ca86080337060c1f8f87ed5d88 | Python | kurkul608/SSU-GRAPH | /lv c/main.py | UTF-8 | 1,538 | 3.421875 | 3 | [] | no_license | """Алгоритм Флойда"""
"""Вывести кратчайшие пути из вершин u1 и u2 до v."""
"""W - вес ребер """
W =[
[0, 4, 10, 2],
[4, 0, 7, 7],
[10, 7, 0, 11],
[2, 11, 9, 0]
]
"""n - кол-во вершин"""
n = 4
print('Введите u1, u2, v')
u1, u2, v = map(int, input().split())
A = [[W[i][j] for j in range(n)] for i in rang... | true |
71319bb020e80f78c7f1378edb992b2673bd37cc | Python | JonathanVengadasalam/Scraping-Data-on-LeBonCoin | /tp/spiders/crawl_checker.py | UTF-8 | 752 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import csv
import scrapy
from datetime import datetime
from datetime import timedelta
from ..items import Link
FOLDER = "C:/Users/Home-PC/Desktop/scrapy/tp/test.csv"
def get_urls(folder):
res = []
if os.path.exists(folder):
with open(folder,encoding='utf-8') as file:
... | true |
ee59663cbe393734c198d031d1941f4096fa9af0 | Python | javiergayala/brother-admin-py | /brother_admin/exceptions.py | UTF-8 | 374 | 2.734375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Exceptions module."""
class BrotherAdminError(Exception):
"""Base Class for all other errors."""
class PrinterNameTypeError(TypeError):
"""Raised when you do not define the printer name as a string."""
def __init__(self, **kwargs):
msg = "Printer name must be provide... | true |
4a8bf2168b5856cd1a6eff74b8534b049468950a | Python | nihathalici/Break-The-Ice-With-Python | /Python-Files/Day-5/Question-17-alternative-solution-2.py | UTF-8 | 926 | 4.25 | 4 | [] | no_license | """
Question 17
Question:
Write a program that computes the net amount of a bank account based a transaction log
from console input. The transaction log format is shown as following:
D 100
W 200
D means deposit while W means withdrawal.
Suppose the following input is supplied to the program:
D 300
D 300
W 200
D 100... | true |
a6cfe7fd9dc82c53b6e1b46f8a5872be1a041b6c | Python | earthexploration/MKS-Experimentation | /fip_collab/2015_09_22_spectral_database_codes/bigmem.py | UTF-8 | 225 | 2.640625 | 3 | [] | no_license | import numpy as np
for ii in xrange(100):
rrr = np.random.rand(ii, ii, ii, ii, ii, ii)
print rrr.shape
memU = rrr.nbytes/(1E9)
print "array memory usage: %s gb" % memU
if memU > 75.0:
break
| true |
0bbb152cbf1f7b6d0ad1e295aea236e2b04b945d | Python | jurandirs/forcap2p | /server/TCPServer.py | UTF-8 | 435 | 2.5625 | 3 | [] | no_license | from socket import *
from collections import namedtuple
Move = namedtuple('Move', 'player letter')
setdefaulttimeout(1)
class Server:
def __init__(self,):
self.serverPort = 12000
self.serverSocket = socket(AF_INET, SOCK_STREAM)
self.serverSocket.bind(('', self.serverPort))
self.ser... | true |
7086dad26dcc1fac1af95e54da45092164f2c046 | Python | tiago-pichelli25/520 | /Laco | UTF-8 | 149 | 3.890625 | 4 | [] | no_license | #!/usr/bin/python3
x = 1
num = int(input('Digite um numero: '))
while x < num:
if x % 2 == 0:
continue
print('Numero: {}'.format(x)) | true |
5e5aba78b00393ad7781a55860e98a353fc75c50 | Python | TaielC/Fiuba_ANumerico_TP1 | /funcion.py | UTF-8 | 487 | 2.984375 | 3 | [] | no_license | import math
import numpy as np
NP = 102145 # Padrón utilizado
# Raiz con g = 0 : +-1.6833787452620399
valor_raiz = np.longdouble(1.6833787452620399)
error = 0.5e-15
k = np.longdouble(10)
Lo = np.longdouble(2 * 100000 / NP)
a = np.longdouble(1)
m = np.longdouble(100000 / NP)
g = np.longdouble(0)
def funcion(y):
re... | true |
c4035dc6ff4b251ed7f4cd6f74ed0a3ed1b3450b | Python | zizi0308/StudyPython | /Chap04/함수.py | UTF-8 | 635 | 4.25 | 4 | [] | no_license | # def는 코드를 생성하여 기록함 << 저장단계
# 내장함수 >> python이 가지고 있는 함수
big = max('Hello world')
print(big)
# 사용자 정의함수 << 함수를 호출해야 실행
def greet(lang): # 매개변수 lang
if lang == 'es':
print('Hola')
elif lang == 'fr':
print('Bonjour')
else:
print('Hello')
greet('en') # ... | true |
3dd9fd9dfd0dc1eaa8a235aba29c72339df0ad43 | Python | rohith2506/Algo-world | /euler/66.py | UTF-8 | 757 | 3.234375 | 3 | [] | no_license | '''
Chakravaka method for solving diophantine equations.
for Reference see wikipedia and project euler 66 thread
@Author: Rohit
'''
import math
def firstTriplet(N,b):
kvalues = []
for a in range(1, int(math.sqrt(N)+1)):
kval = abs(a**2 - N*b**2)
kvalues.append(kval)
kmin = min(kvalues)
return (a,b,kmin)
def ... | true |
599ef4ffcd692bd62423714bf027b6f1fa07197d | Python | d-mo/mist.api | /src/mist/api/clouds/controllers/dns/controllers.py | UTF-8 | 7,052 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | """Cloud DNS Sub-Controllers
A cloud's DNS sub-controller handles all calls to libcloud's DNS API by
subclassing and extending the `BaseDNSController`.
Most often for each different cloud type, there is a corresponding DNS
controller defined here. All the different classes inherit `BaseDBSController`
and share a comm... | true |
1000177b1daf83a761a466117e85a838c2fc6f47 | Python | RCoon/CodingBat | /Python/String_2/cat_dog.py | UTF-8 | 345 | 4.46875 | 4 | [
"MIT"
] | permissive | # Return True if the string "cat" and "dog" appear the same number of times
# in the given string.
# cat_dog('catdog') --> True
# cat_dog('catcat') --> False
# cat_dog('1cat1cadodog') --> True
def cat_dog(str):
return (str.count("cat") == str.count("dog"))
print(cat_dog('catdog'))
print(cat_dog('catcat'))
print... | true |
b068293e4d26120b344685fcf69db4285fb49cff | Python | ftrono/NLU_Assign1_2020-21_UniTrento | /Code/221723_NLU_Ass1.2.py | UTF-8 | 975 | 3.5625 | 4 | [] | no_license | import spacy
#FUNCTION: extract subtree of dependents for each token:
def depsubtree(sentence, info=None):
#parsing
spacy_nlp = spacy.load('en_core_web_sm')
sent = spacy_nlp(sentence)
#funct:
dep_subtree = {}
if info == True:
#return list of tokens in subtree with th... | true |
122395e073e2a765d8a8a4c0a77ba1943eaa5de0 | Python | cnrobin/code | /mypy/test_crawl2.py | UTF-8 | 3,366 | 3.0625 | 3 | [] | no_license | #-*- coding:utf-8 -*-
# Author:K
# http://www.allitebooks.org/
import requests
from lxml import etree
import os
import csv
class BooksSpider(object):
def open_file(self):
# 创建目录
if not os.path.exists('D:/allitebooks数据'):
os.mkdir('D:/allitebooks数据')
self.fp = op... | true |
9eb6aaedc66add7309df9ad638e1f75706e98f58 | Python | DaikiTanak/Atcoder | /ABC136/D.py | UTF-8 | 1,618 | 2.9375 | 3 | [] | no_license | S = input()
L_searching_flag = True
R_searching_flag = False
LR_idx = []
boundary_idx = []
for i, char in enumerate(S):
if L_searching_flag:
if char == "L":
L_searching_flag = False
R_searching_flag = True
LR_idx.append(i)
else:
continue
elif R_se... | true |
f7fcfadb8a9b3ea3f6b1de25269de710dacd001f | Python | Victor-Grinan-Dev/tomato-study-timer | /tomato_timer_script.py | UTF-8 | 1,065 | 2.640625 | 3 | [] | no_license | import time as tm
from datetime import timedelta
from study_timer import tomato_timer_ui as ttu
from study_timer import timer_study as ts
def countdown(time):
ts.down_counter = True
counter_top = timedelta(seconds=time) # convert integer into time
mins, secs = divmod(time, 60)
timeforma... | true |
fc78745003b109b7d0f37d6e449bfd9f2ee0cf34 | Python | ParzivalMarcos/Curso_Mestres_Automacao | /bootcamp_python/teste_random.py | UTF-8 | 211 | 3.546875 | 4 | [] | no_license | import random
lado_modeda = ['Cara', 'Coroa']
print(random.choice(lado_modeda))
lista_nomes = ['Marcos', 'Kalienne', 'Tom', 'Moises', 'Luiza']
print(random.choice(lista_nomes))
print(random.randint(10, 100))
| true |
de153199cb63a806e119a4e9ef592f8fceb6b580 | Python | afreymiller/flask-tutorial | /reviews_utils.py | UTF-8 | 6,061 | 3.25 | 3 | [] | no_license | import bs4
from bs4 import BeautifulSoup, Tag
import requests
import re
import math
import threading
import concurrent.futures
# Added positive unit tests, will add some more negative ones
def populate_review_fields(review, star_rating):
"""
Given a review tag and star_rating, populates a dictionary
wit... | true |
4b388d2fce3f5759a6b9b15d722f074a07e195e8 | Python | Cretheego/imagedenoising | /size_re.py | UTF-8 | 3,939 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 25 17:25:39 2018
@author: Administrator
"""
import numpy as np
from PIL import Image
import sys
import os
import shutil
import random as rd
import string
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
#图像填充,重采样
#先将 input image 填充... | true |
27fa33b5b6254ba0cf37c7542b998bf6290e0e61 | Python | DTaschen/scratch | /scratch/scratch/Text.py | UTF-8 | 1,250 | 2.71875 | 3 | [] | no_license | '''
Created on 22.05.2012
@author: demian
'''
import numpy as np
import sympy as sp
from scipy.linalg import \
inv, det
from numpy import \
array, zeros, int_, float_, ix_, dot, linspace, hstack, vstack, arange, \
identity
x_, y_, z_, t_ = sp.symbols('x,y,z,t')
P = [1, x_, y_, x_ * y_]
PX = sp.l... | true |
f2ced0392e4629b0b9bf8b30ddca5dddb7d9648a | Python | devdinu/FunWithClojure | /Marbles/Marbles.py | UTF-8 | 227 | 3.015625 | 3 | [] | no_license | MOD_VALUE = 10 ** 9 + 7
def get_counts(b,exp,m):
val = 1
while exp:
if exp%2:
val*=b
val%=m
b*=b
b%=m
exp=int(exp/2)
return val
for tc in range(int(input())):
print(get_counts(2, int(input()) -1, MOD_VALUE)) | true |
2c8fddee8d1d8a91ad6c4a936ce9e7de91abcb06 | Python | eric-wieser/cued-icw | /integrator.py | UTF-8 | 5,503 | 2.546875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import math
import scipy.signal
import model_config
import inputs
from mechanics import System, simulate, frequency_response
# Sampling rate and range
dt = 1/200.0
t = np.arange(0, 90, dt)
# frequency sweeping
freqs = scipy.interp(t, [0, t.max()], [0, ... | true |
20d64ab425e288f4cd5b8490c4742105a8885fbf | Python | enderdzz/ReverseThings | /2020/flareon7/1/solve.py | UTF-8 | 539 | 2.53125 | 3 | [] | no_license | def decode_flag(frob):
last_value = frob
encoded_flag = [1135, 1038, 1126, 1028, 1117, 1071, 1094, 1077, 1121, 1087, 1110, 1092, 1072, 1095, 1090, 1027,
1127, 1040, 1137, 1030, 1127, 1099, 1062, 1101, 1123, 1027, 1136, 1054]
decoded_flag = []
for i in range(len(encoded_flag)):
... | true |
a84377ffb3a0da002a16f3c1efcc4a26783ac4b2 | Python | UsmanMaan324/python-practice-tasks | /Task2.py | UTF-8 | 361 | 3.5625 | 4 | [] | no_license |
def find_divisible_by_7_not_5():
"""
Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 1000
and 2000 (both included).
"""
for i in range(1000, 2001):
if i % 7 == 0 and i % 5 != 0:
print(i, end=",")
if __name__ == '__... | true |
8f404dd9f87feae9a0b2c22d54b7c1e5641b0c48 | Python | vincenttuan/PythonCourse | /lesson1/Hello_Input3.py | UTF-8 | 440 | 3.0625 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
import math
h = 170.0
w = 60.0
bmi = w / ((h/100)**2)
print('身體評量指數 bmi = %.2f' % bmi)
bmi = w / math.pow(h/100, 2)
print('bmi = %.2f' % bmi)
print('h = %.2f, w = %.2f, bmi = %.2f' % (h, w, bmi))
print("h = {0}, w = {1}, bmi = {2}".format(h, w, bmi))
if (bmi >= 18.0 and bmi < 23) :
print('正... | true |
bf332bd68041e51df9690c9a1d9ddaecb23a3edc | Python | gorgeousbubble/Nightmare | /draft/use_special.py | UTF-8 | 783 | 3.890625 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Student(object):
def __init__(self, name):
self.name = name
def __str__(self):
return 'Student object (name:%s)' % self.name
def __getattr__(self, item):
if item == 'age':
return lambda: 25
raise AttributeEr... | true |
4aedaf7ac8e0c80cab1eaf1c07c5a6dd2feba5b8 | Python | christopher-besch/zipfs_law | /main.py | UTF-8 | 1,918 | 4.03125 | 4 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
# get index with word: occurrences_of_word
def get_words_dict(text):
# splitting at word breaks
words_raw = text.split()
words = {}
# adding every wordcount to a dict
for word in words_raw:
if word in words:
words[word] += 1
else:
... | true |
33335a6195195b5497fcd8a4f4f159c5ad0ddaab | Python | nandamsanches/VideoAulaPython | /biblioteca.py | UTF-8 | 232 | 2.625 | 3 | [] | no_license | def processa_convite(convite):
posicao_final = len(convite)
posicao_inicial = posicao_final - 4
parte1 = convite[0:4]
parte2 = convite[posicao_inicial:posicao_final]
return 'Enviando convite para %s %s' %(parte1, parte2)
| true |
3597fc7e0fb87bb4399265a0eaf352ebb7b587b2 | Python | CKEJET57/StudyProject | /zadaha.py | UTF-8 | 1,037 | 3.71875 | 4 | [] | no_license | def words_counter(path_to_file: str, word_for_search: str) -> int:
"""
Поступим как в кодеварс, есть фнкция которая открывает файл и считает сколько раз встречается искомое слово в тексте
из файлика Test ты можешь посмотреть как открывать и читать файл.
:param path_to_file: путь к файлу
:param word... | true |
c77d9a1e196a75be8e04440754b6f194b4d9b84e | Python | shaul-s/Industry-Proj | /b_project/bpSingleImage.py | UTF-8 | 5,841 | 2.890625 | 3 | [] | no_license | import numpy as np
from scipy import linalg as la
from bpCamera import *
from MatrixMethods import *
class SingleImage(object):
def __init__(self, id, camera):
"""
Initialize the SingleImage object
:param camera: instance of the Camera class
:type camera: Camera
"""
... | true |
ec7afb9e5920654d6b2a58e2ebb76d18769d2266 | Python | Grant-Syt/COMP-431-S21 | /hw3-Grant-Syt/FTP_ReplyParser.py | UTF-8 | 3,662 | 3.390625 | 3 | [] | no_license | ###################################
# John Moore - COMP 431 #
# FTP Reply Parser #
# Version 1.0 #
###################################
# This program is intended to provide the base framework for parsing FTP_Server replies
# to the commands that get sent by FTP_Client.py. ... | true |