blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
0841a731df7c492819267af739a51675eff73436
oguipcj/ListaDeExercicios
/EstruturaDeDecisao/7.py
3,008
4.25
4
# 7. Faça um Programa que leia três números e mostre o maior e o menor deles. primeiro_numero = float(input("Digite o primeiro número:")) segundo_numero = float(input("Digite o segundo número:")) terceiro_numero = float(input("Digite o terceiro número:")) if primeiro_numero == segundo_numero and segundo_numero == ter...
4793dfc338f66ac4fd66f3b43d4785eb82842a32
XihangJ/leetcode
/BFS/463. Island Perimeter.py
2,045
3.703125
4
''' You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). The isl...
22e99c6dcdf463a4dd3a06f797c57b136529e5ff
yuxluo/umtri_label
/XDG_CACHE_HOME/Microsoft/Python Language Server/stubs.v1/M2KcDmVDYL_Yq1CJMCom4n3OUETWJLIvUfy8ZvHg0Zw=/python3._elementtree.pyi
5,923
3.703125
4
class Element(object): __class__ = Element def __copy__(self): pass def __deepcopy__(self, memo): pass def __delitem__(self, key): 'Delete self[key].' return None def __getattribute__(self, name): 'Return getattr(self, name).' pass ...
7d4ff1656699d4f507c8a6892e917fc30fbce73b
Anuvrat-Singh/SeleniumWD_Python
/Practice/classesAndObj.py
551
3.703125
4
class fruit(): def __init__(self): print("fruit created") def nutrition(self): print("This is a nutritiuos fruit") def fruit_shape(self): print("The fruit is cylindrical") class kiwi(fruit): def __init__(self): super(kiwi, self).__init__() print("Kiwi is create...
eab81bbc5c4abeb93569572f6b23f4bc4b4f7992
tony148565/BPlusTree
/main.py
3,719
3.53125
4
from Bplustree import Bplustree import csv fn = "C:/Users/user/PycharmProjects/bptree/output_big5.csv" # output_big5.csv # test.csv def build(a, b): with open(fn) as csvFile: csv_reader = csv.reader(csvFile) lists = list(csv_reader) csvFile.close() lists.remove(lists[0]) #...
3a4b50731f55c808cb779f73a7eb045a4acb0bc4
jochumb/adventofcode
/2019/python/03.py
1,706
3.5625
4
def part1(wires): paths = [path(wire) for wire in wires] intersections = list(set(paths[0]) & set(paths[1])) manhattans = [abs(i[0]) + abs(i[1]) for i in intersections] return min(manhattans) def part2(wires): paths = [path(wire) for wire in wires] intersections = list(set(paths[0]) & set(paths...
5353968fce6015ec3f0be46381f56fc238ac32f2
EonKid/HackerrankProblemSolving
/migratoryBirds.py
600
3.6875
4
#!/bin/python import math import os import random import re import sys # https://www.hackerrank.com/challenges/migratory-birds/problem def migratoryBirds(arr): arr_types = [0]*5 for type in arr: count = arr_types[type-1] count += 1 arr_types[type-1] = count return arr_types.index(m...
6f41f85494878ba603cc1ec18df79ab17106dc41
PMiskew/Year9DesignTeaching2020_PYTHON
/Simple_Game_Example/game_stage_clicklocation.py
1,968
4.09375
4
import tkinter as tk import tkinter.font as tkFont #Binding Source Link #https://www.python-course.eu/tkinter_events_binds.php def motion(event): print("Mouse position: (%s %s)" % (event.x, event.y)) def click(event): print("click") x = event.x y = event.y if not(100 < x < 200 and 100 < y < 200): print("o...
f0e008b24a72712c5f07c797da15002c350235c9
KimYeong-su/sw_expert
/D3/exponential1217.py
260
3.53125
4
def expo(number, Many): if Many == 1: return number return number*expo(number,Many-1) cases = 10 for case in range(cases): n = int(input()) num, m = map(int, input().split()) result = expo(num, m) print(f'#{case+1} {result}')
416210c6fc7f394a82e7e06e44a8de9a94e21427
sunrain0707/python_exercise_100
/ex12.py
260
3.609375
4
#12.判断101-200之间有多少个素数,并输出所有素数。 import math x = True for i in range(101,200): for j in range(2,int(math.sqrt(i))+1): if i%j == 0: x = False if x == True: print(i) x = True
7b77226958cc484adbb8e8dfd3a51530cc3e9431
Mukesh010/Python-Programs
/Formula Validation.py
3,416
4.03125
4
# We used Topological sorting for validation of given equations in formula. # This Topological sort function provides order of nodes in a Directed Graph based on dependency and empty list if a cycle is present # We took input of equations and created a dictionary ‘dic’ according to dependency # e.g. Followings are inpu...
36d31c608750b0f412f801df82881c0a07e6acd8
8589/codes
/python/leetcode/tests/ladder_length.py
3,544
3.640625
4
def is_diff_one(str1, str2): diff_sum = 0 for i in xrange(len(str1)): if str1[i] != str2[i]: diff_sum+=1 if diff_sum >= 2: return False return True def find_diff_one_indexes(begin_word, word_list, exclude_indexs): result = [] for i in xrange(len(word...
0821ea685e34767ab7e0bcc869231163fcc487e3
csdu/coding-club-sessions
/2021-02-14-recursion-basics/binary_search.py
1,227
3.84375
4
# Simple Iterative Binary Search def binary_search(a: list, k: int) -> bool: low, high = 0, len(a) - 1 while low <= high: mid = (low + high) // 2 if a[mid] == k: return True elif a[mid] > k: high = mid - 1 else: low = mid + 1 return False ...
b961dce59fa89f13944205a68f71e6e34977b02c
lalitkar/work
/func2.py
154
3.90625
4
def add(): a=10 b=20 c=a+b #return c #print('after') #return #return [a,b,c] return (a+b)/(b-a) i=add() print(i)
1212b8c618d0eb15b8f66a9d34c07e84910bb124
QWCD12/TIC-TAC-TOE
/tic_tac_toe.py
1,547
4.0625
4
# Set up environment board = [a1:'', a2:'', a3:'', b1:'', b2:'', b3:'', c1:'', c2:'', c3:''] # Winner variable used to stop the program winner = 0 # Set up winning environments def win(): if board[a1] == board[b2] and board[b2] == board[c3]: print( str(board[a1]) + "'s wins.") winner += 1 re...
54a1144c00646a0f91900ce63082335db2db1478
jinurajan/Datastructures
/LeetCode/top_interview_qns/easy/reverse_integer.py
1,096
4.0625
4
""" Reverse Integer Solution Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−...
31c8151663e8f9c68a6eb4d9be6808cf60c1b298
max180643/PSIT-IT
/Week-10/AlmostMean.py
561
3.59375
4
""" AlmostMean Author : Chanwit Settavongsin """ def main(total, data, avg, answer): """ Find who almostMean """ for _ in range(total): # store data temp = input().split("\t") data[temp[0]] = temp[1] for j in data: # find average avg += float(data[j]) avg = avg / total value ...
08cf04137dc9e7c444c728901be44f34b9bc6ed0
cog-isa/htm-rl
/htm_rl/htm_rl/agents/q/balancing_param.py
769
3.640625
4
class BalancingParam: value: float min_value: float max_value: float delta: float negative_delta_rate: float def __init__( self, initial_value: float, min_value: float, max_value: float, delta: float, negative_delta_rate: float, ): self.value = initial_value ...
a36cc45966123693a8a6b6e8916b77cb57200a36
dulatemesgen/module-10
/class_definitions/tests/test_students.py
2,006
3.65625
4
""" Author: Dula Temesgen program: students.py testing student class """ import unittest from class_definitions import students as s class MyTestCase(unittest.TestCase): def setUp(self): self.student = s.Student('Temesgen', 'Dula', 'Maths', 4.0) def tearDown(self): del self.student def ...
daa67f9b5dc7c7157a887a776577125ba5ff4b29
pk1397117/python_study01
/study01/chap03/Demo05.py
478
3.96875
4
# 布尔运算符 print("-------与-------") print(True and True) print(True and False) print(False and False) print("-------或-------") print(True or True) print(True or False) print(False or False) print("-------非-------") print(not True) print(not False) print("-------in-------") s = "HelloWorld" print("W" in s) print("k" in s) ...
454765fd74e18f4bdfd58dc1df6aaedcb8a56819
RafaelMuniz94/Primeiros-Passos
/Exercicios/Aula/ex1Aula.py
314
4.0625
4
# fibonacci # 1,1,2,3,5,8 .... # Resolver de forma Recursiva: def fibonacci(numero): if numero == 1 or numero == 2: return 1 return fibonacci(numero - 1) + fibonacci(numero - 2) #print(fibonacci(6)) resposta = [] numero = 8 for p in range(1,numero + 1): resposta.append(fibonacci(p)) print(resposta)
7157f20e3565c8ec175b673725fd2073ad8ae33e
fennieliang/week3
/lesson_0212_regex.py
1,082
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 25 14:40:57 2021 @author: fennieliang """ #useful links for regular expression #http://python-learnnotebook.blogspot.com/2018/10/python-regular-expression.html #https://www.tutorialspoint.com/python/python_reg_expressions.htm #regular expression i...
598a83bd56d9a7bda8e453482602fa185f6bfbd5
RUSTHONG/RosalindProblems
/1-21/10_ConsensusAndProfile/ConsensusAndProfile.py
2,368
3.875
4
""" Problem A matrix is a rectangular table of values divided into rows and columns. An m*n matrix has m rows and n columns. Given a matrix A, we write Ai,j to indicate the value found at the intersection of row i and column j. Say that we have a collection of DNA strings, all having the same length n. Their profil...
9672539eebfeb187227d5e075efb4cb5f3f115b6
ezhang315/cs-110
/lab-4-cwolosh1/lab4.py
8,925
3.984375
4
''' Estimates pi using Monte Carlo simulation Virtual Dartboard has area 2 X 2 to accommodate unit circle Total area is 4 Therefore, since area of unit circle = pi * radius^2 (and radius of 1 squared is 1), ratio of area of unit circle to area of board should be pi/4 Theoretically, if you fill the entire board wit...
ad20fc4f7a94bfaf03582323dd06306d7f4362f0
AnikethSDeshpande/Order-Management
/order_management/order/test_order.py
878
3.609375
4
import unittest from order_management.order.order import Order from order_management import CATALOGUE class Test_Order_Creation(unittest.TestCase): def test_order_creation_1(self): order1 = Order() self.assertEqual(order1.order_id, 0) order2 = Order() self.assertEqual(order2.order...
2eda781017aaf6df04a2b755885017521d3d7e0b
wendelcampos/python-desafios-cursoemvideo
/ex098.py
753
3.6875
4
from time import (sleep) def linha(): print('-=-' * 20) def contador(i, f, p): if p == 0: p = 1 if i < f: print(f'Contagem de {i} até {f} de {p} em {p}') for c in range(i, f+1, p): print(c, end=' ', flush=True) sleep(0.5) print('FIM!') if i > f...
80f900ac334c6170c524edfbfb3984694f145950
sk-coder/HackerRank_Challenges
/Python/NewYearChaos2.py
2,464
3.71875
4
#!/usr/bin/python import math import os import random import re import sys # Complete the minimumBribes function below. def minimumBribes(arr): arr_len = len(arr) is_valid = 1 bribes = 0 in_order = 1 idx_sum = 0 val_sum = 0 last_match = 0 # Test for a too long array ...
b39a5d32d9d79125cedb8a3147f70632a5be56bd
wscheib2000/CS1110
/higher_lower_player.py
1,305
4.15625
4
# Will Scheib wms9gv """ Plays a guessing game where the computer guesses a user-selected number between 1 and 100. """ print("Think of a number between 1 and 100 and I'll guess it.") num_guesses = int(input("How many guesses do I get? ")) lower_bound = 0 upper_bound = 101 while num_guesses > 0: answer = input("...
17931ab709720975d89b6dcb37cbb9ac2c12a296
seyedmm/pythonestan
/alarm/alarm.py
560
3.53125
4
from winsound import Beep from time import localtime, strftime, sleep import keyboard alarm_time=input("What time does the alarm sound?(Enter it in 24-hour format like 05:13 or 00:15):") text = input("If your alarm has text, enter it:") pattern = "%H:%M" while True: now = strftime(pattern, localtime()) if no...
d7ded8761703fed2f75c48429bedee098799351d
junteak/subjectC
/C-7.py
1,885
4.28125
4
''' C-5,6, ''' # C-1. フルネームを取得できる class Customer: def __init__(self, first_name, family_name, age): self.first_name = first_name self.family_name = family_name self.age = age def full_name(self): print(self.family_name + ' ' + self.first_name) def entry_fee(self): ...
b5c12e2bbb870aca3d24a2e786856190b1592eea
stellakaniaru/practice_solutions
/manipulate_data.py
349
4.0625
4
''' Create a function that takes in a list of numbers and returns the sum total of negative numbers and the number of positive integers in the list. The output should be in a list. ''' def manipulate(a): totalP = 0 totalN = 0 if type(a) is list: for i in a: if i >= 0: totalP += 1 else: totalN += ...
30564b98097b9b855a82ee8c67a0d7b23b307875
athulyakv/basic-python-program
/program_3.py
105
3.671875
4
'''write a program to get the sum of all the no.s in a list''' list= [1,2,3,4,5,6,7] print(sum(list))
d42ae7760aff0f8c10a551b8e4dcf05a42669318
yatingupta10/Coding-Practice
/LeetCode/461_Hamming_Distance.py
285
3.546875
4
class Solution(object): def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ binx = '{0:032b}'.format(x) biny = '{0:032b}'.format(y) return sum([1 for x,y in zip(binx,biny) if x!=y])
7b564dec41eb7e97dbdd70642eb916fa8b9539d7
crawsome/Python-programming-exercises
/100q/question_067/hint067.py
269
4.25
4
"""Hint 067 We can define recursive function in Python. Use list comprehension to generate a list from an existing list. Use string.join() to join a list of strings. In case of input data being supplied to the question, it should be assumed to be a console input. """
ccc61f4fab2d41f66ea20ce608c84d77309197a6
NoobsZero/DesignMode
/automation/ algorithm/sort/InsertionSort.py
1,014
4.3125
4
# encoding: utf-8 """ @file: InsertionSort.py @time: 2021/7/8 14:39 @author: Chen @contact: Afakerchen@em-data.com.cn @software: PyCharm """ def insertionSort(A): """ 插入排序 Args: A: 数组 Returns:升序数组 """ # 初始化:第一次循环迭代之前(当j=2时),循环不变式成立 # j[1,2,...,N-1] for j in range(1, len(A...
4d779f3c0fb0bcac2059a3c3f72bcad355d59b03
A-Alexander-code/150-Python-Challenges--Solutions
/Ejercicio_N041.py
215
4.09375
4
num = int(input("Ingrese un número: ")) if num <= 10: name = input("Ingrese su nombre: ") for i in range(0,num+1): print(name) else: for j in range(0,3): print("Demasiado alto")
95893be438a389e00c0e67efff2cd40a658012fb
JJWSSS/exercise
/filtered_words.py
674
3.734375
4
__author__ = 'JJW' # -*- coding: utf-8 -*- import re def filtered_words(word): with open('filtered_words.txt', 'r', encoding='utf-8') as f: s = f.read() words = re.split(' |\n', s) print(words) for fword in words: print(fword) if word.__contains__(fword): ...
2618367c571003d76373b5d64615e8c68d132b03
kaust-cs249-2020/MOHSHAMMASI-CS249-BIOINFORMATICS
/Chapter-7/ChromosomeToCycle_section12.py
867
3.609375
4
def read_input(filename): try: input_file = open(filename, "r") chromosome = input_file.readline().rstrip('\n') chromosome = chromosome[:-1] chromosome = chromosome[1:] chromosome = [int(i) for i in chromosome.split(" ")] input_file.close() except: print...
802cc01e6ffc3325df9cafc9a9e1c29e813b877e
Riskybiznuts/it-python
/zipcode.py
1,022
3.953125
4
from banner import banner banner ("ZIP CODE SORTER", "Brad") print("Welcome to the Newaygo County zip code sorter.") go_again = True while go_again: zipcode = int(input("Please enater a zip code: ")) if zipcode == 49309: print("The zipcode 49309 is for Bitely.") elif zipcode == 49312: p...
2b571a348218d28e59149c0371e01cee42f011fc
beidou9313/deeptest
/第一期/广州-Roger/task2/error01.py
763
3.546875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-01-23 17:33:47 # @Author : Roger TX (425144880@qq.com) # @Link : https://github.com/paotong999 # @Version : $Id$ import os,time import re # 定义函数 def temp_convert(var): try: return int(var) except (ValueError) as Argument: prin...
30f39a52e1ce8ec5419c3b43630dfa5d58b17c3f
ttyskg/ProgrammingCompetition
/AtCoder/ABC/035/d.py
1,350
3.53125
4
import sys from heapq import heappush, heappop, heapify def dijkstra(s, links): """Dijkstra algorism s: int, start node. t: int, target node. links: iterable, link infomation. links[i] contains edges from node i: (cost, target_node). return int, minimal cost from s node to t node. ...
ef65b3c70fda21b66833f10295da1851140d638e
officialGanesh/Guess-My-Number
/main.py
711
4.0625
4
# import the required module from random import randint Secret_number_range = int(input("Enter the range of secret number --> ")) def playerGuess(Secre_number_range): secret_number = randint(1, Secret_number_range) player_guess = 0 count = 0 while player_guess != secret_number: player_guess = ...
2826bb57d4af9caa338a68659b16d67ef258e671
eselyavka/python
/leetcode/solution_213.py
871
3.765625
4
#!/usr/bin/env python import unittest class Solution(object): def _rob(self, nums): dp = [0] * len(nums) res = 0 for i in range(len(nums)): res = max(nums[i]+(dp[i-2] if i >= 2 else 0), (dp[i-1] if i > 0 else 0)) dp[i] = res return res def rob(self, n...
e1bc10063075d65d8273d74e1e9f9c72e877426f
vishrutkmr7/DailyPracticeProblemsDIP
/2023/03 March/db03282023.py
630
4.03125
4
""" Given two non-negative integers low and high, return the total count of odd numbers between them (inclusive). Ex: Given the following low and high… low = 1, high = 3, return 2 (1 and 3 are both odd). Ex: Given the following low and high… low = 1, high = 10, return 5. """ class Solution: def countOdds(self,...
5ea7a6930208fed56c08f85f0f40cd92c795c8c9
mahdi00021/Twitter_and_Locations_gis
/tweeter_crawler/factory/IFactorySocial.py
371
3.5625
4
""" this class is interface for implement factory pattern""" import abc class IFactorySocial(metaclass=abc.ABCMeta): @staticmethod def read_and_save(request): pass @staticmethod def save_images(request): pass @staticmethod def read_data_from_mongodb(): pass @sta...
d3d0d7f317264b773af5dd3b2c534822a84bdac4
vinayak906/whatsapp_spam_bot
/spam_bot.py
1,193
3.65625
4
from pyautogui import press,sleep,hotkey,confirm,prompt,typewrite FAILSAFE = False sleep(1) con=confirm(text='Please make sure whatsapp is installed in your system and login your whatsapp account ',title="Confirmation promt",buttons=['Continue','Quit']) if con=='Continue': press("win") sleep(.2) ty...
b467a7a15bf0dcd523a7de566ed85f0db1c76a9e
kuzin2006/codewars
/encrypt.py
332
3.890625
4
def encrypt_this(text): return " ".join(filter(None, [''.join([str(ord(word[0])) if len(word) else '', word[-1] if len(word) > 1 else '', ''.join([word[2:-1], word[1]]) if len(word) > 2 else '']) for word in text.split(" ")])) \ if text else '' print(encrypt_this...
ddafeb652804ec6307ec4f6238b5d094414c47c5
noppakorn-11417/psit-2019
/problem/Triangle.py
383
3.71875
4
"""despacito""" def cal(num, count=2): """despacito""" for i in range(-num, 0): if i == -num: print(" "*(abs(i)-1)+"%02d"%abs(i)) elif i == -num+1: print(" "*(abs(i)-1)+"%02d"%abs(i)+" "+"%02d"%abs(i)) else: count += 4 print(" "*(abs(i)...
ad270e9e7ffd738382ab37202a3e9d1c6c6bd9ab
Farah-Amalia/ML-Algorithms
/LinearRegression/LinearRegression.py
2,012
3.703125
4
# Import required module import numpy as np # Creating class class LinearRegression: def __init__(self, cost_function="l2", learning_rate=0.01, epochs=1000000) : self.learning_rate = learning_rate self.epochs = epochs self.cost_function = cost_function # Model fitting def fit(s...
b3308e5d3a3bfa2039381f896d74fa37dcbdd8b0
srikanthpragada/PYTHON_29_OCT_2020
/demo/funs/passing_list.py
90
3.6875
4
def prepend(lst, value): lst.insert(0, value) l = [1, 2, 3] prepend(l, 10) print(l)
e51124ffcd43400885523e0e67e95386cf9da3b9
manimanis/2TI_2020-2021
/progs/prj01/s02.py
791
3.578125
4
from random import randint eq1 = input('Nom 1ère équipe : ') eq2 = input('Nom 2ème équipe : ') print('Le match est joué entre', eq1, 'et', eq2) num_eq = randint(0, 1) if num_eq == 0: eq = eq1 autre_eq = eq2 else: eq = eq2 autre_eq = eq1 print("Le capitaine de l'équipe", eq, 'choisit Pile/Face') choi...
2ff0d12f11fb06aa751506b4e1964d00c18a2a67
enzomasson25/football_data_science
/equipe.py
3,363
3.78125
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 12 09:03:24 2020 @author: 33762 """ # import the libraries we'll need from urllib.request import urlopen from bs4 import BeautifulSoup import pandas as pd # instantiate the BeautifulSoup to find data on the website html = urlopen("https://fbref.com/en/country/clubs/ENG...
fa28db55af034eb591e5b04ff2130b46f82af22f
FreemanG/Introduction-to-Computational-Thinking-and-Data-Science-6.00.2x-
/w5l904_shortestDFS.py
2,505
3.796875
4
from graph import * #def DFS(graph, start, end, path = [], shortest = None): # #assumes graph is a Digraph # #assumes start and end are nodes in graph # path = path + [start] # print 'Current dfs path:', printPath(path) # if start == end: # return path # for node in graph.childrenOf(start): # ...
8d56615cfb12c572596e077c2c2cf68f6acf74e3
ecoronado92/MIT_Covid19
/objects/input_class.py
2,627
3.765625
4
import pandas as pd import numpy as np import random as rnd import networkx as nx import osmnx as ox class Inputs(): def __init__(self,num_points = None): self.points = num_points def random_point_generator(self,num_points): """ Generate random latitude and longitude points from a give...
477b951778f051f37647d54f1f1a3bdf16b38a6a
guruc-134/Py_programs
/SUM.py
550
3.8125
4
N = int(input()) answer=list() for i in range(12): str=input() commands=str.split() if commands[0] == "insert": answer.insert(int(commands[1]),int(commands[2])) elif commands[0] == "print": print(answer) elif commands[0] == "remove": answer.remove(int(commands[1])) elif c...
086eadc21eae4f2077911657e4705a13fb49f77c
Emdesade/test1
/zad6.py
1,601
3.640625
4
class Slowa: def __init__(self,slowo1,slowo2): self.slowo1 = slowo1 self.slowo2 = slowo2 def sprawdz_czy_palindrom(self): rev = ''.join(reversed(self.slowo1)) if (self.slowo1 == rev): return True return False def sprawdz_czy_metagramy(self): ...
47fce24a77e525c391482c7bd520d2e55a9c30ad
five-hundred-eleven/cs-module-project-hash-tables
/applications/markov/markov.py
945
3.53125
4
import random # Read in all the words in one go with open("input.txt") as f: words = f.read() # TODO: analyze which words can follow other words import re from collections import defaultdict from spacy.lang.en import English from spacy.tokenizer import Tokenizer nlp = English() tokenizer = Tokenizer(nlp.vocab) ...
c4e0de17109faac11758640c07bb2a9ab35a4dcb
KuboBahyl/coding-interviews
/Algo topics/Problems Simple/QueueCircular.py
409
4.03125
4
# Queue - insert into circular queue def circular_insert(queue, data): # empty queue if queue.front is None: self.front = self.back = 0 # full queue if (queue.back + 1) % queue.size == queue.front: return print("Queue overflow!") # boundary case elif queue.back == queue.size - ...
bccea5d749fc030dc1e896d31734ff5ea1423bc3
brevnoman/chinchopa
/lesson4/Task4.py
1,601
4
4
import math while True: hi=input("1 or 2?:") if hi=="1": ch=input("10 or 01") if ch=="10": ans1=input("write correct answer for !12=") right_ans1= math.factorial(12) if ans1==str(right_ans1): print("good job", right_ans1, "is write answer)") ...
92a3df9af4c613e67fdc91fe11944ae8b9a95da2
manigh/ghc
/main.py
2,993
3.703125
4
#!/bin/python2 import ride from ride import * import car import sys import parser import random def do(r, c, t): c.do_this_ride(r, t) r.isDone=True def pick_from_available_cars(r, available_cars, t): bonus_cars=[] deadline_cars=[] for c in available_cars: time_to_make_itAND_bonus_list=r.ti...
d3c2e5c28fc14a43774f1d1c158140f990c4624e
Pranav174/Paraphrase_generation
/functions/paraphrase_with_syn_ant.py
1,464
3.640625
4
# -*- coding: utf-8 -*- import json import random import re def replace_paryavachi(sentence): filename = 'paryavachis.txt' with open(filename, 'r') as f: paryavachis = json.load(f) sentence = sentence.split(" ") for i, word in enumerate(sentence): for synset in paryavachis: ...
be3063a710771888934f0ca61dba60816344e583
DILEEPKUMA/Python_practice
/practice/condtion2.py
148
4.09375
4
temp=int(input('enter the temp : ')) temp1=45 if (temp > temp1): print("its hot day") else: print("its cool day") print("enjoy your day")
da1a0381b84cb07be6c59277c16de50dcc979a44
KUNAL932/linear_search_algorithm
/linear_algo.py
534
3.75
4
# -*- coding: utf-8 -*- """ Created on Thu Dec 27 20:19:48 2018 @author: kunal """ list=[] num=int(input("enter the range of the list: \t")) for n in range(num): number=int(input("enter the number to be added in list \t")) list.append(number) x=int(input("enter the value to be searched \n")) found=False for ...
df6888ee48b5cbb8463523f90edccf44d114b23d
bbkang2018/coding-practice
/jeju6/app2.py
175
3.734375
4
is_female = True is_beautiful = False is_young = True if is_female and is_beautiful and is_young: print("Your are beautiful young female") else: print("You're oopse")
44257e016d8ec57474daa2dee499f07f7dc2d0b6
AlexPersaud17/my_python_progress
/projects/calculator.py
899
4.25
4
# This program computes various operatios based on the user input x, y = eval(input("Enter two numbers: ")) operation = input("Enter the operation: ") result = "" if operation == "+" or operation == "a" : operation = "+" result = x + y elif operation == "-" or operation == "s" : operation = "-" res...
f754f747d1429ad6c4d9a85e996b76cd088b10c9
sumanth82/py-practice
/practicepython/exercise-1.py
197
3.765625
4
# http://www.practicepython.org/exercise/2014/01/29/01-character-input.html import datetime from datetime import date user_input = input("Enter your age : ") year_when_user_turns_100_years =
ffc4f1335d52ae4eae1e7477258f6c70afb61d3d
amaljoy93/EDA
/learning panda.py
8,364
3.921875
4
#!/usr/bin/env python # coding: utf-8 # # pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language # Pandas - Panel Data # Datatypes in Pandas # Series # Series is a one-dimensional labeled array capable of holding any data ty...
1d2d55c257cbc981bb800db4f4f429d480d7397f
harishassan85/python-assignment-
/assignment#2/question4.py
384
4.1875
4
#Write a Python program to sum all the numeric items in a list? #initializing veriable sum sum = 0 #empty list numbers = [] n = int(input("How many number of sum you want: ")) #append user input in list for i in range(n): number = int(input("Enter Number: ")) numbers.append(number) #sum of use...
35f941abd52ec6fd7097326a853447c2b34b44b8
ravioliasb/COSC310NovaBot
/Code/Wikipedia_Api.py
514
3.734375
4
import wikipedia import warnings warnings.catch_warnings() warnings.simplefilter("ignore") def wikiSearch(input_): # Takes user input and tries to find it on Wikipedia input_lower = input_.lower() input_split = input_lower.split() ask_wiki = "" ask = range(1, len(input_split)) for i in ask: ...
61b588a8547ca9b9c8816d640a6f27d83148bf9c
kumar6273/greyatom-python-for-data-science
/myfolder/code.py
1,520
4.25
4
# -------------- # Code starts here # Create the lists class_1= [ "Geoffrey Hinton", " Andrew Ng", "Sebastian Raschka", "Yoshua Bengio"] class_2= ["Hillary Mason", "Carla Gentry", "Corinna cortes"] # Concatenate both the strings new_class = class_1+ class_2 print(new_class) # Append the list new_class.ap...
c3e785f9e9c628f506e6d3009dd0fb8d22c7c703
KaloyankerR/python-advanced-repository
/Assignments/Exam Preparation/Python Advanced Exam - 27 June 2020/02. Snake.py
1,976
3.84375
4
def get_snake_position(): global matrix for r in range(n): if 'S' in matrix[r]: for c in range(n): if matrix[r][c] == 'S': return [r, c] # get the index with the .index() method def get_burrows_indexes(field): global n res = [...
68732c8b1e392c646de7a3aa508acc61f3b499e9
enosteteo/Introducao-a-Programacao-P1
/4. Estrutura de Repeticao While/Lista 02/programa 02.py
185
3.609375
4
cont = 25 qtdeParEPositivo = 0 while cont > 0: numero = int(input()) if (numero >= 0) and (numero % 2 == 0): qtdeParEPositivo += 1 cont -= 1 print(qtdeParEPositivo)
75ca1c0aae4309048b616aa5657307dc4ee5ea0b
alexjwong/learning-python
/tictactoe.py
14,030
3.765625
4
#Alexander Wong #EK128 #If I were to write this again, I would definitely try to use more functions #-its a little messy right now (but still very much understandable) import random #The board will be held in a list #e will be empty #o will be a spot where player 'o' has played #x is a spot where player 'x' has p...
1df9a2f92bfefa79e8d51a703936c01a6eac7da4
AamodPaud3l/python_assignment_dec22
/dict_num_numsquare.py
311
3.796875
4
# Program to ask a number, n from user and generate a dictionary containing (i, i*i), where i = 1 to n num = int(input("Enter a number: ")) init = 1 final = 0 num_square = { } while num != 0: if init <= num: final += init num_square[final] = final * final num -= 1 print(num_square)
94f81ede48c26011c79cbc4f4ec243a204efb5cc
giserh/com.sma
/src/main/python/alg/best_time_to_buy_and_sell_stock_with_cooldown.py
1,136
3.8125
4
""" Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times) with the following restrictions: You may not engage in multiple tra...
b2f7493d2ea2c23c884aaeda4a30735a297054b1
LucianoPAlmeida/udacity-data-analysis-exercices
/Lesson4/Code/project.py
707
3.640625
4
import numpy as np import pandas as pd titanic_df = pd.read_csv('../titanic_data.csv') # How many of the survivals where female and male print 'How many of the survivals where female and male' print titanic_df.groupby('Sex')['Survived'].sum() # How many of the survivals per class print 'How many of the survivals pe...
f53b2bbfe37ed53c0f9994ddcfce1535f7e6cd3f
nicksteffen/GroupmeBot
/parser.py
406
3.796875
4
import re def contains_key_phrase(phrase): word_list=[] word_list=phrase.split() for word in word_list: word= re.sub(r'\W+','',word) if word.endswith("er"): return word return False def format_message(phrase): word=contains_key_phrase(phrase) if word == False: ...
198723bc3f8a4509816288c68788c462962ac0de
linminhtoo/algorithms
/greedy/medium/jumpGameI.py
495
3.625
4
# https://leetcode.com/problems/jump-game/submissions/ from typing import List class Solution: def canJump(self, nums: List[int]) -> bool: furthest_idx = 0 for i in range(len(nums)): if furthest_idx < i: # check if position i could be reached based on current furthest_idx...
deb9a1136a297ffb4ed4c417e4745d70d4b0a3ca
Akimov232/big_work
/hangman.py
2,173
3.765625
4
from random import choice def generate_word(w): ''' input: list of words output: 1 word which generated choice ''' return choice(w) def start_string(w): tp = [] for i in w : tp.append('_') return tp def welcome_speake(t): print(f'''Добро пожаловать в игру...
0f807f2f2637748a25e2ff2df3c8c4c5a91d7ebe
needsomeham/School_Projects
/CS5050_Advanced_Algos/HW7_FFT/PythonFFT.py
3,868
3.75
4
import cmath import numpy as np import matplotlib.pyplot as plt import time import random # Small function to ensure that the string is of length 2^something # If not, pad the end till it is def addPadding(x): # Finds the smallest power of 2 that is larger than the len(x) power = 0 while 2**power < len(x):...
0cbfdd0fbafb72100c5c75e4a3d8532dee14e046
richard-durham/AdventOfCode
/Advent_day2.py
1,441
3.84375
4
''' From www.adventofcode.com Day 2 questions ''' with open('day2.txt', 'r') as input_packages: list_of_packages = input_packages.readlines() print len(list_of_packages) def make_package_usable(package): ''' split the package into seperate dimensions, convert them to int, and sort ''' dimensions = package...
7ed798f39088ad9c6bd27506104abd0a8560245c
JimzyLui/pySplitFiles
/pySplitFiles old.py
3,245
3.984375
4
# from itertools import chain import csv import argparse import os def split_file(filename, pattern, size): """ Split a file into multiple output files. The first line read from 'filename' is a header line that is copied to every output file. The remaining lines are split into blocks of at le...
ddef51a783c2db7f3b6caf511b9003a0d5216816
Tai-Son/Python-Chile
/python/funciones6.py
381
3.875
4
# Escribir una funcion recursiva para contar en cuantos intentos #Practica de funciones #! /usr/bin/python # -*- coding: iso-8859-15 from random import * def adivina(n): n = randint(1,6) return n a = int(input("Adivina el numero: ")) for i in range(a): print adivina(1) if a== adivina(i): pri...
b5cd8af793e0ecf8025cdd667133a50610930e1e
dmitry-pechersky/algorithms
/hackerrank/The Longest Increasing Subsequence.py
636
4
4
def smallest_greater_dc(array, a, b, value): while a != b: c = (a + b) // 2 if array[c] < value: a = c + 1 else: b = c return b def longest_increasing_subsequence(sequence): dp = [sequence[0]] for i in range(1, len(sequence)): if sequence[i] > dp[...
e4739c89a498e0612dceaf22d47c31777c20097c
GTxx/leetcode
/algorithms/283. Move Zeroes/main.py
823
3.609375
4
from typing import List class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zero_num = 0 non_zero_idx = 0 idx = 0 while non_zero_idx < len(nums): if nums[non_zero_idx] == 0:...
030284e80b92f1f2c886bde002847f65d4c86bb2
666syh/Learn_Algorithm
/31_Next_Permutation.py
1,430
3.875
4
""" https://leetcode.com/problems/next-permutation/ Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-p...
26af18f58bbf0dda025b7bec0e2d98b03d917029
bemcgahan/webscraper
/business_record.py
1,791
3.5
4
import bs4 from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup my_url = 'https://www.businessrecord40.com/caroline-bettis' # opeining up connection, grabbing page uClient = uReq(my_url) # puts content into variable page_html = uClient.read() #close web connection uClient.close(...
4fb8dd222e8f3caa16f4e2a40c8bf0f060f85e03
divindvm/MyStudyCompanion-MSC-
/projecttrials/timetable/inputtkinter.py
506
3.5
4
from Tkinter import * def get_class(): print(var.get()) def get_entry(): print(ent.get()) lsum["text"]="ohh noooo" textinp.set("shit") root=Tk() var=StringVar() textinp=StringVar() ent=Entry(root,textvariable=var) ent.place(x=10,y=10,width=100) ent2=Entry(root,textvariable=textinp) lsum=Label(root,text="the") b...
64bb1ec663ceae762087718988c004d1f199b8a3
jcockbain/ctci-solutions
/chapter-10/Q02_group_anagrams.py
827
4
4
import unittest def group_anagrams(word_list): anagrams = {} for w in word_list: sorted_word = "".join(sorted(w)) if sorted_word in anagrams: anagrams[sorted_word].append(w) else: anagrams[sorted_word] = [w] res = [] for sorted_word in anagrams: ...
8bad5445386914131da5f76922cd9b19a739cb93
gabriellaec/desoft-analise-exercicios
/backup/user_063/ch36_2019_09_18_19_55_17_743327.py
232
3.625
4
def eh_primo(x): y=2 if x==2: return True if x==0 or x==1: return False while x>y: if x%y==0: return False else: return True y+=1
62775ac7718476541df572166c25fc69f94dcbe6
mohira/oop-iroha-python
/interface_08.py
2,186
3.953125
4
""" https://qiita.com/nrslib/items/73bf176147192c402049#interface もう1つのif文 要素の評価 に interface を使ってみる """ from abc import ABCMeta, abstractmethod from typing import List class IConverter(metaclass=ABCMeta): @abstractmethod def convert(self, data: List[str]) -> str: pass class CsvConverter(IConverter...
dcf84af54b511a5cb05b8346d687bb1687eb2f1a
bybside/cb-trade-analysis
/models/strategy.py
685
3.546875
4
from models.wallet import Wallet class Strategy: """ this class is intended as an abstract base class for implementing various trading strategies """ def __init__(self, token: str, init_cash_amount: float): self.wallet = Wallet(token, init_cash_amount) self.start_amount = init_cash_...
b73f68257023c1fa8bc857f401cec846ef532ede
ejm714/dsp
/python/advanced_python_regex.py
741
3.59375
4
## Q1 import pandas as pd from collections import Counter df = pd.read_csv('https://raw.githubusercontent.com/ejm714/dsp/master/python/faculty.csv') print(df.columns.tolist()) df.columns = df.columns.str.strip() degrees = df['degree'].str.strip().str.replace('.', '').str.split() degree_counts = Counter(degrees.sum()) ...
a83f619f7756122c0107bfdc6914965af3a10aee
DavidToca/programming-challanges
/leetcode/130. Surrounded Regions/solve.py
1,962
3.625
4
CHANGE_TO_O = '1' class Solution: def generate_n(self, board, row, col): n = [] options = [ (-1, 0), (0, -1), (0, 1), (1, 0), ] max_row = len(board) max_col = len(board[0]) for option in options: x, y = ...
4dd47f5967bb70ec3f26e8a9ded13eada675c1ad
Aasthaengg/IBMdataset
/Python_codes/p02261/s775073974.py
1,173
3.609375
4
def selectionSort(n, A): cnt = 0 for i in range(n): minj = i for j in range(i, n): if A[minj][1] > A[j][1]: minj = j if i != minj: A[i], A[minj] = A[minj], A[i] cnt += 1 return A def bubbleSort(n, A): flag = True cnt = 0 ...
8c843be93c18671fa448c3fd6de4f76473f0f22f
notveryfamous/python1
/冒泡排序.py
502
3.734375
4
nums = [6, 5, 3, 1, 8, 7, 2, 4] # 冒泡排序思想: # 让一个数字和它相邻的下一个数字进行比较运算 # 如果前一个数字大于后一个数字,交换两个数据的位置 # 每一次比较次数的优化 # 总比较次数的优化 i = 0 while i < len(nums) - 1: i += 1 n = 0 while n < len(nums) - 1: # print(nums[n], nums[n + 1]) if nums[n] > nums[n + 1]: nums[n], nums[n + 1] = nums[n + 1]...
8d392335fb299af93dfa607c97b00191d60e6fb1
jonasmzsouza/fiap-tdsr-ctup
/20200408/problema4.4.py
482
3.90625
4
# Problema 4.4: Escreva um programa que dadas duas notas de 0 a 10 calcula a média aritmética entre elas. nota1 = float(input("Digite a primeira nota: ")) while nota1 < 0 or nota1 > 10: nota1 = float(input("Nota inválida, digite a primeira nota: ")) nota2 = float(input("Digite a segunda nota: ")) while nota2 < ...
17007871b3550fee5fafef115ccf5cbe9b377467
nguyntyler/DigitalCrafts-Algorithms
/NumOccurence.py
371
4.1875
4
# 2. Write a function that counts the number of times the number 7 occurs in a given integer # without converting it to a string. # # For example the number 7,704,793 would output 3 import math def seven_counter(num): count = 0 while num > 0: rem = num % 10 if rem == 7: count += 1...
64928fd3a60a32ca6ef2596d9feacde57cd5040a
strategist922/SinicaSemanticParserChinese
/shared/prepareData.py
10,222
3.59375
4
import string import re class Tree(object): def __init__(self): self.children = [] self.data = None self.pos = None self.position = None self.word = None self.depth = 0 self.terminal = False self.terNo = None self.parent = None #self.sid = None def print_tree(tree): if tree != None: print st...
1aa119f0896b708cbfb0eb04268b9087dfa2b44a
noahfp/Project_Euler
/p004.py
365
3.875
4
def is_palindrome(x): x = str(x) if x == x[::-1]: return True else: return False def large_palindrome(cap): for i in range(cap): for j in range(i): val = (cap-j)*(cap-i+j) if is_palindrome(val): return val return -1 pri...