blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
9206528ea484b33d63978ae8c8c37a06ba332706
AbelhaJR/Huffman
/data_structures.py
6,365
4.125
4
# imports import os , heapq from collections import defaultdict from bitstring import BitArray # Global variables dic_char_codes = {} frequency = defaultdict(int) # GIT HUB link : https://github.com/AbelhaJR/Huffman # Functions # 1 - Read File def read_file(file_path : str)-> str: """All...
036d1c65f775dbb424dd7d905ac3dcf799a73e67
arcadiabill/Learn_GIT
/Src/Python/Intro to Tkinter/menu01.py
1,138
3.78125
4
from tkinter import * top = Tk() top.title('Find & Replace') Label(top,text="Find:").grid(row=0, column=0, sticky='e') Entry(top).grid(row=0,column=1,padx=2,pady=2,sticky='we',columnspan=9) Label(top, text="Replace:").grid(row=1, column=0, sticky='e') Entry(top).grid(row=1,column=1,padx=2,pady=2,sticky='we',columnspan=...
3b8af5ee45028b94c0cfa4ab0e82d5e0d6f57e23
girishalwani/Training
/python prog/Pyhton Fundamentals/divisible by 5.py
158
4.21875
4
""" Write a program to find the given number is divisible by 5 """ a = 100 if(a%5 == 0): print("Divisible by 5") else: print("not divisible by 5")
ac27f0d5e2cfcec2f2e924ba11a47704940eb5ed
tspoon1/sales
/reporter.py
1,080
4.03125
4
# reporter.py import os import pandas def to_usd(my_price): """ Converts a numeric value to usd-formatted string, for printing and display purposes. Source: https://github.com/prof-rossetti/intro-to-python/blob/master/notes/python/datatypes/numbers.md#formatting-as-currency Param: my_price (int or floa...
0f17f01ef772b8596dc9f96d5eb3241202b39caa
sonhmai/harvard-cs50
/w7-sql/src7/favorites4.py
638
3.875
4
import csv # For counting favorites counts = {} # Open CSV file with open("CS50 2019 - Lecture 7 - Favorite TV Shows (Responses) - Form Responses 1.csv", "r") as file: # Create DictReader reader = csv.DictReader(file) # Iterate over CSV file for row in reader: # Force title to lowercase ...
aa51dbada9633e1a55e23376860cb73da84b1c5e
CyborgVillager/Learning_py_info
/snake_game/snake.py
2,178
3.546875
4
# learning on how to make a snake game / user controls / etc # thanks in part to Engineer Man -> https://www.youtube.com/watch?v=rbasThWVb-c&t=85s # Engineer Man Python Playlist -> https://www.youtube.com/watch?v=lbbNoCFSBV4&list=PLlcnQQJK8SUj5vlKibv8_i42nwmxDUOFc&index=7 # make sure to install curses via terminal -> p...
c248ed413449df5bc560032b5c240d74c7c7349e
turenc/workspace
/framework-learning/pythonWorkspace/chapter01-PythonBased/demo03.py
1,536
4.21875
4
# -*- coding: utf-8 -*- # @Author: gaopeng # @Date: 2017-01-16 15:40:59 # @Last Modified by: gaopeng # @Last Modified time: 2017-01-16 16:12:35 # dict通过key-value形式存储,一个key只能对应一个value,如果多次对一个key放入value,后面的值会把前面的覆盖掉 d = {} d['Adam'] = 67 print d['Adam'] # 如果key不存在,dict会报错 # 要避免key不存在的错误,一是通过in判断key是否存在,...
e85c48a6db20da76f06816dc5f289507c592eb33
SunmoonHans/boj
/other/2523.py
137
3.703125
4
n = int(input()) + 1 for i in range(1, n): print('*' * i) line = list(range(1, n-1)) line.reverse() for i in line: print('*' * i)
c8771071fe4d2e8b193f9efbaa492935397313b7
benitez96/unsam
/unsam/Clase 11/burbujeo.py
931
3.78125
4
def ord_burbujeo(lista, debug=False): n = len(lista)-1 if debug: print('{:^10s} - {:^20s}'.format('N', 'LISTA')) comparaciones = 0 while n: if debug: print(f'{n:^10} - {lista}') for i in range(n): comparaciones += 1 ...
0bf54fbbcce521b5b63661c117f8e469c65f0d40
minh1061998/D-ng-Quang-Minh-python-c4e27
/homework/Bai1b.py
2,034
4.03125
4
# sheep =[5, 7, 300, 90, 24, 50, 75] # print ("My name is Minh and these are my sheeps sizes: ",sheep) # maxweight = max(sheep) # print ("Now my biggest sheep has size ",maxweight ,"let's shear it") # index = sheep.index(maxweight) # sheep.insert(index, 8) # sheep.remove(maxweight) # print("After shearing, here is my f...
9e5627b5a51cbfe6c7771a6b57284d2cf2defbe0
magnoazneto/IFPI_Algoritmos
/Fabio03_For_com_for/Fabio03_01_inteiros.py
193
3.578125
4
from get_inputs import get_inteiro def main(): valor = get_inteiro('Por favor, digite um número inteiro: ') for i in range(1, valor+1): print(i, end = ' ') print() main()
b4243d69853a454b335d3a669a73f8acede55338
jtlai0921/XB1828-
/XB1828_Python零基礎最強入門之路-王者歸來_範例檔案New/ch18/ch18_18.py
1,060
3.5625
4
# ch18_18.py from tkinter import * def printInfo(): # 列印輸入資訊 print("Account: %s\nPassword: %s" % (e1.get(),e2.get())) window = Tk() window.title("ch18_18") # 視窗標題 lab1 = Label(window,text="Account ").grid(row=0) lab2 = Label(window,text="Password").grid(row=1) e1 = Entry(...
5573b308910b6e131d07d99c31a01d2877a3cf2d
nmomaya/Python_Assignment
/tietactoe.py
549
3.78125
4
""" board = { "TopL" : ' ', 'TopM' :' ',"TopR":' ', "ML" : ' ', 'MM':' ', "MR":' ', "BL" : ' ', 'BM':' ',"BR":' ' } print(board) """ def displayInventory(inventory): import pprint print("Inventory:") item_total = 0 for k, v in inventory.items(): item_total = item_tota...
73b2b4e18bf60a4a17ff7d606d77cb4f881ea93e
Jane2353/AlgoritmeAflevering
/Sort with random numbers.py
578
4.5
4
# Python program to find the largest number in the list # The list is empty in the beginning list = [] # It asks how many many numbers you want in the list number = int(input("Hvor mange tal vil du have i din liste? ")) # It will keep asking until you have the amount of numbers you want, # then it will sort t...
86220ff5dcdbc281f29edd2981752a19b83cf115
PoolloverNathan/rotate-screen
/invscr.py
566
3.640625
4
#!/usr/bin/env python3 # Simple script that inverts the computer's screen(s). # Or rather, it gets the screen(s) into inverted mode, i.e. executing # the script twice won't get the screen(s) back to normal. import subprocess def invscr(): # Get screens get = subprocess.check_output(["xrandr"]).decode("utf-8"...
a0586c8045992bf5083cbff4f926506234cb3dbc
awanishgit/python-course
/conditional.py
1,453
4.46875
4
# If/ Else conditions are used to decide to do something based on something being true or false x = 40 y = 40 # Comparison operators (==, !=, >, <, >=, <=) - Use to compare values # Simple if if x == y: print(f'{x} is equal to {y}') # Simple If/ else if x > y: print (f'{x} is greater than {y}') else: pr...
ee910c1aca41df4de640a28ab88b09d972e09747
gokou00/python_programming_challenges
/leetcode/searchRange.py
299
3.53125
4
def searchRange(nums,target): if target not in nums: return[-1,-1] idx1 = nums.index(target) if target not in nums[idx1+1:]: return[idx,-1] idx2 = nums[::-1].index(target) return[idx1,(len(nums) -1) - idx2] print(searchRange([5,7,7,8,8,10],6))
98a1ad766c163f486e79cbbc61117b9ad317747a
hvncodes/Dojo_Assignments
/Python/fundamentals/oop/bank/bankaccount.py
1,960
4
4
class BankAccount: # class attribute bank_name = "First National Dojo" all_accounts = [] def __init__(self, int_rate, balance): self.int_rate = int_rate self.balance = balance BankAccount.all_accounts.append(self) # class method to change the name of the bank @classmethod...
ce65e99629c14369889a3862f43c8d1de2f97bff
jeff-a-holland/python_class_2020_B3
/exercise_13/solution.py
2,505
4.09375
4
#!/Users/jeff/.pyenv/shims/python from queue import PriorityQueue from threading import Thread import time import random import sys def main(): """Main functin for Threadify solution""" def add(q, x, y, tuple): """Add function. Simply return the sumer of values in a tuple passed as the argume...
e4450f9468766e742cebef6289ee92cede4ab92b
copland/python_algorithms
/trees/binary_heap.py
791
3.65625
4
class BinaryHeap: def __init__(self): self.heapList = [0] self.currentSize = 0 def insert(self, obj): self.heapList.append(obj) self.currentSize = self.currentSize + 1; self.percUp(self.currentSize) def findMin(self): return self.heapList[1] def delMin(self): print "Unimplemented" # TODO fill in...
51c60d08bb50eb4b822b989bc0c44f2640636086
MP076/Python_Practicals_02
/11_While/40_counting.py
846
4.34375
4
# WHILE LOOP --- # A while loop will repeatedly execute a single statement or group of statements # as long as the condition being checked is true. # 197 current_number = 1 while current_number <= 5: print(current_number) current_number += 1 # 198 # x = 0 # # while x < 3: # print('X is currently', x) ...
224ba62ca4df8b3328c71c078471660d04326bd6
dharmesh99s/college
/python/python_practicle/39_INPUT_statment_integer_from_keyboard.py
198
4.0625
4
no1=input("enter a number 1:") no2=input("enter a number 2:") no3=input("enter a number 3:") print("you entered a no1 as:",no1) print("you entered a no2 as:",no2) print("you entered a no3 as:",no3)
521d0b2de44a0bdd8a3aaf03a14fbc2fa7559ba7
gabriellaec/desoft-analise-exercicios
/backup/user_108/ch139_2020_04_01_19_16_15_539700.py
232
3.53125
4
def arcotangente(x,n): sinal = -1 soma = x lista = list(range(3,(3+(n-1)*2)+1,2)) print(n,lista) for i in range(3,(3+(n-1)*2)+1,2): soma += (x**i/i) * sinal sinal = -sinal return soma
765990d1d63e1b1559a2b47f218d82d8c45237bd
anamhayat/dsa_prog
/dsap_toolbox/prog_dir/bconcepts_exps/DFS_easy.py
644
3.90625
4
# graph using dictionaries ''' pseudocode DFS init graph // stack is being used implicitly init visited DFS(s): s.append(visited) for w in neigbours(s): if w not in visited: DFS(w) return ''' G = {"1": ["2", "3", "4"], "2": ["1", "3"], "3": ["1", "2", "4", "5"], "4": ["1", "3", "5"], ...
5c3e0db7af2ffae626666a549f4e6ee040d6b45b
hemapriyadharshini/Text-Summarizer
/summarize.py
3,111
3.625
4
import bs4 as bs #Beautifulsoup package import urllib.request #Fetch url import nltk #Natural Language tool kit import re #Regular Expression scraped_data = urllib.request.urlopen('https://en.wikipedia.org/wiki/Machine_learning') #scrap data from web url article = scraped_data.read() #Read scraped data parsed_article =...
dff70c7f3eb2e9abb66461decf35f575822496ec
wesleyramalho/fatec-exercises
/Exemplos/hello.py
263
3.578125
4
print('Início do Programa') import random arq = open('NUMEROS.txt', 'w') for i in range(1,2001): n = random.randint(1,100000) arq.write("{}\n".format(n)) arq.close() print("{} gravados no arquivo NUMEROS.txt!".format(i)) print('Fim do Programa')
e558c1e75284ce9d96da90fe343fe3f66bb64e00
aindrila2412/DSA-1
/Queue/queue.py
779
3.90625
4
class Queue: def __init__(self): self.q = [] def is_empty(self): return len(self.q) == 0 def enqueue(self, elm): self.q.append(elm) def dequeue(self): if self.is_empty(): raise Exception("Queue is empty.") return self.q.pop(0) def top(self): ...
246efad54c515720d6435a057eb62c8abdcb2e6b
d8aninja/persCode
/pythonCookBook/sequences.py
904
3.6875
4
# for hashable types def dedupeHash(items): seen = set() for item in items: if item not in seen: yield item # generator = general purpose! seen.add(item) l = [1,2,3,3,4,3,2,2,2,1,1,1,1] dGen = dedupeHash(l) list(dGen) #dGen gets used up! # for unhashable type (like dicts/maps) ...
f44a8f3432e664cf37ea69d407a3f49ef8c5f0b9
aaaaasize/algorithm
/func/6_random.py
898
4.125
4
# 6. В программе генерируется случайное целое число от 0 до 100. # Пользователь должен его отгадать не более чем за 10 попыток. # После каждой неудачной попытки должно сообщаться, больше или меньше введенное число, чем то, что загадано. # Если за 10 попыток число не отгадано, вывести ответ. import random result = rand...
d5d0ee1ab5e339613a93777a53935b747d02329d
ogianatiempo/natasWriteups
/utils.py
479
3.578125
4
def read_passwords(file): """ Esta funcion crea un diccionario con las credenciales de cada nivel a partir de un archivo. Ver el archivo modelo natas_passwords_sample. """ credentials = {} for line in open(file, 'r'): line = ''.join(line.split()) data = [element.replace('\n', '...
49ab25716b6c7dc7d8ba0ed3d8145860812c7ae8
darshan-gandhi/Hackkerank
/diagonal diff.py
807
3.578125
4
def diagonalDifference(arr): sum1 = 0 # sum2 = 0 save = [] for i in range(n): for j in range(n): if int(arr[i][j])>=-100 and int(arr[i][j])<=100: if i == j: sum1 = sum1 + int(arr[i][j]) # print(f"the sum is {sum1}") save.append(sum1) #...
4281558a1f79d3488ca41b6efc5153b3c13b7744
LIMMIHEE/python_afterschool
/Code05-12.py
318
3.984375
4
answer = 0 num1 = int(input("첫 번째 숫자 입력하세요 : " )) num2 = int(input("두 번째 숫자 입력하세요 : " )) num3 = int(input("더할 숫자 입력하세요 : " )) for i in range(num1,num2+1,num3): answer = answer+i print(num1,"+",(num1+num3),"...+",num2,"는 ",answer,"입니다")
3a99e48a0144551f92a9f39ff7bef30358ff0f2a
LP13972330215/algorithm010
/Week01/爬楼梯.py
763
3.984375
4
import functools class Solution: """ 解题方法:1、利用F(n) = F(n-1) +F(n-2)递归,时间复杂度O(n^2)。递归 2、在1的基础上,将计算过的缓存下来,下次碰到就不在计算,直接从缓存中拿。递归+记忆化搜索。时间复杂度O(n),空间复杂度O(n) 3、动态规划,既递推。后面的将前一个覆盖。时间复杂度O(n)、空间复杂度O(1) 4、矩阵快速幂或通向公式。时间复杂度O(logn) """ @functools.lru_cache(100) # 缓存装饰器 def ...
27d3b605af7e21f1900447092d400f9760749e65
sjzyjc/leetcode
/272/272-0.py
2,002
3.703125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def closestKValues(self, root, target, k): """ :type root: TreeNode :type target: float :...
9c9f36803e5c72a87b24ffe4d77d66a8cfc78381
marcelofreire1988/python-para-zumbis-resolucao
/Lista 1/questão07.py
227
4.1875
4
#Converta uma temperatura digitada em Celsius para Fahrenheit. F = 9*C/5 + 32 tempC = int(input("insira o valor da temperatura em Celsius: ")) tempF = tempC = 9*tempC/5 + 32 print 'a temperatura em Fahrenheit de: ' , tempF
4c0dafc8cd639210dbfe3c7b52d3fcdbc916f88f
DhineshPV/function.py
/digits.py
1,317
3.84375
4
#py1_sumofdigits num =int(input()) sum=0 while(num!=0): n=num%10 #o/p_15=6 sum=sum+n num=num//10 print(sum) #PY2_reverse num =int(input()) reverse=0 while(num>0): #o/p_1505=5051 n=num%10 reverse=(reverse*10)+n num=num//10 print(reverse) ...
056079a9294e9bdfa1180b564574718fdd5167dc
anshikatiwari11/PythonPractice
/assignment.py
2,320
4.375
4
# How to reverse the function w/o using builtin function: # a = "Hello World"[::-1] # print(a) # a = [1,2,3,4,5,6,7,8][::-1] # print(a) # How to append in a list in python w/o using append builtin function: # a = [1,2,3] # b = [4,5,6] # a[:0] = b # print(a) # How to insert in list in python w/o using insert builtin fun...
49a40e58dd89d56f844e6f12d4c7b301f1ce6000
GophnaUrease/scripts
/fasta_utils.py
716
4.0625
4
''' utililties for reading and writing fasta files to / from a {header : sequence} dictionary ''' def read_file(filename): ''' read a fasta file, returns a {header : sequence} dictionary ''' sequence = {} with open(filename, 'r') as f: head = '' for line in f: if line[0] == '>': key = l...
3e647d76b2c2dd6eeca7f5e61d460743ee249087
MistyLeo12/Learning
/Python/twopointerpractice.py
1,954
3.890625
4
class Node: def __init__(self, val, next = None): self.val = val self.next = next class LinkedList: def __init__(self): self.head = Node(None) self.size = 0 def get(self, index: int) -> int: if index >= self.size: return -1 node = self.head....
779bc7be91a97ddadda28ef51d7f1ff3b0e181c2
zackfravel/Movie-Library-Graph-Generation-using-IMDb-and-Python
/Code/promptGUI.py
1,733
4
4
# Zack Fravel # ECE508 - Python Workshop # Spring 2021 # Final Project # # filename: promptGUI.py # # description: Implements a simple GUI to be used by the top level program # for taking in user information. Gives the user a directory selection dialogue # for the program to use as the media folder for gen...
2408c8e28b4bb315cac68c09a501602e50981abc
oxhead/CodingYourWay
/src/lt_41.py
2,233
3.640625
4
""" https://leetcode.com/problems/first-missing-positive Related: - lt_268_missing-number - lt_287_find-the-duplicate-number - lt_448_find-all-numbers-disappeared-in-an-array - lt_765_couples-holding-hands """ """ Given an unsorted integer array, find the first missing positive integer. For example, Given [1...
3ab6cbf680fd1c4ec82760e7f7579fb5fac92938
Tech-at-DU/CS-1.0-Introduction-To-Programming
/T010-Dictionaries-and-Code-Quality/assets/T10-WhichSong.py
529
3.9375
4
# Which Song # Step 1: Add one song to each category in the following dictionary of playlists playlists = { 'gym' : ['Eye of the Tiger', 'POWER', 'Level Up'], 'study': ['White Noise', 'ChilledCow', 'Space Ambient'], 'bbq' : ['Before I Let Go', 'Summertime', 'Outstanding'] } # Step 2: We want to make a new pl...
be6c793bf3a8ca3be2affdb32d05018df48c05eb
huangyisan/lab
/python/partialfunc.py
299
3.6875
4
from functools import partial # range(m,n) 为原函数 print(list(range(2,11))) # 将range函数中的第一个数字2冻结 par = partial(range, 2) # 至此par通过range和给定的参数2构建了一个新的函数,功能为range(2,x) # 进行内容输出 print(par(11)) print(list(par(11)))
7f61bd7b2fc81e84932b9d16dbbac6e1c6a64994
hellorobo/PyCode
/Udemy Python Mega Course/sqlite_operations.py
1,440
3.625
4
import sqlite3 def connect_database(database): return sqlite3.connect(database) def close_database(connection): connection.close() def create_table(connection, table, schema): cur = connection.cursor() cur.execute("CREATE TABLE IF NOT EXISTS " + table + " (" + schema + ")") connection.commit()...
0f9e88677be37d369dd39212c8aabe1e36e43880
MohamedAmeer/python-T2
/day8.py
2,438
4.25
4
# merge two dictionaries d1 = {'a': 1, 'b': 2} d2 = {'b': 1, 'c': 3} d1.update(d2) print(d1) # sort the list from des to ascen and convert list into set lst = ["xyz", "abc", "20", "16", "11"] print("list is:", lst) lst.sort() print("list in ascending order:", lst) set = set(lst) print("set is", set) #...
f87e2f79cf0acb4841dc5053b38560b71467061b
Harshith-S/Python-4-Everybody
/ex_13/ex_13_03.py
288
3.953125
4
#Simple Python program using JSON2 import json data = '''[ { "name" : "Harshith", "id" : "485095" }, { "name" : "Geetha", "id" : "485381" } ]''' info = json.loads(data) print("Count : ",len(info)) for item in info: print("Name : ",item['name']) print("ID : ",item['id'])
4c4a69885dfe58ebb9fad1568c44bbfbda7cc5c3
m-mburu/data_camp
/python/extreme-gradient-boosting-with-xgboost/ex1.py
5,409
4.1875
4
""" XGBoost: Fit/Predict It's time to create your first XGBoost model! As Sergey showed you in the video, you can use the scikit-learn .fit() / .predict() paradigm that you are already familiar to build your XGBoost models, as the xgboost library has a scikit-learn compatible API! Here, you'll be working with churn ...
50a6ead38b8e3a1c6517fded6a1a3659715f98be
Priya2120/loop
/que 11.py
47
3.71875
4
ch=1 while ch<=5: print("#"*ch) ch=ch+1
beb5c9454fdcb992a702ccf636c54dd8ee3b581c
candyer/codechef
/October Challenge 2019/MSV/MSV.py
1,039
3.609375
4
# https://www.codechef.com/OCT19B/problems/MSV ##################### ##### subtask 1 ##### ##################### # def solve(n, array): # res = 0 # for i in range(n): # count = 0 # for j in range(i): # if array[j] % array[i] == 0: # count += 1 # res = max(res, count) # return res # if __name__ == '__...
6e8be00a5f6be2c2e604d83b15ffc879eeed5ee2
memomora/Tarea2
/E4_S4.py
3,949
4.25
4
''' Cree una función que se llame round_sum(num_a, num_b, num_c). La función round_sum recibe 3 números enteros. Para cada uno de estos números enteros, la función debe redondearlos a la decena más cercana (ejemplo: si un número es 15, entonces se redondea a 20, pero si es 14, se redondea a 10) y luego debe sumar los n...
343f80901d29cffb561627dcbc6d12bb929e3384
TEAMLAB-Lecture/text-processing-kjy93217
/text_processing.py
3,530
3.546875
4
####################### # Test Processing I # ####################### """ NLP에서 흔히하는 전처리는 소문자 변환, 앞뒤 필요없는 띄어쓰기를 제거하는 등의 텍스트 정규화 (text normalization)입니다. 이번 숙제에서는 텍스트 처리 방법을 파이썬으로 배워보겠습니다. """ def normalize(input_string): """ 인풋으로 받는 스트링에서 정규화된 스트링을 반환함 아래의 요건들을 충족시켜야함 * 모든 단어들은 소문자로 되어야함 * 띄...
ce22e32e5f8861cfa09efe1736e92047c79d6155
Joshverge/algorithms
/mergeSort.py
587
3.765625
4
# O(nlogn) time | O(nlogn) space def mergeSort(array): # Write your code here. if len(array) == 1: return array middleIdx = len(array) // 2 lh = array[:middleIdx] rh = array[middleIdx:] return mergeSortA(mergeSort(lh), mergeSort(rh)) def mergeSortA(lh, rh): sArray = [None]*(len(lh) + len(rh)) k = i = j =...
5d55d0388f0a09e24c70f360e613555c602bc75e
jrmanrique/codingproblems
/dailycodingproblem/day_5.py
1,091
4.28125
4
"""cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4. Given this implementation of cons: def cons(a, b): return lambda f : f(a, b) Implement car and cdr. """ # Explanation: https://stac...
63e3e1f4d5612b8dce39625f005ab6bd5d06d07e
IMDCGP105-1819/portfolio-XHyperNovaX
/ex11.py
271
4.03125
4
from random import randint x = randint(0, 100) guess = x - 1 while guess != x: guess = int(input("Enter what you think the number is: ")) if guess > x: print("Too high.") if guess < x: print("Too low.") print("Correct, you got it!")
2b3d41907dd7d0c4b761d947c8a15cffc9a25245
DIdaniel/coding-training
/4-quotes/demo.py
207
3.546875
4
print("What is the quote?") print("These aren't the droids you're looking for") prompt = input("Who said it? ") prompt2 = input("tell me what he(she) says : ") print(prompt + " says " + f"'{prompt2}'")
5c6a9fec877c778e2c731c10439e3d256db1e561
hulaba/GeeksForGeeksPython
/Search/BinarySearch.py
1,295
4.125
4
class BinarySearch: def run_recursive(self, input_arr, element, left, right): if left >= right: print("Element {0} is not in the input array".format(element)) mid = left + (right - left) / 2 if input_arr[mid] == element: print("Found element {0} at position {1}".forma...
d311c4ca9b961dcd96b8186dc9bdd3bbec14d156
UG-SEP/NeoAlgo
/Python/cp/anagram_problem.py
1,372
4
4
""" Problem Statement : To find out if two given string is anagram strings or not. What is anagram? The string is anagram if it is formed by changing the positions of the characters. Problem Link:- https://en.wikipedia.org/wiki/Anagram Intution: Sort the characters in both given strings. After so...
f5e365acfce86c39ed1501e667e3371a4e07048c
Oukey/data_visualization
/scatter_squares.py
892
3.53125
4
# scatter_squares.py import matplotlib.pyplot as plt # x_values = [1, 2, 3, 4, 5] # y_values = [1, 4, 9, 16, 25] x_values = list(range(1, 1001)) y_values = [x ** 2 for x in x_values] # plt.scatter(x_values, y_values, s=40) plt.scatter(x_values, y_values, c=y_values, cmap=plt.cm.Blues, edgecolors='None', s=40) # На...
429369b5cc9f2840e6f35f139c64cdf5920d2e67
MilkUndPanis/MilkUndPanis-Python-Exercise-2019.6.27-2020.2.15
/Exercising/glass/glass.py
5,573
3.828125
4
import math as m EAST=0 SOUTH=270 WEST=180 NORTH=90 A_TURN=90 GLASS_WIDTH=40 HALF_WIDTH=20 GLASS_HEIGHT=30 HALF_HEIGHT=15 import turtle turtle.hideturtle() turtle.pensize(3) turtle.speed(0) turtle.penup() turtle.goto(50,50) turtle.pendown() turtle.setheading(EAST) turtle.forward(GLASS_WIDTH) turtle....
f4f1780adb44e6bd7daadc70b3e22ef814e3b342
capJavert/advent-of-code-2016
/5-day.py
733
3.515625
4
from hashlib import md5 def is_numeric(string): try: int(string) except: return False return True def main(): password_size = 0 password = ["_", "_", "_", "_", "_", "_", "_", "_"] door_id = "abbhdwsy" index = 0 while password_size < 8: m = md5() stri...
1e8406743d6752ab3b44f95ab0fa398feac54638
a1379478560/offer-python
/反转链表.py
546
4
4
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # 返回ListNode def ReverseList(self, pHead): # write code here if not pHead or not pHead.next: return pHead pre=pHead pHead=pHead.next...
db83d0520e8c0ce8c6ae6a083d70a530b40bfbde
YangLiyli131/Leetcode2020
/in_Python/0025 Reverse Nodes in k-Group.py
1,741
3.671875
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def rev(self, head): pre = None nex = None cur = head while cur: nex = cur.nex...
c1720754ba312fa8d6a4dfe56a5d29d8f1e14d8e
rodrigocamargo854/Some_codes_python
/COORDENADA_9ANO.py
523
3.65625
4
titulo= "GERADOR DO GRÁFICO DE UMA FUNÇÃO" soma = 0 print("=" *80) print(titulo.center(70)) print("=" *80) import matplotlib.pyplot as grafico x = [] y =[] num = int(input(" Digite numero de coordenadas para x e para y\n")) for i in range (0,num): coodx = int(input(" digite a coordenada para x\n...
1bf089da861a1a7e57ccf4103091e3056bc8bda2
htmlprogrammist/kege-2021
/tasks_19-21/homework/zadanie_20_130920-automized.py
233
3.546875
4
end_of_interval = 200 x = 1 answer = 125 while x <= end_of_interval: # x = int(input()) L = 17 M = 70 while L <= M: L = L + 2*x M = M + x if L == answer: print(x) x += 1
abf4c295fbfe1594631121d6539f4ff91d3491b9
SkyBulk/bigb0ss-RD
/python_learning/w3resource/basics/basic_1-10.py
302
3.9375
4
# 10. Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. # Sample value of n is 5 # Expected Result : 615 num = int(input("[*] Enter the number: ")) num1 = int("%s" % num) num2 = int("%s%s" % (num,num)) num3 = int("%s%s%s" % (num,num,num)) print(num + num2 + num3)
2aa58a44011362aa580ef38409fa0c52d497d1a7
jaarmore/holberton-system_engineering-devops
/0x16-api_advanced/2-recurse.py
973
3.609375
4
#!/usr/bin/python3 """ Recursive function that queries the Reddit API and returns a list containing the titles of all hot articles for a given subreddit. """ import requests def recurse(subreddit, hot_list=[], after=''): """ Recursive function that queries the Reddit API. Args URL: url of the API...
9e3b454f2262af1b37cffcf1f6d77b3c8e437f05
fernandochimi/Intro_Python
/Exercícios/053_Contagem_Cedulas.py
609
3.8125
4
valor = int(input("Digite o valor a pagar: ")) cedulas = 0 atual = 100 a_pagar = valor while True: if atual <= a_pagar: a_pagar -= atual cedulas += 1 else: print("%d cédula(s) de R$ %d" % (cedulas, atual)) if a_pagar == 0: break if atual == 100: atual = 50 elif atual == 50: atual = 20 elif atua...
6a6d4313b655a9d5ac34bb9f8dc45652d1f6502a
Rulowizard/Homework-Week-3-python-challenge
/PyPoll/main.py
1,724
3.59375
4
import os import csv csvpath = os.path.join("election_data.csv") num_votos=0 #Declaro un diccionario nulo cand={} with open(csvpath,"r") as csv_file: csvreader= csv.reader(csv_file, delimiter=",") csv_header = next(csvreader) #Creo lista de candidatos candidatos= list( set( [candidato[2] for candida...
09795245970efd7c64f5a2b158d621d93a0fa5d8
vivekpapnai/Python-DSA-Questions
/Binary Search Tree/NodetoRootPath.py
1,872
3.734375
4
import queue from sys import stdin class BinaryTreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def NodetoRootPath(root,x): if root is None: return None if root.data == x: li = list() li.append(root.data) ...
6fb33625c14de399b441091ea7a154fa0053ccf3
kajj8808/DjangoStudy
/Arguments.py
706
3.703125
4
def plus(a , b): return a + b #종종 파이썬에서 함수에 무제한으로 arguments 를 넣고싶을때. #첫번째 방법은 *args 를 써놓는것. # 이렇게하면 tuple 로 return def plus_args(a , b , *args): print(args) return a + b #무한정으로 keyword argument 를 사용하고싶을때면. ** 은 꼭붙혀야함. def plus_args_infinity(a , b , *args , **kwargs): print(args) print(kwargs) return a + ...
50cd97efa2821e47c68d34e32fab15c3fc629d45
danWalt/automate_the_boring_stuff_selfprojects
/CSV/excel2csv/excel2csv.py
1,502
3.609375
4
#! python3 # excel2csv.py filters a directory for excel files and saves each sheet in # an excel file as a separate CSV file import openpyxl, csv, os os.makedirs('csvFiles', exist_ok=True) for excelFile in os.listdir('.'): excel_file_name = excelFile[:len(excelFile) - 5] # Skip non-xlsx files, load the work...
7154fbc21ae802534748bfbd47221cb772ccdaef
OlavBerg/Text_based_python_game
/help_functions.py
901
3.59375
4
import operator def reverseDirection(direction: str): if direction == "n": return "s" elif direction == "e": return "w" elif direction == "s": return "n" elif direction == "w": return "e" else: print("Error: Invalid direction.") return False def doub...
02e75b45374d35a2a8862dee62f817cc4850cedd
DKU-STUDY/Algorithm
/BOJ/solved.ac_class/Class02/11050. 이항계수/sAp00n.py
146
3.5
4
from math import factorial as f n, k = map(int, input().split()) if k < 0 or k > n: print(0) else: print(int(f(n) / (f(k) * f(n - k))))
6eba254ae9d58e9ed60dee2430a422150282bbe4
LeeDongGeon1996/co-te
/book/[구현-pt1] 상하좌우.py
662
3.5625
4
# solution: 상하좌우를 배열로 만들어 순회하며 입력된 경로와 비교한다. # time-complexity: O(N) - 선형시간 direction = ['L', 'R', 'U', 'D'] move_x = [-1, 1, 0, 0] move_y = [0, 0, -1, 1] x_pos = 1 y_pos = 1 # start_input N = int(input()) path = input().split() # end_input for i in path: for j in range(len(direction)): if i == direction[...
a25adbead415aad3d9c7d54c024912aa14844489
montaro/leetcode-python
/arrays_strings/2973_most_common_word.py
1,125
3.609375
4
from typing import List def clear_symbols(text: str) -> str: symbols = '!?\',;.' for symbol in symbols: text = text.replace(symbol, " ") return text s = clear_symbols("Ahmed ?and??Doaa!!").split() print(s) class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:...
323e9861a0389a1c50f1a16ccad97ace57037638
CoderTitan/PythonDemo
/PythonStudy/8-银行系统和thinter/1-银行自动提款机系统/ATM.py
6,458
3.578125
4
from Users import Users from Card import Card import random class ATM(object): def __init__(self, allUsers): # 所有用户 self.allUsers = allUsers # 1.开户 def creatUser(self): name = input('请输入姓名:') idCard = input('请输入身份证号:') phoneNum = input('请输入手机号:') money = i...
97256e4594bbbe596db6783088527f3099bfdc86
nithinp300/subscription-tracker
/main.py
1,324
3.875
4
import subscription my_subs = subscription.Inventory() userChoices = "(a) add, (r) remove (t) total (p) print (e) exit" userInput = "" while userInput != "e": userInput = input(userChoices+"\n") if userInput == "a": subType = input("monthly(m), yearly(y) or one-time(ot) subscription?:") subNam...
f7371997cadc5a88dceda9fc4ba4bb3d170b253a
calendula547/python_fundamentals_2020
/python_fund/list_advanced/next_version.py
343
3.609375
4
version = list(input().split(".")) def greater_num(num_list): int_version = int("".join(num_list)) next_version = int_version + 1 result_version = [int(x) for x in str(next_version)] return result_version next_version_result = (greater_num(version)) print('.'.join(str(el) for el in next...
1f62b8ecd51bb9b7bb696af7df264709fcc8d8d4
TengXu/CS-2015
/CS 111/ps9/ps9pr3.py
1,027
4.0625
4
# Name: Teng Xu # E-mail: xt@bu.edu from ps9pr2 import Date def get_age_on(birthday, other): """ accepts two Date objects as parameters: one to represent a person’s birthday, and one to represent an arbitrary date. The function should then return the person’s age on that date as an integer """ ...
2699efa3a987b4c20d54ab33ecd1a233597c7f6c
kjkjv/python
/실습문제.py
63,276
3.875
4
#1번 g = input("거리 : ") s = input("속도 : ") total = int(g) / int(s) print(total) #2번 g = input("거리 : ") n = input("너비 : ") m = int(g)*int(s) print(m) d = (int(g)*2) + (int(n)*2) print(d) #3번 h = input("화씨 : ") s = (int(h)-32)/1.8 print(s) #4번 a = input("a : ") b = input("b : ") print(("덧셈 :",...
873bea103c835e6909ec9e92350d7693c4d7bbb0
nadineo/python
/ex9/RLEString.py
1,588
4.03125
4
import re from re import sub class RLEString(object): def __init__(self, string): #check if the string is valid if not re.match('^[a-zA-Z]+$',string): raise ValueError("Text has to consist of alphabetic characters (a-zA-Z))") else: self.__mystring = string self.__iscompressed = False def compress(s...
2ca35001b54ed6ce402290382394f628d35b25f3
Aternumm/python_tasks
/hw4_tsk2.py
291
4.0625
4
x = int(input("Введите Х ")) y = int(input("Введите У")) if x >= 0 and y >= 0: print("В 1 четверти") elif x >= 0 and y <= 0: print("В 4 четверти") elif x <= 0 and y <= 0: print("в 3 четверти") else: print("Во 2 четверти")
60390ca3dd4ef0e199ec902a23f499caf787c461
bananasfourscale/Journal_Assistant
/Journal/JournalEntry.py
1,766
3.546875
4
#!/usr/bin/env python """Base Class representing all types of Journal Entires that can be added to the journal""" class JournalEntry: """ Represents a journal entry which is the base class used by many other types of entires that can be added to the Journal Attributes: name(str): string w...
b6403443d057dfc2448e6338781c60f346c4a21e
yannhamdi/n.projet7
/p7app/parsing.py
2,113
3.640625
4
#!/usr/bin/python3 # -*- coding: Utf-8 -* """module that will parses the sentence""" from p7app.stopword import stop_words class SentenceParse: """our class that will creates all the methods needed for parsing the sentence""" def __init__(self): "we initialize the attribute stop words...
952188160ab25e04a7cdd349eded56bf07318d24
mathans1695/Python-Practice
/codeforces problem/petyaandstrings.py
126
3.765625
4
first, second = input().lower(), input().lower() if first < second: print(-1) elif second < first: print(1) else: print(0)
2f42978e87807665a4ad38900fda393c715a2316
knu2xs/setup-course-event
/setupClass.py
3,298
3.609375
4
''' Name: setupClass Purpose: Copies all class materials from a location storing all materials for a specific class to C:/student/<class>. In this directory the script will create three directories. ./<class>_dataStudent ./<class>_dataD...
a11531e47d76e0e89fd77ca184d5bc49d84968d2
dpedu/advent2018
/1/b.py
376
3.640625
4
#!/usr/bin/env python3 def main(): total = 0 seen = {} with open("input.txt") as f: numbers = [int(i) for i in f.readlines()] while True: for number in numbers: total += number if total in seen: print(total) return see...
1720dff055b265a6e6a3d3934860e7c66bb566e8
Prakashchater/Daily-Practice-questions
/Arrays/Remove elements.py
257
3.78125
4
def removeElement(nums): count=0 for i in range(len(nums)): if nums[i] != val: nums[count] = nums[i] count+=1 return count if __name__ == '__main__': nums=[3,2,2,3] val= 3 print(removeElement(nums))
e1d8758ec9831152337e1cbb98cbe3f3cd413e1c
PyRPy/stats_py
/math_py/Ch01_polygons_turtle.py
283
4.3125
4
# chapter 1 drawing polygons with the turtle module # import module from turtle import * # moving turtle # forward(100) # shape('turtle') # changing directions # right(45) # forward(150) # square dance shape('turtle') for i in range(4): forward(100) right(90)
34fe75ff0de6fe6df5f9edde343119a0b4460687
rajesh-cric/pythonchallenges.py
/code1.py
136
4
4
first=input("enter your first name: ") last=input("enter your last name: ") print('NAME: '+first.capitalize()+' '+last.capitalize())
b1652db2d60742f33af54d057fb26c4aefe0505c
msGenDev/Python-SiteMap-Generator
/crawler.py
2,872
3.578125
4
from BeautifulSoup import BeautifulSoup, SoupStrainer import re import urllib2 website = input('Enter full website domain as quoted string: ') uniqueURLS = [] #Return list of clean string urls from given clean string website url def getLinks(website): hierarchy = [website] uniqueURLS.append(website) linkl...
193513f098e82cc77a1cf6b2fb4366c65138173f
wang10517/Algorithms
/leetcode/easy/083 - delete duplicate list.py
553
3.671875
4
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: if head is None: return None result = ListNode(head.val) cur...
bfb739f13dba710201f1d0ab23f4ba81299ef1dd
iglidraci/functional-programming
/monads/maybe.py
1,213
3.671875
4
class Maybe(object): def __init__(self, value): self.value = value @classmethod def unit(cls, value): return cls(value) def map(self, f): if self.value is None: return self # forward the empty box new_value = f(self.value) return Maybe.unit(new_val...
67568b08aaa35cbc39915fd06fb6cedbb9b75979
gv1010/Algorithms-and-Data-Structures-Leetcode-
/Recursion/CountWays.py
145
3.796875
4
def countingWays(M,N): if M == 1 or N == 1: return 1 return countingWays(M-1, N) + countingWays(M, N-1) M = 3 N = 3 print(countingWays(M,N))
74876883128a3d8059ab1909fab6dfcd09975d42
estherica/wonderland
/Lessons/targil3.py
554
3.71875
4
a="estherica" b=32 c="belleshamharoth" print("Full name: estherica \nMy age: 32 \nMy nickname: belleshamharoth") print("Full name: " + a + "\nMy age: " + str(b+2) + "\nMy nickname: " + c) d=''' My name is Estherica I love art Follow me on instagram esthericas ''' print(d) print("p1={},p2={},p3={},p4={red}".format(1, ...
45189e613a591f5ffdd8820f255ccb3e812313fb
ChJL/LeetCode
/easy/225. Implement Stack using Queues.py
1,858
4.03125
4
#Tag: Stack ''' Implement a last in first out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal queue (push, top, pop, and empty). Implement the MyStack class: void push(int x) Pushes element x to the top of the stack. int pop() Removes the element on the top of t...
9ca446357382f2cf4d1b60efa7795cc883c47b93
AparaV/project-euler
/Problem 065/Problem_065.py
551
3.59375
4
''' Problem 065: Convergents of e Author: Aparajithan Venkateswaran ''' from time import time ''' By writing out the fractions, we can deduce the following pattern: n(k+1) = a(k) * n(k-1) + n(k-2) ''' def answer(): d = 1 n = 2 for i in range(2, 101): temp = d c = 1 if i % 3 == 0: c = 2 * int(i / 3) ...
25eced7cd1a1ca2f4858cd02c0ba625f0c45788c
text007/learngit
/15.函数结构/5.遍历技巧.py
902
3.671875
4
# items() 方法可以同时解读字典遍历中关键字和对应的值 knig = {'a':'1', 'b':'2'} for k, v in knig.items(): print(k, v) print('---------------------') # enumerate() 方法可以同时解读序列遍历中关键字和对应的值 for i, v in enumerate(['a','b','c']): print(i, v) print('---------------------') # zip() 同时遍历两个或更多的序列 que = ['a','b','c','d'] ans = ['1','2','3'...
abed592990fbb7f7d23c7afa1b1c6b523a4fec40
igortereshchenko/amis_python
/km73/Zviahin_Mykyta/5/task2.py
342
3.828125
4
massive = [] n = int(input("Lenght of the massive: ")) for i in range(n): new_element = int(input("Enter an element: ")) massive.append(new_element) massive.sort() counter = 0 for i in range(len(massive)-1): if massive[i] == massive[i+1]: counter += 1 print("Number of pairs: ", counter...
35597c251cb9f8f6642ccb52a95c60d44493ae41
CameronMBrown/Pirple-Python-Course
/fizzbuzz.py
791
4.21875
4
#Pirple Assignment 5 - loops # classic fizzbuzz problem with the addition of finding prime numbers # isPrime is not maximally optimized def isPrime(num): if num > 1: for i in range(2, num): if num % i == 0 : # mod = 0 implies this is not a prime return False return True #if we have ...