blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
c8e8c100948e7707b0293a6c738661793ff2d0a5
mardoniofranca/maraca
/django/py/list.py
370
3.8125
4
import sqlite3 try: con = sqlite3.connect('db.sqlite3') print("Successfully Connected to SQLite") cursor = con.cursor() cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") rows = cursor.fetchall() for row in rows: print(row) finally: if (con): con.close()...
c27996746f3302aa99726fd0e67905666baaf0a3
franklin-antony/Mongo-WS
/Week-1/basic-python/function_call.py
261
4.03125
4
fruits = ["orange","apple","orange","banana","apple"] def list_frequency(in_list): print in_list count={} for item in in_list: if item in count: count[item] = count[item]+1 else: count[item] = 1 print item print count list_frequency(fruits)
c0fec7f8580825ff8cab39fcc5dcc0379a56ef8f
danielmoniz/merge_in_memory
/merge_in_memory.py
3,228
3.8125
4
import difflib class Merger: """Stores methods for creating and merging diffs stored in variables.""" def diff_make(self, text1, text2): """Returns the unified diff for two strings.""" text1_lines = self.manual_splitlines(text1) text2_lines = self.manual_splitlines(text2) diffe...
62723975656688878e97a1ee00ae3722116109f1
angelrure/ORCID2
/orcid2.py
13,336
3.53125
4
""" ORCID 2.0 but without having to download the data, just on the fly For each provided orcid it returns: - ORCID: the provided ORCIDs as identifier. - The number of potential papers: papers that share the name of the author of interest and could possibly be from him/her. - The number of linked papers: the number of p...
befd45358209b7e0dfc60ed2300164bff900f748
jh-zhu/AlgoStudyGroup
/Week5_DivideConquer/LeetCode23.py
1,274
3.859375
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None ''' Time 65.09% Memory 67.09% Remember to update the result pointer itself ''' class Solution: def mergeKLists(self, lists: List[ListNode]) -> ListNode: def divide(lists,...
7c8cfd10ded8ad2da422bb1b4e2228ad24a58af3
jh-zhu/AlgoStudyGroup
/Week5_DivideConquer/Leetcode215.py
356
3.5625
4
''' Time 99.79% Memory 80.39% Using a priority queue for implememntation ''' import heapq class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: hq = nums[:k] heapq.heapify(hq) for i in range(k,len(nums)): if nums[i] > hq[0]: heapq.heappushp...
a9d679d3f2f5fe00c1bd8d5ab5242d4a1361136c
Pitchaimanidivakar/python-programmings
/largest.py
262
4.15625
4
n1 = float(input("Enter first number: ")) n2 = float(input("Enter second number: ")) n3 = float(input("Enter third number: ")) if (n1 > n2) and (n1 > n3): lgt = n1 elif (n2 > n1) and (n2 > n3): lgt = n2 else: lgt = n3 print("The largest number is",lgt)
6bb742263242beef6bbf4f9a57b1b1da19dd2316
lforet/astroid
/vision/learn.py
9,884
3.5625
4
''' The script learn.py will generate a visual vocabulary and train a classifier using a user provided set of already classified images. After the learning phase classify.py will use the generated vocabulary and the trained classifier to predict the class for any image given to the script by the user. The learning con...
35cdcc363022e842137e5f0c99daa8ba23fb9c07
denn-s/SimCLR
/transformations/gaussian_blur.py
1,060
3.671875
4
import cv2 import numpy as np class GaussianBlur(object): """ Implementation of Gaussian blur as described in the SimCLR paper https://arxiv.org/abs/2002.05709. Uses OpenCV to perform the blur operation """ def __init__(self, kernel_size=0.1, min_sigma=0.1, max_sigma=2.0): # sigma set to ...
02892b46ff5a8095ae51024062802dcc7dcb9b82
SubhrajyotiSen/Lyricist
/lyricist.py
1,779
3.671875
4
import urllib2 from bs4 import BeautifulSoup from google import search import html2text def connected(host='http://google.com'): try: # check connectivity with google as reference urllib2.urlopen(host) return True except: return False def getSoup(url): # required header ...
9f7407e073f28635efdc6bb97be1dbe2d04b5f5b
bely66/Games
/Hangman.py
1,828
3.90625
4
import random class hangman (): def __init__(self): self.words = "word worm cold duck beautiful smart stupid ugly fam fat" self.l_w = words.split() self.missed = 0 def load_random(self): return self.l_w[random.randint(0,len(self.l_w)-...
b74c1841b6490ea12eaceb00eaf886682f1c911d
Vijaysimhadri/VijayCodeHome
/removing dupilicates from string.py
119
3.890625
4
st=input("enetr a string") st1="" for i in st: if i not in st1: st1=st1+i print(st1[::-1])
965f9d720414a904e8a4ef9c6e3232b8661ab654
TavAndRoy/PyDayBot
/PyDayBot/PyDayBot/SmallBoard.py
2,064
3.5
4
from math import * from copy import deepcopy class SmallBoard(object): """Helps calculating the samll boards""" def __init__(self, **kwargs): self.table = [[0 for x in range(3)] for x in range(3)] return super().__init__(**kwargs) def GetLegalMovesByIndex(self): return [ ...
a2cd009d94174af6fd17c799beb9a1de3db63550
Arpit2903/HackerRankCodingExamples
/MinionGame.py
641
3.84375
4
#https://www.hackerrank.com/challenges/the-minion-game/problem def minion_game(s): # your code goes here kevin = 0 stuart = 0 for i in range(len(s)): if s[i]=='A' or s[i]=='E' or s[i]=='I' or s[i]=='O' or s[i]=='U': kevin = kevin + len(s) - i # vowels added in kevin's score and remov...
8958b33c0992ff168c8628a5b919870a19910eef
Arpit2903/HackerRankCodingExamples
/Modpower.py
201
3.78125
4
# https://www.hackerrank.com/challenges/python-power-mod-power/problem import math a = int(input()) b = int(input()) m = int(input()) print(a**b) print(pow(a,b,m)) # pow(a,b,m) results in (a ** b) % m
46c3b49300cb96e3ee39f03673ac60ffbfead966
karankaushik95/COMP9021
/quiz5.py
4,038
3.953125
4
# -*- coding: utf-8 -*- # Randomly fills a grid of size 10 x 10 with 0s and 1s and computes: # - the size of the largest homogenous region starting from the top left corner, # so the largest region consisting of connected cells all filled with 1s or # all filled with 0s, depending on the value stored in the top lef...
31551c7eda7089da6040188f970f93e476a58db3
veell/pirple_HW
/hw4.py
1,312
3.9375
4
myUniqueList = [] #Function that adds only unique elements to myUniqueList def addUniq(thing): if myUniqueList.count(thing) == 0: #if occurences of parameter is in List myUniqueList.append(thing) return True else: return False #Extra myLeftovers = [] def addUniqWithRejects(thing): i...
dc52d706c64a65fe21bdd4a405a931332e71be5a
MattyChoi/MachineLearningMethods
/NeuralNetwork/activations.py
958
3.703125
4
import numpy as np # sigmoid function def sigmoid(x): # implemented in a way where if x is too big, we won't have runtime warning if x >= 0: return 1 / (1 + np.exp(-x)) return np.exp(x)/ (1 + np.exp(x)) # softmax function def softmax(x): # implemented in a way where if x is too big, we...
5506fcd3ac448dd74edef63a8d9612dc93e0bdf0
johnkour/Three_span_truss
/data_split.py
9,393
3.640625
4
# This progam divideds the dataset stored in two CSV files to 3 smaller # datasets and stores them in 6 new CSVs: X_train, Y_train, X_dev, Y_dev, # X_test & Y_test. ''' This program uses the build-in functions to seperate the initial dataset randomly to 3 sub-datasets: Train(X_train, Y_train), Development(...
88b6b5d2cd8b90b373c0b16d551dfb99e86a250a
rcortezsp/IN1910_Raf
/Exercises/week2/Fibonacci.py
1,426
3.84375
4
def fibonacci(n): F0 = 0 F1 = 1 if n == 2: return (F0+F1) elif n == 1: return F1 elif n == 0: return F0 else: return fibonacci(n-1)+fibonacci(n-2) class Fibonacci: def __init__(self): self.memory = {0: 1, 1: 1} def __call__(self, n): if...
ee148af0e3aee992c1e97accddc1cc1c25ed52da
NorthArea/design
/examples/notebook/menu.py
1,898
3.546875
4
from notebook import Note, Notebook import sys class Menu: def __init__(self): self.notebook = Notebook() self.choices = { "1": self.show_notes, "2": self.search_notes, "3": self.add_note, "4": self.modify_note, "5": self.quite } ...
3e531a6b3063b289718580fb9a0d92e4243c62dd
zznixt07/pythonproject
/approx pi using monte carlo.py
649
3.921875
4
import random import math insidePoints = 0 totalPoints = int(input('''Enter the number of points to drop randomly. As the no. of points tends to infinity, the error in the value of pi tends to zero. (points > 1 million maybe CPU intensive): ''')) # totalPoints = 10000000 for i in range(0, t...
73d69054e7228f43dda98bfec4dd3bd125ffad93
kaduBass/520
/arquivo3.py
223
3.875
4
#! /usr/bin/python3 # introducao pyhton with open("frutas4.txt","w") as arquivo: while True: nome=input("Digite um nome") if nome =="sair": break arquivo.write("{}\n".format(nome))
5107c3ed4a322104ffdca801d48bb79dae9f162b
kaduBass/520
/novo.py
229
3.78125
4
#! /usr/bin/python3 # introducao pyhton lista=[] for x in range(65,65 +26): lista.append(chr(x)) dd=lista.pop(0) txt="carlos eduardo de oliveira pantaleao" print(txt.upper()) print(txt.lower()) print(txt.replace("e","K")) print(txt.split("e"))
0adb381eda38b63fbd0e5f1538443324fe8a7598
hebbar10/examplerepo
/kg/script/dict.py
815
3.640625
4
import argparse import json def get_parser(): parser = argparse.ArgumentParser(description="Usage: python dict.py -d '' -k 'c'") parser.add_argument("--dict", "-d", type=str, required=True, default='', help="Mention Dict") parser.add_argument("--key", "-k", type=str, required=True, default='', help...
16ab18286979fec5c30e7a170d5539258877cc9d
efremdedwards/projects
/hangman.py
1,965
3.578125
4
"""Hangman created May 16th I need to control for case sentence words and no numbers """ letra = '' import random,sys,re,os import pyinputplus as pyip os.system('clear') false_count = 1 xword=[] guessed_letras = [] import time correct_word = [] inFile = open("word_list", "r") line = inFile.readlines() xrandom = (...
7bbdaf4eb4eeb5171de4ec2cac9fea049a78d0f9
shaharyar-memon/Python-Programming-Assignments
/PY07751 Assignment 05.py
1,359
3.9375
4
#Q1 def factorial(n): fact = 1 if n == 0: return fact else: fact = n * factorial(n-1) return fact n=int(input("Enter number: ")) print(factorial(n)) #Q2 def my_string_func(sentence): u_case = 0 l_case = 0 for i in sentence: if i.isupper(): ...
fb2a1dde39c4b5843b95618372d50f180495391b
Kruthikasv/Fibonacci-series
/fib.py
925
3.703125
4
import numpy as np import sys if len(sys.argv) < 2: print("No arguments provided") exit() try: number= int(sys.argv[1]) except ValueError: print("Invalid Input") exit() if number < 0: print("Invalid Input") exit() def power(m,MAT): if m == 0: return np.ones((2, 2...
c18c4387b3a4d7316a5fbdb67277c2aacd39d9ad
dlclgnss/coding-for-office-workers
/1week_python_homework/가위바위보.py
2,656
3.625
4
# # 구현 내용 # # 사용자에게 가위, 바위, 보 중 하나를 물어봅니다. # # 사용자가 가위, 바위, 보를 고르면, 컴퓨터도 같이 가위, 바위, 보를 내고 승패를 가릅니다. # # 다합쳐 3번을 지거나, 3번을 이기면 게임은 최종 스코어를 보여 주면서 끝이 납니다. # # 힌트 # # 리스트를 한 개를 사용하고 사용자의 입력을 받아야 합니다. # # 앞서 사용했던 임의 뽑기를 다시 사용합니다. 검색 키워드 : random, randint, shuffle # # 컴퓨터에게 가위, 바위, 보의 승패를 가르쳐줘야 합니다. # # 마감시간 # # 필수 과제가 아닙...
aa25a40506e45676482ef162442e457fec470e06
dmitriyVasilievich1986/HomeWork
/Lesson 02/Lesson 2.5.py
311
3.9375
4
# инициализация рейтинга my_list = [7, 5, 3, 3, 2] # ввод данных пользователя my_list.append(int(input('Введите целое число от 0 до 10:'))) # сортировка списка и вывод данных my_list.sort(reverse=True) print(my_list)
67f3ed495ec7ba3eeced87cffb2752a456b9cf19
maris205/dnasearchengine
/build_dict_v2/filter_dict/freq_filter.py
1,026
3.5625
4
#!/usr/local/bin/python #coding:utf-8 #also filter according to prob/freq #select top threshold_percent word for same length import math import sys threshold_percent = 0.9 if __name__=='__main__': if len(sys.argv) != 2 : print "please input the dict file name" sys.exit() #filter dict ...
7e741ce85d9f5f2f5a916440238e315dd2ce9748
Yui-Ezic/Numerical-Methods
/labs/lab10.py
4,930
4.34375
4
""" Лабораторна работа номер 10 з курсу Чисельні методи, варіант 6 Завдання: Наближенно обчислити значення визначеного інтеграла з точністю ε = 0.001 за допомогою подвійного перерахунку, узявше початкове значення L = 2. Використовувати метод Ньютона-Котес...
989d2e6ef10816c0d2bb9acc5713baa595397fbb
ZhengWG/Code-practise
/Leetcode/Template/必读系列/二分.py
1,991
3.609375
4
# -*- coding: utf-8 -*- ''' @Author: Wengang.Zheng @Email: zwg0606@gmail.com @Filename: 二分.py @Time: 2020-12-13-01:02:11 @Des: 二分法的一些注意事项: + 对于含有重复数字的情况是返回左边界还是右边界 + 计算mid的时候可能溢出:mid=(left+right)/2 + left,right以及等号问题 二分法的技巧点: + 尽量不要用else,全部用elif + 采用left + (right - left) / 2 + 采用固定的模板设计 ''' def binary_search(nums,...
052b303301eaf2901ef7ec31c12422296add1583
ZhengWG/Code-practise
/Leetcode/Template/高频面试/素数个数.py
1,120
3.96875
4
# -*- coding: utf-8 -*- ''' @Author: Wengang.Zheng @Email: zwg0606@gmail.com @Filename: 素数个数.py @Time: 2021-01-03-21:56:27 @Des: 高效得到区间内的素数个数 ''' import math def isPrime(n): """ @brief 判断是否为素数 """ if n < 0: raise ValueError(n) if n == 1 or n == 0: return False if n == ...
671c02b066159ac1216c69448a0016a14917f97c
mkskyring/PIAIC-136742-
/_(PIAIC136742) mahnoor's assignment 1.py
7,355
4.4375
4
#!/usr/bin/env python # coding: utf-8 # # **Assignment For Numpy** # Difficulty Level **Beginner** # 1. Import the numpy package under the name np # In[1]: import numpy as np # 2. Create a null vector of size 10 # In[2]: np.zeros(10) # 3. Create a vector with values ranging from 10 to 49 # In[2]: impor...
e3cbe485930b5d980faf933cbe4aba5008f53309
beldam-source/pascal-interpreter-python
/interpreter_from_scratch.py
3,547
4.125
4
#! /usr/bin/env python3 # an interpreter to process # arithmetic expressions with multiplication and division # NEEDS: # token types 'INT', 'DIV', 'MULT' # lexer: breaks input into tokens # parser: recognizes expressions based on a stream of tokens # token types INT, DIV, MULT = 'INT', 'DIV', 'MULT' class Tok...
6c90aed6306f8caa67eb92265f61b0add25ef02b
Usernam-kimyoonha/python
/6-5.py
336
3.609375
4
def sayhello(name,age): if age < 10: print("안녕." + name +"군") elif age <= 20 and age >= 10: print("안녕하세요." + name +" 씨") else: print("안녕하십니까?" + name + " 님") sayhello("철수", 6) sayhello("태희", 11) sayhello("정수", 21) sayhello("병선", 30)
4936d49976b447852749f96c9189e15700307f8d
gabosantos/PyIFN
/classes/arrowshaper.py
11,183
3.84375
4
# File: canvasarrow.py # http://infohost.nmt.edu/tcc/help/pubs/tkinter//canvas.html from tkinter import * from tkinter import ttk from demopanels import MsgPanel, SeeDismissPanel class CanvasArrowheadDemo(ttk.Frame): def __init__(self, isapp=True, name='canvasarrowheaddemo'): ttk.Frame.__init__(se...
6919b3c77dd72af3e8429f04f2a2074676aa4b87
abdouglass/GWU_MSBA_Prog_for_Analytics_Fall14
/hangman_1person.py
4,393
4.09375
4
player = raw_input("Welcome player. What is your name? ") #Initiate game, by asking who is playing print "Hello {0}! Welcome to hangman.".format(player) with open('G:/Programming for Analytics/HW #1/words.txt','r') as words: #import word file that will be pulled from words = words.read().split("\n") import rand...
d8173a9c849159e6785752407c78205b8bda9342
SamConti184/Hierarchical-Pointer-Memory-Network
/Data_preprocessing.py
19,281
3.578125
4
import numpy as np import random from typing import Tuple, List #Implementation of a class used to read the .txt Dataset and create a series #of .npz files (serialized Numpy arrays) that will be used as starting point #to create TensorFlow Datasets. #The main objective of this class is the creation for each set (train...
cf01372cf71a3fcf0987d7e27a07ef241e0c4337
yourbuddyconner/pysnap
/pysnap/sorted_dict.py
742
3.71875
4
from collections import OrderedDict class SortedDict(OrderedDict): def __init__(self, **kwargs): super(SortedDict, self).__init__() for key, value in sorted(kwargs.items()): if isinstance(value, dict): self[key] = SortedDict(**value) elif isinstance(value, ...
97a30b8ae45d91b436c3ea74dec8c696859ec86b
blanejmoore/Class
/Week1/hwpart1.py
1,328
3.875
4
""" Class: Python Certification Course - Intro to Python Created By: Blane Moore Created On: 10/2/2013 Description: Create a function that creates a grid using +, -, and | characters """ def gridrowleft(): print '+', def gridrowmid(): print '-', def gridrowright(): print '+' def gridcolumnleft(): pr...
0669d9bba71103ba6f6feb61504b2d278c3447a9
EnginKosure/Jupyter_nb
/ch25.py
159
3.71875
4
def split(n): return n if n < 5 else 3*split(n-3) print(split(5)) # ➞ 6 # 3 times 2 print(split(10)) # ➞ 36 # 3 * 3 * 4 print(split(1)) # ➞ 1
80b91ed4361b2ced3d649e8f602c990c56bbf8b3
EnginKosure/Jupyter_nb
/ch09.py
513
3.984375
4
# Create methods for the Calculator class that can do the following: class Calculator: def add(self, num1, num2): return num1+num2 def subtract(self, num1, num2): return num1-num2 def multiply(self, num1, num2): return num1*num2 def divide(self, num1, num2): return nu...
4c7ae6cee092cc04c5cec4febc31031dc766b9a7
EnginKosure/Jupyter_nb
/ch19.py
526
3.609375
4
# def round_number(num, n): # floor_div = num//n # surplus = num % n # result = floor_div*n # if surplus >= n/2: # result += n # return result # def round_number(num, n): # div, mod = divmod(num, n) # if mod >= n/2: # return div * n + n # return div * n def round_num...
a75e96806216d53b284ffb9b26beca3ae494a7e4
EnginKosure/Jupyter_nb
/ch11.py
1,652
3.828125
4
# def tic_tac_toe(lst): # if lst[0][0] == lst[1][0] == lst[2][0]: # return lst[0][0] # elif lst[0][1] == lst[1][1] == lst[2][1]: # return lst[0][1] # elif lst[0][2] == lst[1][2] == lst[2][2]: # return lst[0][2] # elif lst[0][0] == lst[1][1] == lst[2][2]: # return lst[0][0...
1fed061ace4af67f7a37112055219958cedda3f5
AlexandreNadiras/PersonalProjects
/UseCase/BonusSQL.py
1,043
3.84375
4
# -*- coding: utf-8 -*- """ Created on Fri Mar 20 10:04:48 2020 @author: User """ import pandas as pd import sqlite3 #you need the csv file to be in the same directory as the .py code connection = sqlite3.connect('wines.db') #creating and linking the SQLite database cursor = connection.cursor() ...
3b798c1b5353763cdd0eacf18ef118be0516f35f
hufterkruk/generate_voekkr
/voekkr.py
1,241
3.6875
4
#!/usr/bin/env python3 """Generate random voekkrs""" import argparse import random import pyfiglet def parse(): """Parse command-line arguments""" parser = argparse.ArgumentParser(description="generate random voekkrs") parser.add_argument( "length", type=int, nargs="?", help="length of voekkr to...
710e64365382b1734c9f9900df39bccf0bcd102f
nitishdash26/python-leet-code
/best time to buy and sell a stock.py
250
3.6875
4
def best_time_sell_stock(prices): sell = 0 buy = prices[0] for i in range(1, len(prices)): buy = min(buy, prices[i]) sell = max(sell, prices[i] - buy) return sell print(best_time_sell_stock([7,1,5,3,6,4]))
a58ea97cac81a236c81039161f5485b2676819e4
pasignature/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/1-search_replace.py
212
4.03125
4
#!/usr/bin/python3 def search_replace(my_list, search, replace): new = [] for n in my_list: if n == search: new.append(replace) else: new.append(n) return(new)
a91daf8425ce9b3834ce3b1bea5d842e45d0c4d1
pasignature/holbertonschool-higher_level_programming
/0x03-python-data_structures/5-no_c.py
161
3.78125
4
#!/usr/bin/python3 def no_c(my_string): res = [] for x in my_string: if x != 'c' and x != 'C': res.append(x) return "".join(res)
06682812cf992d06680032f816dcbbb61cb24e75
pasignature/holbertonschool-higher_level_programming
/0x0B-python-input_output/14-pascal_triangle.py
351
3.78125
4
#!/usr/bin/python3 """Pascal's Triangle Module""" def pascal_triangle(n): """Returns a list of list of integers repr Pascal's Triangle of n""" ans = [] if n > 0: ans.append([1]) for r in range(1, n): prv = ans[-1] ans.append([1] + [prv[i - 1] + prv[i] for i in rang...
71c8cb6ff3577758ac4592845198d68eb0187527
pasignature/holbertonschool-higher_level_programming
/0x10-python-network_0/6-peak.py
590
4.03125
4
#!/usr/bin/python3 """ finds a peak in a list of unsorted integers. """ def find_peak(list_of_integers): """ finds a peak in a list of unsorted integers. """ ln = len(list_of_integers) if ln == 0: return m = ln // 2 pivot = list_of_integers[m] left = list_of_integers[m - 1] if (...
2c84eff48c28059b069dd027a46c9b66329e20ca
coelhocaique/uri
/python/2483.py
100
3.578125
4
I = int(input()) output = "Feliz nat" for a in range(I): output+="a" output+="l!" print output
6360b5579bd0820980cc7ebf0c337ff93fc13bb6
Dylan-Harris/sals_shipping
/sals_shipping.py
1,001
3.78125
4
premium = 125.00 def ground_shipping(weight): if weight <= 2: return (weight * 1.50) + 20.00 elif weight >= 2 and weight <=6: return (weight * 3.00) + 20.00 elif weight >= 6 and weight <= 10: return (weight * 4.00) + 20.00 else: (weight * 4.75) + 20.00 def drone_shipping(weight): if weight ...
72e564baca5a6837d8e3c23101c5e4efd27ab616
nguyenbenjamin3/CECS-174-Fall-2019
/Triangle.py
175
4.0625
4
tri_char = input('Enter a character:\n') triangle_height = int(input('Enter triangle height:\n')) x = (tri_char + ' ') for i in range(triangle_height +1): print(x*i)
8946ad3e37adef380236b3da256ad1b640b69617
wukao1985/algorithm-1
/subset.py
474
3.890625
4
#!/usr/bin/python # 1, 2, 3 from sets import Set def subsets(S): """ 1. Corner Case 2. Difference between append and concatenate Time Complexity: O(n^2) Space depth of stack """ if S == None: return None if S == []: return [[]] curr = subsets(S[1:]) for ele in cu...
e302805d4d319ad8136335bb505b19c4fd3790e8
CloudCranee/2019_April_11_Ubermelon_Accounting
/accounting.py
612
3.921875
4
def customer_pay(customer, melons, did_pay): melon_cost = 1.00 count = 0 customer_expected = melons * melon_cost if customer_expected != did_pay: count += 1 print(f"{customer} paid ${did_pay:.2f},", f"expected ${customer_expected:.2f}" ) the_file = open("customer-orders.txt...
e1319412dbb3f7d82dabc176e68038f23ddf6b24
jcespinoza/odoocalc
/controllers/calculator.py
914
3.5
4
import re class Calculator(): def add(self, x, y): return x + y def evalute(self, reqObj): strInput = reqObj['input'] inputMatches = re.match(r"^(\d)*\s*([+\-\/*×÷]\s*(\d)*)*\s*$", strInput) if inputMatches == None: return { 'success': False, ...
5a75322ef3a623b6c053576a3d0782a5f67ef6ec
Andrewwu73/MetropolisHastingsDecryption
/Project Code/src/encode.py
3,704
3.71875
4
""" Script for generating ciphertexts. Usage: python3 encode.py plaintext.out ciphertext.out has_breakpoint [seed] Behavior: 1. Reads in standard input (until EOF). 2. Cleans text to satisfy requirements given in the project handout. 3. Writes the cleaned text to `plaintext.out`. 4. Encodes the cleaned...
559d6f6deb75829bd85b6cb1eaf0bd2932360511
ebenezer2002/HackBioProject1
/odara_script.py
655
3.9375
4
#!/usr/local/bin/python3 # a function that calculates the hamming distance # between my slack handle and twitter handle def hammingDistance(str1, str2): i = 0 count = 0 while (i<len(str1)): if(str1[i] != str2[i]): count += 1 i += 1 return count # defining variabl...
047503151d7276431e2b236683d5c244958b33f1
SailBotPitt/SailBot
/stepper.py
3,245
3.875
4
""" handles sending signal to stepper driver to move stepper a set number of steps """ import sys import time import RPi.GPIO as GPIO class stepperDriver(object): def __init__(self, direction_pin, step_pin): """ class init method 3 inputs (1) direction type=int , help=GPIO pin connected to DIR pin...
bba22e97a3631d9fe7e34f889c2421d0f798fbf5
nahumj/py_graph
/complexFeaturesGraph.py
11,098
3.71875
4
# https://bespokeblog.wordpress.com/2011/07/07/basic-data-plotting-with-matplotlib-part-2-lines-points-formatting/ import matplotlib.pyplot as plt import numpy as np import math from matplotlib.backends.backend_pdf import PdfPages #### # # ReadDataFile(FileName,DataFields,Separator=' ',SkipRows=0) # Reads...
f31118cd56f69ad580e7a14c96e361e31cd6acdc
LuuckyG/Chess
/chess/view/button.py
2,626
4.1875
4
import pygame class Button: def __init__(self, color, x, y, width, height, value, group, selected=False, text_color=(0, 0, 0), text=''): """Class for a button to select the game style Args: - color: color of the button - x: top left x-coordinate of the button ...
2a12dac1854318e6a404d28060d3d7f2a51f044d
mkmayank/algo
/projecteuler.net/9.py
761
3.9375
4
#!/usr/bin/env python ''' https://projecteuler.net/problem=9 A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc...
f19c1eea644731b9b5bc84625e1a13a22eb2cd31
subinmun1997/my_python
/two.py
151
3.65625
4
def two(): print('two') return 2 g = (two()*i for i in range(1,10)) print(next(g)) print(next(g)) print(next(g)) print(next(g)) print(next(g))
4bd19a267d0983f0a91eb84891b51e9e573118c1
subinmun1997/my_python
/End_Sep.py
103
3.703125
4
for i in (1,3,5,7,9): print(i, end= 'm^^m') print(1,2,3,sep='_') print(1,2,3,sep="_",end=' m^^m ')
8ba65474ac0ec8f0ea588d229e1034e61d6dd9ed
subinmun1997/my_python
/vertor_add.py
360
3.921875
4
class Vector: def __init__(self,x,y): self.x = x self.y = y def __add__(self, o): return Vector(self.x + o.x, self.y + o.y) def __call__(self): return 'Vector({0},{1})'.format(self.x,self.y) def main(): v1 = Vector(3,3) v2 = Vector(7,7) v3 = v1+v2 print(v1())...
708c74363322d680811a63bddb0d331585dea486
subinmun1997/my_python
/div.py
149
3.75
4
def main(): bread=10 people=int(input("몇 명?: ")) print("1인당 빵의 수: ",bread/people) print("맛있게 드세요.") main()
062f66a923c10dffbb995392230580304df7e6ba
subinmun1997/my_python
/reverse_lambda.py
74
3.515625
4
st=['one','two','three'] rst = list(map(lambda s : s[::-1],st)) print(rst)
4ba19e8d4fca91bb7a765b2feea74480861aed7a
subinmun1997/my_python
/pow.py
94
3.59375
4
def pow(n): return n**2 st1=[1,2,3] st2=[pow(st1[0]),pow(st1[1]),pow(st1[2])] print(st2)
b7ddee1a9a32876b4fcc8fb2045d4f2085264cdd
subinmun1997/my_python
/map_filter_comprehension.py
71
3.546875
4
st=list(range(1,11)) print(st) fst=[n**2 for n in st if n%2] print(fst)
12578b1b3f08cacdc322eb20fe9b1ecfcb05e45a
subinmun1997/my_python
/gen_expression.py
102
3.53125
4
def show_all(s): for i in s: print(i, end=' ') g = (2*i for i in range(1,10)) show_all(g)
401cf9b3f3ed75b5f44a96301ac04faee6c25645
subinmun1997/my_python
/ListFunction.py
292
3.5625
4
st=[1,2,3] st.append(4) print(st) st.extend([5,6]) print(st) st.insert(3,3.5) print(st) st.clear() print(st) st.append(1) st.append(9) print(st) st.extend([2,3,4]) print(st) st.pop(0) print(st) st.remove(2) print(st) st.extend([2,2,2,3,3,4,5,5,5,5,]) print(st) st.count(2) st.index(2)
2ff7fc007d2ac138d4d40d07d992b63c149abb8a
subinmun1997/my_python
/times2.py
142
3.65625
4
def show_all(s): for i in s: print(i, end=' ') def times2(): for i in range(1,10): yield 2*i g = times2() show_all(g)
8f0401c4eca95025037ae0188c9a89eb8dc907af
subinmun1997/my_python
/twice.py
63
3.609375
4
r1=[1,2,3,4,5] r2=[] for i in r1: r2.append(i*2) print(r2)
cfcec234581c3f654ab32d633530ca6631e1acee
subinmun1997/my_python
/zip.py
188
4.15625
4
z = zip(['a','b','c'],[1,2,3]) for i in z: print(i,end=', ') z = zip(('a','b','c'),(1,2,3)) for i in z: print(i,end=', ') z = zip('abc',(1,2,3)) for i in z: print(i,end=', ')
72941eae01e8bb616606c022c9d4672c129852e0
subinmun1997/my_python
/count_instance.py
312
3.8125
4
class Simple: count = 0 # Simple의 클래스 변수 def __init__(self): Simple.count += 1 def get_count(self): return Simple.count def main(): s1 = Simple() print(s1.get_count()) s2 = Simple() print(s1.get_count()) s3 = Simple() print(s2.get_count()) main()
7510cb93877c4f9325e9b185f982843621a243cb
subinmun1997/my_python
/person2.py
376
3.640625
4
class Person: def __init__(self,n,a): self.name = n self.age = a def add_age(self,a): if(a<0): print("나이 정보 오류") else: self.age += a def __str__(self): return '{0}: {1}'.format(self.name,self.age) def main(): p = Person('James',22) pri...
895c52f9a2e07d6b1cb3bfb0195d79cf33178632
subinmun1997/my_python
/while_continue.py
70
3.75
4
i=0 while i<10: i=i+1 if i%3==0: continue print(i,end=' ')
92e8302575cb4c9c98194a9e52e3726b8e8e7e46
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Itertools/itertools combinations.py
294
3.734375
4
# https://www.hackerrank.com/challenges/itertools-combinations/problem from itertools import combinations word, k = input().split() word = sorted([w for w in word]) for i in range(1, int(k)+1): for j in combinations(word, i): print(''.join(j)) # github.com/ArutselvanManivannan
a1eeced91b0cb43f5a21ea4c07af6510f9a3552c
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Regex and Parsing/Hex Color Code.py
297
3.78125
4
# https://www.hackerrank.com/challenges/hex-color-code/problem import re pattern = re.compile(r'(?<!^)(#[0-9a-f]{6}|#[0-9a-f]{3})', re.I) for _ in range(int(input())): m = pattern.findall(input()) if m: for code in m: print(code) # github.com/ArutselvanManivannan
7107868683710ec3235cee8cd82b07a26b4a9bbf
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Collections/deque().py
510
3.65625
4
# https://www.hackerrank.com/challenges/py-collections-deque/problem from collections import deque d = deque() for _ in range(int(input())): query = input().split() if query[0] == 'append': d.append(int(query[1])) elif query[0] == 'appendleft': d.appendleft(int(query[1])) elif query[0...
0c2720c55db78fda76c1d56571fb4beab698e582
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Collections/OrderedDict().py
335
3.796875
4
# https://www.hackerrank.com/challenges/py-collections-ordereddict/problem from collections import OrderedDict d = OrderedDict() t = int(input()) for _ in range(t): key, value = input().rsplit(' ', 1) d[key] = d.get(key, 0) + int(value) for key, value in d.items(): print(key, value) # github.com/Arutse...
3817713876c8f869c17a35006bfb919e70630469
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Math/Integers Come In All Sizes.py
307
3.578125
4
# https://www.hackerrank.com/challenges/python-integers-come-in-all-sizes/problem print(pow(int(input()), int(input())) + pow(int(input()), int(input()))) # or # a = int(input()) # b = int(input()) # c = int(input()) # d = int(input()) # print(pow(a, b) + pow(c, d)) # github.com/ArutselvanManivannan
6915e8fbda26b6dea8bd54f4a80a4db6f1e5a4fd
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Itertools/Compress the String.py
222
3.875
4
# https://www.hackerrank.com/challenges/compress-the-string/problem from itertools import groupby for key, group in groupby(input()): print(f'({len(list(group))}, {key})', end=' ') # github.com/ArutselvanManivannan
32dfeab7ff8379874248ed501a1d8ad055d3a8e2
ArutselvanManivannan/Hackerrank-Code-Repository
/30 Days of Code/Day23 BST Level Order Traversal.py
355
3.828125
4
def levelOrder(self, root): from collections import deque # Write your code here if not root: return root queue = deque([root]) while queue: temp = queue.popleft() print(temp.data, end=' ') if temp.left: queue.append(temp.left) if temp.right: ...
43bc58abbd34c7264d8c0b7474a4c1f6ad79d9c2
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Regex and Parsing/HTML Parser - Part 1.py
652
3.515625
4
# https://www.hackerrank.com/challenges/html-parser-part-1/problem from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print(f'Start : {tag}') for attr in attrs: print(f'-> {attr[0]} > {attr[1]}') def handle_endtag(self, tag)...
09bb277cd572b44b4554c79714d92831769a8d75
ArutselvanManivannan/Hackerrank-Code-Repository
/Python/Collections/Piling Up.py
619
3.71875
4
# https://www.hackerrank.com/challenges/piling-up/problem from collections import deque for _ in range(int(input())): n = int(input()) sideLength = deque([int(i) for i in input().split()]) lastCube = pow(2, 31) while len(sideLength) > 1: if sideLength[0] >= sideLength[-1] and (sideLength[0]...
745aee79cf818d9d65a2d08a51cb4efeab219a30
dummycode/PythonJunk
/calculatePercentages.py
1,405
3.578125
4
"""listOfNumbers = [] while (True): number = int(input()) if (number == 0): break else: listOfNumbers.append(number) print(listOfNumbers) """ def toPercent(amount, total): return round(amount / total * 100, 2) def main(): listOfNumbers = [4, 4, 3, 3, 4, 2, 2, 4, 1, 2, 2, 4, 3, 1, ...
e88db79badacd5496b1df9def1769d63a8ff9cae
dummycode/PythonJunk
/mastermind.py
770
3.578125
4
import random, math print('I am thinking of a four digit number, try and guess it!') secret = random.randint(1000, 9999) correct = False while not correct: tempSecret = secret print('Guess (#): ', end='') guess = int(input()) numCorrect = 0 sumCorrect = 0 for i in range(0, 4): ...
53135c64917c633526ace3a5d02628b6b7a04ce8
thingtwin1/CAT_TT_Project
/Team Tech Project/Incuser.py
171
3.84375
4
# -*- coding: utf-8 -*- """ Created on Sun Sep 23 17:34:11 2018 @author: c501 """ input1 = input("Please input a number") if input1 == 6: print('hi')
161689769ada85a5051b14f2cb76dd025aea17e4
F0b1an/VigenereCypher
/Encryption.py
1,509
4.25
4
print("Press e to encrypt and d to decrypt ") while True : encryption = input() if encryption == "e": print("What would you like to encrypt?") message = input() print("What key would you like to use?") key = input() ran = range(len(message)) encrypted = "" for i in ran: ...
e46700614f9f748cf8d5910502ebd77ee186181b
Arehandoro/setp03
/tri_pascal.py
1,615
4.15625
4
#UNIVERIDAD DE SANTIAGO DE CHILE #Carrera: Licenciatura en Ciencias de la Computación. #Asignatura: Lenguaje y Técnicas de Programación. #Profesor: Igor Caracci. #Ayudante: Andrés Caro Q. #Autor del Programa: Alejandro Alberto Sánchez Iturriaga. #Problema 01 - Pascal: def tri_pascal(n): #Función que imprime y ...
b922ba78b16e33e9bda7d1dfc347aacd426f3807
Arbonik/Diplom
/venv/Documentation.py
2,234
3.703125
4
from Command import CommandHolder, Command # Документация по использованию # Commands # Для вывода ответа используется поле answer # Для оценки соответствия ключа строке answerCount # Команда с единственным ключем c = Command("трава","зеленая") # print(c.answerCount("тра")) # Команда с множественным ключем, работает к...
4993f78596131e2c80b325811289714165eed59c
kundantajne/Full_Stack
/addition.py
92
4.03125
4
num=input("enter the first no:") num1=input("enter th second no:") print "addition",num+num1
1deb5c51133c29dcbc7a79b2da43c33f3b185309
Bishal-Gurung/PythonAssignment
/DataTypes/39.py
314
4
4
# this lines PACKS values # into variable a a = ("MNNIT Allahabad", 5000, "Engineering") # this lines UNPACKS values # of variable a (college, student, type_ofcollege) = a # print college name print(college) # print no of student print(student) # print type of college print(type_ofcollege)...
a9d473dce2d58e8ade34ad413e7f101ef38d12f6
vantoara/Proyecto-Algoritmos-2021-1
/Color.py
1,547
3.78125
4
# Este es mi plan b para el juego ya que el sudoku no quiso funcionar. from Game import Game import enquiries import random class Color(Game): def __init__(self, room, obj): super().__init__(room, obj) self.name = "Adivine el color" self.question = self.question_choice["question"] ...
9236b53509ba533e5642bc2bb00d9c71bfc04299
vantoara/Proyecto-Algoritmos-2021-1
/Player.py
1,769
3.640625
4
class Player: def __init__(self, user, pswd, age): self.user = user self.pswd = pswd self.age = age self.avatar = "" self.inventory = [] self.lives = 0.0 self.clues = 0 def set_difficulty(self, lives, clues): self.lives = lives self.clues ...
acb66b65bb4e572dd630bc6411d284003dcd49cf
vantoara/Proyecto-Algoritmos-2021-1
/Math.py
3,139
3.921875
4
from Game import Game from sympy import * # sympy nos calculará la derivada y su valor en un punto dado from fractions import Fraction import random class Math(Game): def __init__(self, room, obj): super().__init__(room, obj) self.question = self.question_choice["question"] self.clue =...