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
abf8cc5b7dd5d9f13c1117c13dd24f9fae68202e
Python
PauloVilarinho/algoritmos
/problemas uri/Problema1289.py
UTF-8
323
3
3
[]
no_license
quantity = int(input()) for i in range (quantity): lista = input().split() n = int(lista[0]) p = float(lista[1]) j = int(lista[2]) q = (1-p)**(n) a1 = ((1-p)**(j-1))*p if 0<p<1 : probabilidade = a1/(1-q) elif p==1 and j==1 : probabilidade = 1.0000 else: probabilidade = 0.0000 print("%.4f" %probabilida...
true
959c12e8acb5dfeb5d814d3896f6492e86ba9591
Python
BasiaKo/ZaliczenieSelenium
/pages/strona_zapytaj.py
UTF-8
1,513
2.625
3
[]
no_license
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver import ActionChains from locators import Strona_Zapytaj_Lokatory class StronaZapytaj: def __init__(self, driver): self.driver=driver def refresh(self): ...
true
8da27209396f64dfb4c4b8cac9966a516275a788
Python
napo/osm_civici_trento
/get_street_names_comuni.py
UTF-8
1,282
2.53125
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Sep 19 10:21:11 2017 @author: daniele """ import csv import sqlite3 import time def main(): db = '../db.sqlite' connection = sqlite3.connect(db) connection.row_factory = sqlite3.Row connection.enable_load_extension(True) curso...
true
b5e1072cd714d974b9acfd59c4501ca4df001139
Python
alrivero/histogram_equalization
/equalize.py
UTF-8
1,444
3.140625
3
[]
no_license
import cv2 import sys from histogram_equalization import block_histogram_equalization, global_histogram_equalization from getopt import getopt def equalize_img(): # Use getopt to gather our arguments img_name = None result_path = None block_size = 0 opts, args = getopt(sys.argv[1:], "s:b:i:") ...
true
91aa892e672aed7692b323253d529987c83fc19d
Python
aly50n/Python-Algoritmos-2019.2
/lista05ex03.py
UTF-8
199
3.890625
4
[]
no_license
vetor = [""] * 10 cont=0 for i in range(10): vetor[i]= int(input("Digite um valor inteiro: ")) if vetor[i] % 2 == 0: cont= cont+1 print("Dos valores do seu vetor", cont, "sรฃo pares")
true
0d0f726b0b494b84ca9b022c43dcc7c1b4875b1f
Python
luisgcastillos/LogoGenerator
/LogoGenerator.py
UTF-8
1,447
2.953125
3
[]
no_license
import svgwrite import argparse import string import os def pattern(name, logoText): dwg = svgwrite.Drawing(name, size=('20cm', '10cm'), profile='full', debug=True) #We use dwg.g to use different style fonts, this can be done using the css classes dir = os.path.dirname(__file__) filename = os.path.joi...
true
64725c4b2ad5f80cedf9b14300af7e1951798ce3
Python
taylor-swift-1989/PyGameExamplesAndAnswers
/examples/minimal_examples/pygame_minimal_math_curve_sine.py
UTF-8
3,669
3.03125
3
[]
no_license
# pygame.math module # https://www.pygame.org/docs/ref/math.html # # Sine # https://en.wikipedia.org/wiki/Sine # # Gaps in a line while trying to draw them with a mouse problem # https://stackoverflow.com/questions/56379888/gaps-in-a-line-while-trying-to-draw-them-with-a-mouse-problem/56380523#56380523 # # GitHub - PyG...
true
671ed4a3811204db7adf62ae35922cc8fdf4d054
Python
axetang/AxePython
/60days/17.py
UTF-8
2,316
4.0625
4
[ "Apache-2.0" ]
permissive
# Day 17๏ผšPython ๅˆ—่กจ็”Ÿๆˆๅผ้ซ˜ๆ•ˆไฝฟ็”จ็š„ 12 ไธชๆกˆไพ‹ # Python ้‡Œไฝฟ็”จ [] ๅˆ›ๅปบไธ€ไธชๅˆ—่กจใ€‚ๅฎนๅ™จ็ฑปๅž‹็š„ๆ•ฐๆฎ่ฟ›่กŒ่ฟ็ฎ—ๅ’Œๆ“ไฝœ๏ผŒ็”Ÿๆˆๆ–ฐ็š„ๅˆ—่กจๆœ€้ซ˜ๆ•ˆ็š„ๅŠžๆณ•โ€”โ€”ๅˆ—่กจ็”Ÿๆˆๅผใ€‚ from math import floor import os from random import random a = range(0, 11) b = [x**2 for x in a] print(b) c = [str(x) for x in a] print(c) a = [round(random(), 2) for _ in range(10)] print(a) a = range(11) d = [x**2 for x i...
true
43a6359d5bec575f68f1a318155cf322ea3443e2
Python
Nithesh-Wayne/ML
/e14.py
UTF-8
707
2.53125
3
[]
no_license
import numpy as np from sklearn import preprocessing,neighbors from sklearn.model_selection import train_test_split import pandas as pd df=pd.read_csv('breast-cancer-wisconsin.data') df.replace('?', -99999,inplace=True) df.drop(['id'],1,inplace=True) X=np.array(df.drop(['class'],1)) y=np.array(df['class']) X_train,X...
true
f1d2e07fa35dc2b2077ca3ee8c9578bb38b1a0d7
Python
mattpiccolella/StreetlightsBackendAPI
/models.py
UTF-8
2,019
2.8125
3
[]
no_license
from flask.ext.sqlalchemy import SQLAlchemy from datetime import datetime, timedelta db = SQLAlchemy() class User(db.Model): __tablename__ = 'users' uid = db.Column(db.Integer, primary_key = True) name = db.Column(db.String(100)) email = db.Column(db.String(120), unique=True) password = db.Column(...
true
9516be410b2bbda062777b1e7dc7fecf13a242cb
Python
aungminko93750/lira
/lira/parsers/nodes.py
UTF-8
5,968
3.125
3
[ "MIT" ]
permissive
from copy import copy from lira.validators import TestBlockValidator, get_validator_class def _get_attributes_proxy(attributes, **values): class AttributesProxy: __slots__ = attributes def __init__(self, **kwargs): for item, value in kwargs.items(): setattr(self, item...
true
c151c2c1060141ed2e79192a2efe66e9d8e9a9bd
Python
dockerizeme/dockerizeme
/hard-gists/10010307/snippet.py
UTF-8
1,788
2.828125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python ''' Playing around with CoreWLAN to return information about the wi-fi connection Documentation: https://developer.apple.com/library/mac/documentation/CoreWLAN/Reference/CWInterface_reference/translated_content/CWInterface.html ''' import objc objc.loadBundle('CoreWLAN', bundle_path='/Syste...
true
afb47e12ae9dcff5b4c029c65e1f780b2c926ca8
Python
salmonofdoubt/TECH
/PROG/PY/pyintro/coding/week9_demo_files/urllib/orginfo_basic.py
UTF-8
303
2.5625
3
[]
no_license
#!/usr/bin/python2.6 import re import urllib def UrlToText(url): url_file = urllib.urlopen(url) contents = url_file.read() return contents def main(): my_moma_page = 'https://orginfo.corp.google.com/alberthwang?format=xml' print UrlToText(my_moma_page) if __name__ == '__main__': main()
true
a158cae87455f0c9ec348759569d89fbfa57fcbf
Python
testkkj/Python-L
/ch04.py
UTF-8
5,942
4.59375
5
[]
no_license
# ํ•จ์ˆ˜ # ํŒŒ์ด์ฌ ํ•จ์ˆ˜์˜ ๊ตฌ์กฐ ''' def ํ•จ์ˆ˜๋ช…(์ž…๋ ฅ ์ธ์ˆ˜): ์ˆ˜ํ–‰ํ•  ๋ฌธ์žฅ1 ์ˆ˜ํ–‰ํ•  ๋ฌธ์žฅ2 ... ''' def sum(a,b): return a + b a = 3 b = 4 c = sum(a,b) print(c) # ์ž…๋ ฅ๊ฐ’๊ณผ ๊ฒฐ๊ณผ๊ฐ’์— ๋”ฐ๋ฅธ ํ•จ์ˆ˜์˜ ํ˜•ํƒœ # ์ผ๋ฐ˜์ ์ธ ํ•จ์ˆ˜ ''' def ํ•จ์ˆ˜๋ช…(์ž…๋ ฅ ์ธ์ˆ˜): ์ˆ˜ํ–‰ํ•  ๋ฌธ์žฅ ... return ๊ฒฐ๊ณผ๊ฐ’ ''' def sum(a,b): result = a + b return result a = sum(3,4) print(a) # ์ž…๋ ฅ๊ฐ’์ด ์—†๋Š” ...
true
b62b9704907feff5ca8eaee193df63eb91535881
Python
binthafra/Python
/4-Advance Python- Functional Programmimg/15-Pure Function.py
UTF-8
143
3.453125
3
[]
no_license
def multipy_by2(li): new_list = [] for item in li: new_list.append(item+2) return new_list print(multipy_by2([1, 2, 3]))
true
92b9e48bd6bf1683739cf8d0974e42c5b9fe63e9
Python
yuewuo/fusion-blossom
/benchmark/util.py
UTF-8
9,932
2.53125
3
[ "MIT" ]
permissive
import json, subprocess, os, sys, tempfile, math, scipy class Profile: """ read profile given filename; if provided `skip_begin_profiles`, then it will skip such number of profiles in the beginning, by default to 5 because usually the first few profiles are not stable yet """ def __init__(self, fi...
true
7593deba29e57c09a97b11dc7770f330aaad8051
Python
tgomez22/distanceVector
/updatedDistanceVector.py
UTF-8
3,112
3.25
3
[]
no_license
class node: def __init__(self, identifier): self.distanceVector = dict() self.distanceVector[identifier] = 0 self.name = identifier self.hasChanged = False def addNeighbor(self, neighbor, distance): self.distanceVector[neighbor] = distance def updateVector(self,...
true
dbba8fbef53d8b0ae19775c81ac4fbdf4d83b59c
Python
QuentinJol/Exercicessupplementaires
/Premiere Serie/Exo 6.py
UTF-8
127
3.171875
3
[]
no_license
# -*- coding: utf8 -*- A=0 B=1 C=0 i=0 while i != 10: C=A+B print(A, " + ", B, " = ", C) A=B B=C i += 1
true
362bdbf08c326b9907c5421c8abee85c120023a8
Python
zhang-wen/dynmt
/stream_with_dict.py
UTF-8
14,787
2.625
3
[]
no_license
# -*- coding: utf-8 -*- import numpy from fuel.datasets import TextFile from fuel.schemes import ConstantScheme from fuel.streams import DataStream from fuel.transformers import ( Merge, Batch, Filter, Padding, SortMapping, Unpack, Mapping) from six.moves import cPickle import logging logger = logging.getLogger(...
true
0a32c13ca24baed623fe6d9baacc6749a04b7fae
Python
wlgud0402/dev
/๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ/Counter.py
UTF-8
194
3.515625
4
[]
no_license
#Counter ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ from collections import Counter string = "hello" print(Counter(string)) print(Counter(string).items()) print(Counter(string).keys()) print(Counter(string).values())
true
0fb84b9259cf7a17a21d1ec8f93e73784e0ba9a8
Python
MarianCeap/citisim-bitool
/CitiSIM/login.py
UTF-8
912
2.609375
3
[]
no_license
#!flask/bin/python from flask import request from flask import flash from flask import redirect from flask import render_template from flask_login import login_user,logout_user,current_user from main import app from users import User @app.route('/login', methods=['GET','POST']) def loginPage(): if(current_user.is_...
true
bbde312d2a3e0fcaa2984ae7f93a5d8716dffcf8
Python
Sylphy0052/PythonWebApplication
/Flask/OneDayFlaskBeginner/flaskworks/chap5.py
UTF-8
1,865
2.796875
3
[]
no_license
import os from flask import Flask, render_template, request, redirect, url_for, send_from_directory from werkzeug import secure_filename # appใจใ„ใ†ๅค‰ๆ•ฐใซFlaskใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใ‚’ไฝœๆˆใ™ใ‚‹ใŠใพใ˜ใชใ„ app = Flask(__name__) UPLOAD_FOLDER = './uploads' ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) app.config['UPLOAD_FOLDER'] ...
true
a03389e42ac5892af913c282b60a573b35fd1e43
Python
fare-xzy/LeetCode
/python/leetcode/algorithms/easy/7-ๆ•ดๆ•ฐ็ฟป่ฝฌ.py
UTF-8
426
3.03125
3
[]
no_license
class Solution: def reverse(self, x: int) -> int: maxInt = 2 ** 31 strX = str(abs(x)) strList = list(strX) newStr = ''.join(strList[-1::-1]) newInt = int(newStr) if newInt < -maxInt or newInt > maxInt - 1: return 0 if x < 0: return -new...
true
9b62542b41d1f0ce73ca8a553a984c8cba5d893a
Python
1Shivam12/SIOT
/Python/TwitterAPI.py
UTF-8
1,802
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jan 4 08:47:17 2019 @author: Shivam Bhatnagar """ import json from twython import TwythonStreamer import csv credentials = {} credentials['CONSUMER_KEY'] = 'GUHAjTw17AGUss9kPzu8I9PNB' credentials['CONSUMER_SECRET'] = 'UAyXIwrL1qKSUrB3WaBIlvbH7bYgloj2ejFs247JxcAGD5Rgs4' cr...
true
c5f9e8daa3d4d80fd28514b5ae0ca13b5a79e2c3
Python
Coobeliues/pp2_py
/inf_arr9/3852.py
UTF-8
331
3.109375
3
[]
no_license
s, x, y = list(), list(), list() n = 8 for i in range(n): b = list(map(int, input().split())) l, r = b[0], b[1] s.append(l + r) x.append(l) y.append(r) for i in range(n): for j in range(i+1, n): if s[i] == s[j] or x[i] == x[j] or y[i] == y[j]: print("YES") exit() ...
true
b1e5b2034f966c79dae70bf6ccfeb9bf782d4f3c
Python
apprenticearnab/ReinforceBots
/load_embeddings.py
UTF-8
1,098
3.171875
3
[ "MIT" ]
permissive
''' This file loads a word2vec of user's choice For this project : Word2Vec model : 'word2vec-google-news-300' ''' import torch import gensim.downloader # Downloads Google news word2vec model def load_embeddings(word2vec_model='word2vec-google-news-300'): embed_model = gensim.downloader.load(word2vec_mode...
true
ba74600b06e5901a86a13e5ec93d6aad4bf782d2
Python
TestingIaCwithNewAccount/clouds-aws
/src/clouds_aws/local_stack/parameters.py
UTF-8
2,267
2.953125
3
[ "Apache-2.0" ]
permissive
""" Parameters class """ import logging from os import path, unlink from clouds_aws.local_stack.helpers import dump_yaml, load_yaml LOG = logging.getLogger(__name__) class ParameterError(Exception): """ Custom errors for Parameters class """ pass class Parameters: """ Parameters class """ def __i...
true
57a1459d7a8bfffc71d9e63538832c2ddab76709
Python
edbutcher/course
/xmllesson.py
UTF-8
322
2.78125
3
[]
no_license
import urllib import xml.etree.ElementTree as ET url = 'http://python-data.dr-chuck.net/comments_333665.xml' data = urllib.urlopen(url).read() mn = [] stuff = ET.fromstring(data) lst = stuff.findall('comments/comment') print len(lst) for item in lst: x = int(item.find('count').text) mn.append(x) print sum(mn...
true
4d50108480c4bced543c3ff77569d1f9ae356192
Python
ayoubkachkach/Buffon-s-Experiment
/flaskr/engine.py
UTF-8
2,175
3.328125
3
[]
no_license
import numpy as np import math MATCH_LEN = 1 #in pixels LINE_SPACING = 2*MATCH_LEN #spacing between consecutive lines DIM_SPACE = 240 class Point: '''Represents a 2D point''' def __init__(self, x, y): self.x = x self.y = y def get_coordinates(): return (x, y) class Match: '''...
true
63047843cb18a5ee696728c150b44699ae9f2865
Python
tahmid-tanzim/problem-solving
/codility/CountDiv.py
UTF-8
1,155
3.9375
4
[]
no_license
#!/usr/bin/python3 # https://app.codility.com/programmers/lessons/5-prefix_sums/count_div/ from typing import List # Time O(B - A) # Space O(1) def findCountDiv(A: int, B: int, K: int) -> int: counter = 0 for i in range(A, B + 1, K): if i % K == 0: counter += 1 return counter # Time ...
true
dbb9d23e66fc1e370bafefbfbf8907f394e57fa2
Python
houfu/lsra-scraper
/lsra_scraper/lsra_scraper.py
UTF-8
6,445
2.59375
3
[ "MIT" ]
permissive
import dataclasses import os import click import requests from bs4 import BeautifulSoup from selenium import webdriver @click.command() @click.option('--site', '-s', help='Url to LSRA search page', default='https://eservices.mlaw.gov.sg/lsra/search-lawyer-or-law-firm') @click.option('--output', '-o', h...
true
30e67b7c9969de4b1f599583cbf2af042af409c1
Python
mxmaslin/dvmn
/async_python/dvmn_async_python_lesson1/frames/fire.py
UTF-8
900
3.296875
3
[ "MIT" ]
permissive
import asyncio import curses async def fire(canvas, start_row, start_column, rows_speed=-0.3, columns_speed=0): """Display animation of gun shot. Direction and speed can be specified.""" row, column = start_row, start_column canvas.addstr(round(row), round(column), '*') await asyncio.sleep(0) c...
true
fd27aa3abbaa854f031d984b91ae65fe3a326c6b
Python
tony32769/sciquence
/sciquence/text_processing/text_generator.py
UTF-8
3,440
2.609375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Krzysztof Joachimiak 2017 # sciquence: Time series & sequences in Python # # Text generator # Author: Krzysztof Joachimiak # # License: MIT import theano import theano.tensor as T from sciquence.nn.neural_utils import init_weight import numpy as np from sklearn.utils import shuffle import ...
true
2ab6b9e25060d15b74ed40203a41f0e05257f4dc
Python
thu-spmi/semi-EBM
/train/scorer.py
UTF-8
4,260
2.890625
3
[ "Apache-2.0" ]
permissive
# Copyright 2020 Tsinghua University, Author: Yunfu Song # Apache 2.0. # This script contrains functions to calculate F1 score. import abc def get_span_labels(sentence_tags, inv_label_mapping=None): """Go from token-level labels to list of entities (start, end, class).""" if inv_label_mapping: sentence_tags ...
true
01df17c160a3324587cb89ba32ad9ef5372212ee
Python
ollamh/addressbook
/addressbook/tests.py
UTF-8
3,925
2.90625
3
[]
no_license
import os import unittest from addressbook.core import ( AddressBook, Group, Person, ValidationError ) from .tst import Node class ABTest(unittest.TestCase): def setUp(self): self.ab = AddressBook('test.dat') self.person = Person( 'Test', 'Person'...
true
9528de8144db8cf606205aa9ecae26f625dfcb75
Python
sureshkumarkadi/Pytest
/Library/Test.py
UTF-8
2,790
3.375
3
[]
no_license
s =[] for i in range(10): s.append(i**2) print(s) add = lambda x,y:x+y print(add(1,2)) #download a file from web ##import requests ##file_url = 'https://www.facebook.com/favicon.ico' ## ##image = requests.get(file_url) ##print(image) ## ##with open('D:/eTender/facebook.ico','wb') as f: ## f.write(image.con...
true
50620ad4373512cfead7cbbd9cf2dc70a1eaf876
Python
roshancspro/Python_Starter
/doublecola.py
UTF-8
1,164
3.375
3
[]
no_license
import math def whoIsNext(names, r): if(names == None): return if(r == None or r == 0): return total = len(names) if(r <= total): return names[r-1] #Geometric Sequence find nth repetition logic currVal = r // total # 2 is geometric difference nVal ...
true
f3ce29dcdfa33b59bfe5b109533b78fa60e3b649
Python
luccavn/random_graphs
/random_graphs.py
UTF-8
11,808
2.765625
3
[ "MIT" ]
permissive
from collections import deque, namedtuple from random import randint, randrange, choice from itertools import permutations from time import time from math import sqrt import pygame global MAX_NODES global DEST_NODE COMPLETE_GRAPH = False INCLUDE_BRUTEFORCE_TRAVELLER = False MAX_NODES = 8 MAX_NEIGHBOURS =...
true
bbb665758e69224351ade3e60cb790d37e1c2512
Python
ItManHarry/Python
/PythonCSDN/code/book/chapter10/code-counter.py
UTF-8
1,257
3.8125
4
[]
no_license
from collections import Counter print('-' * 80) c1 = Counter() print(c1) print('-' * 80) c2 = Counter('hahaIamHarry') print(c2) print('-' * 80) c3 = Counter(['a','Go','Java','Go','Python','Groovy','Kotlin','Java','C','a']) print(c3) print('-' * 80) c4 = Counter({'a':20,'b':30,'c':29}) print(c4) print('-' * 80) c5 = Cou...
true
fda0f7d0a0240de8ae9295e8c522e7f1235828b3
Python
xiaohaoxing/mioj
/problem110.py
UTF-8
1,034
3.59375
4
[]
no_license
def solution(line): num_p, p, q = line.split(' ') #่ฎก็ฎ—ๅ‡บ base 10็š„ๆ•ฐๅญ— num_10 = 0; p = int(p) for char in num_p: num_10 *= p if char == 'a': num_10 += 10 elif char == 'b': num_10 += 11 elif char == 'c': num_10 += 12 elif char ==...
true
0760854c66a6d9a4f7c7c189c27b7501ce188c43
Python
blibrano/PythonProjects
/minHeap.py
UTF-8
2,072
3.53125
4
[]
no_license
class minHeap: def __init__(self): self.array=[(0,0)] self.count=0 def is_empty(self): if self.count==0: return True else: return False def swap(self,x,y,vertices): a,b=self.array[x] c,d=self.array[y] ver...
true
794e0948f832a93844447a8f5af4e86736813c00
Python
turbcool/pymorphy-nltk
/main.py
UTF-8
2,312
3.84375
4
[]
no_license
#0. ะ’ะบะปัŽั‡ะฐะตะผ ะฒ ะฟั€ะพะณั€ะฐะผะผัƒ ัั‚ะพั€ะพะฝะฝะธะต ะฑะธะฑะปะธะพั‚ะตะบะธ: import pymorphy2 import nltk import string from nltk.tokenize import sent_tokenize from nltk.corpus import stopwords #ะญั‚ะฐ ัˆั‚ัƒะบะฐ ะดะพะบะฐั‡ะธะฒะฐะตั‚ ะฝัƒะถะฝั‹ะต ะฟะฐะบะตั‚ั‹ ะธะท ะธะฝั‚ะตั€ะฝะตั‚ะฐ, ะตัะปะธ ะธั… ัƒ ั‚ะตะฑั ะฝะตั‚: nltk.download("punkt") nltk.download("stopwords") #1. ะ—ะฐะดะฐั‘ะผ ะธัั…ะพะดะฝั‹ะน ั‚ะตะบัั‚, ั ะบะพั‚ะพั€ั‹...
true
43aec529d4c008f2b83ddf2ab3171ace6c201726
Python
Joie-Kim/python_ex
/chap3_exercise/chap3_ex4.py
UTF-8
108
3.828125
4
[]
no_license
# for ๋ฌธ์„ ์‚ฌ์šฉํ•ด 1๋ถ€ํ„ฐ 100๊นŒ์ง€์˜ ์ˆซ์ž๋ฅผ ์ถœ๋ ฅํ•ด ๋ณด์ž. for i in range(1,101): print(i)
true
2a211e24398f99dfb9fc9e05fcb11c5b2b2044e5
Python
LKhushlani/leetcode
/arrays/minRewards.py
UTF-8
490
3.125
3
[]
no_license
def minRewards(scores): # Write your code here. rewards = [1 for _ in scores] for i in range(1, len(scores)): if scores[i] > scores[i-1]: rewards[i] = rewards[i-1] +1 for i in reversed(range(len(scores)-1)): print(i) print("s", scores[i], 's i+1',scores[i+1]) ...
true
e706bd294cccbe165fa1e4c38dfb83581886be98
Python
A01377246/Mision-03
/Rendimiento de un auto.py
UTF-8
2,109
4.375
4
[]
no_license
# Autor: Humberto Carrillo Gรณmez """Descripciรณn: Este programa calcula el rendimiento de un automรณvil en kilometros/litro y millas/galรณn e imprime los litros de gasolina que necesitarรก para recorrer cierto kilometraje"}""" #Calcula el rendimiento en km por litro utlizando los km recorridos y los litros de gasolina...
true
808d62eccb8831cdc0adda51e50b7d5612d37c6a
Python
JustinLee32/cai_niao_shua_ti
/10.5 ๅŒๅ‘จ่ต›/5081 ๆญฅ่ฟ›ๆ•ฐ.py
UTF-8
2,714
3.84375
4
[]
no_license
# ๅฆ‚ๆžœไธ€ไธชๆ•ดๆ•ฐไธŠ็š„ๆฏไธ€ไฝๆ•ฐๅญ—ไธŽๅ…ถ็›ธ้‚ปไฝไธŠ็š„ๆ•ฐๅญ—็š„็ปๅฏนๅทฎ้ƒฝๆ˜ฏ # 1๏ผŒ้‚ฃไนˆ่ฟ™ไธชๆ•ฐๅฐฑๆ˜ฏไธ€ไธชใ€Œๆญฅ่ฟ›ๆ•ฐใ€ใ€‚ # # ไพ‹ๅฆ‚๏ผŒ321 # ๆ˜ฏไธ€ไธชๆญฅ่ฟ›ๆ•ฐ๏ผŒ่€Œ # 421 # ไธๆ˜ฏใ€‚ # # ็ป™ไฝ ไธคไธชๆ•ดๆ•ฐ๏ผŒlow # ๅ’Œ # high๏ผŒ่ฏทไฝ ๆ‰พๅ‡บๅœจ[low, high] # ่Œƒๅ›ดๅ†…็š„ๆ‰€ๆœ‰ๆญฅ่ฟ›ๆ•ฐ๏ผŒๅนถ่ฟ”ๅ›ž # ๆŽ’ๅบๅŽ # ็š„็ป“ๆžœใ€‚ # # # # ็คบไพ‹๏ผš # # ่พ“ๅ…ฅ๏ผšlow = 0, high = 21 # ่พ“ๅ‡บ๏ผš[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10_7 ๅ‘จ่ต›, 12, 21] # # ๆ็คบ๏ผš # # 0 <= low <= high <= 2 * 10_7 ๅ‘จ่ต› ^ 9 from typing import List...
true
e802da45ce8362f08f7f6ef30e285e265ec2b698
Python
Jake-Len/Rock-Paper-Scissors
/Rock Paper Scissors/HardMode.py
UTF-8
2,785
3.859375
4
[]
no_license
#hard game mode import random past_player_choices = [] #storing past player choices past_computer_choices = [] #storing past computer choices #in hard mode, past choices are stored and evaluated to check for biases toward a certain choice. #the computer checks to see if the player uses one choice more than others and...
true
06fe639c9a071885fa0427bf284b718e3299f22e
Python
VenomzGaming/Sp-Battle-royal
/addons/source-python/plugins/battle_royal/menus/backpack.py
UTF-8
3,681
2.5625
3
[]
no_license
## IMPORTS from menus import SimpleMenu from menus import SimpleOption from menus import Text from messages import SayText2 from players.entity import Player from ..entity.battleroyal import _battle_royal from ..entity.player import Player as BrPlayer from ..items.item import Item __all__ = ( 'backpack_menu', ) ...
true
fd48252dd1bd8bd4ebf13673d108be84debba95a
Python
RibinMTC/DockerConfigShare
/unsup_features.py
UTF-8
5,362
2.953125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt from pathlib import Path import os import cv2 import numpy as np from pyemd import emd from PIL import Image import skimage.color from collections import defaultdict import pandas as pd def image_colorfulness(image): '''calculate color...
true
8e96bfdf7fe4f90770b880b5f383066e04f9cf2b
Python
realpython/python-basics-exercises
/ch18-graphical-user-interfaces/4-introduction-to-tkinter.py
UTF-8
375
3.546875
4
[]
no_license
# 18.4 - Introduction to Tkinter # Review exercises import tkinter as tk # Exercise 1 window = tk.Tk() label = tk.Label(text="GUIs are great!") label.pack() window.mainloop() # Exercise 2 window = tk.Tk() label = tk.Label(text="Python rocks!") label.pack() window.mainloop() # Exercise 3 window = tk.Tk() label = t...
true
d6878792526feac48e9f32d513f860ad13201c2e
Python
swong225/advent-of-code-2017
/shaw/15/sol.py
UTF-8
752
3.21875
3
[ "MIT" ]
permissive
INPUT_A = 703 INPUT_B = 516 a = INPUT_A b = INPUT_B count = 0 for i in range(40000000): a *= 16807 b *= 48271 a %= 2147483647 b %= 2147483647 if (a & 0xFFFF) == (b & 0xFFFF): count += 1 print('part 1', count) a = INPUT_A b = INPUT_B count = 0 comps = 0 change_a = True change_b = True...
true
348d6688e2b3089c3eeafa05db43630e1f02eb19
Python
LeonardoPereirajr/Curso_em_video_Python
/des085b.py
UTF-8
389
4.09375
4
[ "MIT" ]
permissive
numeros=[[], []] valor = 0 for c in range(1,8): valor= int(input(f' Digite o {c}ยบ valor: ')) if valor % 2 == 0: numeros[0].append(valor) if valor % 2 == 1: numeros[1].append(valor) print(numeros) numeros[0].sort() numeros[1].sort() print(f' Os valores pares digitados foram {numeros[0]}...
true
d503bab219b920e09d856a95dc85eb08ddcc2a39
Python
Aasthaengg/IBMdataset
/Python_codes/p02677/s799552735.py
UTF-8
159
3.109375
3
[]
no_license
import math a,b,h,m=map(int,input().split()) A=30*h+0.5*m B=6*m point=abs(A-B) C=math.cos(math.radians(min(point,360-point))) print((a**2+b**2-2*a*b*C)**0.5)
true
7d630101fede3bcf73adc416774af83eb87b7f87
Python
dsendik/Sudokunator
/driver_3.py
UTF-8
14,591
3.40625
3
[]
no_license
#!/usr/bin/env python #coding:utf-8 import random import time as time import os """ Each sudoku board is represented as a dictionary with string keys and int values. e.g. my_board['A1'] = 8 """ ROW = "ABCDEFGHI" COL = "123456789" myRowDict = [] myColDict = [] myBoxDict = [] traversal = [] mylist = ['A1', 'A2', 'A3', ...
true
274ca25126950a72661248de9b5050b3005b9978
Python
akhilpy/python-practice
/duplicate_ele.py
UTF-8
519
4.125
4
[]
no_license
""" This example remove the duplicate element from the list """ list_a=[1,2,3,4,4,5,7,2,5,6] #solution 1 b = list(set(list_a)) # convert list into set, and it remove the duplicate elements print(b) #Solution 2 new_list=[] for i in list_a: if i not in new_list: new_list.append(i) print(new_list) #s...
true
4e879a773a3dab8a31ed4370fdf7080955fa39f5
Python
weifanhaha/digit-uda
/dann/train.py
UTF-8
6,731
2.515625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import torch import torch.nn as nn import numpy as np from tqdm import tqdm from torch import optim from torch.utils.data import DataLoader import copy from models import DANN from image_dataset import ImageDataset # In[2]: ########## Arguments ########## num_epoch...
true
f7c855b374b7e2b838f163c8e5916d8b0b051473
Python
obtusedev/xkcd-web-scraper
/main.py
UTF-8
1,492
3.078125
3
[]
no_license
import os import requests from bs4 import BeautifulSoup from db import insert_comic_data num = 1 while num < 6: print(f"Scraping...{num}") url = f"https://xkcd.com/{num}/" res = requests.get(url) content = res.text soup = BeautifulSoup(content, "html.parser") comic_title = soup....
true
ee779c7f6affcb7acfbe119a1ceb13da2b2b2c69
Python
kokoa-naverAIboostcamp/algorithm
/Algorithm/solution/BOJ5052.py
UTF-8
1,925
3.8125
4
[]
no_license
### ๋ฌด์ง€ ### ## ํ’€์ด 1 -> 1์ค‘ for ๋ฌธ import sys t = int(sys.stdin.readline()) answer = "" while t > 0: t -= 1 n = int(sys.stdin.readline()) phone_book = [sys.stdin.readline()[:-1] for _ in range(n)] phone_book.sort() ans = "YES\n" for s1, s2 in zip(phone_book[:-1], phone_book[1:]): ...
true
c3fbd3ef8adcab2ee8e760633ffa28af1b9fc3f7
Python
hemanthponnada/ML-Practice
/ts.py
UTF-8
1,590
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 25 16:23:32 2019 @author: saimohan """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import datetime from pandas import Series %matplotlib inline import warnings train=pd.read_csv("Train_SU63ISt.csv") test=pd.read_c...
true
8b639991ec2bf0dc765073149aec3e168462c49d
Python
dhimasn/fuzzy-expert
/fuzzy_expert/mf.py
UTF-8
11,848
3.40625
3
[ "MIT" ]
permissive
""" Membership Functions ============================================================================== Functions in this module returns a standard membership function specificaion as a list of points (x_i, u_i). """ from __future__ import annotations from typing import Tuple, List import numpy as np ## pag. 27, Fu...
true
132c31dd5e3e2fb30af1996e564a519cefad1b8f
Python
RaghuMylapilli/Script-Evaluation-Assistant
/files/Prime_Number.py
UTF-8
235
3.6875
4
[ "MIT" ]
permissive
num=int(input("enter a number :")) if num>1: for i in range(2,num/2): if num%i==0: print(num,"is not a prime number") break else: print(num,"is a prime number") else: print(num,"is not a prime number")
true
b1594311efe8c85c0a3e1d52f2ae10e649d39c67
Python
alexandersoen/influencemap
/webapp/webapp/graph.py
UTF-8
2,381
2.53125
3
[]
no_license
import os, sys, json import numpy as np from operator import itemgetter BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PYTHON_DIR = os.path.join(os.path.dirname(BASE_DIR), 'python') sys.path.insert(0, PYTHON_DIR) def processdata(gtype, egoG): center_node = egoG.graph['ego'] # Radius o...
true
0dd23c900503b291ea9bcc0e97cf0e36beda6cf4
Python
LoadingByte/sts-inquiry
/sts_inquiry/structs.py
UTF-8
2,721
2.609375
3
[ "MIT" ]
permissive
from __future__ import annotations from dataclasses import dataclass from datetime import datetime from typing import Optional, List, FrozenSet from markupsafe import Markup @dataclass(frozen=True) class World: superregions: List[SuperRegion] regions: List[Region] stws: List[Stw] edges: List[Edge] ...
true
feab659673be3a4fcf12e8092f2b8ce76f31e672
Python
chasmani/grinstead_and_snell_introduction_to_probability_solutions
/1_2_1_spinner.py
UTF-8
1,158
3.578125
4
[]
no_license
import random import numpy as np import matplotlib.pyplot as plt def spin(): return random.random() def run_experiment(): runs = 10000 semicircle_landed = 0 third_circle_landed = 0 sextant_landed = 0 for i in range(runs): result = spin() if 0 <= result < 0.5: semicircle_landed += 1 elif 0.5 <= r...
true
e4c02822b68e211747dbeed40c2c4e077f42ccce
Python
prashantkumar99/Hexapawn
/Human.py
UTF-8
551
3.59375
4
[]
no_license
from Player import Player class Human(Player): def __init__(self, name): Player.__init__(self, name) def readMoveCoordinates(self): print("Playing:", self.name) print("Select Pawn:-") pawn = self.readCoordinates() print("Select Position to move to:-") t...
true
d4acd0573132db11761631eb70d341e1b6dfc318
Python
andreaippolito/computationalFinanceAssignment
/exercise3.py
UTF-8
2,490
3.234375
3
[]
no_license
import brownian_paths as bp import numpy as np import matplotlib.pyplot as plt def option_maturity_value(stock_price_1, stock_price_2, strike_price, discount_factor): euler_option_value = np.maximum(1/2 * stock_price_1 - 1/2 * stock_price_2, strike_price)*discount_factor number_of_processes = np.size(euler_op...
true
0bb3b799ad16d2545ceae8d25d11b3baea251741
Python
ishitsuka-hikaru/neural-wrappers
/neural_wrappers/utilities/running_mean.py
UTF-8
2,512
2.765625
3
[ "WTFPL" ]
permissive
import numpy as np from typing import Union, Optional from .utils import NWNumber, NWSequence, NWDict class RunningMeanNumber: def __init__(self, initValue : NWNumber): self.value = initValue self.count = 0 def update(self, value : NWNumber, count : Optional[int] = None): if not count: count = 1 self.val...
true
a8f1763d77b4e1475cfad5ad5a0b418f89ea2887
Python
sarim/qmltest
/main.py
UTF-8
1,655
2.609375
3
[]
no_license
#!/usr/bin/env python import sys from PySide import QtCore, QtGui, QtDeclarative class GittuCM( QtCore.QObject ): def __init__( self ): QtCore.QObject.__init__(self) @QtCore.Slot('QString') def printText(self,text): print text @QtCore.Slot() def quitMe(self): sys.exit() ...
true
c2f68f4c5b5ce85928a5c53951d50e4a6ed4819b
Python
grungi-ankhfire/ebenezer
/ebenezer/ui/menu.py
UTF-8
1,092
2.953125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Copyright (c) 2012 Bastien Gorissen # Licensed under the MIT license # See LICENSE file for licensing details import os class Menu: def __init__(self, app): self.app = app self.header = [] self.contents = [] self.footer = [] self.prompt = "" self.answers = {} ...
true
fe737444c58539393a630c921d93555104391b3a
Python
jacegem/scrapy-news-crawling
/newscrawling/spiders/newsSpider.py
UTF-8
3,033
2.796875
3
[]
no_license
import scrapy import time import csv from newscrawling.items import NewscrawlingItem class NewsUrlSpider(scrapy.Spider): name = "newsUrlCrawler" def start_requests(self): print("start_requests") press = [8, 190, 200] # 8: ์ค‘์•™ pageNum = 2 date = [20180501] # http://m...
true
ba568158f19d5d71d88f4d7cabd7c8d9f7cd9322
Python
nicolaslazzos/machine-learning-a-z
/Part 8 - Deep Learning/Unsupervised/2. Boltzmann Machines/restricted_boltzmann_machine.py
UTF-8
14,252
3.578125
4
[]
no_license
# BOLTZMANN MACHINES (BM) # Todos los tipos de redes vistos anteriormente tienen en comun que son modelos dirigidos, es decir, hay una direcccion # en la que el modelo funciona. En las Boltzmann Machines, no hay direccionalidad, son como un grafo conexo completo y # no dirigido. # Las BM, no tienen una capa de salida...
true
74037de7e9306289f0e67a4a3c56b7e75e750abc
Python
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/arc076/A/4253881.py
UTF-8
239
2.703125
3
[]
no_license
N,M=map(int,input().split()) ans=1 if(abs(N-M)<2) else 0 n=max(N,M) fa=0 for i in range(1,n+1): fa=ans ans=ans*i%(10**9+7) if(N==M): ans=(ans*ans*2)%(10**9+7) else: ans=((ans)*fa)%(10**9+7) print(ans)
true
bd620c3b238af64f5845487a4e539132c446ded4
Python
ChensonVan/orm.py
/test_orm.py
UTF-8
384
2.5625
3
[]
no_license
import unittest import orm class UtilTests(unittest.TestCase): def test_camel_to_under(self): t = 'TestClassName' r = 'test_class_name' self.assertEqual(r, orm.camel_to_underscores(t)) def test_under_to_under(self): t = 'test_class_name' self.assertEqual(t, orm.camel_to_...
true
33e35247aace9d41bb20957c46a27df6c2668772
Python
wolfsinem/AnalyticalComputing
/rechtewegSnelheden.py
UTF-8
1,042
2.765625
3
[]
no_license
import csv import numpy as np import matplotlib.pyplot as plt with open('snelheden.csv', 'r') as csvFile: posities = csv.reader(csvFile, delimiter=';') tijd = [] beginPunt = [] auto1 = [] auto2 = [] auto3 = [] i=0 for row in posities: if i == 0: beginPunt = [float(ro...
true
1c566cefb0a6e0d1bb139ece76cbf2dd7ad4c795
Python
jinnaiyuu/search-ja
/python/greedy_best_first_search.py
UTF-8
359
2.90625
3
[ "MIT" ]
permissive
from graph_search import GraphSearch def GreedyBestFirstSearch(problem): h = lambda node: problem.heuristic(node.state) return GraphSearch(problem, h) if __name__ == "__main__": from grid_pathfinding import GridPathfinding problem = GridPathfinding() path = GreedyBestFirstSearch(problem) fo...
true
6173f8e24063c6bcfa3f2cbcc3c593217b4507bb
Python
havealot/Python-for-DM-ITI-Tasks
/task3.py
UTF-8
1,695
2.671875
3
[]
no_license
import sqlalchemy as db import pandas as pd import numpy as np import json from keras.models import model_from_json # create connection with the database con = db.create_engine('postgresql://postgres:root@localhost/ammardb') #First run only to load table the unscored table.. #df = pd.read_csv("pima-indians-diabetes...
true
43ea9b83e272b77facda4d4f3c3be6caccdfb292
Python
jacokyle/MTH325_Homework
/Programming Set 1.py
UTF-8
1,807
4.53125
5
[]
no_license
# Kyle Jacobson # Professor Taylor # MTH 325 - 02 # 24 February 2020 # The following function takes a graph represented by a # dictionary as input and outputs the degree sequence of # the graph as a list (in non-increasing order). def degree_sequence(dict): # The initiliazed list for the function. seq = [] ...
true
f78a4897abf662b5faf605065758cd7b7067fbfd
Python
parthpankajtiwary/robotics-ai-final
/head_controller/scripts/headController.py
UTF-8
5,356
2.5625
3
[]
no_license
#!/usr/bin/env python import roslib roslib.load_manifest('head_controller') import rospy import actionlib from std_msgs.msg import Float64 import trajectory_msgs.msg import control_msgs.msg from trajectory_msgs.msg import JointTrajectoryPoint from control_msgs.msg import JointTrajectoryAction, JointTrajectoryGoal, ...
true
af5b7e16d5fe6b87363b775758541463ff8e758d
Python
CMS28/cms28.github.io
/practice/Yeet/diamond.py
UTF-8
298
3.546875
4
[]
no_license
for i in range(9): for j in range(9-i): print(" ", end="") for j in range(9-i,9+i+1): print("*", end="") print() for i in range(9,-1,-1): for j in range(9-i): print(" ", end="") for j in range(9-i,9+i+1): print("*", end="") print()
true
8f18225fc0b894949328d88e0d08105f8b7cbb15
Python
aaanneli/women-in-black
/bullet.py
UTF-8
4,391
3.015625
3
[]
no_license
from __future__ import print_function, division import pygame import random import math from constant import * def radians_to_degrees(radians): return (radians / math.pi) * 180.0 class Bullet(pygame.sprite.Sprite): side = 7 # small side of bullet rectangle vel = 250 # velocity maxlifetime = 10.0 # ...
true
b358a942a0bae493bd644d50ad68f4fa7e764e0b
Python
ssong38/PortfolioWeb
/test/testParse.py
UTF-8
6,611
2.859375
3
[]
no_license
import unittest from flask import Flask from flask import request, redirect, url_for, render_template import xml.etree.ElementTree as ET # This dictionary will take all of file information according to version dicttest = {} # This dictionary will take all of version message according to version versionmessage = {} # T...
true
ae19a792764a5ee2a3840ad07da1209cce544887
Python
duxiaotxt/test
/UDPtest.py
UTF-8
1,062
2.78125
3
[]
no_license
# encoding : utf-8 from socket import * PORT = 5050 def main(): a = ["0","0","0","0","0","0","0"] while True: menuswitch = input("์ˆ˜์ •ํ™”๋ฉด์œผ๋กœ ๊ฐ€๋ ค๋ฉด Eํ‚ค : ") if (menuswitch == "e" or menuswitch == "E"): while True: getnum = input('1.์ˆ˜๋ถ„์ƒํƒœ/2.๋ถ€๋™์•ก/3.๋ฐง๋ฐ๋ฆฌ/4.์—”์ง„์ˆ˜์˜จ/5.์—”...
true
1c04c17c354963dbb65a7887ae2ea7782319a536
Python
AliceHincu/FP-Assignment11
/GUI/GUI.py
UTF-8
19,166
3.140625
3
[]
no_license
# ---- IMPORT ZONE ---- import pygame from win32api import GetSystemMetrics from start_game.start import Game from start_game.minimax import EasyMode, MediumMode, HardMode import math import numpy as np # ---- CLASS ZONE ---- class GuiElements(Game): def __init__(self): super().__init__() self._DI...
true
2a13253d4d815d9062cf17f973aa55d61a76821b
Python
edjuaro/HiC_dev
/testing.py
UTF-8
414
2.53125
3
[]
no_license
import pandas as pd import sklearn.cluster as skl # from sklearn.cluster import AgglomerativeClustering from scipy.cluster.hierarchy import fclusterdata as cluster df = pd.read_csv("test_dataset.gct", sep='\t', skiprows=2) # print(df) df.drop(['Name', 'Description'], axis=1, inplace=True) df = df.T print(df.shape) # p...
true
18e5d05b25d6b4b00abb36306b9898f169ef7fb2
Python
syedibrahimhussain/Eagle-Eye
/searchnp.py
UTF-8
1,685
2.828125
3
[]
no_license
import mysql.connector def mysql_connect(): mydb = mysql.connector.connect(host="localhost", user="root", passwd="root786") if (mydb): return 1 else: return -1 def mysql_cdb(): mydb = mysql.connector.connect(host="localhost", user="root", passwd="root786") my_cursor=mydb.cursor() my_cursor.exe...
true
fad68c7a60c17880819b11d3b6ed8524c95763cb
Python
Desperado1/mini-projects
/practice problems(Data Structures)/NoOfWaysToMakeChange.py
UTF-8
385
3.59375
4
[]
no_license
"""DYNAMIC PROGRAMMING a given array representing coin denominations and a non negative target amount function returns ways to make change for that target amount. """ def numberOfWaysToMakeChange(n, denoms): # Write your code here. d = [0 for i in range(n + 1)] d[0] = 1 for denom in denoms: for i in range(1, ...
true
abbdbda70f49157e6bc18e7357754da55f36e330
Python
Mariano92m/commonTecInfo2016
/Ejercicios Clases/Complejo/Servicio.py
UTF-8
141
2.90625
3
[]
no_license
import os class Servicio: def __init__(self, tipo): self.tipo tipo def mostrarTipo(): print("El tipo de Servicio es %s" %(self.tipo))
true
c94e9d9adcf6771d505031a785763b5e3450c2b0
Python
Aasthaengg/IBMdataset
/Python_codes/p03723/s770560827.py
UTF-8
608
3.703125
4
[]
no_license
a, b, c = map(int, input().split()) # ๅฐ‘ใชใใจใ‚‚ไธ€ใคใ€ๅฅ‡ๆ•ฐใŒๅญ˜ๅœจใ™ใ‚‹ๅ ดๅˆ if a % 2 != 0 or b % 2 != 0 or c % 2 != 0: print(0) exit() # ๅ…จใฆๅถๆ•ฐใงใ€A=B=Cใฎๅ ดๅˆ if a == b and b == c: print(-1) exit() cnt = 0 while True: cnt += 1 next_a = b // 2 + c // 2 next_b = a // 2 + c // 2 next_c = a // 2 + b // 2 a = nex...
true
a6eaa666233ebe13d009f167a549c49ce836fb35
Python
elguneminov/Python-2021-Complete-Python-Bootcamp-Zero-Hero-Programming
/Exam_Control.py
UTF-8
655
4.5625
5
[]
no_license
""" Python Exception Handling Using try, except and finally statement""" def exam(first_exam, second_exam): if first_exam < 50 or second_exam < 50: raise Exception elif second_exam < 50 or first_exam > 50: raise Exception elif second_exam > 50 or first_exam < 50: raise Exc...
true
91ab170e5c999008a18f47659c6190dadbf217c2
Python
arikel/ariclient
/gui/guiButton.py
UTF-8
5,944
2.609375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf8 -*- import pygame import sys import math import re import string from guiFunctions import * from guiWidget import Widget from guiLabel import Label from guiFrame import Frame #----------------------------------------------------------------------- # Button #----------------------...
true
b7e6ae69c26406badb16e126d10c8a950cd1a83f
Python
Zhen-hui/BioinformaticsProgramming
/Python3Scripts/parse_go_terms.py
UTF-8
1,937
3.03125
3
[]
no_license
''' Created on Oct 30, 2018 @author: cathytrinh ''' import re import os # define a class that will contain the necessary attribute values of a single GO term record. class GO_attributes(): def __init__(self, term): ID_pattern = re.compile(r"^id:\s+(GO:[0-9]+)", re.M) name_pattern ...
true
a7ca24e856d7b2e9bbcb2029fa15b38f3363b424
Python
AnotherdayBeaux/Blind_Ptychography_GUI
/blind_ptycho_fun.py
UTF-8
18,160
2.515625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 19 02:00:39 2018 @author: Zheqing Zhang email: zheqing@math.ucdavis.edu Oversampled ptycho-fft/ifft function + any necessary function required by blind_ptycho_fun.py """ import numpy as np import matplotlib.pyplot as plt import os from scipy.spars...
true
b3ba1fbacd74cc9f4c2c445cc5bc4cdd2f01ee7a
Python
cshintov/python
/anand-python/chapter2/ex25map.py
UTF-8
257
3.015625
3
[]
no_license
def my_fun(item): return item+item def my_map(func,seq): list_c=[my_fun(item) for item in seq] return list_c print my_map(my_fun,['a','b','c','d']) print map(my_fun,['a','b','c','d']) print my_map(my_fun,[1,'b',3,'d']) print map(my_fun,[1,'b',3,'d'])
true
d2f752c33581581298c3ec1c8285a4a5de340fad
Python
mahvash-siavashpour/LinearAlgebra
/LUFactorization/substitution.py
UTF-8
1,875
2.953125
3
[]
no_license
import numpy def forward_substitution(matrix): n = len(matrix[:, 0]) m = len(matrix[0, :]) for i in range(n): # find a staring row with pivot position if matrix[i][i] == 0: for j in range(i + 1, n): if matrix[j][0] != 0: matrix[[0, j]] = matr...
true
62c1f076a060b3346514f03c731b52dbff957843
Python
MDCGP105-1718/portfolio-err0rzzz
/Semester_1/Week04/ex10.py
UTF-8
397
4.15625
4
[]
no_license
##function definition testing ## x = 1 def f_fizzbuzz(x): """ checks if number is divisible by both 3 and 5 outputs fizzbuzz if it is """ if x %3 == 0: if x %5 == 0: print ("fizzbuzz") else: print ("Fizz") elif x %5 == 0: print ("Buzz") else: ...
true
34d0fc44db6e511632b635aa394ba1c7b7a4a3f0
Python
malannpren/geog5092-lab5
/lab5functions.py
UTF-8
2,396
3.375
3
[]
no_license
""" Author: Originally created by Galen Maclaurin, updated by Ricardo Oliveira Created: Created on 3.15.16, updated on 10.17.19 Purpose: Helper functions to get started with Lab 5 """ import numpy as np def slopeAspect(dem, cs): """Calculates slope and aspect using the 3rd-order finite difference method Par...
true
c6c7198f7ca6be493b8f5085909f626969268898
Python
ref-humbold/AlgoLib_Python
/tests/maths/test_equation_system.py
UTF-8
1,869
3.46875
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """Tests: Structure of linear equations system """ import unittest from assertpy import assert_that from algolib.maths import Equation, EquationSystem, InfiniteSolutionsError, NoSolutionError class EquationSystemTest(unittest.TestCase): @staticmethod def test__solve__when_single_solu...
true
4a1564fa6818ef55ffe4729bfbecda4bc4dc00a2
Python
pdrylo/kubenvz
/commands/__init__.py
UTF-8
1,480
2.515625
3
[ "MIT" ]
permissive
import os from typing import Union from sys import exit from .list import list_local, list_remote from .install import install from .uninstall import uninstall from .use import use def locate_file(file: str) -> Union[str, bool]: dir: str = os.path.realpath('.') while dir: if os.path.exists(f"{dir}/...
true
d5dd7ed9e59390fb7eb07cb82dfd9db7959067cc
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_55/353.py
UTF-8
1,921
2.59375
3
[]
no_license
import sys def ride(q,k): t=0 i=0 while (i<len(q)) and (t+q[i]<=k): t+=q[i] i+=1 return i,t,q[i:]+q[0:i] def runride(R,k,N,q): ringfound=0 r=0 total=0 historic_indexes=[] historic_vals=map(lambda x:([],[]),range(N)) cur_index=0 ring_index=0 ring_pair=() while ringfound==0 and r<R: ...
true
3a79742d4940d4506c6e4235b954640f6b5e9500
Python
OmarGP/Python1
/Secuencia_de_Ejercicio01/Ejercicio I.py
UTF-8
580
4.3125
4
[ "Apache-2.0" ]
permissive
#I1. Pregunta al operador 5 colores list_color = [] contador = 1 print(f" >>>>>Ingrese CINCO colores de uno a uno<<<<<") try: while(contador < 6): color = input("Dรญgame un color: \r\n") print("") list_color.append(color) contador += 1 finally: #I2. Muestra los colores ordenad...
true