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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
80fcab59b781e020312e6744c78eaf68b6a34737 | Python | TijanaSekaric/Midterm-Exam-2 | /task2.py | UTF-8 | 1,091 | 4 | 4 | [] | no_license | """
=================== TASK 2 ====================
* Name: Roll The Dice
*
* Write a script that will simulate rolling the
* dice. The script should fetch the number of times
* the dice should be "rolled" as user input.
* At the end, the script should print how many times
* each number appeared (1 - 6).
*
* Note: ... | true |
f16ca6e1602cb92ccd23dbd5f77057a4d309821b | Python | ugaldedr/Computational-Methods | /Homework 9/dru8068-hw09/monteArea.py | UTF-8 | 985 | 3.515625 | 4 | [] | no_license | """
Name: Dario Ugalde
MavID: 1001268068
Course: CSE 4345 Computational Methods
"""
import numpy as np
import matplotlib.pyplot as plt
from random import uniform
def estArea(samples) :
count = 0
plt.figure()
plt.xlim(0,11)
plt.ylim(0,10)
for i in range(0,samples):
x = getX()... | true |
a29ef70636b4daa1b98ab87b2e35218621de1dca | Python | jslijb/python3.x | /print_9x9_multiplication_table.py | UTF-8 | 728 | 3.453125 | 3 | [] | no_license | #coding = utf-8
import time
import datetime
i = 1
start_time=datetime.datetime.now()
while i < 100:
for j in range(1,i+1):
print('%d%s%d%s%d' %(i,'x',j,'=',i*j),end=' ')
print()
i = i + 1
end_time=datetime.datetime.now()
# print("start_time:",start_time)
# print("end_time:",end_time)
p... | true |
72f43f6b067b986ce0a920cc58b19dda24f44378 | Python | orbanjerbi/auto-sklearn | /autosklearn/pipeline/components/regression/xgradient_boosting.py | UTF-8 | 11,397 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerHyperparameter, UnParametrizedHyperparameter, \
CategoricalHyperparameter, Constant
from ConfigSpace.conditions import EqualsCondition
from auto... | true |
9b648500d959cfd12c53c80e1483d152c79c23b0 | Python | muneel/restful-distributed-lock-manager | /tests/bomb2.py | UTF-8 | 859 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import requests
PROCESS_POOL_SIZE = 10
REQUESTS = 10000
BASE_URL = "http://localhost:8888"
RESOURCE_NAME_PREFIX = "resource"
def f(process_number):
resource_name = "%s%i" % (RESOURCE_NAME_PREFIX, process_number)
raw_body = '{"tit... | true |
9f731f7ffa205328daaa963c14d72a1913a0a0ae | Python | psaux0/eulerproject | /p79.py | UTF-8 | 1,677 | 3.46875 | 3 | [] | no_license | #use a set to put the numbers after one number in, and compute the length
#of each set. The larger the length is, the higher position the number is.
f=open("keylog.txt",'r')
b=set()
c=set()
d=dict()
for line in f:
b.add(line.strip())
for i in ''.join(b):
c.add(i)
for i in c:
d[i]=set()
for i in b:
for j in xrange(l... | true |
e60bb5bd95ba95675b23f4c103c938d397814ea0 | Python | hanshou101/WebTesting | /selenium_doc/07_wait.py | UTF-8 | 2,021 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : 07_wait.py
@Time : 2019/8/21 14:01
@Author : Crisimple
@Github : https://crisimple.github.io/
@Contact : Crisimple@foxmail.com
@License : (C)Copyright 2017-2019, Micro-Circle
@Desc : None
"""
# from selenium import webdriver
# from se... | true |
3ebc8aa995df2142ff41b4f47e778ddcd72c590f | Python | wangyongk/scrapy_toturial | /Pythonproject/datafenxi/PCA.py | UTF-8 | 232 | 3.125 | 3 | [] | no_license | # encoding=utf-8
import jieba
sentence="我来到北京清华大学"
w1=jieba.cut(sentence,cut_all=True)
w2=jieba.cut(sentence,cut_all=False)
w3=jieba.cut(sentence)
print("/".join(w1))
print("/".join(w2))
print("/".join(w3)) | true |
ff8ec3ec4254d65906396c0437ab3b4d958cd915 | Python | aruniverse/cse3800 | /PA 1/hmm.py | UTF-8 | 8,575 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
# Author: Arun George
# Class: UConn, CSE 3800, Fall 2017
# Instructor: Yufeng Wu
# Description: Programming Assignment 1
import time
import numpy as np
import random
def main():
lengths = [300, 3000, 30000, 300000]
for lIndex, lVal in enumerate(lengths): #test for each sequence length
startT... | true |
93b4d765a35517a192063ba3f36a9dfda1bce996 | Python | SuperJohn/python_for_informatics | /week_4/assignment_4_john_houghton.py | UTF-8 | 787 | 3.640625 | 4 | [] | no_license | # use file romeo.txt
filename = raw_input('what is the name of the file? > ')
try:
my_file = open(filename)
except:
print filename , ' cannot be found.'
exit()
script_list = []
for line in my_file:
line_list = line.split()
# take the first line and split it
for word in line_list:
# chec... | true |
76e52a3b4af5e4f97276b6458a4f8d7e2347b291 | Python | mohamedirfan/spark | /Lab01.py | UTF-8 | 288 | 4.09375 | 4 | [
"Apache-2.0"
] | permissive |
#Python is a case sensitive language
print("Welcome to Python")
#single line comments
print("""Multi line comments """)
'''This is also a
multiline
comment.'''
#dynamic typing
a = 5
print(type(a))
a = "abc"
print(type(a))
#strongly type
b = 123
#c = a + b
#print(c) | true |
34e31b981f3d549cd5a4c36456cc39d3edd1d221 | Python | zuo785843091/speak_robot_win | /src/speak_robot/logging_config.py | UTF-8 | 708 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*
# 设置logging 格式和输出等级
import logging
#打印到文件
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-4s %(levelname)-8s %(message)s',
filename='myapp.log',
filemode='w') #DEBUG, INFO, WARNING, ERROR
#打印到终端
# 定义一个Handler打印INFO及以... | true |
3c4353ef99d6580f6499951b5a0d08f9831380f6 | Python | limherhuey/CS50ai | /Week 0/tictactoe/tictactoe.py | UTF-8 | 5,214 | 3.828125 | 4 | [] | no_license | """
Tic Tac Toe Player
"""
import math
from copy import deepcopy
X = "X"
O = "O"
EMPTY = None
def initial_state():
"""
Returns starting state of the board.
"""
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]]
def player(board):
"""
Return... | true |
a8e801b41f1ee976a586f325767393ed89b92c78 | Python | yangxiaoxiaoo/cs281sec09 | /experiment_1motifs.py | UTF-8 | 1,333 | 2.671875 | 3 | [] | no_license | #Experiment with real data to find supporting statistics
import os
def IS_line_meta(line):
if line[0].isdigit():
return False
else:
return True
def get_original_count(S):
#S = 3, 4, 5, 6
#for each name, number of blocks, get a number of motifs, and find those sharing nodes
subi... | true |
91c2a57b9d77c346a86766d80a6c3aa0969bb7ee | Python | gaw89/dash-flask-login | /usage_dash_flask_login.py | UTF-8 | 2,507 | 2.703125 | 3 | [
"MIT"
] | permissive | from dash import dcc, html
from dash.dash import Dash
import pandas as pd
import plotly.express as px
from flask import Flask, redirect, request, url_for
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
from dash_flask_login import FlaskLoginAuth
server = Flask(__n... | true |
a7ddb3b46ae43f1441edd7df01ba22a5387ecdbb | Python | ramboma/std-inv-report-v8 | /data_analysis/config_loader.py | UTF-8 | 790 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'config_loader.py'
__author__ = 'kuoren'
import data_analysis.read_excel_util as excelUtil
from data_cleansing.logging import *
logger = get_logger(__name__)
class ConfigLoader:
def __init__(self, config_path):
self.config_path = config_path
@propert... | true |
bb05208ba398404a1396645e346133a8b2f386dd | Python | springlustre/leetcode-execise-python | /execise1/19removeNthFromEnd.py | UTF-8 | 451 | 3.390625 | 3 | [] | no_license | def removeNthFromEnd(head,n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
"""
p1 = p2 = head
for _ in range(n):
p1 = p1.next
if not p1:#p1为空则n为length-1
return head.next
while p1.next:
p1 = p1.next
... | true |
8839241a07bb90ff11a6682aaad07ca50fbd7d46 | Python | uhhcaitie/Coding4NonCoders | /sample_assignments/vowel_replacer.py | UTF-8 | 743 | 4.03125 | 4 | [] | no_license | def changeVowels1(user_input, vowels):
user_input = list(user_input)
for index in range(0, len(user_input)):
if user_input[index].lower() in vowels:
user_input[index] = vowels[user_input[index].lower()]
return ("".join(user_input))
def changeVowels2(user_input, vowels):
temp_strin... | true |
a17bfadc068755c2b8ad984b7e4a616fceea90b3 | Python | noobira/useful_scripts | /vvs_rig_plugin.py | UTF-8 | 12,413 | 2.59375 | 3 | [] | no_license | import math
import maya.OpenMaya as om
import maya.OpenMayaMPx as ompx
rbfNodeName = "vvsRBFNode"
rampNodeName = "vvsRAMPNode"
rbfNodeId = om.MTypeId(0x00008)
rampNodeId = om.MTypeId(0x00009)
# store elem to array function
def store_to_array_by_index(array_data_handle, index, double_value):
try:
array_d... | true |
9aef4490b61b5353d4b46c8c78f1ccc2b4ab7996 | Python | dankoo97/EulerProjects1-50 | /Euler_36_DoubleBasePalindrome.py | UTF-8 | 832 | 4.21875 | 4 | [] | no_license | # The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
#
# Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
#
# (Please note that the palindromic number, in either base, may not include leading zeros.)
limit = 1000000
palindromic_nums = set() # ... | true |
f1628a1f5793e5d0b73ef390ffe04ada704b2796 | Python | htingwang/HandsOnAlgoDS | /LeetCode/0127.Word-Ladder/Word-Ladder.py | UTF-8 | 1,054 | 3.125 | 3 | [] | no_license | from collections import deque
class Solution(object):
def ladderLength(self, beginWord, endWord, wordList):
"""
:type beginWord: str
:type endWord: str
:type wordList: List[str]
:rtype: int
"""
queue = collections.deque()
queue.append(beginWord)
... | true |
b2901a1dbb0e8cc124ae22b35dba6ea8b7231eaa | Python | pasindu-gamarachchi/DineSafe_Infraction_Predictor | /Data/Yelp_Data_Extraction.py | UTF-8 | 2,484 | 2.53125 | 3 | [] | no_license | import numpy as np
import json
import os
import pandas as pd
from pandas.io.json import json_normalize
from datetime import datetime
import logging
import io
import boto3
runtime = datetime.now().strftime("%d_%m_%y_%H_%M_%S")
logfilename = "logfiles/test_yelp_extraction_" + runtime + ".log"
logging.basicConfig(form... | true |
f1be0681a798869b1d609e61f96cf72ab025bb36 | Python | tonyldo/brazilian-forecast.io | /brazilianforecast/current.py | UTF-8 | 2,453 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import xml.etree.ElementTree as ET
import requests
class BrazilianCurrentWeatherService():
conditions_reference = {
'pressure': 'pressao',
'temperature': 'temperatura',
'weather': 'tempo',
'weather_desc': 'tempo_desc',
'humidity': 'umidade',
'wind_dir': 'vento_dir'... | true |
2c2ca9a8c57af89b539ae3fdbbe141998138df0c | Python | pylangstudy/201706 | /25/00/2.py | UTF-8 | 407 | 3.015625 | 3 | [
"CC0-1.0"
] | permissive | import gzip
import bz2
import lzma
s = b'witch which has which witches wrist watch'
with open('2.txt', 'wb') as f: f.write(s)
with gzip.open('2.txt.gz', 'wb') as f: f.write(s)
with bz2.open('2.txt.bz2', 'wb') as f: f.write(s)
with lzma.open('2.txt.xz', 'wb') as f: f.write(s)
print('txt', len(s))
print('gz ', len(gzip... | true |
77267327e7908023841c773ccdcf0844bddcc717 | Python | tmoshole/python_projects | /my_python_projects/submission_005-toy-robot-2/robot.py | UTF-8 | 6,972 | 3.984375 | 4 | [] | no_license |
def robot_start():
"""This is the entry function, do not change"""
y = 0
x = 0
var = 1
num = 0
name = name_robot()
scommand = game_commands(name,y,var,x,num)
# help_command()
# move_forward(name,scommand,y)
#x = updating_x(scommand)
def name_robot():
"""Allowing the use... | true |
3a9ae115c763126645c153a2524360196eb37d5d | Python | B-Tran/CS122A-FinalProject | /FlaskServer/app.py | UTF-8 | 1,179 | 2.59375 | 3 | [] | no_license | from flask import Flask, render_template
from flask import Response
from flask import jsonify
from flask import json
from flask import make_response
#create app
app = Flask(__name__)
#global variable that contains the list of notifications
List_Data = ["","","",""]
#renders the home page for notifications
@app.route... | true |
18e4c9628e74ab9e666ecc55d43088d0f0f73fdc | Python | cmancone/mygrations | /mygrations/formats/mysql/file_reader/parsers/insert_values.py | UTF-8 | 739 | 2.640625 | 3 | [
"MIT"
] | permissive | from mygrations.core.parse.parser import Parser
class InsertValues(Parser):
has_comma = False
values = []
rules = [{
'type': 'literal',
'value': '('
}, {
'type': 'delimited',
'name': 'values',
'separator': ',',
'quote': "'"
}, {
'type': 'lite... | true |
0ba04371ee661e1fc5d962a60d653503d404860e | Python | NewerCN/MyStudy | /水仙花数计算.py | UTF-8 | 494 | 3.6875 | 4 | [] | no_license | def Test(*params,base = 3):
result = 0
for each in params:
result = result + each
result = result * base
print('the result is :',result)
##Test(1,2,3,4,base = 5)
def Narcissistic():
for each in range(100,1000):
temp = each
sum = 0
while temp:
sum = su... | true |
fd31328a17f88f1fc8ccf60cd5614c6611a68452 | Python | Valmarelox/elftoolsng | /elf/types/base/str/elf_string.py | UTF-8 | 1,029 | 2.859375 | 3 | [
"MIT"
] | permissive | from elf.types.base import ElfTypeBase
class ElfString(ElfTypeBase):
STRUCT = ''
parent: 'StringTableSection'
@classmethod
def size(cls):
raise NotImplementedError(f'{cls.__name__} Has no static length')
def __len__(self) -> int:
# Avoid using parent's data to avoid recursions
... | true |
27bab8b26d3bbed7c9b4282d4f3eca774b7d3aaf | Python | surenderthakran/test_suite | /keras_runner/trainers/concrete_compressive_strength/concrete_compressive_strength.py | UTF-8 | 1,031 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from keras.models import Sequential
from keras.layers import Dense
import pandas as pd
def run():
print('running...')
dir_path = os.path.dirname(os.path.realpath(__file__... | true |
b8837b60de05136a7f481db9069f7aab8ec0b437 | Python | axtrace/alisa_count_func | /parrot.py | UTF-8 | 2,020 | 2.890625 | 3 | [] | no_license | import re
def handler(event, context):
"""
Entry-point for Serverless Function.
:param event: request payload.
:param context: information about current execution context.
:return: response to be serialized as JSON.
"""
answer = 'Я могу досчитать до целого числа от 1 до 100. До какого числа... | true |
88de6744f1a048221dfacb78582db21020ba173b | Python | KhaledKhaliifa/graphTraversal | /Graph Traversal.py | UTF-8 | 55,890 | 2.578125 | 3 | [] | no_license | from PyQt5 import QtCore, QtGui, QtWidgets
import networkx as nx
import matplotlib.pyplot as plt
from PyQt5.QtWidgets import QMessageBox
class Ui_MainWindow(object):
#Declaring the directed and undirected graphs
g = nx.DiGraph()
ug = nx.Graph()
def setupUi(self, MainWindow):
MainW... | true |
ac99942ff8904ad7f623cedde25cf21a4231dc58 | Python | zwralbert/Python3.7-opencv4.01 | /18.py | UTF-8 | 1,351 | 2.890625 | 3 | [] | no_license | import cv2 as cv
import numpy as np
def edge_image(image):
blur = cv.GaussianBlur( image, (3, 3), 0 )
gray = cv.cvtColor( blur, cv.COLOR_RGB2GRAY )
# ret,binary=cv.threshold(gray,0,255,cv.THRESH_BINARY|cv.THRESH_OTSU)
xgrad = cv.Sobel( gray, cv.CV_16SC1, 1, 0 )
ygrad = cv.Sobel( gray, cv.... | true |
8db67114e885143eb99692e007d4228f46f9893f | Python | DangerouslyFurry/dutch-flash-cards | /main.py | UTF-8 | 6,551 | 2.890625 | 3 | [] | no_license | vocab = (
("that we discussed", "die wie hebben gesproken over"),
("dog", "hond"),
("attention", "aandacht"),
("supportive; encourageing", "aanmoedigend"),
("liability", "aansprakelijkeid"),
("tip (advice)", "aanwijzing"),
("earth", "aarde"),
("behind", "achter"),
("occasionally", "a... | true |
a1149862f68bbf96bdc39c203a72d5d7d7908dd5 | Python | zitmab16/BruteForceCI | /password.py | UTF-8 | 129 | 2.71875 | 3 | [] | no_license |
class Password:
def __init__(self,pwd):
self.pwd=pwd
def check(self,test):
return self.pwd == test
| true |
3d99222fb069e35ba285dd66e3134079db1462a0 | Python | Mstompan/2018FallProblems | /HW04/testgenerator/testgen.py | UTF-8 | 2,091 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | '''This program randomly assigns the center of
each cluster within (-s, s) for each dimension.
The clusters are distributed within (-sm, sm).
Then, the points of each cluster are within (-span, span) of the center.
If the points are truly random, span is as large 4s (allowing the clusters to overlap).
If overlaping is ... | true |
255fc3102d2075115469d0b14cc5437020a9f246 | Python | chaneyn/neurotheta | /neurotheta/water_retention.py | UTF-8 | 634 | 2.65625 | 3 | [] | no_license | import numpy as np
def brooks_corey(h,parameters):
#Define the parameters
hb = parameters['hb']
theta_r = parameters['theta_r']
theta_s = parameters['theta_s']
l = parameters['lambda']
#Compute the volumetric water content
theta = np.zeros(h.size)
m = h >= hb
theta[m==1] = theta_r + (theta_s - theta_r)*(h[... | true |
b1920825b9a07d1ae0f896739ac5d98f29f6d458 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/3473.py | UTF-8 | 837 | 3.3125 | 3 | [] | no_license | # Read in file
f = open('A-small-attempt1.in', 'r')
f2 = open('output.txt', 'w+')
N = int(f.readline())
# Loop through cases
for i in range(N):
k1 = int(f.readline())
# Read in first input
u1 = ""
for j in range(4):
tmp = f.readline()
if (j+1 == k1): u1 = tmp.split()
k2... | true |
840237a13a481a22937ab26e1f964c8b7f21bfcf | Python | tpotjj/Python | /DataStructuresAndAlgo/SortAlgo/BubbleSort/BubbleSort.py | UTF-8 | 332 | 3.640625 | 4 | [] | no_license | def bubbleSort(customList):
for i in range(len(customList)-1):
for j in range(len(customList)-i-1):
if customList[j] > customList[j+1]:
customList[j], customList[j+1] = customList[j+1], customList[j]
print(customList)
BasicList = [2, 6, 4, 8, 1, 3]
print(BasicList)
bubbleSor... | true |
52c1e0d1768fb958d38524153e74865caee94d79 | Python | Otumian-empire/complete-web-app | /12-python/proj.py | UTF-8 | 2,088 | 4 | 4 | [] | no_license | # mastermind board game implementation in python
# adding my own tweeks, using numbers instead of colors
import random
# number of times to play must be even between 2 to 12 rounds
while True:
try:
rounds = int(input("Enter number of rounds (Even): "))
if rounds >= 2 and rounds <= 12 and rounds % ... | true |
2e21fbcfe6c9c42ef1bcee1fbca55bd5ea750d29 | Python | zakkudata/python-automation-course | /module_0_basics/bucles.py | UTF-8 | 924 | 4.9375 | 5 | [] | no_license | """
Escribir un programa que pida al usuario un número entero positivo y muestre por pantalla la cuenta atrás desde ese número hasta cero separados por comas.
"""
try:
n = abs(int(input("Introduce un número entero positivo: ")))
except:
print("El número no es entero positivo.")
output = ""
for i in range(n, -... | true |
18acec15525211400692e37363f0d78f32683595 | Python | trongleeIT19/proxy_server | /proxy_server.py | UTF-8 | 3,087 | 2.5625 | 3 | [] | no_license | import socket
import threading
import tkinter as tk
from tkinter import messagebox
import os
import tqdm
BUFFER_SIZE = 4096
file_index="index.html"
file_css="style.css"
index_size=os.path.getsize(file_index)
css_size=os.path.getsize(file_css)
def getFile(a):
#Lay file blacklist.conf
f=open(... | true |
3f4da2bee42357f83afe496b62e330f8c1f9773d | Python | amir78729/algorithm-design-course | /2/9731096_HW2_DivideAndConquer.py | UTF-8 | 2,121 | 3.125 | 3 | [] | no_license | import math
import copy
import csv
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
def distance_between_2_points(p1, p2):
return math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y))
def brute_force(A, n):
min = math.inf
for i in range(0, n - 1):
for j ... | true |
92900000dcb49ed6251b2db2c12bc540f1523f95 | Python | emmanuel-bob-ma-joey/dmoj-problems | /golf.py | UTF-8 | 563 | 3.375 | 3 | [] | no_license | import sys
hole = int(sys.stdin.readline())
club = int(sys.stdin.readline())
clubList = []
for i in range(club):
poop = int(input())
clubList.append(poop)
minClub = [9999]*(hole+ 1)
minClub[0] = 0
for i in range(1,len(minClub)):
for x in clubList:
if i - x >= 0:
temp = (minClub[i - x]+... | true |
577517a70cf8b30d11287dc3267b970b8f44e8c1 | Python | romilly/fm2md | /strip.py | UTF-8 | 466 | 2.75 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python
import codecs
import sys
# Horrid fix because markdown2 does not respect formatting in code :(
def tidy(text):
return text.replace(u"\u00A0", " ").replace("$%", "<strong>").replace('%$','</strong>')
if __name__ == '__main__':
filename = sys.argv[1]
with codecs.open(filename, encoding='... | true |
41baf2dcac9f302f905c9edd4dba9b56f8e7b4aa | Python | SravanthiSinha/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/0-square_matrix_simple.py | UTF-8 | 108 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python3
def square_matrix_simple(matrix=[]):
return ([[x*x for x in row] for row in matrix])
| true |
2735cf668de2ccfb26e7a780372096255e82f7f5 | Python | kaushik-pandey/prime-100-days-of-code | /code/day-8/largest_product_pair.py | UTF-8 | 534 | 3.703125 | 4 | [] | no_license | size = int(input("Enter no. of items you want to add: "))
array = []
for n in range(size):
m = n + 1
array.insert(n, int(input("Enter item no. %d: " % m)))
max_val = 0
pair = []
for n in range(size-1):
for m in range(n+1, size):
val = array[n] * array[m]
if val > max_val:
max_val... | true |
f149d4b0c1ccb3ecf764f7c154628bcd37e4d9a6 | Python | semin1012/03.Algorithm | /hw_07_2020182032_2.py | UTF-8 | 608 | 3.5625 | 4 | [] | no_license | # Merge Sort #1
from unsorted import numbers
sublist = numbers[:300000]
def mergeSort(list):
size = len(list)
if size <= 1: return list
mid = size // 2
left = mergeSort(list[:mid])
right = mergeSort(list[mid:])
merged = merge(left, right)
# print(merged)
return merged
def merge(list1, list2):
merged = []
... | true |
aa15b2893507cb24345109c4a9e0d9244058ed47 | Python | BUEC500C1/twitter-summarizer-rest-service-rachidtt | /Tests.py | UTF-8 | 803 | 2.953125 | 3 | [] | no_license | import sys
from twittervideo import *
import unittest
#These tests pass when ran with a proper keys file. Hardcoded print statement to pass github actions
class Tests(unittest.TestCase):
def test_twitter_clientexists(self):
if path.exists('keys'):
user='elonmusk' #exists
tw1 = TwitterClient()
###Testing... | true |
5083c0f3e50df49b61d4c04edec04a57a33640a6 | Python | hissue/Python | /baekjoon/L14_정렬/2750.py | UTF-8 | 650 | 3.859375 | 4 | [] | no_license | '''
문제
N개의 수가 주어졌을 때, 이를 오름차순으로 정렬하는 프로그램을 작성하시오.
입력
첫째 줄에 수의 개수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄부터 N개의 줄에는
숫자가 주어진다. 이 수는 절댓값이 1,000보다 작거나 같은 정수이다. 수는 중복되지
않는다.
출력
첫째 줄부터 N개의 줄에 오름차순으로 정렬한 결과를 한 줄에 하나씩 출력한다.
예제 입력 1
5
5
2
3
4
1
예제 출력 1
1
2
3
4
5
'''
N=int(input())
number=[]
for i in range(N):
number.append(int(inpu... | true |
0881b59c8c8c3b3c6132c8c9f320016d553ce53e | Python | syslabcomarchive/slc.scripts | /issue_converter/issue_converter.py | UTF-8 | 2,174 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
### Input example
### #,Tracker,Status,Priority,Subject,Assignee,Updated,Category,Due date,Project
### 9107,Bug,New,Normal (P3),Cannot rearrange tiles on customise dashboard tiles dialog,"",2013-11-19 11:41 am,"","",StarDesk - 2013
### Corresponding output
### Url,#,Tracker,Status,Priority,Sub... | true |
b809255faf2e105991409184c2b102b4041d6668 | Python | tvial/crystalz | /crystalz/preprocessing/overlaps.py | UTF-8 | 4,280 | 3.46875 | 3 | [] | no_license | """
This method counts the number of atoms that contain the center of each voxel
"""
from typing import List, Tuple
import itertools as it
import numpy as np
def get_voxels(
atoms: Tuple[np.ndarray, np.ndarray, np.ndarray],
vectors: np.ndarray,
resolution: int,
x_max: float,
y_max: float,
z_... | true |
6a957eb75f34a4f2f63f4a748c03b32bf5aaecbf | Python | MichaelTriesHisBest/pythonPractice | /PycharmProjects/PythonPractice/venv/pythonPractice.py | UTF-8 | 1,799 | 4.15625 | 4 | [] | no_license | import random
randomlyfilledArray = random.sample(range(15), 15)
arbitraryArray = [1, 4, 5, 3, 6, 7, 14, -3]
class PythonPractice:
"""SORTING ALGORITHMS IN PYTHON"""
def bubbleSort(arr):
"""BUBBLE SORT IN PYTHON"""
n = len(arr)
for a in range(n - 1):
for x in range(n - a - 1):
... | true |
ad80146e1694c7302b4e633b9a3cd1e629b6e67a | Python | DeepanChakravarthiPadmanabhan/Image_Storyteller | /char_embeddings/evaluate.py | UTF-8 | 1,676 | 3.03125 | 3 | [] | no_license | from tensorflow.keras.models import load_model
from preprocess import preprocess_data
import numpy as np
import re
def sample(preds, temperature=1.0):
preds = np.asarray(preds).astype('float64')
preds = np.log(preds) / temperature
exp_preds = np.exp(preds)
preds = exp_preds / np.sum(exp_preds)
proba... | true |
34f2ab1e55f5aef720282cde6e4dd65ec18ccd0d | Python | kcatjoan/lcd-testrepository | /inputlcd2.py | UTF-8 | 2,249 | 3.359375 | 3 | [] | no_license | #SETUP STARTS
#!/usr/bin/python
# Example using a character LCD connected to a Raspberry Pi or BeagleBone Black.
import time
import os.path
from os import path
import Adafruit_CharLCD as LCD
import sys
# Raspberry Pi pin configuration:
lcd_rs = 25 # Note this might need to be changed to 21 for older revisio... | true |
9e41bac892964de0f1e97ea7d0dee11edc372a4b | Python | PrestaShop/core-weekly-generator | /core_weekly/github.py | UTF-8 | 2,859 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests_cache
import logging
import requests
import ssl
import time
logger = logging.getLogger(__name__)
ssl._create_default_https_context = ssl._create_unverified_context
# Github api
#
class GitHub():
retries = 0
def __init__(self, no... | true |
4e653e4885ea70ff066f89db8174bd8fac3193a3 | Python | maryblack/intro_to_Python | /week_1/stairs.py | UTF-8 | 160 | 3.375 | 3 | [] | no_license | import sys
digit_string = sys.argv[1]
num_of_stairs = int(digit_string)
for i in range(num_of_stairs):
print(f'{" "*(num_of_stairs-(i + 1))}{"#"*(i + 1)}') | true |
5790db8ee0f439b187a17154ff81d9c80519a07f | Python | lawy623/Algorithm_Interview_Prep | /Algo/LeadToOffer/02_ReplaceSpaceInString.py | UTF-8 | 282 | 3.21875 | 3 | [] | no_license | ## Use python str package for easy replace.
## O(n) time.
class Solution:
def replaceSpace(self, s):
words = s.split(' ')
if len(words) == 0:
return s
res = words[0]
for w in words[1:]:
res += '%20' + w
return res
| true |
7e9035d2f585947bc7efed5fd0096d2d946ce382 | Python | pitek93/Cassandra-vs-MySQL | /projekt paczka/obiektowa.py | UTF-8 | 1,740 | 2.875 | 3 | [] | no_license | import csv
import ZODB, ZODB.FileStorage
import BTrees.OOBTree
import transaction
import persistent
import time
import random
from ZEO.ClientStorage import ClientStorage
from ZODB import DB
server_and_port = ('127.0.0.1', 8090)
storage = ClientStorage(server_and_port)
db = DB(storage)
connection = db.open()
root = co... | true |
ec05b200b3a0e1254f535c8da0f71d2997b0d4ce | Python | josueocampol/introprogramacion | /variables 2/ejercicio_1.py | UTF-8 | 199 | 3.953125 | 4 | [] | no_license | distancia_millas = float(input("Ingrese la distancia en millas: "))
distancia_kilometros = distancia_millas * 1.60934
print(f"{distancia_millas} millas equivalen a {distancia_kilometros} kilometros") | true |
47b20b675ca81f47ca033d62b2e575cc65b96c77 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/859.py | UTF-8 | 782 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
def read_int():
return int(sys.stdin.readline())
def read_matrix(row):
"reads the matrix and returns only the chosen row"
result = ''
for i in range(1,5):
curr_row = sys.stdin.readline()
if i == row:
result = curr_row.strip()
return [ i... | true |
f5fc0b097afc1a95f5f10fb113d88c6b67b4c307 | Python | vinxavier/metodosdeotimizacao | /turno.py | UTF-8 | 712 | 2.53125 | 3 | [] | no_license | from ortools.linear_solver import pywraplp
custos = [15,25,52,22,54,24,55,23,16]
p = pywraplp.Solver("", pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
infinity = p.infinity()
n=11
s = [p.IntVar(0, infinity,"turno "+str(i+1)) for i in range(n)]
p.Add(s[0]+s[1]+s[2]>=8)
p.Add(s[1]+s[2]>=10)
p.Add(s[2]+s[3]+s[4]>=2... | true |
eddeb6ac175ef8c7bb02b7decd7aeab168ca029a | Python | hamioo66/Test | /classTest/APITest.py | UTF-8 | 536 | 2.796875 | 3 | [] | no_license | # -*- coding=UTF-8 -*-
"""
author:hamioo
date:2018/10/11
describle:接口自动化 requests库
"""
# import requests
# import urllib
# r = requests.get('https://api.github.com/user')
# print(r.status_code)
# print(r.text)
import urllib.request
import ssl
ssl._create_default_https_context = ssl._create_unverified_context()
resp... | true |
02bb57bb70bc23b2ae43daa3cee39180706045c1 | Python | bradford-smith94/cs347_project | /src/ac_attendance.py | UTF-8 | 1,579 | 3.5625 | 4 | [] | no_license | # Bradford Smith and David Ott
# CS 347 Project
# AbsenceCheck ac_attendance.py
# "I pledge my honor that I have abided by the Stevens Honor System."
#####################################################################
#import csv to read .csv files
import csv
#import student class
from student import student
#ac_att... | true |
316fdeec1877afd00f13fd212e4ed90d9f548453 | Python | masonhuh/assignment_playground | /server.py | UTF-8 | 430 | 2.71875 | 3 | [] | no_license | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Playground Assingment! "/play" for Level 1'
@app.route('/play/<int:num>')
def bluebox(num):
return render_template('play.html',num=num,)
@app.route('/play/<int:num>/<string:color>')
def play(num, color):... | true |
50673b3a093baca9f2e322e5aa3a0ef59ef50715 | Python | D3f0/txscada | /src/dsem/pyscada/gui/map.py | UTF-8 | 5,251 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python
# -*- encoding: utf-8 -*-
from PyQt4.Qt import *
#from PyQt4.QtCore import *
from zooming import ZoomingScrollingGraphicsView as ZoomGraphicsView
from pyscada.gui.esquina_view_dialog import Esquina_View_Dialog
class MapView(ZoomGraphicsView):
'''
'''
MAX_ZOOM = 5
instance = Non... | true |
1d465917da8564b2fcd2022ee9aec51f6856cf28 | Python | 631068264/learn_crawler | /python-scraping/bea/test.py | UTF-8 | 925 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author = 'wyx'
@time = 16/9/10 13:24
@annotation = ''
"""
from bs4 import BeautifulSoup
html = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title title1" name="dromouse"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time ... | true |
d76255c54e16d9696d5d14762608275f81831293 | Python | widigya/business_intelligence | /words.py | UTF-8 | 2,379 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
#Author: Alam Widigya (alam.widigya@kcl.ac.uk)
#Description: Python script to gather keywords and search into urls
def keywords(filename, filename2, newmdata):
import csv
import link
companies = []
counts = []
counter = 0
layers = []
clayer = []
urls2 = []
... | true |
0e492ae305eabde955e9aba58aa2bbfd264beb2c | Python | Aasthaengg/IBMdataset | /Python_codes/p03049/s541421750.py | UTF-8 | 251 | 3.15625 | 3 | [] | no_license | n = int(input())
a = 0
b = 0
x = 0
ans = 0
for i in range(n):
s = input()
ans += s.count("AB")
a += s[-1] == "A"
b += s[0] == "B"
x += (s[-1] == "A") and (s[0] == "B")
if a == x == b != 0:
ans += x-1
else:
ans += min(n-1,a,b)
print(ans)
| true |
428c086e8bf177767314b8c3e89de6696396d7b9 | Python | thekingofhero/impala-profile-analysis | /log_analysis/getLineInfo.py | UTF-8 | 411 | 2.890625 | 3 | [] | no_license | class getLineInfo:
def __init__(self, log_lines):
self.logfile = log_lines
def getLineInfo(self, key, keywords):
attribute = {}
for i, line in enumerate(self.logfile):
if line.find(keywords) != -1:
impalad = line[len(keywords) + 1:]
self.logfil... | true |
96a43a4079659abe302462adbcacb14a2f89720b | Python | HenningFischer/bonprix | /test/test_extract_json.py | UTF-8 | 1,574 | 3.078125 | 3 | [] | no_license | import json
import unittest
from extract_json import Extract_json
class Extract_json_UnitTest(unittest.TestCase):
def setUp(self):
self.extract_json = Extract_json()
self.string_dict = {'a': 'A', 'b': 'B', 'c': 'C', 'd': {'d1': 'D1', 'Foo': 'Bar'}, 'e': 'F'}
self.json_data = json.dumps(s... | true |
b3cc9d48684f0359eee8658a7b1060a279a67862 | Python | Kakashi4/NNFL-assignments | /Assignment 1/Final py/q9_cross-val_1vall.py | UTF-8 | 2,330 | 3.40625 | 3 | [] | no_license | ## K-fold cross validation (One vs All)
import numpy as np
import pandas as pd
from math import exp,log
import random
lr = 0.01
# Define activation function
def sigmoid(x):
return 1/(1+np.exp(-x))
# Function to calculate gradients for logistic regression
def getGradients(x, weights):
delta ... | true |
63b484b721c3ee8026179ef1910b582a153928bd | Python | andrewlakes/Pythontest | /test.py | UTF-8 | 787 | 3.328125 | 3 | [] | no_license | from random import choice
import matplotlib
import numpy as np
import pandas as pd
#alt enter after highlighting
#ctrl+Q for quick documentation
#github push is ctrl shift k
# test = 1
#
# # def adder(A, B):
# # test = A*2+B
# # print(test)
# # return
#
# print(test)
x = np.array([2,3,1,5])
y = pd.... | true |
65083b941fdc9f4331f254b20aee94fc41173436 | Python | Guilherme2020/ADS | /Algoritmos 2016-1/1-lista(professor_fabio)/11.py | UTF-8 | 436 | 3.96875 | 4 | [] | no_license | '''
Leia um número inteiro (3 dígitos)
e escreva o inverso do número. (Ex.: número = 532 ; inverso = 235)
'''
multi = 0
num_tres_digitos = int(input(" "))
n1 = int(num_tres_digitos/100)
multi = num_tres_digitos - (n1*100)
n2 = int(multi/10)
n3 = num_tres_digitos-((n1*100)+(n2*10))
invertido = (n3*100)+(n2*10)+(n1... | true |
907b214c9444d7fcb7ec13d178bf90ce00893f76 | Python | huixinqiang/UVA_Server | /logic/Tar.py | UTF-8 | 964 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import shutil
import tarfile
import sys
import Config
sys.path.append("..")
class Tar:
@staticmethod
def unpack_tar(tar_path, save_path, flag_delete=False):
"""
:param tar_path: 压缩包文件的相对路径
:param save_path: 保存解压文件的文件夹相对路径
:param flag_delete: 是... | true |
277b652d423613d51e8213950bb3c5ede69d0d73 | Python | loochao/lch-emacs-1 | /library/programming/python/lch_python1.py | UTF-8 | 243 | 3.046875 | 3 | [] | no_license | import string
import sys
def cvt(s):
while len(s) > 0:
try:
return string.atof(s)
except:
s = s[:-1]
s = sys.stdin.readline()
while s != '':
print '\t %g' % cvt(s)
s = sys.stdin.readline()
| true |
7d40b3e09e309d5b4152a4a7acd2fcd3b696a2ae | Python | Jimbiscus/Python_Dump | /LetsMakeMultiChoices.py | UTF-8 | 567 | 3.96875 | 4 | [] | no_license | from MultiChoice import Question
from MultiChoice import TrueFalse
from MultiChoice import MultiChoice
get_name = Question("What is your name?") # setup
user = get_name() # get input
print(user) # print
question = TrueFalse("True or False: Python3 is the best!... | true |
3593b871c2403ca82eac4af74de85dd654360721 | Python | loristissino/oopython | /lessons/12/i/private.py | UTF-8 | 357 | 3.484375 | 3 | [] | no_license | class Foo():
def __init__(self):
self.bar = 1
self._bar = 2
self.__bar = 3
f = Foo()
print("f.bar: %d" % f.bar)
print("f._bar: %d" % f._bar)
#print("f.__bar: %d" % f.__bar)
print(f.__dict__)
print("f.__bar (accesso indiretto): %d" % f.__dict__['_Foo__bar'])
print("f.__bar (accesso con nome... | true |
0ae288a405c0d1bcf56a97df61a753fb273e1a4b | Python | nazrul-avash/Python-Practise | /General_Practises/SummationOfSeries.py | UTF-8 | 132 | 3.71875 | 4 | [] | no_license | #Gauss summation
print("Enter the number: ")
sum = 0
number = int(input())
for i in range(number+1):
sum += i
print(sum)
print(i)
| true |
1cf2b1a6a7895706786df336ef1693802c3ed941 | Python | michaelworkspace/Codewars | /unique_in_order.py | UTF-8 | 242 | 3.515625 | 4 | [] | no_license | def unique_in_order(iter):
n = []
for i in range(len(iter)-1):
if iter[i] == iter[i+1]:
continue
else:
n.append(iter[i])
n.append(iter[-1])
return n
print(unique_in_order([1,2,2,3,3]))
print(unique_in_order('AAAABBBCCDAABBB'))
| true |
099488f70a0869381129ad97cf753d1a44fdb265 | Python | Eeveeboo/xair-remote | /lib/midicontroller.py | UTF-8 | 11,018 | 2.796875 | 3 | [
"MIT"
] | permissive | import threading
import time
import os
from .mixerstate import MixerState
from mido import Message, open_input, open_output, get_input_names, get_output_names
class TempoDetector:
"""
Detect song tempo via a tap button
"""
_MAX_TAP_DURATION = 3.0
current_tempo = 0.5
def __init__(self,... | true |
0a75332d8e81f511bc07a68971089ad85d0505bb | Python | bsilvers64/CVdash | /x.py | UTF-8 | 483 | 2.609375 | 3 | [] | no_license | import streamlit as st
import cv2 as cv
import tempfile
f = st.file_uploader("Upload file")
tfile = tempfile.NamedTemporaryFile(delete=False)
tfile.write(f.read())
vf = cv.VideoCapture(tfile.name)
stframe = st.empty()
while vf.isOpened():
ret, frame = vf.read()
# if frame is read correctly ret is True
... | true |
cf008305ac078cd03c53c9e5e93531260b6ca628 | Python | victorrenop/meli-challenge | /meli_challenge/sessions/custom_spark_session.py | UTF-8 | 1,345 | 2.609375 | 3 | [] | no_license | from pyspark import SparkConf
from pyspark.sql import SparkSession
from typing import List, Tuple
class CustomSparkSession:
"""Custom session that initializes the Spark Session and Spark Context.
Initializes the Spark Session using the defined configurations passed by the user
or simply utilizes an alrea... | true |
9f71cac5ad9bd0fa4346d25b75911dff156b3e27 | Python | shanlihou/pythonFunc | /modifyDPInfo/modifyDPInfo.py | UTF-8 | 1,399 | 2.53125 | 3 | [] | no_license | import re
import sys
import string
def modifyDPInfo(compPath, DPPath):
dictDP = {}
dictUrl = {}
dictHash = {}
patName = re.compile(r'name\s*=\s*"([^"]+)"')
patVer = re.compile(r'(revision\s*=\s*")([^"]+)"')
patUrl = re.compile(r'url\s*=\s*"([^"]+)"')
fileComp = open(compPath, 'r')
fileDPOri = open(DPPath, 'r')
... | true |
f64874c0a2d1240e0a4dfa229bfe4a573f9024d1 | Python | euphoria-paradox/py_practice | /2_temperatureConversion.py | UTF-8 | 496 | 4.5625 | 5 | [] | no_license | # Temperature Conversion Program
# This program converts the temperature entered in Fahrenheit
# to equivalent degrees in Celcius
# program greeting
print('This program will convert degrees Fahrenheit to degrees Celcius.')
#get temperature in Fahrenheit
fahr = float(input("Enter the temperature in Fahrenheit: "))
#... | true |
b2ab775923acbcf34e358c151b99eef215659bb2 | Python | MalwiB/academic-projects | /Algorithms_Data_Structures_Python/Travelling_sailsman/genetic_algorithms.py | UTF-8 | 5,756 | 3.25 | 3 | [] | no_license | from hamilton_cycle import HamiltonCycle
from random import randint
def find_tournament_participants(population, new_population, tournament_participants_number):
print "finding tournament participants:"
tournament_participants = []
for i in range(tournament_participants_number):
participant_index = randint(0, le... | true |
1f83d92aef9c7559a6219334085f8656cbf3db83 | Python | Aidabal/tech_supp_bot | /bot.py | UTF-8 | 1,163 | 2.75 | 3 | [] | no_license | import telebot
import config
from telebot import types
bot = telebot.TeleBot(config.token)
@bot.message_handler(commands=['start'])
def SayHello(message) :
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton("Вопрос")
item2 = types.KeyboardButton("Неполадка")
markup.add(item1,... | true |
99fc8052a30a9abac57792bbabba58196b50b09f | Python | nikowis/Atari-bot | /scripts/game_benchmark.py | UTF-8 | 2,678 | 2.890625 | 3 | [] | no_license | # Import the gym module
import random
import time
import numpy as np
import matplotlib.pyplot as plt
import atari_model
import helpers
from env_wrapper import EnvWrapper
IMG_SIZE = 84
FRAMES_IN_STATE_COUNT = 4
EPSILON = 0.05
GAME_ENV_NAME = 'BreakoutDeterministic-v4'
RENDER = False
PRINT_LATEX = True
MO... | true |
53e64399dd465448cecd9bc7f2b4aa6922524334 | Python | lokeshgajula/Automation | /Random-Quiz-Generator/randomQuizGenerator.py | UTF-8 | 1,996 | 2.921875 | 3 | [] | no_license | import random
NUM_OF_QUESTIONS = 20
NUM_OF_SETS = 35
capitals = {'Andhra Pradesh': 'Amaravati',
'Arunachal Pradesh': 'Itanagar',
'Assam': 'Dispur',
'Bihar': 'Patna',
'Chhattisgarh': 'Naya Raipur',
'Goa': 'Panaji',
'Gujarat': 'Gandhinagar',
'Haryana': 'Chandigarh',
'Himachal Pradesh': 'Shimla',
... | true |
0c8f5f8f772dd59d2979d9fa999710760d195ce0 | Python | blackantywj/Leetcode_coding_everyday | /insert_interval.py | UTF-8 | 386 | 3.046875 | 3 | [] | no_license | class Solution:
def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
res = []
intervals.append(newInterval)
for i in sorted(intervals, key=lambda x: x[0]):
if res and i[0] <= res[-1][-1]:
res[-1][-1] = max(res[-1][-1], i[-1])
... | true |
1460d365ce00f138e51e543d20edf357647ac1aa | Python | RoshmiRoy/python | /c4(3)/graphics/Dgraphics/demo.py | UTF-8 | 589 | 2.9375 | 3 | [] | no_license | import graphics.rectangle
from graphics.Dgraphics import sphere
print("area of rect",graphics.rectangle.area(4,3))
print("per of rect",graphics.rectangle.per(4,3))
from graphics.circle import *
print("area of circle",area(2))
print("per of circle",per(2))
from graphics.Dgraphics.cuboid import area
prin... | true |
81d264e7a956e78b2b20013ca73675412263c932 | Python | Aniaaaaa/Szyfrator | /python/main.py | UTF-8 | 10,635 | 3.03125 | 3 | [] | no_license | import math
special_signs = {",", " ", ".", "?", "!"}
alphabet ="QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm"
def get_alphabet():
return alphabet
def get_alphabet_length():
return len(alphabet)
def caesar_code(message, key):
key = int(key)
message = str(message)
message_li... | true |
96e2a2d9922270ecfb2aee1a100340400c00d6ff | Python | kfrancischen/leetcode | /python/38_count-and-say/countAndSay.py | UTF-8 | 640 | 3.421875 | 3 | [] | no_license | class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
if n <= 0:
return ""
result = "1"
for i in range(1, n):
count = 1
newStr = ""
for j in range(0, len(result) - 1):
... | true |
70e02c83426c1cf999d0daea7aff2ec664c5668c | Python | skanin/NTNU | /Informatikk/Bachelor/H2017/ITGK/Øvinger/Øving 2/Karaktergrense/oppgave.py | UTF-8 | 488 | 3.578125 | 4 | [] | no_license | poeng = int(input("Skriv inn antall poeng: "))
if poeng == 100 or poeng > 89:
print("Du fikk A!")
elif poeng == 88 or poeng > 77:
print("Du fikk B!")
elif poeng == 76 or poeng > 65:
print("Du fikk C!")
elif poeng == 64 or poeng > 53:
print("Du fikk D!")
elif poeng == 52 or poeng > 41:
print("Du fik... | true |
b774b145767caa2dc9c81bd5bad4050cfe48deec | Python | manizer/sl-scrapmenus | /app.py | UTF-8 | 1,991 | 2.609375 | 3 | [] | no_license | import os
from bs4 import BeautifulSoup
import urllib.request
import requests
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
base_url = 'http://202.58.181.161:88/protot... | true |
de71e6b488a747820dd4f49aece5469ab5d20a11 | Python | brianv0/gafaelfawr | /src/gafaelfawr/storage/history.py | UTF-8 | 10,732 | 2.59375 | 3 | [
"MIT"
] | permissive | """Storage for change and authentication history."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING
from sqlalchemy import and_, or_
from sqlalchemy.sql import text
from gafaelfawr.models.history import (
HistoryCursor,
PaginatedHistory,
TokenChangeHistoryEntry,
)
from gaf... | true |
da2ba6a36f1ebb76b90c2095d1e30e225eb569fb | Python | pablogarin/torrentmanager | /torrentmanager/config/config.py | UTF-8 | 3,025 | 2.953125 | 3 | [] | no_license | import os
import re
from pathlib import Path
from configparser import ConfigParser
class Config(object):
_config_folder = "%s/.torrentmanager" % str(Path.home())
_config_file = "%s/config.ini" % _config_folder
_config = None
def __init__(self):
self._config = ConfigParser()
if not os.... | true |
8bf84340d8b506d0aacf03a526cbdd00f9d33d51 | Python | tarnoga/fb2ren | /fb2ren | UTF-8 | 2,708 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import optparse, glob
from os import path, sep, rename
from lxml import etree
#from pdb import set_trace
def find_all_ns(elem, tag):
result = []
for ns in elem.nsmap.values():
result = result + elem.findall('.//{%s}%s' %(ns, tag))
return result
... | true |
4f45bf5a68a321f0ec684970760a0de2f37fd8ad | Python | Newton-Figueiredo/PluralsightClass | /Cap 6/OBJandTYP_PyTypeSys.py | UTF-8 | 1,772 | 4.625 | 5 | [] | no_license | #------- oython type system -------
'''
resumo dessa aula ...
python é caracterizado por ser um sistemas de "tipos" dinamicos
por exemplo, seja essa função:
'''
def soma(a,b):
return a + b
# vamos chamar essa função de diversas maneiras
# inteiro
print(soma(5,9))
# float
print(soma(5.8,9.7))
# string
print(soma(... | true |
0c89957db08eccd3cd58bbde7b5391510b82167a | Python | lilium513/competition_programing | /37ABC/b.py | UTF-8 | 229 | 2.609375 | 3 | [] | no_license | N,K =list(map(int,input().split(" ")))
As = list(map(int,input().split(" ")))
l = 0
r = 0
ans = 0
total = 0
for r in range(N):
total += As[r]
while total>=K:
total -=As[l]
l += 1
ans += l
print(ans) | true |