text stringlengths 0 1.05M | meta dict |
|---|---|
# 6.00.2x Problem Set 4
import numpy
import random
import pylab
from ps3b import *
#
# PROBLEM 1
#
def simulationDelayedTreatment(numTrials):
"""Runs simulations and make histograms for problem 1.
Runs numTrials simulations to show the relationship between delayed
treatment and patient outcome us... | {
"repo_name": "xqliu/coursera",
"path": "6.00.2x_IntroductionToComputationalThinkingAndDataScience/ProblemSet4/ps4.py",
"copies": "1",
"size": "2382",
"license": "mit",
"hash": 2855546330917083000,
"line_mean": 27.0235294118,
"line_max": 78,
"alpha_frac": 0.6570109152,
"autogenerated": false,
"ra... |
# 6.00.2x Problem Set 5
# Graph optimization
#
# A set of data structures to represent graphs
#
class Node(object):
def __init__(self, name):
self.name = str(name)
def getName(self):
return self.name
def __str__(self):
return self.name
def __repr__(self):
return self.nam... | {
"repo_name": "parmarmanojkumar/MITx_Python",
"path": "6002x/week5/ProblemSet5/graph.py",
"copies": "1",
"size": "5161",
"license": "mit",
"hash": 708466740412439900,
"line_mean": 28.838150289,
"line_max": 105,
"alpha_frac": 0.5851579151,
"autogenerated": false,
"ratio": 3.0793556085918854,
"co... |
# 6.00 Problem Set 10
# Graph optimization
#
# A set of data structures to represent graphs
#
class Node(object):
def __init__(self, name):
self.name = str(name)
def getName(self):
return self.name
def __str__(self):
return self.name
def __repr__(self):
return self.name
... | {
"repo_name": "juampi/6.00x",
"path": "ProblemSet10/graph.py",
"copies": "1",
"size": "1632",
"license": "mit",
"hash": 6502726002925922000,
"line_mean": 26.2,
"line_max": 58,
"alpha_frac": 0.5379901961,
"autogenerated": false,
"ratio": 3.7006802721088436,
"config_test": false,
"has_no_keywor... |
# 6.00 Problem Set 11
#
# graph.py
#
# A set of data structures to represent graphs
#
BAD_EDGE_MSG = "Total distance outdoors cannot exceed the total "+\
"distance of the route"
class Node(object):
def __init__(self, name):
self.name = str(name)
def getName(self):
return self.name
... | {
"repo_name": "downpat/mit-6000",
"path": "problem-set-11/graph.py",
"copies": "1",
"size": "2412",
"license": "mit",
"hash": 7537011258384121000,
"line_mean": 26.724137931,
"line_max": 67,
"alpha_frac": 0.5733830846,
"autogenerated": false,
"ratio": 3.5892857142857144,
"config_test": false,
... |
# 6.00 Problem Set 2
#
# Hangman
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
# -----------------------------------
# Helper code
# You don't need to understand this helper code,
# but you will have to know how to use the functions
import random
import string
WO... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/recursion/problem-set/mit-solutions/ps2_hangman_sol1.py",
"copies": "1",
"size": "3242",
"license": "mit",
"hash": -1535458611875630300,
"line_mean": 31.7474747475,
"line_max": 108,
"alpha_frac": 0.5909932141,
"autogenerated": fal... |
# 6.00 Problem Set 2
#
# Successive Approximation: Newton's Method
#
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
#
def evaluate_poly(poly, x):
"""
Computes the value of a polynomial function at given value x. Returns that value.
Example:
>>> poly =... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/recursion/problem-set/mit-solutions/ps2_newton_sol1.py",
"copies": "1",
"size": "2193",
"license": "mit",
"hash": 644374723076951300,
"line_mean": 27.4805194805,
"line_max": 85,
"alpha_frac": 0.5649794802,
"autogenerated": false,
... |
# 6.00 Problem Set 2
#
# Successive Approximation
#
def evaluate_poly(poly, x):
"""
Computes the polynomial function for a given value x. Returns that value.
Example:
>>> poly = (0.0, 0.0, 5.0, 9.3, 7.0) # f(x) = 7x^4 + 9.3x^3 + 5x^2
>>> x = -13
>>> print evaluate_poly(poly, x) # f(-13) = ... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/recursion/problem-set/ps2_newton.py",
"copies": "1",
"size": "2798",
"license": "mit",
"hash": -2008098361653459200,
"line_mean": 26.1747572816,
"line_max": 81,
"alpha_frac": 0.5446747677,
"autogenerated": false,
"ratio": 2.9989... |
# 6.00 Problem Set 2
#
# Successive Approximation
#
def evaluate_poly(poly, x):
"""
Computes the polynomial function for a given value x. Returns that value.
Example:
>>> poly = (0.0, 0.0, 5.0, 9.3, 7.0) # f(x) = 7x^4 + 9.3x^3 + 5x^2
>>> x = -13
>>> print evaluate_poly(poly, x) # f(-13) =... | {
"repo_name": "willcohen/mit-6.00sc-python",
"path": "ps2/ps2_newton.py",
"copies": "1",
"size": "2534",
"license": "mit",
"hash": -6270430405376733000,
"line_mean": 26.8461538462,
"line_max": 81,
"alpha_frac": 0.5477505919,
"autogenerated": false,
"ratio": 3.236270753512133,
"config_test": fal... |
# 6.00 Problem Set 2
#
# Hangman
#
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
import random
import string
WORDLIST_FILENAME = "words.txt"
def l... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/recursion/problem-set/mit-solutions/ps2_hangman_sol2.py",
"copies": "1",
"size": "3608",
"license": "mit",
"hash": 6292003318839041000,
"line_mean": 29.9292035398,
"line_max": 79,
"alpha_frac": 0.5898004435,
"autogenerated": false... |
# 6.00 Problem Set 3A
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
#
#
# Problem Set 3a
# Name: Marc Laughton
# Collaborators: N/A
# Time Spent: 4 hours
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'... | {
"repo_name": "bashhack/MIT_CompSci_Degree",
"path": "MIT_600SC/Unit_1/ps3/ps3a.py",
"copies": "1",
"size": "9349",
"license": "mit",
"hash": 892256660378017700,
"line_mean": 24.3360433604,
"line_max": 79,
"alpha_frac": 0.5815595251,
"autogenerated": false,
"ratio": 3.5751434034416825,
"config_... |
# 6.00 Problem Set 3A Solutions
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
#
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_L... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/debugging/problem-set/ps3asol.py",
"copies": "2",
"size": "8407",
"license": "mit",
"hash": -4689418768166067000,
"line_mean": 27.7910958904,
"line_max": 212,
"alpha_frac": 0.6036636137,
"autogenerated": false,
"ratio": 3.661585... |
# 6.00 Problem Set 3A Solutions
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
#
#
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j'... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/debugging/problem-set/ps3a.py",
"copies": "1",
"size": "8309",
"license": "mit",
"hash": 406862389093253800,
"line_mean": 26.1535947712,
"line_max": 212,
"alpha_frac": 0.5927307739,
"autogenerated": false,
"ratio": 3.59230436662... |
# 6.00 Problem Set 3B
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
#
#
# Problem Set 3b
# Name: Marc Laughton
# Collaborators: N/A
# Time Spent: 2 hours 30 minutes
from ps3a import *
import time
from perm import *
#
# Problem #6A: Computer chooses a word
#
def comp_choose_word(han... | {
"repo_name": "bashhack/MIT_CompSci_Degree",
"path": "MIT_600SC/Unit_1/ps3/ps3b.py",
"copies": "1",
"size": "4862",
"license": "mit",
"hash": 7889581519952670000,
"line_mean": 27.1040462428,
"line_max": 77,
"alpha_frac": 0.5890580008,
"autogenerated": false,
"ratio": 3.633781763826607,
"config_... |
# 6.00 Problem Set 3B Solutions
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
#
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
from ps3asol import *
import time
from perm import *
# Problem #6A: Computer chooses a word
#
#
def comp_c... | {
"repo_name": "jdhaines/MIT6.00",
"path": "PS3/ps3_sol/ps3bsol.py",
"copies": "2",
"size": "3819",
"license": "mit",
"hash": 6934246732193059000,
"line_mean": 29.3095238095,
"line_max": 112,
"alpha_frac": 0.6103692066,
"autogenerated": false,
"ratio": 3.7962226640159047,
"config_test": false,
... |
# 6.00 Problem Set 3
#
# Hangman game
#
# -----------------------------------
# Helper code
# You don't need to understand this helper code,
# but you will have to know how to use the functions
# (so be sure to read the docstrings!)
import random
import string
from string import maketrans
WORDLIST_FILENAME = "words.... | {
"repo_name": "shiva92/Contests",
"path": "Edx/Week3_ProbSet3/ps3_hangman.py",
"copies": "1",
"size": "4648",
"license": "apache-2.0",
"hash": -5785783921072495000,
"line_mean": 31.2777777778,
"line_max": 115,
"alpha_frac": 0.6622203098,
"autogenerated": false,
"ratio": 3.9389830508474577,
"con... |
# 6.00 Problem Set 3
#
# Hangman game
#
# -----------------------------------
# Helper code
# You don't need to understand this helper code,
# but you will have to know how to use the functions
# (so be sure to read the docstrings!)
import random
import string
WORDLIST_FILENAME = "words.txt"
def loadWords():
"... | {
"repo_name": "ay1011/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python",
"path": "problem_set_3_hangman/ps3_hangman.py",
"copies": "1",
"size": "5582",
"license": "mit",
"hash": -1146782785782658300,
"line_mean": 30.5367231638,
"line_max": 111,
"alpha_frac": 0.6415263346,
... |
# 6.00 Problem Set 3
#
# Hangman
#
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
import random
import string
from hangman import Hangman
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-1/recursion/problem-set/ps2_hangman.py",
"copies": "1",
"size": "1036",
"license": "mit",
"hash": 2783669679339863600,
"line_mean": 21.5434782609,
"line_max": 74,
"alpha_frac": 0.6167953668,
"autogenerated": false,
"ratio": 3.6868... |
# 6.00 Problem Set 3
#
# Hangman
#
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
import random
import string
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Dependin... | {
"repo_name": "MarkSmithlxviii/MIT_600_Intro_to_CompSci",
"path": "mit600/handouts/PS2/ps2_hangman.py",
"copies": "2",
"size": "1121",
"license": "cc0-1.0",
"hash": -3968343846875728000,
"line_mean": 22.3541666667,
"line_max": 74,
"alpha_frac": 0.6235504014,
"autogenerated": false,
"ratio": 3.852... |
# 6.00 Problem Set 3
#
# Hangman
#
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
import random
import string
WORDLIST_FILENAME = "words.txt"
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Depending on ... | {
"repo_name": "willcohen/mit-6.00sc-python",
"path": "ps2/ps2_hangman.py",
"copies": "1",
"size": "3456",
"license": "mit",
"hash": -9153964135055827000,
"line_mean": 23.6857142857,
"line_max": 74,
"alpha_frac": 0.5324074074,
"autogenerated": false,
"ratio": 3.878787878787879,
"config_test": fa... |
# 6.00 Problem Set 4
#
# Caesar Cipher Skeleton
#
import string
import random
import numbers
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase... | {
"repo_name": "sheva29/Introduction_to_Computational_Thinking",
"path": "caesar_cipher/ps4.py",
"copies": "1",
"size": "9705",
"license": "mit",
"hash": -742555510610359600,
"line_mean": 27.049132948,
"line_max": 92,
"alpha_frac": 0.5988665636,
"autogenerated": false,
"ratio": 3.3933566433566433,... |
# 6.00 Problem Set 4
#
# Caesar Cipher Skeleton
#
import string
import random
WORDLIST_FILENAME = "/Users/macbookpro/Documents/CS/CS600/hw/ps4/words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def load_words():
"""
Returns a list of valid words. W... | {
"repo_name": "Am3ra/CS",
"path": "CS600/hw/ps4/ps4.py",
"copies": "1",
"size": "9986",
"license": "mit",
"hash": -4498530835086232000,
"line_mean": 28.8089552239,
"line_max": 92,
"alpha_frac": 0.5634888844,
"autogenerated": false,
"ratio": 3.0764017252002462,
"config_test": false,
"has_no_ke... |
# 6.00 Problem Set 4
#
# Caesar Cipher Skeleton
#
import string
import random
WORDLIST_FILENAME = "words.txt"
ALPHABET = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' ']
ALPHABET_LEN = len(ALPHABET)
# ------------------------------... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-2/hashing-and-classes/problem-sets/problem-set/ps4.py",
"copies": "1",
"size": "12349",
"license": "mit",
"hash": 3049969271220197400,
"line_mean": 28.6850961538,
"line_max": 146,
"alpha_frac": 0.5684670824,
"autogenerated": false,
... |
# 6.00 Problem Set 4
#
# Caesar Cipher Skeleton
#
import string
import random
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def load_words():
"""
Returns a list of valid words. Words are strings of lowercase letters.
... | {
"repo_name": "jdhaines/MIT6.00",
"path": "PS4/ps4.py",
"copies": "2",
"size": "9940",
"license": "mit",
"hash": -4594512356353688600,
"line_mean": 28.671641791,
"line_max": 92,
"alpha_frac": 0.5624748491,
"autogenerated": false,
"ratio": 3.0793060718711276,
"config_test": false,
"has_no_keyw... |
# 6.00 Problem Set 4
#
# Caesar Cipher Skeleton
#
# Problem Set 4
# Name: Shouvik Roy
# Collaborators: None
# Time: 6 hours 30 minutes
import string
import random
from types import *
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
... | {
"repo_name": "royshouvik/6.00SC",
"path": "Unit 2/ps4/ps4.py",
"copies": "1",
"size": "13250",
"license": "mit",
"hash": 7224546019040608000,
"line_mean": 30.8509615385,
"line_max": 102,
"alpha_frac": 0.5726037736,
"autogenerated": false,
"ratio": 3.2254138266796493,
"config_test": false,
"h... |
# 6.00 Problem Set 4
#
# Part 1 - HAIL CAESAR!
#
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
import string
import random
import numbers
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helpe... | {
"repo_name": "jdhaines/MIT6.00",
"path": "PS4/ps4_sol/ps4_encryption_sol.py",
"copies": "2",
"size": "8078",
"license": "mit",
"hash": 7343710550057314000,
"line_mean": 29.3684210526,
"line_max": 91,
"alpha_frac": 0.6073285467,
"autogenerated": false,
"ratio": 3.4924340683095547,
"config_test"... |
# 6.00 Problem Set 4
#
# Part 2 - RECURSION
#
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
#
# Problem 3: Recursive String Reversal
#
def reverse_string(string):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the s... | {
"repo_name": "marioluan/mit-opencourseware-cs",
"path": "600/unit-2/hashing-and-classes/problem-sets/solutions/recursion.py",
"copies": "2",
"size": "2155",
"license": "mit",
"hash": -2916928078220328000,
"line_mean": 25.2804878049,
"line_max": 81,
"alpha_frac": 0.6153132251,
"autogenerated": fals... |
# 6.00 Problem Set 6
#
# The 6.00 Word Game
#
import random
import string
import time
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
# TIME_LIMIT = 8
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o'... | {
"repo_name": "wnduan/IntroToComSci",
"path": "ps6.py",
"copies": "2",
"size": "10053",
"license": "mit",
"hash": -3340011112650332700,
"line_mean": 28.1391304348,
"line_max": 212,
"alpha_frac": 0.5944494181,
"autogenerated": false,
"ratio": 3.6187904967602593,
"config_test": false,
"has_no_k... |
# 6.00 Problem Set 6
#
# The 6.00 Word Game
#
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1,... | {
"repo_name": "feliposz/learning-stuff",
"path": "python/ps6_download.py",
"copies": "1",
"size": "7545",
"license": "mit",
"hash": 8077040483754716000,
"line_mean": 27.4716981132,
"line_max": 212,
"alpha_frac": 0.5945659377,
"autogenerated": false,
"ratio": 3.6414092664092665,
"config_test": f... |
# 6.00 Problem Set 8
#
# Intelligent Course Advisor
#
# Name: Felipo Soranz
# Time:
# 18:18 started
# 18:24 problem 1
# 19:00 problem 2
# 19:17 problem 3
import time
SUBJECT_FILENAME = "subjects.txt"
VALUE, WORK = 0, 1
#
# Problem 1: Building A Subject Dictionary
#
def loadSubjects(filename):
"""
Returns ... | {
"repo_name": "feliposz/learning-stuff",
"path": "python/ps8.py",
"copies": "1",
"size": "11093",
"license": "mit",
"hash": -1832485670571378200,
"line_mean": 31.1536231884,
"line_max": 112,
"alpha_frac": 0.6405841522,
"autogenerated": false,
"ratio": 3.6063068920676202,
"config_test": false,
... |
# 6.00 Problem Set 9
import numpy
import random
import pylab
#from ps8b import *
from ps8b_precompiled_27 import *
#
# PROBLEM 1
#
def simulationDelayedTreatment(numTrials):
"""
Runs simulations and make histograms for problem 1.
Runs numTrials simulations to show the relationship between delayed
tre... | {
"repo_name": "fossilet/6.00x",
"path": "week9/problemset9/ps9.py",
"copies": "1",
"size": "3754",
"license": "mit",
"hash": -8648047929270670000,
"line_mean": 30.2833333333,
"line_max": 80,
"alpha_frac": 0.5788492275,
"autogenerated": false,
"ratio": 3.799595141700405,
"config_test": false,
... |
# 6.00x Problem Set 10
# Graph optimization
#
# A set of data structures to represent graphs
#
class Node(object):
def __init__(self, name):
self.name = str(name)
def getName(self):
return self.name
def __str__(self):
return self.name
def __repr__(self):
return self.name... | {
"repo_name": "fossilet/6.00x",
"path": "week10/problemset10/graph.py",
"copies": "1",
"size": "2137",
"license": "mit",
"hash": 8372579474059721000,
"line_mean": 31.3787878788,
"line_max": 105,
"alpha_frac": 0.5699578849,
"autogenerated": false,
"ratio": 3.736013986013986,
"config_test": false... |
# 6.00x Problem Set 10
# Graph optimization
#
# A set of data structures to represent graphs
#
class Node(object):
def __init__(self, name):
self.name = str(name)
def getName(self):
return self.name
def __str__(self):
return self.name
def __repr__(self):
r... | {
"repo_name": "b3ngmann/python-pastime",
"path": "ps10/graph.py",
"copies": "1",
"size": "8029",
"license": "mit",
"hash": 4716473312965881000,
"line_mean": 28.9626865672,
"line_max": 111,
"alpha_frac": 0.5648275003,
"autogenerated": false,
"ratio": 3.3454166666666665,
"config_test": false,
"... |
# 6.00x Problem Set 3
#
# Successive Approximation: Newton's Method
#
# Problem 1: Polynomials
def evaluatePoly(poly, x):
'''
Computes the value of a polynomial function at given value x. Returns that
value as a float.
poly: list of numbers, length > 0
x: number
returns: float
'''
s =... | {
"repo_name": "juampi/6.00x",
"path": "ProblemSet03/ps3_newton.py",
"copies": "1",
"size": "1557",
"license": "mit",
"hash": 4112787284032387600,
"line_mean": 26.3333333333,
"line_max": 81,
"alpha_frac": 0.6133590238,
"autogenerated": false,
"ratio": 3.562929061784897,
"config_test": false,
"... |
# 6.00x Problem Set 4A Template
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
# Modified by: Sarina Canelake <sarina>
#
import random
from duplicity._librsync import librsyncError
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': ... | {
"repo_name": "FylmTM/edX-code",
"path": "MITx_6.00.1x/problem_set_4/ps4a.py",
"copies": "1",
"size": "8443",
"license": "mit",
"hash": -4228921071101049300,
"line_mean": 28.1137931034,
"line_max": 120,
"alpha_frac": 0.6057088713,
"autogenerated": false,
"ratio": 3.6901223776223775,
"config_tes... |
# 6.00x Problem Set 4A Template
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
# Modified by: Sarina Canelake <sarina>
#
import random
import string
from operator import indexOf
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, ... | {
"repo_name": "ahmedraza007/6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python",
"path": "source/ProblemSet4/ps4a.py",
"copies": "1",
"size": "9897",
"license": "mit",
"hash": 4209749235697940500,
"line_mean": 27.7703488372,
"line_max": 212,
"alpha_frac": 0.5683540467,
"autogener... |
# 6.00x Problem Set 4A Template
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
# Modified by: Sarina Canelake <sarina>
#
import random
import string
#import test_ps4a
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c... | {
"repo_name": "maistrovas/My-Courses-Solutions",
"path": "MITx-6.00.1x/ProblemSet4/ps4a.py",
"copies": "1",
"size": "9495",
"license": "mit",
"hash": -2527031644311416300,
"line_mean": 29.0474683544,
"line_max": 212,
"alpha_frac": 0.5948393892,
"autogenerated": false,
"ratio": 3.7060889929742387,... |
# 6.00x Problem Set 4A Template
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
# Modified by: Sarina Canelake <sarina>
#
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
BONUS = 50
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd... | {
"repo_name": "cosmopod/MIT_6001",
"path": "600_wordgame/ps4a.py",
"copies": "1",
"size": "8895",
"license": "mit",
"hash": -6852339220092170000,
"line_mean": 28.2598684211,
"line_max": 212,
"alpha_frac": 0.6098931984,
"autogenerated": false,
"ratio": 3.73582528349433,
"config_test": false,
"... |
# 6.00x Problem Set 5
#
# Part 1 - HAIL CAESAR!
import string
import random
#import cgitb
#cgitb.enable()
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWords():
"""
Returns a list of valid words. Words are strings... | {
"repo_name": "fossilet/6.00x",
"path": "week5/problemset5/ps5_encryption.py",
"copies": "1",
"size": "6674",
"license": "mit",
"hash": -8735668022999925000,
"line_mean": 26.5785123967,
"line_max": 81,
"alpha_frac": 0.609080012,
"autogenerated": false,
"ratio": 3.87122969837587,
"config_test": ... |
# 6.00x Problem Set 5
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWords():
"""
Returns a list of valid words. Words are strings of lowercase letters.
... | {
"repo_name": "b3ngmann/python-pastime",
"path": "ps5/ps5_encryption.py",
"copies": "1",
"size": "6980",
"license": "mit",
"hash": -7065860199740942000,
"line_mean": 27.7242798354,
"line_max": 94,
"alpha_frac": 0.6143266476,
"autogenerated": false,
"ratio": 3.643006263048017,
"config_test": fal... |
# 6.00x Problem Set 5
#
# Part 2 - RECURSION
#
# Problem 3: Recursive String Reversal
#
def reverseString(aStr):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the string is 'abc', the function returns 'cba'.
The only string operations you are allowed to use are ... | {
"repo_name": "juampi/6.00x",
"path": "ProblemSet05/ps5_recursion.py",
"copies": "1",
"size": "2063",
"license": "mit",
"hash": 4454095761086967000,
"line_mean": 26.8918918919,
"line_max": 102,
"alpha_frac": 0.6461463888,
"autogenerated": false,
"ratio": 3.8851224105461393,
"config_test": false... |
# 6.00x Problem Set 5
#
# Part 2 - RECURSION
#
# Problem 3: Recursive String Reversal
#
def reverseString(aStr):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the string is 'abc', the function returns 'cba'.
The only string operations you are allowed to use are... | {
"repo_name": "fossilet/6.00x",
"path": "week5/problemset5/ps5_recursion.py",
"copies": "1",
"size": "2417",
"license": "mit",
"hash": -1111604706721512400,
"line_mean": 26.7816091954,
"line_max": 78,
"alpha_frac": 0.5899875879,
"autogenerated": false,
"ratio": 3.764797507788162,
"config_test":... |
# 6.00x Problem Set 6
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "./courseraSpecialization/git_repos/PlayingWithPython/computationAndProgrammingUsingPython/src/problemSet06/code_ProblemSet6/words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand t... | {
"repo_name": "pparacch/PlayingWithPython",
"path": "computationAndProgrammingUsingPython/src/problemSet06/code_ProblemSet6/ps6_encryption.py",
"copies": "1",
"size": "6832",
"license": "mit",
"hash": 3414396510692623000,
"line_mean": 30.3394495413,
"line_max": 399,
"alpha_frac": 0.6520784543,
"aut... |
# 6.00x Problem Set 6
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "/home/xala/workarea/Introduction-to-Computer-Science-and-Programming-with-python/week6/Problems/words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWor... | {
"repo_name": "xala3pa/Introduction-to-Computer-Science-and-Programming-with-python",
"path": "week6/Problems/ps6_encryption.py",
"copies": "1",
"size": "5477",
"license": "mit",
"hash": -5221291587378261000,
"line_mean": 26.943877551,
"line_max": 136,
"alpha_frac": 0.6326456089,
"autogenerated": f... |
# 6.00x Problem Set 6
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "/Users/bolo/githubRepo/python_6.00.1x/PSet6/words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWords():
"""
Returns a list of valid words. Wor... | {
"repo_name": "medifle/python_6.00.1x",
"path": "PSet6/ps6_encryption.py",
"copies": "1",
"size": "5971",
"license": "mit",
"hash": 7292666313861401000,
"line_mean": 28.1268292683,
"line_max": 92,
"alpha_frac": 0.6369117401,
"autogenerated": false,
"ratio": 3.9282894736842104,
"config_test": fa... |
# 6.00x Problem Set 6
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "/Users/yulianzhou/Desktop/course/python/6001x/ProblemSet6/words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWords():
"""
Returns a list of va... | {
"repo_name": "zhouyulian17/Course",
"path": "Python/6.00.1x Introduction to Computer Science and Programming Using Python/ProblemSet6/ps6_encryption.py",
"copies": "1",
"size": "5154",
"license": "mit",
"hash": 6206161764396643000,
"line_mean": 25.7046632124,
"line_max": 98,
"alpha_frac": 0.62514551... |
# 6.00x Problem Set 6
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
def loadWords():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Depending on the size of the word list, this fun... | {
"repo_name": "nicola88/edx",
"path": "MITx/6.00.1x/Week-6/Problem-Set-6/ps6_encryption.py",
"copies": "1",
"size": "5594",
"license": "mit",
"hash": 8681619399060628000,
"line_mean": 28.140625,
"line_max": 81,
"alpha_frac": 0.6271004648,
"autogenerated": false,
"ratio": 3.863259668508287,
"con... |
# 6.00x Problem Set 6
#
# Part 1 - HAIL CAESAR!
import string
import random
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWords():
"""
Returns a list of valid words. Words are strings of lowercase letters.
... | {
"repo_name": "ahmedraza007/6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python",
"path": "source/ProblemSet6/ps6_encryption.py",
"copies": "1",
"size": "6326",
"license": "mit",
"hash": -804341283839104100,
"line_mean": 24.0079051383,
"line_max": 83,
"alpha_frac": 0.5975339867,
"... |
# 6.00x Problem Set 6
#
# Part 2 - RECURSION
#
# Problem 3: Recursive String Reversal
#
def reverseString(aStr):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the string is 'abc', the function returns 'cba'.
The only string operations you are allowed to use are ... | {
"repo_name": "medifle/python_6.00.1x",
"path": "PSet6/ps6_recursion.py",
"copies": "1",
"size": "2124",
"license": "mit",
"hash": 5823978072950275000,
"line_mean": 25.8987341772,
"line_max": 83,
"alpha_frac": 0.6148775895,
"autogenerated": false,
"ratio": 3.6557659208261617,
"config_test": fal... |
# 6.00x Problem Set 6
# RSS Feed Filter
import feedparser
import string
import time
from project_util import translate_html
from Tkinter import *
import traceback
#-----------------------------------------------------------------------
#
# Problem Set 6
#======================
# Code for retrieving and parsing RSS ... | {
"repo_name": "fossilet/6.00x",
"path": "week6/problemset6/ps6.py",
"copies": "1",
"size": "9149",
"license": "mit",
"hash": 2318594821080466400,
"line_mean": 27.0644171779,
"line_max": 118,
"alpha_frac": 0.5822494262,
"autogenerated": false,
"ratio": 4.102690582959641,
"config_test": false,
... |
# 6.00x Problem Set 6
# RSS Feed Filter
import feedparser
import string
import time
from project_util import translate_html
from Tkinter import *
#-----------------------------------------------------------------------
#
# Problem Set 6
#======================
# Code for retrieving and parsing RSS feeds
# Do not ch... | {
"repo_name": "juampi/6.00x",
"path": "ProblemSet06/ps6.py",
"copies": "1",
"size": "8313",
"license": "mit",
"hash": 6278079950951329000,
"line_mean": 27.1796610169,
"line_max": 118,
"alpha_frac": 0.575845062,
"autogenerated": false,
"ratio": 4.019825918762089,
"config_test": false,
"has_no_... |
# 6.00x Problem Set 7: Simulating robots
import math
import random
import ps7_visualize
#from ps7_visualize import *
import pylab
# For Python 2.7:
from ps7_verify_movement27 import *
# If you get a "Bad magic number" ImportError, comment out what's above and
# uncomment this line (for Python 2.6):
# from ps7_verif... | {
"repo_name": "b3ngmann/python-pastime",
"path": "ps7/ps7.py",
"copies": "1",
"size": "12084",
"license": "mit",
"hash": -7892459734396978000,
"line_mean": 30.5509138381,
"line_max": 124,
"alpha_frac": 0.6097318769,
"autogenerated": false,
"ratio": 3.938722294654498,
"config_test": false,
"ha... |
# 6.00x Problem Set 7: Simulating robots
import math
import random
import ps7_visualize
import pylab
# For Python 2.7:
from ps7_verify_movement27 import testRobotMovement
# If you get a "Bad magic number" ImportError, comment out what's above and
# uncomment this line (for Python 2.6):
# from ps7_verify_movement26 ... | {
"repo_name": "juampi/6.00x",
"path": "ProblemSet07/ps7.py",
"copies": "1",
"size": "10849",
"license": "mit",
"hash": -3751101475361587700,
"line_mean": 30.265129683,
"line_max": 128,
"alpha_frac": 0.6258641349,
"autogenerated": false,
"ratio": 3.9522768670309656,
"config_test": false,
"has_... |
"""60. Permutation Sequence
https://leetcode.com/problems/permutation-sequence/
The set [1,2,3,...,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order,
we get the following sequence for n = 3:
"123"
"132"
"213"
"231"
"312"
"321"
Given n and k, return the kth permut... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/permutation_sequence.py",
"copies": "1",
"size": "1193",
"license": "mit",
"hash": -569886761548710000,
"line_mean": 20.3035714286,
"line_max": 65,
"alpha_frac": 0.5398155909,
"autogenerated": false,
"ratio": 3.295580110... |
# 6.15
def print_spiral(array):
x = len(array[0])
y = len(array)
max_bounds = {
"right": x-1,
"down": y-1,
"left": 0,
"up": 1
}
number_of_elements = x*y
coord = (0, -1)
func = go_right
result = []
while number_of_elements > 0:
number, func, c... | {
"repo_name": "napplebee/EPI",
"path": "epi/spiral_array.py",
"copies": "2",
"size": "1948",
"license": "mit",
"hash": 8793734870602898000,
"line_mean": 20.8876404494,
"line_max": 68,
"alpha_frac": 0.5302874743,
"autogenerated": false,
"ratio": 3.435626102292769,
"config_test": false,
"has_no... |
#61.题目:打印出杨辉三角形(要求打印出10行如下图)。
#利用生成器解决
def triangle():
x = [1]
while True:
yield x
#zip: 添加0组成元组
x = [sum(i) for i in zip([0]+x, x+[0])]
num = 0
for x in triangle():
print(x)
num += 1
if num == 10:
break
#62.题目:查找字符串。
str1 = 'abcdedf'
str2 = 'ded'
print('The fi... | {
"repo_name": "cwenao/python_web_learn",
"path": "base100/base100/base_61-70.py",
"copies": "1",
"size": "3975",
"license": "apache-2.0",
"hash": -5340528991041915000,
"line_mean": 17.7934782609,
"line_max": 79,
"alpha_frac": 0.574486549,
"autogenerated": false,
"ratio": 2.255055446836269,
"con... |
"""62. Unique Paths
https://leetcode.com/problems/unique-paths/
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time.
The robot is trying to reach the bottom-right corner of the grid
(marked 'Finish' in the ... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/unique_paths.py",
"copies": "1",
"size": "1170",
"license": "mit",
"hash": 2047565186621674800,
"line_mean": 24.4347826087,
"line_max": 87,
"alpha_frac": 0.6068376068,
"autogenerated": false,
"ratio": 3.0870712401055407,... |
# 6-3. Glossary: A Python dictionary can be used to model an actual dictionary.
# However, to avoid confusion, let’s call it a glossary.
# • Think of five programming words you’ve learned about in the previous chapters.
# Use these words as the keys in your glossary, and store their meanings as values.
# • Print each ... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ago-Dic-2019/DanielM/PracticaUno/6.3_Glossary.py",
"copies": "1",
"size": "1231",
"license": "mit",
"hash": 7405889597583223000,
"line_mean": 38.4838709677,
"line_max": 108,
"alpha_frac": 0.6696647588,
"autogenerated": false,
"ratio": 3.3415300546448... |
# 6.3
def get_battery_capacity(steps):
result_capacity = 0
current_capacity = 0
energy_needed = False
for step in reversed(steps):
# just skip last positive elements
if not energy_needed:
if step < 0:
energy_needed = True
else:
cont... | {
"repo_name": "napplebee/algorithms",
"path": "epi/robot.py",
"copies": "2",
"size": "1294",
"license": "mit",
"hash": 2275122525974983700,
"line_mean": 32.1794871795,
"line_max": 99,
"alpha_frac": 0.5765069552,
"autogenerated": false,
"ratio": 4.386440677966101,
"config_test": false,
"has_no... |
"""63. Unique Paths II
https://leetcode.com/problems/unique-paths-ii/
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time.
The robot is trying to reach the bottom-right corner of the grid
(marked 'Finish' i... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/unique_paths_ii.py",
"copies": "1",
"size": "1695",
"license": "mit",
"hash": 2167477229631199200,
"line_mean": 25.9047619048,
"line_max": 74,
"alpha_frac": 0.5486725664,
"autogenerated": false,
"ratio": 3.20415879017013... |
"""64bit ARM/NEON assembly emitter.
Used by code generators to produce ARM assembly with NEON simd code.
Provides tools for easier register management: named register variable
allocation/deallocation, and offers a more procedural/structured approach
to generating assembly.
"""
_WIDE_TYPES = {8: 16,
16... | {
"repo_name": "shishaochen/TensorFlow-0.8-Win",
"path": "third_party/gemmlowp/meta/generators/neon_emitter_64.py",
"copies": "5",
"size": "33110",
"license": "apache-2.0",
"hash": 114153941532316770,
"line_mean": 34.4496788009,
"line_max": 80,
"alpha_frac": 0.5894593778,
"autogenerated": false,
"... |
""" 6502 instructions
See for example: http://www.6502.org/tutorials/6502opcodes.html
"""
from ..isa import Isa
from ..encoding import Instruction, Syntax, Operand, Constructor, Relocation
from ..token import Token, bit_range
isa = Isa()
class OpcodeToken(Token):
class Info:
size = 8
opcode = bi... | {
"repo_name": "windelbouwman/ppci-mirror",
"path": "ppci/arch/mcs6500/instructions.py",
"copies": "1",
"size": "18989",
"license": "bsd-2-clause",
"hash": 6040450708539225000,
"line_mean": 20.2881165919,
"line_max": 76,
"alpha_frac": 0.5635367845,
"autogenerated": false,
"ratio": 3.31569757290029... |
"""654. Maximum Binary Tree
https://leetcode.com/problems/maximum-binary-tree/
Given an integer array with no duplicates. A maximum tree building on this
array is defined as follow:
The root is the maximum number in the array.
The left subtree is the maximum tree constructed from left part subarray
divided by the ma... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/maximum_binary_tree.py",
"copies": "1",
"size": "1262",
"license": "mit",
"hash": -2037311377261799000,
"line_mean": 21.2857142857,
"line_max": 77,
"alpha_frac": 0.6818910256,
"autogenerated": false,
"ratio": 3.438016528... |
"""66. Plus One
https://leetcode.com/problems/plus-one/
Given a non-empty array of digits representing a non-negative integer,
plus one to the integer.
The digits are stored such that the most significant digit is at the head of
the list, and each element in the array contain a single digit.
You may assume the inte... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/plus_one.py",
"copies": "1",
"size": "1277",
"license": "mit",
"hash": -6169181165776846000,
"line_mean": 23.5576923077,
"line_max": 76,
"alpha_frac": 0.5732184808,
"autogenerated": false,
"ratio": 3.5373961218836567,
... |
# 66. Puls One
#
# Given a non-negative number represented as an array of digits, plus one to the number.
#
# You may assume the integer do not contain any leading zero, except the number 0 itself.
#
# The digits are stored such that the most significant digit is at the head of the list.
#
class Solution(object):
... | {
"repo_name": "gengwg/leetcode",
"path": "066_plus_one.py",
"copies": "1",
"size": "1649",
"license": "apache-2.0",
"hash": 9188936053089992000,
"line_mean": 27.4310344828,
"line_max": 89,
"alpha_frac": 0.5009096422,
"autogenerated": false,
"ratio": 3.3448275862068964,
"config_test": false,
"... |
# 6.6 递归
from functools import reduce
# 递归函数
def recursion():
return recursion()
# 阶乘的实现
def factorial(n):
result = n
for i in range(1, n):
result *= i
return result
print(factorial(5))
# 阶乘的实现(递归版本)
def factorial(n):
if n == 1:
return 1
else:
return n * factorial(... | {
"repo_name": "xiezipei/beginning-python-demo",
"path": "demo/func_recur.py",
"copies": "1",
"size": "1644",
"license": "mit",
"hash": -8848745177111289000,
"line_mean": 18.0704225352,
"line_max": 62,
"alpha_frac": 0.5649926145,
"autogenerated": false,
"ratio": 2.1123244929797194,
"config_test"... |
''' 67. Add Binary - LeetCode
https://leetcode.com/problems/add-binary/description/
'''
# Given two binary strings, return their sum (also a binary string).
# For example,
# a = "11"
# b = "1"
# Return "100".
class Solution(object):
def addBinary(self, a, b):
"""
:type a: str
:type b: str... | {
"repo_name": "heyf/cloaked-octo-adventure",
"path": "leetcode/067_add-binary.py",
"copies": "1",
"size": "1138",
"license": "mit",
"hash": 6795876896713615000,
"line_mean": 20.4905660377,
"line_max": 68,
"alpha_frac": 0.3892794376,
"autogenerated": false,
"ratio": 3.17877094972067,
"config_tes... |
# 6.9 at page 58
class BigInt(object):
def __init__(self, string):
if string[0] == "-":
self.sign = -1
stop = 1
else:
self.sign = 1
stop = 0
self.digits = []
i = len(string) - 1
while i >= stop:
self.digits.append(i... | {
"repo_name": "napplebee/algorithms",
"path": "epi/bigint.py",
"copies": "2",
"size": "1306",
"license": "mit",
"hash": -4871332949125268000,
"line_mean": 30.8780487805,
"line_max": 108,
"alpha_frac": 0.4073506891,
"autogenerated": false,
"ratio": 3.8753709198813056,
"config_test": false,
"ha... |
6import pymysql.cursors
import urllib2
from multiprocessing.dummy import Pool as ThreadPool
import threading
import time
from itertools import izip_longest
#GLOBAL VARIABLE DECLARATIONS
count = 1
#"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
def grouper(n, iterable, f... | {
"repo_name": "Roncool13/generic-python-scripts",
"path": "database_feeder.py",
"copies": "1",
"size": "2371",
"license": "mit",
"hash": 2368909262698072000,
"line_mean": 33.3623188406,
"line_max": 181,
"alpha_frac": 0.562210038,
"autogenerated": false,
"ratio": 3.8057784911717496,
"config_test... |
# 6. In video 28. Update, it was suggested that some of the duplicate code in
# lookup and update could be avoided by a better design. We can do this by
# defining a procedure that finds the entry corresponding to a given key, and
# using that in both lookup and update.
# Here are the original procedures:
def hashtab... | {
"repo_name": "ezralalonde/cloaked-octo-sansa",
"path": "05/hw/04.py",
"copies": "1",
"size": "2352",
"license": "bsd-2-clause",
"hash": -3091464502252838400,
"line_mean": 35.1846153846,
"line_max": 81,
"alpha_frac": 0.7142857143,
"autogenerated": false,
"ratio": 3.4844444444444442,
"config_tes... |
''' 6-mean_sl.py
=========================
AIM: Compute the mean of the stray light in the sense of:
- Mean across all points then every minutes
- Mean of max value
- Mean of direction of maximum (in the orbit)
INPUT: files: - <orbit_id>_misc/orbits.dat
- <orbit_id>_flux/flux_*.dat
variables: see section PARAME... | {
"repo_name": "kuntzer/SALSA-public",
"path": "6_mean_sl.py",
"copies": "1",
"size": "4202",
"license": "bsd-3-clause",
"hash": 5394654132008850000,
"line_mean": 30.1259259259,
"line_max": 139,
"alpha_frac": 0.6204188482,
"autogenerated": false,
"ratio": 3.0208483105679367,
"config_test": false... |
#6. Pyramid (PSO)
#Consider n cubes of known sides length s[i] and colors c[i] . Assemble the highest
#pyramid from the cubes in such a way that it has 'stability' (there is not a bigger cube
#over a smaller one) and there are not two consecutive cubes of the same color.
from random import random, randint, shuffle
fro... | {
"repo_name": "rusucosmin/courses",
"path": "ubb/ai/lab4.py",
"copies": "1",
"size": "4616",
"license": "mit",
"hash": -8584106011782966000,
"line_mean": 33.9696969697,
"line_max": 111,
"alpha_frac": 0.5608752166,
"autogenerated": false,
"ratio": 3.6034348165495707,
"config_test": false,
"has... |
# 6. ts/all_species
# Get all species that belong to a particular Taxon.
import sys, unittest, json
sys.path.append('./')
sys.path.append('../')
import webapp
service = webapp.get_service(5004, 'ts/all_species')
class TestTsAllSpecies(webapp.WebappTestCase):
@classmethod
def get_service(self):
return... | {
"repo_name": "jar398/tryphy",
"path": "tests/test_ts_all_species.py",
"copies": "1",
"size": "4216",
"license": "bsd-2-clause",
"hash": -2218218349133219000,
"line_mean": 37.3272727273,
"line_max": 90,
"alpha_frac": 0.6069734345,
"autogenerated": false,
"ratio": 3.411003236245955,
"config_test... |
6#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | {
"repo_name": "locaweb/leela-client",
"path": "src/python/leela/client/functions.py",
"copies": "1",
"size": "1299",
"license": "apache-2.0",
"hash": 759752589505456800,
"line_mean": 26.6382978723,
"line_max": 80,
"alpha_frac": 0.6127790608,
"autogenerated": false,
"ratio": 3.13768115942029,
"c... |
"""6. ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this:
(you may want to display this pattern in a fixed font for better legibility)
P A H N
A P L S I I G
Y I R
And then read line by line: "PAHNAPLSIIGYIR"
Write the code that will take... | {
"repo_name": "nadesico19/nadepy",
"path": "leetcode/algo_6_zigzag_conversion.py",
"copies": "1",
"size": "1348",
"license": "mit",
"hash": -3848648996385796600,
"line_mean": 31.65,
"line_max": 95,
"alpha_frac": 0.5832095097,
"autogenerated": false,
"ratio": 3.15962441314554,
"config_test": fal... |
# 70600674
import euler
s = """
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 ... | {
"repo_name": "higgsd/euler",
"path": "py/11.py",
"copies": "1",
"size": "2013",
"license": "bsd-2-clause",
"hash": -1584624586775569000,
"line_mean": 36.9811320755,
"line_max": 59,
"alpha_frac": 0.5494287134,
"autogenerated": false,
"ratio": 2.8553191489361702,
"config_test": false,
"has_no_... |
# 7.1.2015
# Builtins
import os, sys
# from armchair biology blog (now implemented in biopython)
from KGML_parser import read
from KGML_vis import KGMLCanvas
from KGML_scrape import retrieve_kgml_to_file, retrieve_KEGG_pathway
import argparse
import pandas as pd
############################
psr = argparse.ArgumentPars... | {
"repo_name": "bluegenes/MakeMyTranscriptome",
"path": "scripts/util/color_pathways2.py",
"copies": "1",
"size": "3579",
"license": "bsd-3-clause",
"hash": 7207384914111157000,
"line_mean": 33.0857142857,
"line_max": 185,
"alpha_frac": 0.6677842973,
"autogenerated": false,
"ratio": 2.948105436573... |
# 7.1
class Node(object):
nxt = None
value = None
def __init__(self, value, n=None):
self.nxt = n
self.value = value
def merge(head1, head2):
if head1.value < head2.value:
result = head1
current = result
head1 = head1.nxt
else:
result = head2
... | {
"repo_name": "napplebee/algorithms",
"path": "epi/merge_linked.py",
"copies": "2",
"size": "1117",
"license": "mit",
"hash": 5061932790640456000,
"line_mean": 20.9019607843,
"line_max": 58,
"alpha_frac": 0.5264100269,
"autogenerated": false,
"ratio": 3.4159021406727827,
"config_test": false,
... |
#71 编写input()和output()函数输入,输出5个学生的数据记录
student = []
def input_stu(stu, num):
for i in range(5):
stu.append(['', '', []])
for i in range(num):
stu[i][0] = input('input the num:\n')
stu[i][1] = input('input the name:\n')
for j in range(2):
stu[i][2].append(int(inp... | {
"repo_name": "cwenao/python_web_learn",
"path": "base100/base100/base_71-80.py",
"copies": "1",
"size": "3186",
"license": "apache-2.0",
"hash": -7421515881557432000,
"line_mean": 14.6047904192,
"line_max": 90,
"alpha_frac": 0.5510360706,
"autogenerated": false,
"ratio": 1.9757391963608795,
"c... |
#720->144->720
import tensorflow as tf
from PIL import Image
import numpy as np
import os.path
import random
name = 'SCV-CNN-Batch-Re'
lr=1e-4 #learning rate
ratio = 4/3
H1=144
W1=int(H1*ratio)
H15=360
W15=int(H15*ratio)
H2=720
W2=int(H2*ratio)
path="../Data/"
pref2="720p/"
suff2=".jpg"
train_num=... | {
"repo_name": "yhunroh/SSHS-Waifu",
"path": "SCV-batch.py",
"copies": "1",
"size": "5949",
"license": "mit",
"hash": -2501068361271973000,
"line_mean": 35.4150943396,
"line_max": 103,
"alpha_frac": 0.6481761641,
"autogenerated": false,
"ratio": 2.6115013169446883,
"config_test": false,
"has_n... |
#720->144->720
import tensorflow as tf
from PIL import Image
import numpy as np
import os.path
import random
name = 'SCV-CNN-Re'
lr=1e-4 #learning rate
ratio = 4/3
H1=144
W1=int(H1*ratio)
H15=360
W15=int(H15*ratio)
H2=720
W2=int(H2*ratio)
path="Data/"
pref2="720p/"
suff2=".jpg"
train_num=3000000#100... | {
"repo_name": "yhunroh/SSHS-Waifu",
"path": "RNE-수정.py",
"copies": "1",
"size": "4572",
"license": "mit",
"hash": 1501142592260606000,
"line_mean": 29.5310344828,
"line_max": 103,
"alpha_frac": 0.6290463692,
"autogenerated": false,
"ratio": 2.6705607476635516,
"config_test": false,
"has_no_ke... |
#720->144->720
import tensorflow as tf
from PIL import Image
import numpy as np
import os.path
import random
name = 'SCV-CNN-Re'
lr=1e-4 #learning rate
ratio = 4/3
H1=144
W1=int(H1*ratio)
H15=360
W15=int(H15*ratio)
H2=720
W2=int(H2*ratio)
path="../Data/"
pref2="720p/"
suff2=".jpg"
train_num=300000... | {
"repo_name": "yhunroh/SSHS-Waifu",
"path": "SCV.py",
"copies": "1",
"size": "5690",
"license": "mit",
"hash": 2657230980662313500,
"line_mean": 34.9480519481,
"line_max": 103,
"alpha_frac": 0.6509666081,
"autogenerated": false,
"ratio": 2.607699358386801,
"config_test": false,
"has_no_keywor... |
"""72. Edit Distance
https://leetcode.com/problems/edit-distance/description/
Given two words word1 and word2, find the minimum number of operations
required to convert word1 to word2.
You have the following 3 operations permitted on a word:
- Insert a character
- Delete a character
- Replace a character
Example 1... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/edit_distance.py",
"copies": "1",
"size": "1842",
"license": "mit",
"hash": 4992643133368479000,
"line_mean": 28.7096774194,
"line_max": 73,
"alpha_frac": 0.562432139,
"autogenerated": false,
"ratio": 3.154109589041096,
... |
#7.2 Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form:
#X-DSPAM-Confidence: 0.8475
#Count these lines and extract the floating point values from each of the lines and compute the average of those values and produce an output as shown below.
... | {
"repo_name": "joeyb182/pynet_ansible",
"path": "Coursera-UMich/files_7-2_assignment.py",
"copies": "1",
"size": "1286",
"license": "apache-2.0",
"hash": -210679510462083140,
"line_mean": 41.8666666667,
"line_max": 157,
"alpha_frac": 0.7122861586,
"autogenerated": false,
"ratio": 3.73837209302325... |
# 7.2 Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form:
# X-DSPAM-Confidence: 0.8475
# Count these lines and extract the floating point values from each of the lines and compute the average of those values and produce an output as shown belo... | {
"repo_name": "jerrydeboer/crs-assignments",
"path": "assignement72.py",
"copies": "1",
"size": "1059",
"license": "cc0-1.0",
"hash": -9135569060161607000,
"line_mean": 31.0909090909,
"line_max": 158,
"alpha_frac": 0.7072710104,
"autogenerated": false,
"ratio": 3.553691275167785,
"config_test":... |
# 73167176531330624919225119674426574742355349194934
# 96983520312774506326239578318016984801869478851843
# 85861560789112949495459501737958331952853208805511
# 12540698747158523863050715693290963295227443043557
# 66896648950445244523161731856403098711121722383113
# 62229893423380308135336276614282806444486645238749
# ... | {
"repo_name": "utsavnarayan/projecteuler",
"path": "solutions/8.py",
"copies": "1",
"size": "2926",
"license": "mit",
"hash": 2401993863502567400,
"line_mean": 47.7666666667,
"line_max": 127,
"alpha_frac": 0.7812713602,
"autogenerated": false,
"ratio": 2.7840152235965747,
"config_test": false,
... |
"""75. Sort Colors
https://leetcode.com/problems/sort-colors/
Given an array with n objects colored red, white or blue, sort them in-place
so that objects of the same color are adjacent, with the colors in the order
red, white and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white,
and... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/sort_colors.py",
"copies": "1",
"size": "1202",
"license": "mit",
"hash": -6440219481216702000,
"line_mean": 26.3181818182,
"line_max": 78,
"alpha_frac": 0.5266222962,
"autogenerated": false,
"ratio": 3.3669467787114846,... |
"""76. Minimum Window Substring
https://leetcode.com/problems/minimum-window-substring/
Given a string S and a string T, find the minimum window in S which will
contain all the characters in T in complexity O(n).
Example:
Input: S = "ADOBECODEBANC", T = "ABC"
Output: "BANC"
Note:
If there is no such window in S... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/minimum_window_substring.py",
"copies": "1",
"size": "2253",
"license": "mit",
"hash": -3524778804632741400,
"line_mean": 30.7323943662,
"line_max": 77,
"alpha_frac": 0.459831336,
"autogenerated": false,
"ratio": 4.05945... |
# 796. Rotate String
# We are given two strings, A and B.
# A shift on A consists of taking string A and moving the leftmost character to the rightmost position.
# For example, if A = 'abcde', then it will be 'bcdea' after one shift on A.
# Return True if and only if A can become B after some number of shifts on A.... | {
"repo_name": "gengwg/leetcode",
"path": "796_rotate_string.py",
"copies": "1",
"size": "1605",
"license": "apache-2.0",
"hash": -4576956812069303300,
"line_mean": 24.4761904762,
"line_max": 104,
"alpha_frac": 0.600623053,
"autogenerated": false,
"ratio": 3.062977099236641,
"config_test": false... |
"""79 characters long """
import sys
import webbrowser
import praw
import prawcore
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
reddit = praw.Reddit('cheeseywhiz')
class InputDialog(QMainWindow):
"""Enter subreddit: [Ent... | {
"repo_name": "cheeseywhiz/cheeseywhiz",
"path": "Reddit-scripts/GetRedditLink/Dialogs/Input.py",
"copies": "1",
"size": "7010",
"license": "mit",
"hash": 2151585535274177500,
"line_mean": 35.5104166667,
"line_max": 79,
"alpha_frac": 0.5370898716,
"autogenerated": false,
"ratio": 4.49071108263933... |
import sys
import os.path
from getopt import gnu_getopt, GetoptError
import re
BASIC_SET = set([
'BTEQZ', 'BNEZ', 'MTSP', 'JR', 'SUBU',
'SRA', 'BEQZ', 'MFPC', 'CMP', 'LI',
'LW', 'MFIH', 'MTIH', 'ADDIU', 'B',
'ADDIU3', 'SLL', 'SW_SP', 'LW_SP', 'AND',
'ADDU', 'SW', 'ADDSP', 'NOP', 'OR',
])
EXTEND_... | {
"repo_name": "fupolarbear/THU-Class-CO-makecomputer",
"path": "assembler/thcoas.py",
"copies": "1",
"size": "9359",
"license": "mit",
"hash": -4572262676468717600,
"line_mean": 32.7870036101,
"line_max": 79,
"alpha_frac": 0.5097766855,
"autogenerated": false,
"ratio": 3.283859649122807,
"confi... |
"""79. Word Search
https://leetcode.com/problems/word-search/description/
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where
"adjacent" cells are those horizontally or vertically neighboring. The same
letter cell may not be u... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/word_search.py",
"copies": "1",
"size": "1779",
"license": "mit",
"hash": -3279024242654806000,
"line_mean": 27.1428571429,
"line_max": 77,
"alpha_frac": 0.518894529,
"autogenerated": false,
"ratio": 3.6481481481481484,
... |
# 7 may 2013
from idc import *
def panic(msg):
print(msg)
exit()
def addseg(name, start, end):
err = idc.AddSeg(start, end, 0, 1, idc.saAbs, idc.scPub)
if err != 1:
panic("add segment %s failed" % (name))
err = idc.RenameSeg(start, name)
if not(err):
panic("rename segment %s failed" % (name))
def setLabelA... | {
"repo_name": "andlabs/idapyscripts",
"path": "gbaload.py",
"copies": "1",
"size": "7051",
"license": "mit",
"hash": -7422922637238306000,
"line_mean": 42.524691358,
"line_max": 79,
"alpha_frac": 0.7128066941,
"autogenerated": false,
"ratio": 2.222187204538292,
"config_test": false,
"has_no_k... |
''' 7-plot-means.py
=========================
AIM: Plots the means of 6-mean_sl.py ! Comparison for an arbitrary number of cases
INPUT: files: - <orbit_id>_misc/orbits.dat
- <orbit_id>_flux/flux_*.dat
variables: see section PARAMETERS (below)
OUTPUT: in all_figures/ : comparison for every orbit_id
CMD: python 7-... | {
"repo_name": "kuntzer/SALSA-public",
"path": "7a_plot_means.py",
"copies": "1",
"size": "5969",
"license": "bsd-3-clause",
"hash": 757400171365195000,
"line_mean": 28.4039408867,
"line_max": 143,
"alpha_frac": 0.5885407941,
"autogenerated": false,
"ratio": 2.855980861244019,
"config_test": fal... |
# 7. Reverse Integer QuestionEditorial Solution My Submissions
# Total Accepted: 166072
# Total Submissions: 698816
# Difficulty: Easy
# Reverse digits of an integer.
# Example1: x = 123, return 321
# Example2: x = -123, return -321
# Have you thought about this?
# Here are some good questions to ask before coding.... | {
"repo_name": "huhuanming/leetcode",
"path": "Python/reverse_integer.py",
"copies": "1",
"size": "1115",
"license": "mit",
"hash": -7330281477262549000,
"line_mean": 30.8571428571,
"line_max": 172,
"alpha_frac": 0.6439461883,
"autogenerated": false,
"ratio": 3.8184931506849313,
"config_test": f... |
7#!/sw/xc40/python/2.7.11/sles11.3_gnu5.1.0/bin/python
import argparse
from decimate import *
import pprint
DEBUG = False
cmd_line = (" ".join(sys.argv)).split("--decimate")
cmd_line = (" ".join(sys.argv))
if 'DPARAM' in os.environ.keys():
cmd_line = clean_line(os.environ['DPARAM']) + " " + cmd_line
if len(cmd_l... | {
"repo_name": "KAUST-KSL/decimate",
"path": "slurm_frontend.py",
"copies": "1",
"size": "6591",
"license": "bsd-2-clause",
"hash": 1277133867381063400,
"line_mean": 32.9742268041,
"line_max": 99,
"alpha_frac": 0.5307237142,
"autogenerated": false,
"ratio": 3.44177545691906,
"config_test": true,... |
"""7th update, adds an index to the api_key on games
Revision ID: 563495edabd3
Revises: ea0a548215f
Create Date: 2015-11-23 12:23:44.895973
"""
# revision identifiers, used by Alembic.
revision = '563495edabd3'
down_revision = 'ea0a548215f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### com... | {
"repo_name": "Rdbaker/Rank",
"path": "migrations/versions/563495edabd3_.py",
"copies": "2",
"size": "1040",
"license": "mit",
"hash": -8628744957737330000,
"line_mean": 29.5882352941,
"line_max": 80,
"alpha_frac": 0.6403846154,
"autogenerated": false,
"ratio": 3.229813664596273,
"config_test":... |
7#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:38:48 2018
@author: BallBlueMeercat
"""
from scipy.integrate import odeint
from scipy.interpolate import interp1d
import firstderivs_cython as f
import numpy as np
firstderivs_functions = {
'rainbow':f.rainbow,
'niagara':f.ni... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "Models/zodesolve.py",
"copies": "1",
"size": "4884",
"license": "mit",
"hash": 465899834873995900,
"line_mean": 30.5161290323,
"line_max": 114,
"alpha_frac": 0.5642915643,
"autogenerated": false,
"ratio": 2.867880211391662,
"config_test": fal... |
7#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:38:48 2018
@author: BallBlueMeercat
"""
from scipy.integrate import odeint
import firstderivs_cython as f
#import firstderivs as f
firstderivs_functions = {
'exotic':f.exotic,
'late_intxde':f.late_intxde,
'heaviside_... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "zprev versions/Models_py_backup/Models backup/zodesolve.py",
"copies": "1",
"size": "6361",
"license": "mit",
"hash": -2541292502403166700,
"line_mean": 33.3891891892,
"line_max": 105,
"alpha_frac": 0.5277472096,
"autogenerated": false,
"ratio"... |
7#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:38:48 2018
@author: BallBlueMeercat
"""
from scipy.integrate import odeint
import firstderivs_cython as f
import numpy as np
import matplotlib.pyplot as plt
firstderivs_functions = {
'rainbow':f.rainbow,
'kanangra':f.kanangra... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "Models/zodesolve backup.py",
"copies": "1",
"size": "5775",
"license": "mit",
"hash": -5447164605442512000,
"line_mean": 30.0537634409,
"line_max": 114,
"alpha_frac": 0.5383549784,
"autogenerated": false,
"ratio": 2.7292060491493384,
"config_... |
7#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 15 13:38:48 2018
@author: BallBlueMeercat
"""
from scipy.integrate import odeint
import zfirstderivs
# Standard cosmological parameters.
c_over_H0 = 4167 * 10**6 # c/H0 in parsecs
def zodesolve(gamma,m,de,zpicks):
"""
Takes in:
... | {
"repo_name": "lefthandedroo/Cosmo-models",
"path": "zprev versions/zodesolve copy.py",
"copies": "1",
"size": "1511",
"license": "mit",
"hash": 3986755388088950300,
"line_mean": 25.5087719298,
"line_max": 72,
"alpha_frac": 0.5598941099,
"autogenerated": false,
"ratio": 2.693404634581105,
"conf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.