blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c723489a5b1465fee7e9c5316b6fb70ab68a4f7d | Python | AliaGo/goldminer | /passPage.py | UTF-8 | 516 | 2.6875 | 3 | [] | no_license | import sys
import pygame
from pygame.locals import QUIT
# 初始化
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption('congradulation') # 命名
background = pygame.image.load('achieve.png').convert_alpha() # 背景
background = pygame.transform.scale(background, (800, 600))
screen.blit(ba... | true |
5e956dfc772ed052dfeb0decb1a3f46a4cf61fc0 | Python | pyconsk/snakepit-game | /snakepit/player.py | UTF-8 | 2,081 | 2.875 | 3 | [
"MIT"
] | permissive | from logging import getLogger
from .messaging import Messaging
from .snake import Snake
logger = getLogger(__name__)
class Player:
snake = None
def __init__(self, player_id, name, ws):
self.id = player_id
self.name = name
self.wss = []
self.score = 0
self.keymap = {
... | true |
0776bbc34ffae4d892e6fadb496ac1ed8242a882 | Python | Leet-1337/LEET1337 | /LEETX/port-scanner.py | UTF-8 | 5,246 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import socket
import sys
import os
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
Orange='\033[33m'
lightblue='\033[94m'
lightcyan='\033[96m'
BLUE = '\033[94m'
Black = '\033[30m'
GREEN = '\033[92m'
pink='\033[95m'
lightgreen='\033[92m'
... | true |
c200be9d452f550b8e6081834c1acc3370c8df3d | Python | hsiangyi0614/X-Village-2018-Exercise | /Lesson03-Python-Basic-two/exercise4.py | UTF-8 | 204 | 4.1875 | 4 | [] | no_license | #Exercise1: N^X
def number(n):
def power(x):
return n ** x
return power
n = int(input("input a number : "))
m = number(n)
x=int(input("input a power : "))
print(n,"的",x,"次方 :",m(x)) | true |
1d747054d111175baee5bf7efcc9406572868a8c | Python | martinnj/Datanet | /assignment1/server.py | UTF-8 | 3,536 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python2
import socket
import select
import sys
import thread
from datetime import datetime
import errno
class Server:
BUFFER_SIZE = 1024
def __init__(self, port=50000, listen_queue_size=5):
"""
Initialize the variables required by the name server.
"""
self.port... | true |
29986c05cd8d19beb0b21bd3232cdb1d3cf83df4 | Python | lablup/backend.ai-submission-pipeline | /src/ai/backend/submission/submit.py | UTF-8 | 2,686 | 2.75 | 3 | [] | no_license | """
(C) 2015-2021 Lablup Inc.
Backend.AI Code Submitter Example
=================================
Collect and compress the "code" directory in the current working dorectry
and send the compressed submission to a evaluation server.
The evaluation server sample is the ``evaluator`` module.
NOTE: this code is super-si... | true |
a9bd604e97dd774d79c7388d9cc7558171d76d6b | Python | MattHillWakatipu/damage_calculator | /damage_calculator/classes/kara.py | UTF-8 | 2,036 | 3.140625 | 3 | [] | no_license | from util.formulae import calculate_accuracy, calculate_average_damage
class Kara:
"""
A representation of the Monk class for 5th edition Dungeons and Dragons.
"""
def __init__(self, strength, proficiency_bonus, equipment_bonus):
"""
Create a new Fighter instance.
:param stre... | true |
15ffea3f4faa484944fe0667eba4b94981656b79 | Python | gift-surg/puma | /tests/concurrent/executor/typed_executor_slowtest_methods.py | UTF-8 | 1,764 | 3.546875 | 4 | [
"Apache-2.0"
] | permissive | from time import sleep
from typing import Optional
DELAY_SLOW = 1
DELAY_FAST = DELAY_SLOW / 100
def method0() -> str:
sleep(DELAY_SLOW)
return f"method0"
def method1(a: int) -> str:
sleep(DELAY_SLOW)
return f"method1 - {a}"
def method2(a: int, b: int) -> str:
sleep(DELAY_SLOW)
return f"me... | true |
e5d33c6b3c5a43f38e22eecedbf3182142b13c7b | Python | Hitoridake/Taller_Python_Modelos_II | /Caracteres/EraseWhite.py | UTF-8 | 83 | 3.640625 | 4 | [] | no_license | t = input("Enter a string : ")
clean_t = t.replace(" ","")
print(t)
print(clean_t)
| true |
3ec268e58f0fb63d1597d26ad0f6f74bd60c52f2 | Python | vdonoladev/aprendendo-programacao | /Python/Programação_em_Python_Essencial/6- Funções/funcoes_com_parametro.py | UTF-8 | 2,787 | 4.40625 | 4 | [
"MIT"
] | permissive | """
Funções com Parâmetro (de entrada)
- Funções que recebem dados para serem processados dentro da mesma;
Se a gente pensar em um programa qualquer, geralmente temos:
entrada -> processamento -> saída
Se a gente pensar em uma função, já sabemos que temos funções que:
- Não possuem entrada;
- Não possuem saída;
- ... | true |
607608c55cbd33305d69dd75a25cbfc18363c823 | Python | jaxin007/Study | /Python_OOP/29.py | UTF-8 | 598 | 4.21875 | 4 | [] | no_license | # Даны действительные числа х, у . Не пользуясь никакими операциями, кроме умножения, сложения и вычитания, вычислить 3х^2у^2 — 2ху^2 — 7х^2у — 4у^2 + 15ху + 2х^2 — Зх + 10y + 6.
x = float(input('Choose your x: '))
y = float(input('Choose your y: '))
a = (3 * (x * x) ) * (y * y)
b = (2 * x) * (y * y)
c = (7 * (x * x... | true |
7d3d6490fe71b6a477dd79edbe6d4bef81dd111f | Python | SemiionMorozov/learning_python | /4. class_one_line_26.02.2019_semiion_morozov (2) with comments.py | UTF-8 | 11,753 | 3.765625 | 4 | [] | no_license | # 4 задание - класс: уравнение прямой
# 26.02.2019 - Semion Morozov - semiion-morozov@mail.ru
### Класс линейного уравнения v1.0
##
### Tochka пока не используется - не могу понять как подгружать property во внутреннюю функцию другого класса
##class Tochka:
## @property
## def x(self):
## retur... | true |
be3a21654e50cce63c71421855487e44e2793680 | Python | Luqman-Ud-Din/fyyur-FSND | /validators.py | UTF-8 | 570 | 3.03125 | 3 | [] | no_license | import re
from wtforms import ValidationError
class ValidatePattern:
def __init__(self, pattern=None, message=None):
if pattern is None:
raise ValidationError('Pattern is Required')
if not message:
message = 'Not matching with the given pattern'
self.message = f'... | true |
789f2612e24cb1826c93b5197affeb0bf93a2449 | Python | WiillyWonka/Intervals | /Lab5/src/main.py | UTF-8 | 7,237 | 2.5625 | 3 | [] | no_license | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import random
def plot_solutions(Ax_inf, Ax_sup, b_inf, b_sup, b_real, filename=''):
plt.figure()
plt.plot(Ax_sup, label='A * x_sup')
plt.plot(Ax_inf, label='A * x_inf')
plt.plot(b_sup, label='b_sup', ls='--')
plt.plot(b_inf, ... | true |
a8b7c78fcd417f5b934c2d6cb1b30f2e46db10e2 | Python | dianachenyu/AlgorithmPractice | /cache/1296.Divide Array in Sets of K Consecutive Numbers.py | UTF-8 | 640 | 3.109375 | 3 | [] | no_license | from collections import Counter
class Solution:
def isPossibleDivide(self, nums: List[int], k: int) -> bool:
if len(nums) % k != 0:
return False
counter = Counter(nums)
keys = sorted(list(counter.keys()))
for key in keys:
count = counter[key]
if... | true |
8cc55c8d6582d5cb1ae92bf3d07d5226626e54e9 | Python | anderson89marques/point_of_sale | /backend/point_of_sale/api/validators.py | UTF-8 | 844 | 3.09375 | 3 | [] | no_license | """Models Fields Validations"""
import re
from django.core.exceptions import ValidationError
def validate_phone_number(value):
expression = r'^\([1-9]{2}\) (?:[2-8]|9[1-9])[0-9]{3}\-[0-9]{4}$'
if not bool(re.match(expression, value)):
raise ValidationError(
"Phone number must have this fo... | true |
1dae7fa1499e63e2e9be3c30f1fc1c4e9aa0d3d6 | Python | toan27062002/bai_tap_tong_hop | /BT10-11_duyet_cay.py | UTF-8 | 288 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created
@author:
"""
from binarytree import build
values = [3, 4, 7,6 , 2, None, 1, 5, 8]
root = build(values)
print(root)
# duyệt cây theo thứ tự trước
print(root.preorder)
# duyệt cây theo thứ tự sau
print(root.postorder)
| true |
e0463b4df146e1d029d51e090a262d6a59104266 | Python | LordMartron94/collatz-conjecture | /src/logic/abstract/pipeline_kit.py | UTF-8 | 310 | 2.8125 | 3 | [] | no_license | from typing import TypeVar
from abc import ABC, abstractmethod
T = TypeVar("T")
class Pipeline(ABC):
"""Abstract pipeline class."""
def flow(self, data: T):
"""To run the pipeline."""
class Pipe(ABC):
@abstractmethod
def pipe(self, data: T) -> T:
"""Basic pipe method."""
| true |
a9e5a89696f537259a888602eb36d7ea7bb90bf0 | Python | Larrygf02/flask | /rutas.py | UTF-8 | 318 | 2.625 | 3 | [] | no_license | from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
def index():
return 'hola mundo'
@app.route('/saluda')
def saluda():
param = request.args.get('nombre','raul')
return 'Estoy saludando {}'.format(param)
if __name__ == "__main__":
app.run(debug=True, port=2500) | true |
c8e427d24ad1e704affd5626a151ce4457dbfbc1 | Python | mrberti/micropython-scpidev | /bin/send_data.py | UTF-8 | 3,104 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import socket
import time
import argparse
import threading
# Create option parser
parser = argparse.ArgumentParser(
description="Send a message via TCP. A second thread will read the data "
"from the connection.")
parser.add_argument(
"ip",
metavar="REMOTEHOST",
type=str,
... | true |
b1b617da708b974be934a630e7acd9ce795b8de0 | Python | BrooklinJazz/Algorithms-and-Data-Structures | /hackerrank/test_equal.py | UTF-8 | 568 | 3.234375 | 3 | [] | no_license | import pytest
increments = [0, 1, 2, 5]
def arrays_contain_matching_element(arr_of_arr):
for arr in arr_of_arr:
def equal(arr):
dp = [[[] for _ in increments] for _ in arr]
# todo handle case where all el in arr are the same
for i, el in enumerate(arr):
for j, inc in enumerate(increments):
... | true |
9d7640e9f352b1a492d66cbc558ff5b31b801532 | Python | DucMyPham/c4t18 | /session2/var_intro.py | UTF-8 | 149 | 3.515625 | 4 | [] | no_license | yob= int(input("enter ur yob"))
age= 2019 - yob
next_year_age= 2020 - yob
print("you are",age,"year old and you will be", next_year_age, "next year") | true |
89c11bc45d92cf464080bef7cf9bc267fdcf2c6b | Python | ayeon0804/MULTICAMPAS | /FLASKSQLAlchemy/3.MATPLOTtoFLASK/app.py | UTF-8 | 1,244 | 2.75 | 3 | [] | no_license | import io
from flask import Flask, render_template, Response, request
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.backends.backend_agg import FigureCanvasAgg
import random
app = Flask(__name__)
@app.route('/')
def index():
num_x = int(request.args.get('num_x', 50))
return ren... | true |
bbdb08b868dfe6d86cd806e6dcaa35b11237d39a | Python | benwoo1110/A-List-of-Sorts-v2 | /code_old/pygame_objects.py | UTF-8 | 23,696 | 2.703125 | 3 | [
"MIT"
] | permissive | ######################################
# Import and initialize the librarys #
######################################
import os
import textwrap
import inspect
import random
import math
import time
import re
from code.pygame_events import *
from code.algorithm.commonFunc import commonFunc
#################
# Setup logg... | true |
689b52bc10f610aaaec425a2e2075cd628aa96be | Python | shar3d/python_start | /lesson6/p6_2.py | UTF-8 | 113 | 3.671875 | 4 | [] | no_license | l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(l[::2]) # Slice 2 elements in the list
print(l[-3::-3])
print(l[::4]) | true |
0925601d33299fbb69b592962435a22012f77570 | Python | deepakr6242/Coding_Exercises | /DetectCapital.py | UTF-8 | 275 | 2.8125 | 3 | [] | no_license | def detectCapitalUse( word):
if word.istitle() == True:
return True
elif all([True if i.islower() else False for i in word ])==True:
return True
elif all([True if i.isupper() else False for i in word ])==True:
return True
else:
return False
| true |
1745e54c57e9d37286b39075facfeb82c8329fcb | Python | pselle/codachrome | /api/dictionary.py | UTF-8 | 4,934 | 3.09375 | 3 | [] | no_license | from __future__ import print_function
from __future__ import division
from collections import Counter
import math
import random
from numpy.random import choice
import operator
"""
this class handles the combination of dictionaries of suggestions
"""
#### SORTING ####
# given a list of tuples, returns its items sort... | true |
02b78b31b0f5ebc29efa6067bc1da499359b6bb5 | Python | RPGroup-PBoC/growth_limits | /code/figures/figS8_schmidt_correction_approaches.py | UTF-8 | 7,713 | 2.609375 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | import numpy as np
import pandas as pd
from scipy import stats
import glob
import matplotlib.pyplot as plt
import matplotlib.ticker
import prot.viz
import prot.size
colors, palette = prot.viz.bokeh_theme()
# dataset_colors = prot.viz.dataset_colors()
prot.viz.plotting_style()
# Exponential fit function
from scipy.opti... | true |
e6ed9a5429561e5c65eec6f3603c1b4b5f2e6634 | Python | xbe/qcc | /src/solovay_kitaev.py | UTF-8 | 4,222 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | # python3
"""Example: Solovay-Kitaev Algorithm for gate approximation."""
import math
import random
from absl import app
import numpy as np
from src.lib import helper
from src.lib import ops
from src.lib import state
def to_su2(U):
"""Convert a 2x2 unitary to a unitary with determinant 1.0."""
return np.sqrt(... | true |
129068201b36ff4fd79bcba8421525d524bcf10d | Python | gallantlab/cottoncandy | /cottoncandy/browser.py | UTF-8 | 8,325 | 2.765625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | '''
'''
import os
import re
from cottoncandy.utils import (clean_object_name,
has_start_digit,
has_magic,
has_real_magic,
has_trivial_magic,
remove_trivial_magic,
... | true |
feb501185ee388a076715814f311989da3d037a3 | Python | AlekzNet/Cisco-ASA-ACL-toolkit | /optimacl-simple.py | UTF-8 | 5,421 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import string
import argparse
import re
import sys
from operator import itemgetter
from itertools import groupby
try:
import netaddr
except ImportError:
print >>sys.stderr, 'ERROR: netaddr module not found.'
sys.exit(1)
# Check if the line contains 3 fields only
# Remove leading and trailing spa... | true |
e5b3ea68496835446b2a7c68e6a01a62f4a70812 | Python | Pawn-Debugger/SampleBugger | /Adventure.py | UTF-8 | 4,410 | 3.421875 | 3 | [] | no_license | import cmd
from Network import DebuggerOfflineException
class Adventure(cmd.Cmd):
intro = """You woke up in a strange place. People around you
are wearing either green or purple outfits, and are
carrying guns. What do you do?"""
prompt = '>>> '
def __init__(self, printer, debugger):
super().__init__()
... | true |
8a2d067421aee44f6e019c7be01bfd921c265bf4 | Python | swaroopvr07/pythonprograms | /SecondProgram.py | UTF-8 | 130 | 3.109375 | 3 | [] | no_license | def check(number):
print ("Number: ", number)
if number >= 4 and number <= 10:
return true;
print (check(5)) | true |
ff6a7ed2ef880915aa3aa4464a5c02ddfb92ac22 | Python | thuchula6792/ip_mcmc | /ip_mcmc/ip_mcmc/accepter_test.py | UTF-8 | 1,091 | 2.8125 | 3 | [] | no_license | import numpy as np
from .accepter import AnalyticAccepter, StandardRWAccepter, pCNAccepter
from .potential import AnalyticPotential
from .distribution import GaussianDistribution
from .test_utilities import MockRNG
def test_AnalyticAccepter():
rng = MockRNG(0.5)
a = AnalyticAccepter(lambda x: x)
assert... | true |
9ac83c7d0c8261c5f860a1eafb25e9d07fa79f48 | Python | azc14/pimirror | /code/focal_spot/supergaussian_fit/supergaussian.py | UTF-8 | 2,099 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 18 14:31:54 2018
@author: alicecao
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
import sys
sys.path.insert(0, '../')
from profiler import Profile
# definition of supergaussian function
def supergaussian(x, x_0 = 1050., s... | true |
d7f85c4de79036953f960481fc891274d32aef80 | Python | GrantBerland/Geant4_pinhole_detector | /analysis/fncs/fnc_calc_angle_per_particle.py | UTF-8 | 2,083 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3.5
import pandas as pd
import numpy as np
from scipy.stats import norm, skewnorm
# Extracts and returns actual inital particle source angles
from fnc_findSourceAngle import findSourceAngle
def calculateAnglePerParticle(gap_in_cm):
# Read in raw hit data
detector_hits = pd.read_csv('./data... | true |
a652ea8d7723c02274f26112b598b497ee60f408 | Python | AyaReiOwO/LHC | /4-edge.py | UTF-8 | 398 | 2.921875 | 3 | [] | no_license | import cv2
import numpy as np
# 灰度图片,方法四
img = cv2.imread("girl.jpg", 1)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
# canny 1 gray 2 高斯 3 canny
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
imgG = cv2.GaussianBlur(gray, (3, 3), 0)
dst = cv2.Canny(imgG, 50, 50) # 1 data 2 th 图片卷轴——>>th
cv2.imshow("dst",... | true |
41cfa3a6d9f5b4070cbfb6321745bdfd8252d964 | Python | abachman/project_euler | /p015.py | UTF-8 | 985 | 4.125 | 4 | [] | no_license | """
2007-12-18
Starting in the top left corner of a 2 x 2 grid, there are 6 routes
(without backtracking) to the bottom right corner.
How many routes are there through a 2020 grid?
(pascal!)
"""
import psyco
psyco.full()
def pascal(n):
" return the nth row of pascal's triangle "
if n == 0:
... | true |
1ae8c3a8cfd6dbe333f3abc4a84fcdf6101eb523 | Python | Reid00/data_process_pd | /09df_line.py | UTF-8 | 620 | 3.359375 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
# 绘制折线图
books = pd.read_excel('books.xlsx', sheet_name='Sheet1', skiprows=6, usecols='E:K', index_col='id')
# 折线图
# books.plot(y=['numbers', 'numbers_2019', 'numbers_2020?'])
# 叠加区域图
books.plot.area(y=['numbers', 'numbers_2019', 'numbers_2020?'])
plt.title('line ch... | true |
cc9e631813f96d58606eb3f57348fe0c8590c564 | Python | cwhetsel/CodingQuestionPractice | /Operations/Operations.py | UTF-8 | 1,543 | 4.0625 | 4 | [] | no_license | ''' Question: Write methods to implement the multiply subtract and divide operators for integers. The
results of all these are integers
# Time To complete: 15 minutes
# 9/19/17
'''
#
def multiply(a, b):
'''function takes in two integers and their product'''
if a == 0 or b ==0:
return 0
produ... | true |
29990654b07147ca1c5547de7c75c2cb6582865b | Python | gfugante/Old-Machine-Learning | /Classifiers/perceptron.py | UTF-8 | 1,065 | 3.046875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from Classifiers.classes import Perceptron
from Classifiers.functions import plot_decision_regions
df = pd.read_csv('dataTest.csv')
# print(df.tail())
y = df.iloc[0:100, 4].values
y = np.where(y == 'Iris-setosa', -1, 1)
X = df.iloc[0:100, [0, 2... | true |
32fa71da3b9a21430d02c316a948f93103575c34 | Python | Kcita/Kcita | /src/paquete.py | UTF-8 | 2,951 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
codigo_paquete = 0
class Paquete:
"""Este objeto representa un paquete de alquiler
-------------------------------------------
Atributos:
- codigo_paquete: integer
- precio_por_dia: float
- minimo_de_dias: integer
- titulo: integer
-... | true |
901e99fa694cfd36af7acf119fb268597dd9c418 | Python | Albert-Hu/WebCrawler | /Crawler/Shopee.py | UTF-8 | 7,799 | 2.71875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import urllib
import Log
import Utilities
from bs4 import BeautifulSoup
shopee_url = 'https://shopee.tw'
def search_product(keyword):
webdriver = Utilities.webdriver_create()
previous_url, url = '', shopee_url + '/search/?keyword=' + urllib.quote(keyword)
webdriver.get(url)
prod... | true |
737c69e20496b2084117d2b078c6653b636003c2 | Python | sungrn7/chatbot | /chatbot/crawler/subway.py | UTF-8 | 415 | 2.71875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import sqlite3
import time
def subway():
response = requests.get('https://m.map.naver.com/subway/subwayStation.nhn?stationId=449')
content = response.text
soup = BeautifulSoup(content,'html.parser')
subway_time = soup.select('div > div > ul > li > div')
... | true |
234b77e51795d8322788d3f65470a2b075144de8 | Python | LisaTOVO/Wave-3 | /shipping_calculator.py | UTF-8 | 173 | 3.46875 | 3 | [] | no_license | def shipping(num):
if num >= 0:
return (num -1) *2.95 + 10.95
else:
print("Invalid")
print(shipping(int(input("Enter the number of item: ")))) | true |
3ba809716a156fa5d495982975c4f40b357acf2b | Python | TingjunMa/HandWriting-Recognition | /HandWritingRecognition.py | UTF-8 | 3,404 | 2.875 | 3 | [] | no_license | from numpy import *
from scipy import *
from tkinter import filedialog
from os import listdir
from PIL import Image
import matplotlib
import matplotlib.pyplot as plt
import operator
def loadFile():
root = filedialog.Tk()
filename = filedialog.askopenfilename(initialdir = "F:/",title = "Choose your ... | true |
1946119ea44ff1dcad4baf5287e0aca75381ce5e | Python | udchawla02/GRIP-TASK-1 | /griptask1.py | UTF-8 | 3,346 | 3.5625 | 4 | [] | no_license |
"""GRIPtask1.ipynb
# **TASK #1 GRIP March 2021**
## **DATA SCIENCE AND BUSINESS ANALYTICS**
## **Prediction using Supervised ML**
### Predict the percentage of an student based on the no. of study hours.
###What will be predicted score if a student studies for 9.25 hrs/ day?
### implemented by:- **UDIT CHAWLA**... | true |
e1e7f4049db34c30b4345b60f533e64b6c4760e0 | Python | vivid-ZLL/tedu | /part_01_python_base/python_pro/day16/exercise02.py | UTF-8 | 1,037 | 4.4375 | 4 | [] | no_license | # 练习:图形管理器记录多个图形
# 迭代图形管理器对象
class GraphicManager:
def __init__(self):
self.__graphics = []
def add_graphic(self, graphic):
self.__graphics.append(graphic)
def __iter__(self):
# 创建一个迭代器对象,并传递需要迭代的数据。
return GraphicIterator(self.__graphics)
class Graphic:
pass
... | true |
88b0b2acd8150576de16c5989c2934d7d2777832 | Python | Isontre/ThronemasterScraper | /thronescraper/misc.py | UTF-8 | 3,466 | 2.796875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from PyQt5.QtCore import QUrl,QEventLoop,QTimer
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEnginePage,QWebEngineView
from time import sleep
def cook_soup(url):
"""Returns a very beautiful soup from an url
Args:
url (... | true |
94c606494fb7275d5bcf41f8d3149c75fcca6c6b | Python | andywyatte17/random_stuff | /python/GuessWho/Gui/qt/qgv/qgv.py | UTF-8 | 1,407 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, traceback, pprint
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import PeopleGraphicsView
class Example(QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def selectionDidChange(self, view):
... | true |
a17ffc02c58ac5edf7d7e92790c1110ccbdf6df5 | Python | Aasthaengg/IBMdataset | /Python_codes/p03354/s233801279.py | UTF-8 | 1,437 | 3.21875 | 3 | [] | no_license | class UnionFind():
def __init__(self, n):
self.n = n
self.root = [-1]*(n+1)
self.rnk = [0]*(n+1)
def Find_Root(self, x):
if(self.root[x] < 0):
return x
else:
self.root[x] = self.Find_Root(self.root[x])
return self.root[x]
def Unite(... | true |
57a474c7c27d38c260a6e667008ca86402eeda9b | Python | icevivian/Hello_offer | /111.二叉树的最小深度.py | UTF-8 | 1,023 | 3.234375 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=111 lang=python3
#
# [111] 二叉树的最小深度
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def minDepth(self, root: ... | true |
ee1fb5f0fd5104c7e795622f5863a9d46fdb92ce | Python | smoes/rambilight | /lib/ws2801.py | UTF-8 | 1,482 | 2.90625 | 3 | [] | no_license | # Import the WS2801 module.
import Adafruit_WS2801
import Adafruit_GPIO.SPI as SPI
import time
PIXEL_N = 200
pixels = []
def turn_off():
for i in range(0, PIXEL_N):
color = Adafruit_WS2801.RGB_to_color(0,0,0)
pixels.set_pixel(i, color)
pixels.show()
def pulse():
for c in range(1, 21):
... | true |
36862a3bb739351751184e71b0ef3e6e58965fb5 | Python | nparslow/L2FrenchWritingAnalyser | /otherAnalysis/analyseSpelling.py | UTF-8 | 2,597 | 2.5625 | 3 | [] | no_license | __author__ = 'nparslow'
import json
import codecs
jsonfilename = "/home/nparslow/Documents/AutoCorrige/Corpora/figures/spelling.json"
with codecs.open(jsonfilename, mode="r", encoding="utf8") as jfile:
spelling = json.load(jfile)
shortspelling = {}
for y in ["found", "notfound", "foreign", "changed"]:
short... | true |
e2c51d447e76b11970a2379de5caf0c141c13a50 | Python | Aasthaengg/IBMdataset | /Python_codes/p02982/s763744013.py | UTF-8 | 288 | 2.875 | 3 | [] | no_license | import math
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
cnt=0
for i in range(n):
for j in range(i+1,n):
sum=0
for k in range(d):
sum+=(x[i][k]-x[j][k])**2
z=pow(sum,0.5)
if math.ceil(z)==math.floor(z):
cnt+=1
print(cnt)
| true |
096818473242b25e7ef929fe9fdb7edb0be435ab | Python | tomasmussi/tda | /tp2/Grafos/Esquina.py | UTF-8 | 1,107 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Esquina(object):
"""Representa una esquina de Avellaneda/Polo Norte"""
def __init__ (self,id_esquina,x,y,latitud,longitud):
"""Crea una instancia de la clase a partir de una id, sus coordenadas
x e y en metros y sus coordenadas de latitud y longitud"""
self.id_esquina = id_esquina
... | true |
e5c617e13b401164ac7958046a3aa46988e41f4d | Python | jfxugithub/python | /面向对象的高级编程/定制类/__iter__.py | UTF-8 | 1,121 | 4.375 | 4 | [] | no_license | #!/usr/bin/evn python
# -*- coding: utf-8 -*-
'''
如果一个类想被用于for ... in循环,类似list或tuple那样,
就必须实现一个__iter__()方法,该方法返回一个迭代对象,
然后,Python的for循环就会不断调用该迭代对象的__next__()方法拿到循环的下一个值,
直到遇到StopIteration错误时退出循环。
'''
#eg:斐波那契数列(除了前两个数以外,每个数都是前两个数的和)
class Fib(object):
def __init__(self):
self.a = 0
self.b = 1... | true |
e869df1ecd5d7efd325692a33db50f5528d5707f | Python | ismgonza/python_projects | /phone_email_finder.py | UTF-8 | 1,190 | 2.96875 | 3 | [] | no_license | import pyperclip
import re
# regex for phones
regPhone = re.compile(
r'\+?\(?\d{3}\)?[\s\-\.]?\d{3}[\s\-\.]?\d{4}')
# regex for emails
regEmail = re.compile(r'''
[\w\-\.\_\+]+ # username
\@ # @ symbol
[\w\-\_]+ # domain
\.[A-Za-z]{2,3} # dot TLD
... | true |
3237dd1feaddf94023b7be61f88aea9388797d8f | Python | issacto/Energy-Demand-Forecast | /LSTM/dataset.py | UTF-8 | 1,521 | 2.921875 | 3 | [] | no_license | import csv
import numpy as np
import pandas as pd
from torch.utils.data import Dataset
import torch
import random
from sklearn.preprocessing import MinMaxScaler
class SimpleDataset(Dataset):
def __init__(self, path_to_csv, transform=None):
colnames = ['date', 'value']
df = pd.read_csv(path_to_csv... | true |
f468343d9b414deba3af4e367f4392048f058237 | Python | JIMMY-KSU/numerical | /files/heat_galerkin/heat_galerkin_files/heat_galerkin_source/heat_galerkin_single.py | UTF-8 | 4,210 | 2.734375 | 3 | [] | no_license | """
Heat Equation Galerkin Model
This script uses the FEniCS project (primarily the DOLFIN functionality) in order
to generate both the mass matrix M, the coefficient array for u, and the coefficient arrays
for the components of V = laplacian(u) for the system. The right-hand side vector bb is
also generated based on... | true |
ac2c06591c3a269eeabb83d143a2c08e2bb3fb2b | Python | CodyHelbling/price-hawk | /api.py | UTF-8 | 1,194 | 2.734375 | 3 | [] | no_license | import json
import time
from flask import Flask, abort, request
from Scraper import Scraper
from User import User
app = Flask(__name__)
user = User('Cody')
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/test')
def test():
return 'test'
@app.route('/prices', methods=['GET'])
def ge... | true |
980ac383e6dd964be8849eb2af25dcec9d6d62f2 | Python | rntkym/atcoder | /abc169/c.py | UTF-8 | 173 | 2.921875 | 3 | [] | no_license | import math
a, b = map(str, input().split())
a = int(a)
b = int(b.replace('.', ''))
print(b)
ans = str(a * b)
if len(ans) > 2:
print(int(ans[:-2]))
else:
print(0)
| true |
13db9782b906c0d0e8f5bd1fd874daca25bacd8c | Python | tcikovsky/Spongia-2021 | /globalVar.py | UTF-8 | 896 | 2.84375 | 3 | [] | no_license | import os
import sys
import __main__
import pygame
#sys.path.insert(0, os.path.dirname(os.path.realpath(__main__.__file__)) + "\Screens")
#sys.path.insert(0, os.path.dirname(os.path.realpath(__main__.__file__)) + "\Classes")
#from Screen import Screen
#from Temp import drawTemp
#from Town import drawTown
#... | true |
1bd79637adbebfc8117baca5868623130c401e31 | Python | yesl0210/Daily_Study | /Machine_Learning/Ensemble_Learning/ensemble.py | UTF-8 | 5,611 | 3.140625 | 3 | [] | no_license |
# coding: utf-8
# In[4]:
import numpy as np
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import VotingClassifier
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import warnings
warnings.filt... | true |
0dccb8969534357ec57e66898fc5c8d7ef3e025c | Python | brooknew/IrisClassfy | /data/irisdata2csv.py | UTF-8 | 1,794 | 2.53125 | 3 | [] | no_license | from sklearn.datasets import load_iris
import random
iris_dataset = load_iris()
with open( 'iris.csv' , 'wt') as fw :
fw1 = open( 'irisRandom.csv' , 'wt')
descr = iris_dataset['DESCR']
t = descr.split('\n' )
lines = len( t )
descr = descr + '------\n'
content = descr
datasetItems = [ '... | true |
7b4fcbb3f279ecf1498cd609a11d28bb2cc96212 | Python | tkessler45/GUI | /Tour/demoCheck.py | UTF-8 | 1,423 | 2.890625 | 3 | [] | no_license | __author__ = 'tkessler'
from tkinter import *
from Tour.dialogTable import demos
from Tour.quitter import Quitter
class Demo(Frame):
def __init__(self, parent=None, **options):
Frame.__init__(self, master=parent, **options)
self.pack()
self.tools() #call instance of local tools widget
... | true |
9474512e9a3ffea2e88c8e0ed058ac4cffad8bce | Python | leoniepnzr/MyExercises | /ex21.py | UTF-8 | 1,045 | 4.53125 | 5 | [] | no_license | #functions can return values
#function call with two arguments, print ADDING (what we are doing), adding a and b then return them, Python adds numbers, any line will be able to assign this result to a variable
def add(a, b):
print "ADDING %d + %d" % (a, b)
return a + b
#(called return value)returns value in va... | true |
3f917f192222a3ce98d6604199dbd36cfdde272c | Python | bolatuly/osm-shape-extract | /preprocessing/extract_to_json.py | UTF-8 | 1,205 | 2.515625 | 3 | [] | no_license | import osmium
import shapely.wkb as wkblib
from preprocessing.algorithm.polygon import Polygon
from geojson import FeatureCollection
import pandas as pd
import geojson
wkbfab = osmium.geom.WKBFactory()
class BuildingHandler(osmium.SimpleHandler):
def __init__(self):
osmium.SimpleHandler.__init__(self)
... | true |
851cf1df4a84cee5d99d94c506326bd5f37ccd5c | Python | battleforcastile/battleforcastile-match-recorder | /tests/matches/test_matches_get_with_params.py | UTF-8 | 1,807 | 2.59375 | 3 | [] | no_license | import json
def test_get_latest_non_started_match_created_by_username_if_there_are_matches_available(init_database, test_client, user1_username):
new_match_1 = {
'first_user': {
'username': user1_username,
'character': {
"meta": {
"name": "Black... | true |
7f4b666eb0e1dbfdb8828e7ab4179ba253b1fb5f | Python | OleksandrNikitenko/CodeSignal-Arcade | /LabyrinthOfNestedLoops/IsPower.py | UTF-8 | 397 | 4.1875 | 4 | [] | no_license | """
Determine if the given number is a power of some non-negative integer.
Example
For n = 125, the output should be
isPower(n) = true;
For n = 72, the output should be
isPower(n) = false.
"""
from math import sqrt
def isPower(n):
for i in range(1, int(sqrt(n))+1):
for j in range(1, int(sqr... | true |
50ef312219965119977c820d2e3495e99a192267 | Python | chocoai/shujuren_Python | /4data_project/hand_in_hand_get_gaode_api_data_version2_project/get_gaode_poi_1.py | UTF-8 | 1,899 | 2.96875 | 3 | [] | no_license | import urllib.request
from bs4 import BeautifulSoup
import re
import xlwt
poiTag=["id","name","type","typecode","biz_type","address","location","tel","pname","cityname","adname"]
poiSoupTag = ["idSoup","nameSoup","typeSoup","typecodeSoup","biz_typeSoup","addressSoup","locationSoup","telSoup","pnameSoup","citynameSoup",... | true |
05a9ab7f2a2d6017d65d30e043f579ba1a683dd5 | Python | Saurav1212/myapp | /db1.py | UTF-8 | 334 | 2.796875 | 3 | [] | no_license | import mysql.connector as mq
mycon=mq.connect(host='localhost',user="root",password="",database="hotel")
if mycon.is_connected():
print("connected")
c1=mycon.cursor()
sql_1="select * from boarding"
c1.execute(sql_1)
data=c1.fetchall()
for x in data:
for i in x:
print(i,"\t",sep=" ",end=" ")
print(... | true |
44ea07f4bf5bd91bb16ae3121cb74aa047804c82 | Python | nashikun/game_of_life | /DQNAgent.py | UTF-8 | 2,024 | 2.953125 | 3 | [] | no_license | from Agent import Agent
import numpy as np
import random
from collections import deque
from keras.models import clone_model
""" The Class responsible for making decisions """
class DQNAgent(Agent):
""" Returns the action with the highest expected reward """
def act(self, state):
if np.random.random() ... | true |
512260201cfcd6b7bfa61cedfc5388b404d30cbe | Python | zhihao0040/CodingPractice | /sort/sortAuxiliary.py | UTF-8 | 1,704 | 4.125 | 4 | [] | no_license | def getFileData(fileName):
fp = open(fileName, "r")
numOfElems = 0
numOfElems = int(fp.readline().strip())
myTextList = [0] * numOfElems
for i in range(numOfElems):
myTextList[i] = fp.readline().strip()
fp.close()
return numOfElems, myTextList# return as a tuple, no need structur... | true |
a19206be9e8f45483f6a85eedea90a0bac0de07f | Python | GH-KeiKat/my-first-blog | /blog/models.py | UTF-8 | 2,275 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#from __future__ import unicode_literals
#from django.db import models
# Create your models here.
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
#models.ForeignKey – これは他のモデルへのリ... | true |
f279d67047e149388ae32af84f763ba8a8ae8514 | Python | Lizz647/SJTU-Software | /Backend/Secondary Structure Prediction/ModelV3/utils/Getdataset.py | UTF-8 | 4,298 | 2.5625 | 3 | [
"MIT"
] | permissive | import re
from collections import defaultdict
import torch
from torch.utils.data import Dataset
import os
import numpy as np
from gensim.models import word2vec
# 接受一个str, 返回一个tensor类型的上三角邻接矩阵
def dash2matrix(str, length):
# seq_len = len(str)
lst = []
mat = torch.zeros((length, length))
for i in range... | true |
0922c88dfbf0d213582ea74e80fdf3358c98d82f | Python | KybranzF/AdventOfCode | /11_Seating_System/11.py | UTF-8 | 4,319 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3.9
import time
import copy
def replaceX(db, coord, replacement):
# print("DB ", db)
for i in range(len(db)):
db[i] = list(db[i])
# print(db)
# replaceX(data, coord, "#")
col = coord[0]
# col = 1
row = coord[1]
# print("replace:",col,row,"with:" ,replacem... | true |
475c86f181b20992fac46da1b32d06e1482b77e3 | Python | don-quixotee/data-structure-and-algorithms | /algorithms/sorting/mergesort/mergesort.py | UTF-8 | 827 | 3.1875 | 3 | [] | no_license | def merge(a, lb, mid, ub):
i = ub
j = mid + 1
k = lb
while ( i < mid and j <= ub ):
if(a[i] <= a[j] ):
b[k] =a[j]
i = i + 1
k = k + 1
else:
b[k] = a [j]
j = j + 1
k = k + 1
if (i > mid):
... | true |
1f85ba2042c5b05090810471274e434b029aa88f | Python | qlrmawkd/opencv | /video_cam.py | UTF-8 | 837 | 2.875 | 3 | [] | no_license | import cv2
cap = cv2.VideoCapture(0)
#카메라 프레임 구하는 과정
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
print("기존 폭: %d, height:%d" % (width, height))
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 320)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 240)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap... | true |
240aa38fc61d16349f14fea451c9898e1bff9211 | Python | yansonggu/coronavirus_data | /scripts/overlap.py | UTF-8 | 2,006 | 3.015625 | 3 | [] | no_license | from argparse import ArgumentParser
import csv
from itertools import combinations
import os
from typing import List, Set
from p_tqdm import p_map
from rdkit import Chem
from rdkit.Chem.SaltRemover import SaltRemover
remover = SaltRemover()
def standardize_smiles(smiles: str) -> str:
smiles = smiles.replace('\\'... | true |
f866336c7f5218fbb1815baa65e7c3634650a052 | Python | paul-lkx/opencvdemo | /plot.py | UTF-8 | 855 | 2.9375 | 3 | [] | no_license |
import numpy as np
import cv2
# Create a black image
img = np.zeros((512,512,3), np.uint8)
# Draw a diagonal blue line with thickness of 5 px
cv2.line(img, (0,0), (511,511), (255,0,0), 5, cv2.LINE_AA)
cv2.rectangle(img, (384,0), (510,128), (0,255,0), 3)
cv2.circle(img, (447,63), 63, (0,0,255), -1)
cv2.ellipse(img... | true |
f04a220e156d48f38cfa6c524f71ae9dd998da07 | Python | kenzia/interval | /test_sureness.py | UTF-8 | 955 | 2.828125 | 3 | [] | no_license | import unittest
from response import Response
from question import Question
from sureness import Sureness
class TestResponseMethods(unittest.TestCase):
def test_nickname_is_string(self):
response1 = Response (4, 9, Question.get_question())
sureness1 = Sureness ("real damn sure", [response1])
self.assertIsInst... | true |
e9b9f74db917c2e4cb006142f4d80e68dea567af | Python | sara-nl/2D-VQ-AE-2 | /scripts/convert_npy_embeddings_to_hdf5/convert.py | UTF-8 | 2,556 | 2.578125 | 3 | [] | no_license | import logging
from collections.abc import Iterable, Sequence
from glob import glob
from itertools import chain, zip_longest
from operator import attrgetter
from pathlib import Path
import h5py
import hydra
import numpy as np
@hydra.main(config_path="./conf", config_name="convert_camelyon16_embeddings")
def main(
... | true |
556a5b51e780e3693d021cb2cd266c604e1916e4 | Python | serg9300/web_academy | /coroutine.py | UTF-8 | 1,184 | 3.078125 | 3 | [] | no_license | cnt = 0
def decorator(func):
def decorated(pattern, next_coroutine):
global cnt
gen = func(pattern, next_coroutine)
next(gen)
try:
while True:
line = (yield)
gen.send(line)
cnt += 1
except GeneratorExit:
... | true |
4dfba5227a29e5188601a7f696c5ade2950f012a | Python | jaworra/Road-Cetreline | /GPS_TripMetre/SVN/VersionA/GPSTripMetre_Interval version3.py | UTF-8 | 9,358 | 3.15625 | 3 | [] | no_license |
import math
#distance between points on horizontal plane
def ptDist(pt1, pt2):
return math.sqrt(pow(float(pt2[0])-float(pt1[0]),2) + pow(float(pt2[1])-float(pt1[1]),2))
#interpolated point along horizontal plane
def newPoint(pt0,pt1,lineCh,DistPTApart):
##print pt0[0]
##print pt0[1]
... | true |
141440def07563a586352690e65262a5abec00f0 | Python | hiro220/newGame | /src/start/startWindow.py | UTF-8 | 1,874 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
import pygame
from pygame.locals import *
import os
from game.game import Game
class StartWindow:
def __init__(self, screen):
font = pygame.font.Font(None, 25)
self.game_text = font.render("START", True, (255,255,255)) #テキストSTART_GAME
self.end_text =... | true |
f64c93c7f922c2e64547bf5ed4e9209ae7928751 | Python | 1547015/Python-Jun-2019 | /More programs/sample.py | UTF-8 | 848 | 4.1875 | 4 | [] | no_license | # Program to show various ways to read and
# write data in a file.
file1 = open("myfile.txt","w")
L = ["This is Java \n","This is Paris \n","This is London \n"]
# \n is placed to indicate EOL (End of Line)
file1.write("Hello \n")
file1.writelines(L)
file1.close() #to change file access modes
file1 = open... | true |
f43cf360a8a080051392d438b99b05ff049bf8ef | Python | syeluru/MIS304 | /BankAccount.py | UTF-8 | 359 | 3.234375 | 3 | [] | no_license | # Class BankAccount
class BankAccount:
# Constructor or initializer
def __init__(self, initial_balance=0.0):
self.__balance = initial_balance
# Setter, Mutator, Set method
def deposit(self, amount):
self.__balance += amount
# Setter, Mutator, Set method)
def withdraw(self, amo... | true |
72d67cfb2ceeceaafb42739d4407a409554167cc | Python | SukritSriratanawilai/Project | /detect_frequency/Logistic/Preprocess_each_month.py | UTF-8 | 1,492 | 2.578125 | 3 | [] | no_license | import random
import sys
import csv
import nltk.tokenize
import math
import numpy as np
from pylab import plot,show
import statsmodels.api as sm
from sklearn import preprocessing
from scipy.stats.stats import pearsonr
import re
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_sco... | true |
baac6998a08d0c32d27985c802edc302abc420a6 | Python | burrowsa/keeponmockin | /keeponmockin/example3.py | UTF-8 | 383 | 2.953125 | 3 | [] | no_license | def count_words(filename):
words = 0
with open(filename) as f:
for line in f.readlines():
words += sum(1 for word in line.strip().split(' ') if word)
return words
def count_words_alt(filename):
words = 0
with open(filename) as f:
for line in f:
words += sum(1... | true |
4e511427074422411af27c9a136219a8b66e8d60 | Python | ALINA49/luminarpython | /Core Python/Flow controls/if else/+ve or -ve.py | UTF-8 | 140 | 3.578125 | 4 | [] | no_license |
num=int(input("enter the no."))
if(num>0):
print(num,"is positive.")
elif(num<0):
print(num,"is negative.")
else:
print("zero") | true |
f6f04a34db6a3d7511034a94319186a7c367fde4 | Python | Aasthaengg/IBMdataset | /Python_codes/p03544/s494720315.py | UTF-8 | 110 | 2.90625 | 3 | [] | no_license | n=int(input())
l=[0 for i in range(n+1)]
l[0]=2
l[1]=1
for j in range(2,n+1):
l[j]=l[j-1]+l[j-2]
print(l[n]) | true |
ea966f77c709f71f98c26fabf019e7d2f651472c | Python | pedromxavier/BRAFMAN-ASSEMBLY | /src/braf/shell.py | UTF-8 | 1,640 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
+-+-+-+-+-+-+-+
|B|R|A|F|M|A|N|
+-+-+-+-+-+-+-+-+
|A|S|S|E|M|B|L|Y|
+-+-+-+-+-+-+-+-+
v 1.1
"""
import sys, os
import string
argv = sys.argv
argc = len(argv)
from braf import *
def get_cmd(cmd):
if cmd.endswith("H") and all(x in '01' for x in cmd[:-1]):... | true |
3fbb69c75b960c78bce1bdee9510556c4ff0690e | Python | giuscri/problem-solving-workout | /project_euler/2.py | UTF-8 | 1,088 | 4.5 | 4 | [] | no_license | #!/usr/bin/python3
'''
You can show that every third fibonacci
number is even. More specifically,
if fib(3n-2) is odd, fib(3n-1) is odd
and fib(3n) is even, then fib(3n+3) is even:
fib(3n + 1) = fib(3n - 1) + fib(3n) = {odd} + {even} = {odd}
fib(3n + 2) = fib(3n) + fib(3n + 1) = {even} + {odd} = {odd}
fib(3n + 3) = f... | true |
80d9c6194e76567d4850f0d05ee1a52748f3660e | Python | pavbis/python-eventserver | /eventsserver/search/specifications/period_specifications.py | UTF-8 | 4,417 | 2.71875 | 3 | [] | no_license | from eventsserver.value.objects import Period, DateRange
class SpecifiesPeriod:
def is_satisfied_by(self, period: Period) -> bool:
raise NotImplementedError
def and_expression(self) -> str:
raise NotImplementedError
def period(self) -> str:
raise NotImplementedError
def peri... | true |
19d61d6d23ac5412b8ac965d231de4a10bdfdd76 | Python | rec/test | /python/finally_test.py | UTF-8 | 193 | 3.375 | 3 | [
"MIT"
] | permissive |
class Foo:
bar = False
def method(self):
try:
return 0
finally:
self.bar = True
foo = Foo()
print(foo.bar)
print(foo.method())
print(foo.bar)
| true |
40986961b46793cf872b824b1a20f97fb7292a3f | Python | jobsonb10/BlueMod1 | /Módulo 1/Aula06_for/Exercício02.py | UTF-8 | 131 | 4.53125 | 5 | [] | no_license | n = int (input("Digite um número: "))
for i in range(1,n+1):
if n % i == 0:
print(f"O número {i} é divisor de {n}.") | true |
c32be931aa8648b34fda2e0271d3535e62e241af | Python | gioargyr/MyTiramola | /MyTiramola/LwlosTiramola/DecisionMaking/examples/q_ex2/qlearning_ex2.py | UTF-8 | 1,383 | 2.640625 | 3 | [] | no_license |
TIRAMOLA_DIR = "/home/kostis/git/tiramola/"
import sys
sys.path.append(TIRAMOLA_DIR)
from Configuration import ModelConf
from QModel import QModel
from pprint import pprint
import random
def get_next_measurements(old_measurements, action):
action_type, action_value = action
if action_type == "no_op":
... | true |
089c12f3d7f920d321d8c59bc54e2e3cec2a60f4 | Python | pinchukovartur/TesterLevels | /index/models.py | UTF-8 | 2,972 | 2.625 | 3 | [] | no_license | """
The script describes the project models
created by: Pinchukov Artur
date: 13.10.17
"""
# standard libs
import random
import string
# frameworks
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from django.utils import timezone
# static data
SECRET_KEY_SIZE = 32... | true |
632feaad275d4ee5fe82d1e5ca3ed9d547560c62 | Python | minxuezh/linebox | /python-prg/20200320.py | UTF-8 | 111 | 3.046875 | 3 | [] | no_license | movie_title = "Avengers: Endgame"
print(movie_title)
print(movie_title.split())
print(movie_title.lower())
| true |