blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
274aa2b7785d14dd8578224b2efd33533f34e63b
qcarlox/leetCode
/python/Counting Bits.py
343
3.625
4
class Solution: import math def countBits(self, num): """ :type num: int :rtype: List[int] """ counts = [0] for i in range(1, num+1): if i%2 == 0: counts.append(counts[i//2]) else: counts.append(counts[i-1]+1...
6239fd9c1ad88b4639000ab9b8f7ba0a342e153f
qcarlox/leetCode
/python/Longest Palindromic Substring.py
2,862
3.625
4
class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ evenPalindromes = self.scanStringUsingWindow(s, 2) oddPalindromes = self.scanStringUsingWindow(s, 3) longestSubstring = '' #print(evenPalindromes) if len(s...
af17dd69510758bd78a448158f1a4b5934a94318
qcarlox/leetCode
/python/Reverse Integer.py
1,003
3.5625
4
class Solution: def reverse(self, x): """ :type x: int :rtype: int """ digits = self.intToList(x) if x == 0: return x reversedNumber = self.listToReversedInt(digits) return reversedNumber def intToList(self, num): digits = ...
4010f67814de11e00e21a554b8e605427e911fe5
IonesioJunior/Data-Structures
/Python/SkipList/Node.py
2,257
4.09375
4
#coding: utf-8 __author__ = "Ionesio Junior" class Node(object): ''' Node class implementation for skip list structure Attributes: data(optional) : data value to be stored in this node key(optional) : key determine the position of node in skiplist structure forward[Node] : list with all of p...
3d13c6b110cce229493499e32527dc087670c2ba
IonesioJunior/Data-Structures
/Python/Heap/BinaryHeap.py
4,420
4.125
4
#coding: utf-8 __author__ = "Ionesio Junior" class BinaryHeap(): ''' Heap is a priority queue data-structure in tree format. Attributes: heapArray[elements] : store elements of data structure index(int) : index of last element stored in heap array ''' __heapArray = None; __index = None; def __i...
6bab3c6677cc6fc77fb4739bd10023e42eb8ef12
CJosephides/traders_vs_pirates
/tvp/core/deck.py
515
3.5625
4
""" deck.py The Deck class. """ import numpy as np class Deck: """ A deck of cards. Initialization creates a new deck. """ def __init__(self): self.deck = [] for t in ('i', 's', 'p'): for i in range(1, 11): self.deck.append(t + str(i)) def deal_card(s...
34ef087033311b123195a49337098a80d87d6fa4
zootechdrum/algorithms
/post-bootcamp/algo-array-sorted/algo-array-sorted.py
1,270
4.28125
4
def sort(arr , cond): for i in range(0, len(arr)): for j in range(i + 1, len(arr)): if( cond == 'even'): if(arr[i] > arr[j]): temp = arr[i] arr[i] = arr[j] arr[j] = temp else: if(arr[i] < arr[...
774f9514aca7a92fb1bfa67bd552caec5af11861
khemasree/CSEE5590_Lab
/Lab1/Source/Lab1/lab4a.py
495
3.859375
4
# List of students attending python class pythonlist={'Bob','Billy','Sara'} # List of students attending web applications class webApplicationlist={'John','James','Bob'} # List of students attending both attendingboth = pythonlist & webApplicationlist print("The students attending both the classes are: ", attendingbo...
a722dfbc62fa87e96495bb9e90567e4c5b01204e
khemasree/CSEE5590_Lab
/Lab1/Source/Lab1/lab5a.py
5,382
3.875
4
class Customer:#class creation __days_31 = [1,3,5,7,8,10,12]#private variable (encapsulation) days_30 = [4,6,9,11] days_28 = [2] dep_year = None dep_month = None dep_day = None #created a constructor and passed values into it def __init__(self,year, month, day, name,num_of_rooms,occupants,d...
2b7e702bb7c4b35b60487ff68a1b4443e27f3d10
khemasree/CSEE5590_Lab
/ICP3/icp2a.py
1,288
3.921875
4
from bs4 import BeautifulSoup import urllib.request import os # Set the url to variable and open it url="https://en.wikipedia.org/wiki/List_of_state_and_union_territory_capitals_in_India" urllib.request.urlopen(url) source_code = urllib.request.urlopen(url) plain_text = source_code # parse the html content using Beau...
2b467490a578f764e825c0f0c99169ab328fcdfc
chsafouane/algorithms_illuminated_the_basics
/merge_sort.py
1,601
4.09375
4
def split(a): ''' This function splits the input into two lists - Inputs: a: the list to be splitted. ''' n = len(a) if n <= 1: return({}, a) return(a[:int(n/2)], a[int(n/2):]) def merge(b, c): ''' This function merges two sorted lists The result is a sorted list...
a942c98a6b91878fb851a494bc68acb6cb18d2fb
alexzywiak/mit-ocw-intro-to-comp-sci
/00.1ps.py
199
3.984375
4
#!/usr/bin/env python -tt def main(): last = raw_input('What is your last name?') first = raw_input('What is your first name?') print first + ' ' + last if __name__ == "__main__": main()
79235b80a0ea9fdd377175f309c67f07ce75f8c5
rfshiroma/Data_Structures_Algo
/Priority_Queue/PriorityQueueBase.py
820
4.46875
4
# python3 '''Implementation of a Priority Queue''' # How to implement a priority queue by storing its entries in a positional list L. (see Section 7.4.) We provide two realizations, depending on whether or not we keep the entries in L sorted by key. class PriorityQueueBase: ''' Abstract base class for a priorit...
ebdcadf4e75465954d16e1906fccfc7a7b1b69e9
takeuchisatoshi/data_analyzer
/app.py
1,005
4.03125
4
from calculation import * if __name__ == '__main__': # ユーザーからの入力を受け取る input_data = input("データを入力してください(スペース区切り) > ") # print(input_data) # 文字列リストに変換 numbers_as_str = input_data.split(" ") # print(numbers_as_str) # 整数リストに変換する numbers = [] # 空のリストを作成 for number_as_str in numbers_as...
0968e4dbfcf0a48c2508b871d955846950f38f84
DawnGnius/MyLeetCode
/Palindrome_number_20181101.py
647
3.515625
4
class Solution: def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False else: y = [int(i) for i in str(x)] #y doesn't have to be a list, y could just be str(x) length = (len(y)-1)/2 #This num I thought f...
bfa5682115d596c94bcfeb46d273919470b9d6f7
CompOpt4Apps/Thesis
/python/factorial.py
187
3.515625
4
import sys #to = int(sys.argv[1]) #line = sys.stdin.readline() f = open("num.txt", "r") line = f.readline() to = int(line) fact = 1 for i in range(to,1,-1): fact *= i print fact
9cee2a96306926116328cd31559e6fdf39e1843e
petervenables/fun-py
/word-morph/morph.py
1,096
4.03125
4
import random def morph_count(first, second): count = 0 if first == second: return count if len(second) > len(first): count += len(second) - len(first) second = remove_added(first, second) elif len(first) > len(second): count += len(first) - len(second) first = ...