blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
beda96190116544dbace06a9ccc411efbacdd4cc | EricaEmmm/CodePython | /TEST/拼多多_1优先偶数的有序TopN_AC.py | 1,151 | 3.875 | 4 | '''
优先偶数的有序TopN
读入一个数列和N值,返回优先级排序的N个数,满足:
1.所有偶数优先级大于奇数
2.同为奇数/偶数时,数值大的优先级高
输入:用(,)分开的自然数数列和用(;)分开的参数N
输出:N个数
示例:
输入:
555503,772867,756893,339138,399447,40662,859037,628085,855723,974471,599631,636153,581541,174761,948135,411485,554033,858627,402833,546467,574367,360461,566480,755523,222921,164287,420256,40043,977167,5... |
31151f08c557a36b0f6d99336a00e3d3619a3f12 | EricaEmmm/CodePython | /LeetCode/Q095_DP_uniqueBinarySearchTreesII.py | 3,268 | 3.671875 | 4 | # 不同的二叉搜索树 II
# 给定一个整数 n,生成所有由 1 ... n 为节点所组成的二叉搜索树。
#
# 示例:
# 输入: 3
# 输出:
# [
# [1,null,3,2],
# [3,2,null,1],
# [3,1,null,null,2],
# [2,1,3],
# [1,null,2,null,3]
# ]
# 解释:
# 以上的输出对应以下 5 种不同结构的二叉搜索树:
# 1 3 3 2 1
# \ / / / \ \
# 3 2 1 1 3 ... |
b10dafb5052a011a9f8829f2409dc987efd63f13 | EricaEmmm/CodePython | /OfferCode/字符串_02_替换空格.py | 1,962 | 4.03125 | 4 | # 替换空格
# 请实现一个函数,将一个字符串中的每个空格替换成“%20”。
# 例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。
class Solution:
def replaceSpace1(self, s):
"""
顺序查找替换
:param s: 源字符串
:return: 替换空格字符串
"""
res = ''
for i in s:
if i == ' ':
res += '%20'
... |
dc3883530c404a8fcb3180a02f8e2eefb7b36c73 | EricaEmmm/CodePython | /LeetCode/Q939_HM_MinimumAreaRectangle.py | 1,396 | 3.578125 | 4 | # 最小面积矩形
# 给定在xy平面上的一组点,确定由这些点组成的矩形的最小面积,其中矩形的边平行于x轴和y轴。
# 如果没有任何矩形,就返回0。
#
# 示例1:
# 输入:[[1, 1], [1, 3], [3, 1], [3, 3], [2, 2]]
# 输出:4
#
# 示例2:
# 输入:[[1, 1], [1, 3], [3, 1], [3, 3], [4, 1], [4, 3]]
# 输出:2
#
# 提示:
# 1 <= points.length <= 500
# 0 <= points[i][0] <= 40000
# 0 <= points[i][1] <= 40000
# 所有的点都是不同的。
class ... |
84a49854c1ad52c734a3bfbc78e386ca37ae3d35 | EricaEmmm/CodePython | /LeetCode/Q676_HM_ImplementMagicDictionary.py | 2,149 | 3.953125 | 4 | # 实现一个魔法字典
# 实现一个带有buildDict, 以及 search方法的魔法字典。
# 对于buildDict方法,你将被给定一串不重复的单词来构建一个字典。
# 对于search方法,你将被给定一个单词,并且判定能否只将这个单词中一个字母换成另一个字母,使得所形成的新单词存在于你构建的字典中。
#
# 示例 1:
# Input: buildDict(["hello", "leetcode"]), Output: Null
# Input: search("hello"), Output: False
# Input: search("hhllo"), Output: True
# Input: search("hel... |
b4e5f223475b1e8104200772f0395609dafdb48c | EricaEmmm/CodePython | /OfferCode/树_23_二叉搜索树的后序遍历序列.py | 978 | 3.6875 | 4 | '''
二叉搜索树的后序遍历序列
输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。
如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
'''
class Solution:
def VerifySquenceOfBST(self, sequence):
n = len(sequence)
if n == 0: return False
if n == 1: return True
root = sequence[-1]
i = 0
while sequence[i] < root:
... |
a38ac918dfc7d40475536fdca9464280a6daa7b3 | EricaEmmm/CodePython | /Algorithm/List_L141链表求环.py | 1,508 | 3.84375 | 4 | # 环形链表
# 给定一个链表,判断链表中是否有环。
# 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。
from tool import ListNode, createLinkList
class Solution(object):
# 用set存储查找
# 时间复杂度:O(n),空间复杂度:O(n)
def hasCycle1(self, head):
"""
:type head: ListNode
:rtype: bool
"""
... |
36ab70a155e4a25276fad931b81ffd0780444c6b | EricaEmmm/CodePython | /TEST/小红书1_笔记草稿_55改OK.py | 2,112 | 4.0625 | 4 | '''
笔记草稿
薯队长写了一篇笔记草稿,请你帮忙输出最后内容。
1.输入字符包括英文字符,"(" , ")" 和 "<"。
2.英文字符表示笔记内容。
3. ( ) 之间表示注释内容,任何字符都无效。 括号保证成对出现。
4. "<" 表示退格, 删去前面一个笔记内容字符。 括号不受 "<" 影响 。
输入:输入一行字符串。长度 <= 10000.
输出:输出一行字符串,表示最终的笔记内容。
示例:
输入:a<<b((c)<)
输出:b
提示:a退格删除掉了, 括号里面的c不要, 最后一个< 无效
'''
def brackets(mystring):
res = []
tmp_k = 0
while... |
1043a1ed7cb9f5e9ca4da8c80d969da7464e6469 | EricaEmmm/CodePython | /OfferCode/数组_28_数组中出现次数超过一半的数字.py | 1,475 | 3.71875 | 4 | '''
数组中出现次数超过一半的数字
数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。
由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2。如果不存在则输出0。
'''
from collections import Counter
class Solution:
def MoreThanHalfNum_Solution1(self, numbers):
"""
思路:Hash
时间复杂度:O(n),空间复杂度:O(n)
"""
dic = Counter... |
1a01d3e83586a8f144c8ce5dfd01c319280c7341 | EricaEmmm/CodePython | /LeetCode/Q451_HM_SortCharactersByFrequency.py | 1,411 | 3.890625 | 4 | # 根据字符出现频率排序
# 给定一个字符串,请将字符串里的字符按照出现的频率降序排列。
#
# 示例 1:
# 输入:"tree"
# 输出:"eert"
# 解释:'e'出现两次,'r'和't'都只出现一次。因此'e'必须出现在'r'和't'之前。此外,"eetr"也是一个有效的答案。
#
# 示例 2:
# 输入:"cccaaa"
# 输出:"cccaaa"
# 解释:'c'和'a'都出现三次。此外,"aaaccc"也是有效的答案。注意"cacaca"是不正确的,因为相同的字母必须放在一起。
#
# 示例 3:
# 输入:"Aabb"
# 输出:"bbAa"
# 解释:此外,"bbaA"也是一个有效的答案,但"Aabb"是不正... |
deaa8dada80af6eb4d9a6281bccf048c248c2fbe | shuq3/practice-python | /#13 fib.py | 253 | 4.0625 | 4 | num = int(input("Input a num: "))
def fib(n):
if n == 1:
return [1];
if n == 2:
return [1, 1];
else:
arr = fib(n-1);
arr.append(arr[n-2]+arr[n-3])
return arr;
resultarr = fib(num);
print (resultarr)
|
14d067476573bb4b5c8bc5a10641c5b7f16c1237 | Nanorneirbo/Practice_Python.org | /ProjectEuler/palindrome.py | 364 | 3.703125 | 4 | i = 0
j = 0
largest_palindrome = 0
for i in range(99, 999):
for j in range(99, 999):
num = i * j
number = str(num)
reverse = ""
for k in range(len(number)):
reverse += number[len(number)-k-1]
if reverse == number and num > largest_palindrome:
largest_... |
fbeac30f1a4a2ce83899326613a7dabff3e93889 | shmulik-willinger/term3_lessons | /search_program.py | 4,828 | 3.84375 | 4 | # ----------
# User Instructions:
#
# Define a function, search() that returns a list
# in the form of [optimal path length, row, col]. For
# the grid shown below, your function should output
# [11, 4, 5].
#
# If there is no valid path from the start point
# to the goal, your function should return the string
# 'fail'
... |
a4d1dcdac0d183e18e3f643d284e65ab47cb0eba | wangyunpengbio/LeetCode | /51-100/085-maximalRectangle.py | 1,227 | 3.75 | 4 | class Solution:
# 这一题的算法本质上和84题Largest Rectangle in Histogram一样,对每一行都求出每个元素对应的高度,这个高度就是对应的连续1的长度,然后对每一行都更新一次最大矩形面积。那么这个问题就变成了Largest Rectangle in Histogram。本质上是对矩阵中的每行,均依次执行84题算法。
def maximalRectangle(self, matrix: List[List[str]]) -> int:
if len(matrix) == 0:
return 0
res = 0
... |
5c6e827359051f06daa392678c6773c2ecd66367 | wangyunpengbio/LeetCode | /51-100/075-v2-sortColors.py | 731 | 3.5625 | 4 | class Solution:
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
# 解法三:基于三路快排的partition的解法,时间复杂度O(n),只需要一边遍历
# https://www.imooc.com/article/16141
i = 0 # nums[0..<i) == 0
j = 0 # nums[i..<j) == 1
... |
a03ea39af1980ff20691ea92fc4f896430daea4b | wangyunpengbio/LeetCode | /competition/1038-binarySearchTreetoGreaterSumTree.py | 1,315 | 3.734375 | 4 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# 相当于中序遍历,逆向累加求和,再赋值回去
def bstToGst(self, root: TreeNode) -> TreeNode:
# 中序遍历
def inorderTraversal(root: TreeNode) ->... |
bc7a0b5ca39d0bb8e477ffe1116b009ead026fec | wangyunpengbio/LeetCode | /competition/1042-v4-flowerPlantingWithNoAdjacent.py | 1,031 | 3.53125 | 4 | class Solution:
def gardenNoAdj(self, N, paths):
# 与i相连的公园的flower找到,填充不一样flower 就行了
from collections import defaultdict
res = [0] * N
graph = defaultdict(set)
for path in paths:
graph[path[0]].add(path[1])
graph[path[1]].add(path[0])
def conne... |
a9008f80ba846b19cf2460c32c8f64f605ca5a7a | wangyunpengbio/LeetCode | /191-numberof1Bits.py | 482 | 3.65625 | 4 | class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
res = 0
n = str(n)
print(n)
for item in n:
if item == "1":
res = res + 1
return res
# 用1当做mask进行位运算 + 移位运算
# res = ... |
58a82a0525e0ea95eda2ff7a3c35470fbc18cb1c | wangyunpengbio/LeetCode | /199-binaryTreeRightSideView.py | 844 | 3.65625 | 4 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from collections import defaultdict
class Solution:
# 直接借助队列进行层次遍历,找每层最右边的节点即可
def rightSideView(self, root: TreeNode) -> List[int]:
if root =... |
6078f0e23ef872b3eb732313d85cda7cbfe78a75 | wangyunpengbio/LeetCode | /51-100/082-removeDuplicatesfromSortedListII.py | 1,178 | 3.765625 | 4 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
# 链表前头加一个节点会更才能兼容head
headZero = ListNode("Zero")
headZero.next = head
cur = ... |
ff602b42c1346c5a875206e5889ea39e7727183d | wangyunpengbio/LeetCode | /160-v4-intersectionofTwoLinkedLists.py | 1,115 | 3.625 | 4 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
# 先计算链表A的... |
4b52c2b5a7e6078d722910ca83836ec33227fc0e | wangyunpengbio/LeetCode | /interview/Microsoftshoot.py | 2,246 | 3.625 | 4 | # 题目的意思是射击,遇到回文可以消一串回文,问最少射击几次
# 比如[1,2,3]这个数组射击3次消完
# 比如[1,2,3,2]这个数组射击2次消完,先打2 3 2算一次,再消掉1算一次
# 比如[1,2,4,5,2,1]这个数组射击2次消完,先打4或者5算一次,剩下的变成回文数,再一次消完
def expandAroundCenter(s, left, right):
L,R = left,right
while L>=0 and R<len(s) and s[L]==s[R]:
L = L - 1
R = R + 1
return (L,R)
def palindro... |
b5513632f922aef4ba1be104cc4d4b3242eab151 | wangyunpengbio/LeetCode | /51-100/069-v2-Sqrt(x).py | 640 | 3.546875 | 4 | class Solution:
def mySqrt(self, x: int) -> int:
# 二分法查找
l,r = 1,x
while l <= r:
target = (l + r) // 2
# print(l,r,target)
if target * target > x:
r = target
elif target * target < x:
l = target
else:... |
cffd8d7b6f4dce814761673fab3a5e7dc448c782 | wangyunpengbio/LeetCode | /competition/1030-v2-nextGreaterNodeInLinkedList.py | 851 | 3.75 | 4 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def nextLargerNodes(self, head: ListNode) -> List[int]:
# 先把整个链表读进来
numlist = []
while head!=None:
numlist.append(head.val)
... |
1c708793cebe41036db0a3cea969982627abbe82 | wangyunpengbio/LeetCode | /competition/1029-binaryPrefixDivisibleBy5.py | 463 | 3.5 | 4 | # 超出时间限制
class Solution:
def prefixesDivBy5(self, A: List[int]) -> List[bool]:
res = []
# 截取出对应的字符串,再使用python自带的int(num, 2)进行二进制转换
for i in range(len(A)):
num = ""
for x in A[:i+1]:
num = num+str(x)
if int(num, 2) % 5==0:
re... |
5f9b65cf93b598a259037ade9c40ebc7745671f2 | wangyunpengbio/LeetCode | /227-basicCalculatorII.py | 984 | 3.75 | 4 | class Solution:
def calculate(self, s: str) -> int:
import re
numbers = re.split("[+-/*]",s)
operators = re.findall("[+-/*]",s)
# 先把乘除符号前后的数字都计算完成
i = 0
while i < len(operators):
if operators[i] == "*" or operators[i] == "/":
op = operators... |
1b5bf22c5101838b18d44f1f550fa452c752e7a4 | wangyunpengbio/LeetCode | /142-linkedListCycleII.py | 2,503 | 3.875 | 4 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
# 把见过的节点丢集合里,下次再遇见就是环的开始
def detectCycle(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
s = {... |
5613e444b43b3b2a773cc14e9f6f3db1650332f2 | suprithreddy267/ineuron-Assignments | /python_ass1.py | 324 | 3.828125 | 4 | # 1st Answer
for num in range(2000,3200):
if(num%5!=0 and num%7==0):
print(num,end=",")
#2nd answer
first=input("enter first name : ")
last=input("enter last name : ")
print(last[::-1]+" "+first[::-1])
#3rd answer
diameter=12
r=diameter/2
print("Volume of sphere = ",((4/3)*3.12*pow(r,... |
0f41a5dd9afb75891f6670d069ea1f8aba40e37b | Kashyap03-K/Simple_Python_Programs | /Perfect Number or not.py | 498 | 4.0625 | 4 | '''
Write a program to check whether a number is Perfect Number or not.
[What is perfect Number ? --> If the sum of factors of the number N (excluding N)is equal to the number itself it is a perfect number.
Ex: Factors of 6 =1,2,3 and 1+2+3=6 ,6 is a perfect number]
'''
n=int(input("Enter any number"))
s=0
for i in r... |
45446f437f9fd567ed0ad44ea7c8af631b9a3060 | mariabv/MariaVillafranca_labb4 | /Lab4-Upp6_2.py | 873 | 3.828125 | 4 | import time
#import array
def checkorder(lista):
log = True
nn=len(lista)//2 #optimization
for i in range(1,nn):
if lista[i]>lista[i+1]:
log = False; break
return log
def shuffle(lista):
nylista = list(lista)
n=len(lista) #lenght of list
nn = n//2
for i in range(0,nn):
nylista[i*2]=lista[... |
e30ce578655d21d1ab4532a9aa29fb8451383e5f | bliaw/algorithms_python | /robot_sim.py | 6,398 | 4.4375 | 4 | """Find the final max distance of the robot during route."""
from collections import OrderedDict
from typing import Dict
from typing import List
from typing import Tuple
class RobotSim:
"""A robot on an infinite grid starts at (0, 0) and faces north. The
robot can receive 3 possible commands:
- -2: turn... |
6c1b6b9a6c235826ace320eae96868b1a754a05d | gregorybutterfly/examples | /Decorators/1-python-decorator-example.py | 886 | 4.46875 | 4 | #!/usr/bin/python
""" A very simple example of how to use decorators to add additional functionality to your functions. """
def greeting_message_decorator(f):
""" This decorator will take a func with all its contents and wrap it around WRAP func.
This will create additional functionality to the 'greeting_mess... |
ad73e0369c00a547c883e7b5b1c8c5c950a3635e | vanely/Python-Challenges | /KeepHydrated/liters.py | 175 | 3.5625 | 4 | import math;
def litres(time):
return math.floor(time / 2)
#for greater simplicity we could use python floor division
def liters(t):
return t // 2
print(litres(5)) |
0f11b2f462194f59dd6cf698a3c78d77595fd072 | vanely/Python-Challenges | /OrderedCountOfCharacters/script.py | 647 | 4.09375 | 4 | # Count the number of occurrences of each character and return it as a list of tuples in order of appearance.
str1 = "abracadabra"; # [['a', 5], ['b', 2], ['r', 2], ['c', 1], ['d', 1]]]
str2 = "Code Wars"; # [['C', 1], ['o', 1], ['d', 1], ['e', 1], [' ', 1], ['W', 1], ['a', 1], ['r', 1], ['s', 1]]]
str3 = "212"; # [[... |
b5039dbba52d8dbcbd00774c1f2745bc7958f66b | RedH11/hands_on_ml | /Course 1: Intro to TF/california_housing_complex.py | 1,573 | 3.5 | 4 | import tensorflow.keras as keras
from tensorflow.keras.layers import Concatenate, Dense, Input
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
# Fetch the dataset
housing = fetch_california_housing()
# Assign t... |
79295d2163c09aba6bbb2a2942244476e88c79f9 | jchalvorsen/mnist | /2048/random_player.py | 725 | 3.546875 | 4 | from solve2048 import *
import random
def run_random():
board = np.zeros((GRID_LEN, GRID_LEN), dtype=np.int)
place_new_tile(board)
moves = range(4)
while True:
m = random.randint(0,3)
new_board = move(board, m)
#print new_board == board, (new_board==bo... |
3f78094152b4c5759fa4776296a4dd47e48d4b61 | sam676/PythonPracticeProblems | /Robin/desperateForTP.py | 1,004 | 4.28125 | 4 | """
You've just received intel that your local market has received a huge
shipment of toilet paper! In desperate need, you rush out to the store.
Upon arrival, you discover that there is an enormously large line of
people waiting to get in to the store. You step into the queue and start
to wait. While you wait, you bei... |
269910439e357f1e3e9b1576e08dc319918b9406 | sam676/PythonPracticeProblems | /Robin/reverseMessage.py | 1,083 | 4.21875 | 4 | """
Today's question
You are a newbie detective investigating a murder scene in the boardroom
at the Macrosoft Corp. While searching for clues, you discover a red notebook.
Inside of the notebook are long journal entries with inverted messages.
At that moment, you remembered from your profiler father’s advice that
you ... |
26ccdbc2bae76c99ce4409f4dbaef17419d78086 | sam676/PythonPracticeProblems | /Robin/palindromeNumber.py | 1,709 | 4.3125 | 4 | """
Sheltered at home, you are so bored out of your mind that you start thinking
about palindromes. A palindrome, in our case, is a number that reads the
same in reverse as it reads normally. Robin challenges you to write a
function that returns the closest palindrome to any number of your choice.
If your number is exa... |
095000b97fa3e4993fef3682cb33e688586eb4ae | sam676/PythonPracticeProblems | /Robin/isMagic.py | 1,199 | 4.53125 | 5 | """
You've heard about Magic Squares, right?
A magic square is one big square split into separate squares
(usually it is nine separate squares, but can be more), each containing a unique number.
Each horizontal, vertical, and diagonal row MUST add up to the same number
in order for it to be considered a magic squar... |
57a76e4402bad59476588863a63a67e89e5d5bd0 | sam676/PythonPracticeProblems | /Robin/numScanner.py | 1,174 | 4.25 | 4 | """
How are our lovely number people doing today?
We're going to have an exclusive numbers-only party next week.
You can bring any type of friends that wear "String" clothes as long as they are real number.
As we expect the infinite number of numbers to come to the party,
we should rather build a scanner that will ... |
ea1b87cf83dcc3f9acb889c5744db940a74a08c6 | sam676/PythonPracticeProblems | /Robin/blindDate.py | 969 | 4.09375 | 4 |
"""
Spring is here and your friend calls to see if you are interested in meeting
someone for a blind date next month. You have been a loner for
so long - solo for 3 years - and even gained 30 pounds.
You are determined to meet the person looking your best,
so you decide to cut meals and do intensive cardio.
You want t... |
a4b9901488a005c10a02c477fa009b2131fa8906 | sam676/PythonPracticeProblems | /Robin/addPositiveDigit.py | 501 | 4.125 | 4 | """
Beginner programmer John Doe wants to make a program that adds and outputs each positive digit
entered by the user (range is int). For instance, the result of 5528 is 20 and the result of 6714283 is 31.
"""
def addPositiveDigit(n):
total = 0
if n >= 0:
for x in str(n):
total += int(x)... |
09d4525fa26a24dad689d72989b424d6688dd151 | JoshuaHess12/hdi-reg | /HDIreg/utils.py | 3,975 | 3.640625 | 4 | #Functions for general purpose usage
#Joshua Hess
# Import modules
import os
from pathlib import Path
import re
import pandas as pd
import numpy as np
def SearchDir(ending = ".txt",dir=None):
"""Search only in given directory for files that end with
the specified suffix.
Parameters
----------
e... |
19b6bea1b3d0e06a851d736a8ff5cc60955dc889 | khaki4/basic_algorithm | /problem/출력문/1018.py | 420 | 3.625 | 4 | # 어떤 형식에 맞추어 시간이 입력될 때, 그대로 출력하는 연습을 해보자.
# 참고
# scanf( ) 함수는 지정한 형식(format)에 따라 입력받는 함수이다.
# 따라서, 입력받고자 하는 형식으로 표현해주면 된다.
# 예시
# scanf("%d:%d", &h, &m); //콜론(:) 기호를 기준으로 두 수가 각 변수에 저장된다.
h, m = input().split(':')
print(h + ':' + m)
|
6a9c4dd510dc982811ce0337d35ea687c097febf | arotena/Test_python | /prueba.py | 345 | 3.65625 | 4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
class TestFunciones(unittest.TestCase):
def test_factorial(self):
self.assertEqual(1, factorial(1))
def factorial(n):
return 1 if n < 1 else n * factorial(n-1)
def suma(n,p):
return n+p
def resta(n,p):
return n-p
if __name__ == '__main... |
b883f91d5970121bc6f14ddddfc5223a76d7167f | Megacephalo/HoneyBeeColoniesInUSA2019 | /scripts/toDataFrameConverter.py | 1,176 | 3.625 | 4 | #! /usr/bin/env python
import pandas as pd
class ToDataFrameConverter:
def __init__(self, inputFile):
# Check if there is input data
if not inputFile:
print('The input file is empty. Usage:\n converter = ToDataFrameConverter(inputFile.extension)')
return
else:
... |
300d516dbb937c7ab585ae89d8cb847cdd730ca9 | anandmehta05/PythonProgramm | /extract_email_from_url.py | 181 | 3.6875 | 4 | import re
def Find(pat,text):
match=re.match(pat,text)
if match:
print match.group()
else:
print "Not Found"
Find(r'[\w.]+@[\w.]+','https:\\www.github.com\er.anandmehta.com') |
da0455fc9eff91a743fc07c699593f2580c4ac2e | sisayyt/sisayyt.githab.io | /Heroes of Pymoli/PyPoll.py | 1,146 | 3.75 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[33]:
import os
import pandas as pd
df = pd.read_csv ("C:/Users/Sisay/Desktop/Resources/election_data.csv")
# ATotal vote casted
Total_votes = df["Candidate"].count()
Total_votes
Cand_votes = df["Candidate"].value_counts()
Cand_votes
#Convert to DataFrame
Cand_votes = p... |
fe4f70101439e0359007e9d117ff43646f7bdbda | skl7028320/UdaCity_DSA_P1 | /problem_3.py | 13,831 | 4.125 | 4 | import sys
from collections import deque
import heapq
class Node:
def __init__(self, char, frequency):
self.char = char
self.frequency = frequency
self.next = None
self.left = None
self.right = None
def has_left_child(self):
if self.left is None:
re... |
a68e26a02bda5398939f35e2c62883279c97b2a6 | YYDAL/PycharmProjects-YYDAL | /1.基础班/元组字典换值.7.25.py | 623 | 3.78125 | 4 | #原来
def HHH(a,b):
c = a['name']
b,c = c,b
a['name'] = c #貌似是暴力换值法
print(a)
print(b)
HHH({'name':222},(1, 2, 3, 4)) #分别输入字典和元组
#修正后
def HHH(*args,**kwargs):
print(args)
print(kwargs)
q = list(kwargs.values()) #不太了解... |
3fb7a796a24b9b3f3efc787d84540274ce400932 | jokewayne/pythons | /secureCRT/sendfile.py | 871 | 3.53125 | 4 | # $language = "python"
# $interface = "1.0"
# This script demonstrates one way to send a text file to a unix server
# This is equivalent to doing an "send ASCII" in a script.
def main():
# Send a 'cat' command to direct everything we are about to send into a file.
#
crt.Screen.Send("cat > output.txt" + '\r')
#... |
245316d9ddeaa983b1e6047eb83085bd33d3c6ae | gas8310/python_git | /sequence_data.py | 481 | 4.1875 | 4 | #시퀀스 자료형
#문자열, 리스트, 튜플 등 인덱스를 가지는 자료형
#기본적 사용법?
#1.
string = "hello - world"
list = ['h', 'e', 'l', 'l', 'o', '-', 'w', 'o', 'r', 'l', 'd']
tuple = ('h', 'e', 'l', 'l', 'o', '-', 'w', 'o', 'r', 'l', 'd')
print(string[0:5])
print(list[0:5])
print(tuple[0:5])
for i in string:
# print(string[i])
print(i)
print... |
e19d9b412fb2cc7db2e47cd0092bc01f1e8436e8 | kavitagorthi/Assignments | /Project_submit/11modue/5debugreally_simple.py | 431 | 3.5625 | 4 | # if the value of i was 50 and above the zeroDivisionError will occur try and except block will handle it.
def my_fun():
for i in range(1, 500):
try :
123 / (50 - i)
except ZeroDivisionError:
print("Tried to divide by zero. Var i was {} and above. Recovered gracefully.".f... |
77b54a0a13add19b3214e128a6f318b00f93af8d | ddubbu/AI-Study-with-python | /1. DL/1. Tensor-flow/4. Unsupervised_Learning/AutoEncoder.py | 2,414 | 3.5625 | 4 | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("./mnist/data/", one_hot=True)
# Unsupervised_Learning
# - encoder, decoder
# - without drop-out OR batch normalization
# - 정확도 테스트가 아니라, 직접 입력-출력(라벨)... |
650797f3953b22903a4d50f5798dfe7878505736 | vadim008/docker-redis-rabbit-elastic | /algo/bfs.py | 762 | 4 | 4 |
from collections import defaultdict
class Graph:
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self, x, y):
self.graph[x].append(y)
def BFS(self, s):
visited = [False] * len(self.graph)
queue = []
queue.append(s)
while queue:
... |
e241aa2106c8e48c37c3531b6d7fa8bdbbf216e7 | amirrulloh/python-oop | /leetcode/2. rverse_integer.py | 863 | 4.1875 | 4 | #Definition
"""
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
wi... |
d642c6059eba1f0d50dd16648efa281fc330aba0 | gexiaojing/tongji2 | /zy4.py | 2,169 | 3.890625 | 4 | """
1.
n=1
def getPentagonalNumber(n):
count=0
for n in range(1,101):
n=n*(3*n-1)/2
print('%d'%n,end=' ')
count+=1
if count%10==0:
print('\n')
getPentagonalNumber(n)
2.
def sumDigits(n):
ge=n%10
shi=n/10%10
bai=n/10/10%10
sum=ge+... |
ac5807601d45d4f350e0b0efb8cd2c7395d5eb3d | DDan7/CoffeeMachine | /Problems/Palindrome/task.py | 396 | 4.125 | 4 | user_input = input()
def palindrome(a):
backward = a[::-1]
if backward == a:
print("Palindrome")
else:
print("Not palindrome")
palindrome(user_input)
# def palindrome(a):
# backward = ''
# for i in a:
# backward += i
# if backward == a:
# print("Palindrome")... |
837f8ddc48af5b568ffe17ac4e6df2604ef3bf2f | IthielP/CaminoOptimoFSI | /run.py | 2,314 | 3.625 | 4 | # Search methods
import search
print("Prueba 1 de A a B")
ab = search.GPSProblem('A', 'B'
, search.romania)
print("Breadth_First:",search.breadth_first_graph_search(ab).path())
print("Depth_First: ",search.depth_first_graph_search(ab).path())
print("Recorrido y profundidad: ",search.recorrido_y... |
108547337578c9e1fed70475ed5daff84cd26745 | dejanu/turnbased_game | /Heroes.py | 2,328 | 3.75 | 4 | from functools import wraps
from Spells import Spell
from random import random, randint
class Hero(Spell):
"""
template class to create heroes
if subclass Spell means that hero can acquire spells and must implement them
"""
def __init__(self, name, health = 70, strength = 70, defence = 45, speed... |
8fe90948b441f7925c5bc23a55bb37a4b4122813 | swandsc/PESU-IO-SUMMER | /coding_assignment_module1/sum.py | 145 | 4.0625 | 4 | num=int(input("Enter a number: "))
sum=0
while(num>0):
rem=num% 10
sum=sum+rem
num=num//10
print("\n Sum of the digits of the number is ",sum) |
23b87a5f667c3e9dc6bc60d3862494630b6175c9 | hrisheekeshr/reddit_score_calculator | /reddit/base_reddit_connection.py | 1,193 | 3.625 | 4 | import abc
class BaseRedditConnection(abc.ABC):
"""
Baseclass for reddit adapters. This creates an object with the specified methods to obtain
informations from reddit APIs
"""
def connect(self,config):
"""
Connects to the reddit connection object with configurations.
:retu... |
32eef57b168583759f3cb63615aa2f987331e758 | Prajit-Rajendran/Leetcode_coding_problems | /Solutions/Q717_1_bit_and_two_bit_characters.py | 856 | 3.546875 | 4 | class Solution(object):
def isOneBitCharacter(self, bits):
"""
:type bits: List[int]
:rtype: bool
"""
if len(bits) == 1:
return True
if len(bits) == 2:
if bits[0]!=1:
return True
else:
return Fal... |
f10d94970fcc9c9626fbd9aa1129a2475f759124 | Prajit-Rajendran/Leetcode_coding_problems | /Solutions/Q917_reverse_only_letters.py | 839 | 3.65625 | 4 | class Solution(object):
def reverseOnlyLetters(self, S):
"""
:type S: str
:rtype: str
"""
def return_ascii(letter):
return ord(letter)
def return_char(number):
return chr(number)
orig_S = S
S = map(return_ascii... |
33c815e4d458aecd22aba9b94f064a0e624608d7 | zenajung/Algospot | /7.2_QUADTREE/quadTree.py | 1,847 | 3.859375 | 4 | __author__ = 'zena'
'''
def quadTree(treeList):
#if(x in tree[1:] == False):
tree = []
index = 0;
for i in xrange(4):
print(index,treeList[index])
if treeList[index+1] == 'x' :
j,t = quadTree(treeList[index+1:])
tree.append(t)
index += j
else... |
83846fa1dc9360aa541f92bdf2bbde484c57e2fb | rladydgus/python | /notepad.py | 303 | 3.703125 | 4 | from tkinter import *
root=Tk()
def saved():
txt=textbox.get('1.0', END+'-1c')
fp = open('txt.txt','w')
fp.write(txt)
fp.close()
textbox=Text(root)
textbox.grid(row=0, column=0)
btn=Button(root, text="Save", command=saved)
btn.grid(row=1, column=0)
root.mainloop()
|
70392967b8a87b3501e26714b4f98f5166cc38f8 | itsafjal/python_stats | /percentile_score.py | 302 | 3.546875 | 4 | #! /usr/bin/python
def Percentile_calculater(scores, your_score):
cnt = 0
for score in scores:
if score<=your_score:
cnt += 1
result = (cnt*100)/len(scores)
return result
scores= [11,22,33,44,55,66,77]
your_score = 55
myresult = Percentile_calculater(scores, your_score)
print myresult
|
9fb78d6f57282958c4c3d28463b2ae175552704e | vish9767/python | /programes/mix.p/def.while.for.py | 249 | 4.03125 | 4 | def star():
name=('vishal','akshay','rohan','somnath')
for e in name:
print("\n")
print(e)
a=int(input("enter the value for star how star you want"))
i=0
while(i<a):
print("*",end="")
i=i+1
star()
|
959e1c94db4e750ab32716b24eb46938e74ee1bd | sydoruk89/data-structures-and-algorithms | /py-code-challenges/array_reverse/array_reverse.py | 174 | 3.90625 | 4 | def reverseArray(arr):
return arr[::-1]
#Stretch goal
def reverseArray(arr):
for i in range(len(arr)):
arr[i], arr[-i -1] = arr[-i-1], arr[i]
return arr
|
b521f7fc060f38336e988535b224ccda662f8ff2 | MelaJia/PycharmProjects | /Text3.py | 1,028 | 3.625 | 4 | # -*- coding: utf-8 -*-
# @Time : Created on 2017/11/15 23:36
# @Author : JiaHong
# 猜猜数字游戏
import random
# game_count记录共玩了几次
# all_count 记录每次玩的猜测数 list[]
game_count=0
all_count=[]
while True:
guess_count = 0
game_count+=1
answer = random.randint(0, 99)
while True:
guess=input("请输入你要猜的数字:->... |
290c74b48b3fd871f8f748e06fbb0f976c12edfc | Rahul-12/hacktoberfest2k19 | /Calculator/calc.py | 6,481 | 3.515625 | 4 |
from tkinter import *
expression = ""
def press(num):
global expression
expression = expression + str(num)
equation.set(expression)
def equalpress():
try:
global expression
total = str(eval(expression))
equation.set(total)
expression = ""
except:
equation.set(" error ")
express... |
5f07e90464a68e6420e186e70916e8274abc138a | sanjay-chahar/Python-3.5 | /find-out-your-day-of-birth.py | 728 | 4.09375 | 4 | import datetime
from datetime import date
#currentDate = datetime.date.today()
#print (currentDate.strftime("%d %b %y"))
# d0 = datetime.date.today()
# print(d0)
# year = int(input('Enter a year : '))
# month = int(input('Enter a month : '))
# day = int(input('Enter a day : '))
# d1 = datetime.date(year, month, day)... |
99a83a3b32c0529438348e4e0e84b27dd0086a8c | theophilus96/News-Summarizer | /Jolt/jolt_user_db.py | 6,224 | 3.515625 | 4 | import json
def write_to_json(file_name, data, path='./'):
"""Writes data to json file.
Args:
file_name (str): file name for json file.
data (dict): data to write to json file.
path (str): path to write json file. Defaults to current folder.
Returns:
None.
... |
a2909809006a47f94ed9025c98fd60c3590768cd | echen805/AIND | /Bayesian_Inference/Bayesian_Inference_Exercise.py | 6,180 | 3.640625 | 4 | '''
Bayesian_Inference Exercise to build Spam Classifier
'''
import pandas as pd
import string
import re
# Dataset from - https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection
name = ['label','sms_message']
df = pd.read_table('.\smsspamcollection\SMSSpamCollection', sep='\t', header= None, names = name)
# Outp... |
e9e8134bb9e9be7dacb42425eef59eaf1cc1ed7d | dave20874/aoc2020 | /solution_set.py | 1,386 | 3.734375 | 4 | # Reads daily solutions from a file for use in unit testing.
# (Input file should not be git.)
# from itertools import sequence
# Reads a file with Advent of Code solutions.
# Each line contains two numbers separated by whitespace.
# The first line contains test values, the others represent solutions to AoC days star... |
78173ab1f4f6c2833499bdaa4b17506b5b847263 | dave20874/aoc2020 | /rambunctious_recitation.py | 1,427 | 3.5 | 4 | class Recitation:
def __init__(self, filename):
self.start_seq = []
self.last_spoken = {}
self.turns = 0
self.last = 0
self.load(filename)
def reset(self):
self.last_spoken = {}
self.turns = 0
self.last = 0
self.next = 0
def load(self... |
30ca959d0d26e61707bba14c75fd599c80635c95 | Akshaykumara62/Day7-Advanced | /assign7.py | 367 | 4.09375 | 4 | list1=[10,20,30,40,50]
list2=[5,15,25,35,45,60]
size_1 = len(list1)
size_2 = len(list2)
list3 = []
i,j = 0,0
while i < size_1 and j < size_2:
if list1[i] < list2[j]:
list3.append(list1[i])
i+=1
else:
list3.append(list2[j])
j+=1
list3 = list3+list1[i:] +list2[j:]
p... |
fdb0972abf881aad684064b726ca14f2430670ea | zs680/Machine-Learning-CS589-assignments | /HW5/Submission/Code/test.py | 3,395 | 3.765625 | 4 | from PIL import Image
# Open the image form working directory
"""image = Image.open('../../Data/shopping-street.jpg')
# summarize some details about the image
print(image)
print(image.format)
print(image.size)
print(image.mode)
# show the image
image.show()"""
# load and display an image with Matplotlib
"""from matplot... |
26a97e4562d6e4a6810f13f76e719bd12444055d | GeonwooVincentKim/Python_MyFirstDecorator | /StaticMethod.py | 596 | 3.671875 | 4 | from MainTest import Menu
@Menu
def MenuFirst():
print("원하는 값을 선택하세요")
a,b = map(int, input().split())
Sum = a+b
print("값은 : {0}입니다".format(Sum))
n = randint(1, 100)
while True:
ans = input("Guess my Number (1 ~ 100)")
if ans.upper() == 'Q':
break
... |
74ff8a0961e8584717faa30f726a7e5c6de4a4b2 | phsmoura/hidden-power | /tests/test_caesar.py | 2,356 | 3.703125 | 4 | import unittest
from string import ascii_uppercase, ascii_lowercase, digits, punctuation, whitespace
from hiddenpower.commands.caesar import encrypt_content, decrypt_content
class CaesarTest(unittest.TestCase):
# TODO test argument parsing
def test_encrypt_rotation_uppercase_13(self):
"""test encrypt... |
34b7a4619303f0a10b86fbebbf3aeb10ffb6f759 | darbik/dailyprogrammer | /python/easychallenge272.py | 1,473 | 3.5625 | 4 | # Daily Programmer Easy Challenge 272 https://www.reddit.com/r/dailyprogrammer/comments/4oylbo/20160620_challenge_272_easy_whats_in_the_bag/
vals = {
'A': {'count' : 9}, 'B': {'count': 2}, 'C': {'count': 2}, 'D': {'count': 4},
'E': {'count': 12}, 'F': {'count': 2}, 'G': {'count': 3}, 'H': {'count': 2}... |
fbfaee89c3023ca15599d05fa53f3e059bd644db | IliasN/aoc2020 | /Day03/main.py | 690 | 3.546875 | 4 | lines = []
with open("data", "r") as f:
line = f.readline()
while line:
lines.append(line)
line = f.readline()
WIDTH = len(lines[0]) - 1 # Attention aux newlines
HEIGHT = len(lines)
def trees_from_slope(right, down):
x = 0
count = 0
for y in range(0, HEIGHT, down):
c = line... |
8f35c941879a5d7d4e05657d676d88bfc26d8306 | kroebuck/sudoku | /square.py | 323 | 3.59375 | 4 | class Square:
"""Information about squares on the grid to be solved."""
def __init__(self, element, box_size):
if element == 0:
self.options = [1 for i in range(box_size*box_size)]
self.original = False
else:
self.known = element
self.original = Tr... |
4485e0ee799d42b170bf0546f576e34671e69ff7 | rcjose25/ken_ef_inf | /wahrheitstafel.py | 675 | 3.515625 | 4 | #!/usr/bin/python3
# author gregor luedi
# filename wahrheitstafel.py
# logisches und: &
# logisches oder: |
# logisches entweder oder ^
# logisches nicht: not()
# erstellen der Liste mit den beiden Wahrheitswerten
booleanList = [True,False] # oder auch [1,0]
# funktion welche einen logischen Ausdruck berechnet... |
c097cfa78f6c8bc2a62eb04cd86023c51f221b5d | miller9/python_exercises | /17.py | 1,337 | 4.625 | 5 | print ('''
17. Write a version of a palindrome recognizer that also accepts phrase palindromes
such as "Go hang a salami I'm a lasagna hog.", "Was it a rat I saw?",
"Step on no pets", "Sit on a potato pan, Otis", "Lisa Bonet ate no basil",
"Satan, oscillate my metallic sonatas", "I roamed under it as a tired nude... |
571f2c597feb3192b9d5f7cf72e6403ef8b332c9 | miller9/python_exercises | /12.py | 384 | 4.21875 | 4 | print ('''
12. Define a procedure histogram() that takes a list of integers and prints a histogram to the screen.
For example, histogram( [ 4, 9, 7 ] ) should print the following:
****
*********
*******
''')
def histogram(l):
for value in l:
print ("*" * value)
int_list = [4, 9, 7]
print ('The histogra... |
111e530378568654c44b14627fe5f11fe8493a43 | miller9/python_exercises | /10.py | 1,024 | 4.34375 | 4 | print ('''
10. Define a function overlapping() that takes two lists and
returns True if they have at least one member in common, False otherwise.
You may use your 'is_member()' function, or the 'in' operator,
but for the sake of the exercise, you should (also) write it using two nested for-loops.
''')
def o... |
708022edeff4f0868e38e585d4a59c53df8b7080 | VityasZV/Python-tasks | /5 semestr/homework-3/PackedQueue.py | 792 | 3.6875 | 4 | from collections import deque
def form_tuple(elements_from_tuples, needed_amount):
if needed_amount == 0:
print(tuple())
return
else:
tuple_for_print = tuple(elements_from_tuples[i] for i in range(needed_amount))
print(tuple_for_print)
for i in range(needed_amount):
... |
345f8cbfd1dacf55c0e8b311d7705487848330df | VityasZV/Python-tasks | /5 semestr/homework-6/MultTable.py | 1,372 | 3.8125 | 4 | def divider(m):
_divider = "=" * m
print(_divider)
def size(n):
return len(str(n))
def mul_table(n, m):
amount_of_columns = 1 + (m - 2 * size(n) - 7 - size(n**2)) // (2 * size(n) + 9 + size(n**2))
for block_ind in range(n // amount_of_columns):
divider(m)
for str_ind in range(n):... |
d456663f64f733a6f5a1e617e54d01a126c1a87c | VityasZV/Python-tasks | /5 semestr/homework-3/SpiralDigits.py | 2,070 | 3.8125 | 4 | def increment():
i = 0
yield i
while True:
i += 1
if i == 10:
i = 0
yield i
def spiral_digits():
columns, strings = tuple(int(x) for x in input().split(","))
matrix = []
# initialization by seroes
for s in range(strings):
matrix.append([])
... |
2d3a52be8be3c0c1d8bdd5ed10de26606f9f2594 | alexandrevale/ISG018 | /aula6/lsfr.py | 455 | 3.78125 | 4 | #Gerador
def g1():
yield 1
yield 2
yield 3
yield 4
#Gerador sera um objeto da clase dos geradores
'''
gerador = g1()
print gerador.next()
print gerador.next()
print gerador.next()
print gerador.next()
#print gerador.next()
'''
def g2():
i=0
while True: #loop infinito
yield i
i =... |
a79543ab2efab226988165483da79b951ae92d9a | bikennepal/Python-Basic | /average.py | 175 | 4.03125 | 4 | num1=input("enter thre number")
num2=input("enter thre number")
num3=input("enter thre number")
print(f"the average of three number is {(int(num1)+int(num2)+int(num3))/3}") |
edf2bbfaf26040a8b3fd0ef975b14363f7486ad5 | bikennepal/Python-Basic | /function_practice.py | 357 | 3.953125 | 4 |
#function practice
# def last_char(name):
# return name[-1]
# print(last_char('biken'))
# def odd_even(num):
# if num%2 == 0:
# return "even"
# else:
# return "odd"
# print(odd_even(6))
# This is also one way that we can define and execute function
def even(num):
... |
5026000777e1a29995fec667fd8a340bf7e3876d | bikennepal/Python-Basic | /check_empty_or_not.py | 163 | 4 | 4 | #check is empty or not
#important
name='biken'
if name: # true if string is not empty
print('string is not empty')
else:
print('string is empty') |
becb5a3274b440a6116bbb7e6364a5fedba0f50e | bikennepal/Python-Basic | /check_list_number.py | 202 | 3.8125 | 4 | # to check if common number exist in the list
def lis(l1,l2):
output=[]
for i in l1:
if i in l2:
output.append(i)
return output
print(lis([1,2,3],[1,4,3])) |
3759f831c06c78ebade06352082650e501f08d25 | AhmetHamzaEmra/Algorithms | /quicksort_inplace_2.py | 552 | 3.890625 | 4 | def swap(arr,x,y):
mem = arr[x]
arr[x] = arr[y]
arr[y] = mem
return arr
def qsort(ar,start,end):
# base case
if end-start <= 0:
return ar
# pivot
pivot = ar[end]
# init index for pivot
ind = start
# loop less final value (pivot)
for i in range(start,end):
... |
0af51ec4caea93ba9de6826eb4ec8c7730fb57fc | AhmetHamzaEmra/Algorithms | /Largest Sum Contiguous Subarray.py | 289 | 3.671875 | 4 | def Contiguous(ar):
max_so_far = 0
max_ending_here = 0
for i in ar:
max_ending_here+=i
if(max_ending_here<0):
max_ending_here=0
if(max_so_far<max_ending_here):
max_so_far=max_ending_here
print (max_so_far, end=" ")
|
294a4c03c6a387bee4c932fe8f8cdc412a4b2333 | Cyberboa/HelloWorld | /testside/pages/Exercises/Exercise 6.py | 913 | 3.5625 | 4 | from django.test import TestCase
# Create your tests here.
# Exercise 1
def cut_string(string):
listOfCharacters = []
string = input('Type in a word')
file = open('myScript.txt', "w")
"""index starts with 0 / words -2 the right ending"""
for index in range(0, len(string) - 2):
"Insert Stri... |
91bbbfee9f0b92435ffc8a22fbe0b03ee31a16b2 | YX577/mici | /mici/stagers.py | 10,424 | 3.59375 | 4 | """Classes for controlling sampling of Markov chains split into stages."""
import abc
from collections import OrderedDict, namedtuple
ChainStage = namedtuple("ChainStage", ["n_iter", "adapters", "trace_funcs"])
class Stager(abc.ABC):
"""Abstract chain iteration stager."""
@abc.abstractmethod
def stage... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.