blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
568aedd524ef126e222bff03f9acabbaa725ee58 | anzhihe/learning | /python/practise/Python之Django篇第八季:用户权限管理/Django第八季完整项目源码-01/StudentMgr/apps/web/userweb/tests.py | 1,114 | 3.765625 | 4 | # Create your tests here.
# 第一题
def get_common_str(str1, str2):
lstr1 = len(str1)
lstr2 = len(str2)
record = [[0 for i in range(lstr2 + 1)] for j in range(lstr1 + 1)] # 多一位
maxNum = 0 # 最长匹配长度
p = 0 # 匹配的起始位
for i in range(lstr1):
for j in range(lstr2):
if ... |
8a42acb5946ca66fda7370da076396ce91374c4a | anzhihe/learning | /python/practise/learn-python/python_basic/tuple_def.py | 1,949 | 3.90625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: tuple_def.py
@Function: tuple definition
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/6/23
"""
"""一、元组的概述"""
"""
1、什么是元组?
除了列表,元组也是python语言提供的内置数据结构之一
元组与列表的主要区别:
(1) 元组用小括号表示(列表用中括号表示)
"""
t = ('P... |
71330f67688061c6fff11edc3f76f184f16ddcf1 | anzhihe/learning | /python/practise/learn-python/python_advanced/built-in_function2.py | 2,089 | 3.9375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: built-in_function2.py
@Function: python获取对象信息之反射
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/7/16
"""
"""反射"""
"""
所谓"反射",指的是以字符串的形式来操作(包括:增删改查)对象的属性和方法
用于"反射"的内置函数有以下四个(参数name都是一个字符串)
1. hasattr(object, name)
... |
31f2c1cc25f5237f4843b9d459b100d3b4082d87 | anzhihe/learning | /python/practise/learn-python/python_advanced/copy_and_deepcopy.py | 4,099 | 4 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: copy_and_deepcopy.py
@Function: python 浅拷贝与深拷贝
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/7/10
"""
"""一、浅拷贝"""
"""
对于某个对象,如何创建它的拷贝呢?也就是说,如何创建与该对象具有相同值的另一个对象呢?
所谓浅拷贝,指的是:对于某个对象,虽然创建了与该对象具有相同值的另一个对象,但是... |
5d9f577cf5e37298299aab93f9760aa8b3a8b589 | anzhihe/learning | /python/practise/learn-python/python_basic/set_operator.py | 2,585 | 3.5 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: set_operator.py
@Function: set mathematical operations
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/6/29
"""
"""集合的数学操作"""
"""
1、两个集合的交集
调用方法intersection和使用运算符&是等价的
做交集操作后生成一个新集合,做交集操作的两个集合不变
"""
s1 = {1, 3... |
36850807f35c87f195cbc39c0d464cb876782883 | anzhihe/learning | /python/practise/learn-python/python_advanced/encapsulation_inheritance.py | 6,031 | 3.875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: encapsulation_inheritance.py
@Function: python面向对象编程之封装、继承与重写
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/7/13
"""
"""一、封装"""
"""
封装是面向对象编程的三大特征之一
封装有两方面的含义:
1. 将数据(属性)和行为(方法)包装到类对象中。在方法内部对属性进行操作,在类对象的外部调用方法。
这样,无... |
d13bbb8c373dcfb5483bf2c798c79a6d2da71910 | anzhihe/learning | /python/source_code/source_code_of_lp3thw/ex5old.py | 1,484 | 4.28125 | 4 | # -- coding: utf-8 --
## 以下代码在py3下调试通过
my_name = "Zed A.Shaw"
my_age = 35 # not a lie
my_height = 74 #inches
my_weight = 180 #lbs
my_eyes = 'Blue' #注意:字符串内容可以选择单引号或者双引号。放在print函数后面加上括号就可以被打印出来。
my_teeth = 'White'
my_hair = 'Brown'
print ("Let's talk about %s ." % my_name)
#格式化字符%s、%d。
# 只要将格式化的变量放到字符串中,再紧跟着一... |
30ad649095e2a246261bad2276ac478ac79f2102 | anzhihe/learning | /python/practise/learn-python/python_advanced/polymorphism.py | 2,454 | 4.125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: polymorphism.py
@Function: python面向对象编程之多态
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/7/13
"""
"""多态"""
"""
除了封装和继承,多态也是面向对象编程的三大特征之一
简单地说,多态就是"具有多种形态",它指的是:即便不知道一个变量所引用的对象到底是什么类型,
仍然可以通过这个变量调用方法,在运行过程... |
0a9f4d7932f4183a77b0b20e18ce78e629a64ec0 | anzhihe/learning | /python/source_code/source_code_of_lp3thw/ex5.py | 1,012 | 4.1875 | 4 | my_name = 'Zed A. Shaw'
my_age = 35 # not a lie
my_height =74 # inches
my_weight = 180 # lbs
my_eyes = 'Blue'
my_teeth = 'White'
my_hair = 'Brown'
print(f"Let's talk about {my_name}.") #Variables embedded变量嵌入。在字符串中嵌入变量。
print(f"He's {my_height} inches tall.")#看起来print()函数中print和括号之间并没有空格。
print(f"He's {my_weight} poun... |
aa0e91c5df76bd468e1edbbef9dac2344822d0a5 | anzhihe/learning | /python/source_code/source_code_of_lp3thw/ex38.py | 4,909 | 4.125 | 4 | ten_things = "Apples Oranges Crows Telephone Light Sugar"# 定义了个变量接受字符串,还有6个东西,这些字符间有空格。
print("Wait there are not 10 things in the list. Let's fix that.")#打印提示,说这个变量中不包含10个东西,下面将要填充它。
stuff = ten_things.split(' ')#对于上面这个变量使用.split()方法,也即是“分裂”方法,往其中添加空格,之后赋值给了新变量stuff。
more_stuff = ["Day", "Night", "Song", "Frisbee", ... |
c0f10b37c30047dd61abf97e4a576fa19354b0db | anzhihe/learning | /python/practise/learn-python/python_basic/python_practice.py | 4,414 | 4.125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: python_practice.py
@Function: python practice
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/7/5
"""
"""一、舍罕王赏麦"""
"""
【问题描述】
据说印度的舍罕王打算重赏一个宰相,问他有何要求,
这位宰相说:"陛下,请您在这张棋盘的第一个格内赏给我一粒麦子,在第二个格内赏给我两粒麦子,
在第三个格内赏... |
19f043d03aecfd390a2c334cad6af136dbb28f3e | anzhihe/learning | /python/source_code/source_code_of_lp3thw/ex10old.py | 1,535 | 4.0625 | 4 | # 让字符扩展到多行的方法一: 采用 \n 隔开,这是一个放入“新行”的作用。
# “转义序列(escape sequences)”-----\ and \\ and ' ' and " "。
# 你需要告诉Python----- "I "understand" joe." 到底哪个是哪个的边界。——其实你是想让中间的“”也表达是 字符串,而不是真正的双引号。
# 方法1:" I am 6'2\" tall.' # 将 字符串中的“双引号”转意义了;'I am 6\'2" tall.'# 将 字符串中的单引号转意义了。
# 方法2: 使用三引号,在一组三引号"""之间放入任意多行文字。
tabby_cat ="\t I'... |
b0ba97d55394e6fcd4d58c9e97e800cdc8c3d1e2 | anzhihe/learning | /python/source_code/source_code_of_lp3thw/ex39.py | 5,884 | 3.78125 | 4 | # 创造一个州的缩写制图-字典?
states = {#这里建立了一个‘字典’的数据类型,也就是说一个变量,它用大括号括着,里面是dic= {A:B,C:D,E:F}的格式,通过索引 A C E 分别可以调用出 B D F 这三个。
'Oregon': 'OR',
'Florida': 'FL',
'California': 'CA',
'New York': 'NY',
'Michigan': 'MI'
}
# 创建一个州的基本设置,以及它们中的一些城市
cities = {
'CA': 'San Francisco',
'MI': 'Detroit',
'FL':... |
cee4d2aadb360f55bbb8f7ee746d49b4da08d007 | anzhihe/learning | /program/algorithm/ProgrammerXiaohuiPython/src/chapter5/part12/MedianSortedArrays.py | 1,566 | 3.765625 | 4 | def find_median_sorted_arrays(array_A, array_B):
m, n = len(array_A), len(array_B)
# 如果数组A的长度大于等于数组B,则交换数组
if m > n:
array_A, array_B, m, n = array_B, array_A, n, m
if n == 0:
raise ValueError
start, end, half_len = 0, m, (m + n + 1) // 2
while start <= end:
i = (start + ... |
47a87f3a1f1558fcf2a78a79707b0ebd245adbce | anzhihe/learning | /python/practise/learn-python/python_basic/set_def.py | 2,613 | 3.65625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: set_def.py
@Function: set definition
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/6/29
"""
"""一、集合的定义"""
"""
除了列表、元组和字典,集合也是python语言提供的内置数据结构之一
可以把集合看做是没有存储value的字典,因此,集合的特点如下:
(1) 集合中不可以存储重复的数据
... |
ffdc8d6177a5731972767ab2b0e4ae6461ff4615 | anzhihe/learning | /python/practise/learn-python/python_skills/13_split_string.py | 1,155 | 3.8125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@FileName: 13_split_string.py
@Function: 拆分含有多种分隔符的字符串
@Author: Zhihe An
@Site: https://chegva.com
@Time: 2021/9/3
"""
"""如何拆分含有多种分隔符的字符串?"""
"""
实际案例:
我们要把某个字符串依据分隔符号拆分不同的字段,
该字符串包含多种不同的分隔符,例如:
s = 'ab;cd|efg|hi,,jkl|mn... |
8019f7b7dcb2db7ccf2527836241e4fd64d31f91 | anzhihe/learning | /python/source_code/source_code_of_lp3thw/FunctionCheckList.py | 900 | 3.96875 | 4 | # 函数自检卡片 for python3
1 你定义函数的时候,首先用到了def吗?
2 你的函数名字只用到了 字符 和 _ 了吗?
3 函数名称是不是紧跟着括号(?
4 括号里是否包含参数?多个参数是否以逗号隔开?
5 参数名称是否有重复?(不能使用重复的参数名)
6 紧跟着参数的是不是括号和冒号 ):
7 紧跟着函数定义的代码是否使用了 4 个空格的缩进 (indent)?
8 函数结束的位置是否取消了缩进 (“dedent”)?
# 你运行(或者说“使用 use”或者“调用 call”)一个函数时,记得检查下面的要点:
1. 调运函数时是否使用了函数的名称?
2. 函数名称是否紧跟着(?
3. 括号后有无参数?多个参数是否... |
915a83f9f90fd9e7ac1457e33484203a4726f38e | jeffysonar/Data-Structures-and-Algorithms-in-Python | /Heap.py | 1,980 | 3.84375 | 4 | # BinaryHeap implementation using list
class BinaryHeap:
# constructor : initialises Binary Tree
# data : list of data element
# max : True - for max heap
False - for min heap
def __init__(self, data=None, max=True):
if max:
self.compare = lambda side, largest: side > largest
self.data = [float("infinity")]... |
def05837cf816e7ef9b18915d9992fead320ee4b | davidemornatta/machine-learning-examples | /examples/panda_read_csv.py | 614 | 3.65625 | 4 | # Import panda
import pandas as pd
from sklearn import tree
from sklearn.model_selection import train_test_split
# Read a CSV file into a panda data frame
data = pd.read_csv('../utilities/fiver.csv')
# Instantiate a decision tree, split the data and predict using the test data
model = tree.DecisionTreeClassifier()
X ... |
6f21a01e26db664dc7318ddf98a7d3196169965f | aswingokul/Python-Pgm | /BitManipulation.py | 591 | 3.5625 | 4 | #code
def clearBit(num, i):
#print "bin(",num,"):","{0:b}".format(num);
#print "1 <<",i,":", "{0:b}".format((1 << i));
mask = ~(1 << i);
#print "mask:","{0:b}".format(mask);
print "{0:b}".format((num & mask)) ;
def getBit(num,i):
print i,"th bit of",num," 1 ?", (num & (1 << i) !=0);
... |
a2d9a34511253c20b7194daeaecf5f2093c1bcca | beepscore/LearnPythonTheHardWay | /ex13.py | 328 | 3.6875 | 4 | #!/usr/bin/python
# References
#import sys module
from sys import argv
# argv is "argument variable". Holds the script's arguments
script, first, second, third = argv
print "The script is called:", script
print "Your fist variable is:", first
print "Your second variable is:", second
print "Your third variable is:",... |
4c49af1972c40d5699f85da9401cd81ddcf59a1a | HenriFeinaj/Number_Guesser | /PROJECT_1_(NUMBER_GUESSER).py | 744 | 4.15625 | 4 | #PROGRAM THAT LETS THE USER GUESS A RANDOM GENERATED NUMBER BETWEEN 1-100/
#While at the same time it gives the user some tips along the way.
import random
randNum = random.randint(1, 100)
guesses = 0
for i in range(1, 8):
guesses = guesses + 1
print("Hi fellow human guess a number 1-100! \n")
... |
f204bf93052d59de5f41fc76370b49390a11bf25 | FerFrassia/CodeChallenges | /Problemas Random/morganString.py | 653 | 3.890625 | 4 | from collections import deque
def morgan(a, b):
stackA = deque()
stackB = deque()
fill(stackA, a)
fill(stackB, b)
minimalString = ''
while (len(stackA) > 0 or len(stackB) > 0):
charToInsert = ''
if (len(stackA) > 0 and len(stackB) == 0):
charToInsert = stackA.popleft()
elif (len(stackA) == 0 and len(sta... |
bc986ef468c7dd2dd533353f77b6ee543a58ecc4 | FerFrassia/CodeChallenges | /Problemas Random/rangos.py | 1,471 | 3.859375 | 4 | def condense_meeting_times(array_of_tuples):
if len(array_of_tuples) > 1:
for index, current in enumerate(array_of_tuples[:len(array_of_tuples - 1)]):
if current[1] >= array_of_tuples[index + 1][0]
current[1] = array_of_tuples[index + 1][1]
del array_of_tuples[index + 1]
return array_of_tuples
# You... |
f03aad66257b4eea1bac7e66d4f551a1a40f9307 | FerFrassia/CodeChallenges | /Problemas Random/queues.py | 551 | 4.03125 | 4 | import Queue
q1 = Queue.Queue()
q2 = Queue.LifoQueue()
q3 = Queue.PriorityQueue()
def fifoQueue(q, intList):
for val in intList:
q.put(val)
def lifoQueue(q, intList):
for val in intList:
q.put(val)
def myPriorityQueue(q, intList):
for val in intList:
q.put(val)
def showQueue(q):
while not q.empty():
pri... |
a9afebfce27c2fe663362a71f4bf655ff8887c74 | FerFrassia/CodeChallenges | /Problemas Random/rectangles.py | 1,855 | 4.0625 | 4 | class Rectangle:
def __init__(self, X = 0, Y = 0, Width = 0, Height = 0):
self.x = X
self.y = Y
self.width = Width
self.height = Height
def intersection(a, b):
rect = Rectangle()
if (a.x <= b.x <= a.x + a.width):
rect.x = b.x
rect.width = min(b.width, a.width - (b.x - a.x))
elif (b.x <= a.x <= b.x + ... |
136fdb3cda591a047f45491b70498df1b622aea5 | FerFrassia/CodeChallenges | /Problemas Random/stock2.py | 653 | 3.5 | 4 | # returns best profit
def stock(l):
bestMin = 0
bestProfit = 0
i = 0
while (i < len(l)):
if (l[i] < l[bestMin]):
bestMin = i
if (l[i] - l[bestMin] > bestProfit):
bestProfit = l[i] - l[bestMin]
i += 1
return bestProfit
#returns buying and selling indexes
def stockIndex(l):
bestMin = 0
bestMax = 0
i... |
3aede57e68521721ed0520b513af1d128c758c2d | FerFrassia/CodeChallenges | /Problemas Random/bubbleSort.py | 262 | 3.671875 | 4 | def bubbleSort(l):
print l
i = 0
while i < len(l):
j = i+1
while j < len(l):
if l[i] > l[j]:
l[i], l[j] = l[j], l[i]
j += 1
print l
i += 1
print l
bubbleSort([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
#bubbleSort([5, 3, 7, 6, 1, 9, 2, 4, 10, 8]) |
7cf601eb9e57bb644a7e73c2ec808c171d22b261 | Spaceunit/calculation_methods_2016 | /fixed_point_iteration.py | 7,539 | 3.765625 | 4 | import math
class FPI:
def __init__(self):
self.range = []
self.q = []
self.accuracy = 3
self.commands = {
"none": 0,
"exit": 1,
"test": 2,
"clear": 3,
"help": 4,
"new": 5,
"show slist": 6,
... |
8fd628d6f7d44d82876734e78b32453bc24b22af | Spaceunit/calculation_methods_2016 | /LU.py | 2,187 | 3.765625 | 4 | import math
import matrix
class Lmatrix:
def __init__(self,arg):
self.matrix = matrix.Matrix(arg,"Lmatrix")
pass
def setraw(self,raw,um):
self.matrix.matrix.append([])
for item in range(0, raw):
self.matrix.matrix[raw].append(um.matrix.matrix[raw][item])
... |
108a483a1ea55f8f349cf79fcf39c1073accf69b | garrettyzk/python | /Test3.py | 1,253 | 3.828125 | 4 | #Functions
def name_function():
'''
'''
print('Hello')
def say_hello(name='name'):
return'hello'+ name
result=say_hello('Jose')
print(result)
def add(n1,n2):
return n1+n2
result = add(20,30)
print(result)
def dog_check(mystring):
return 'dog' in mystring.lower()
#Pig Latin
def pig_latin(word):... |
ae251d4059ba40fd48347362c5f3a36db727346d | tathagatvikash/HackerRank | /Python/XML_1_Find_the_score.py | 146 | 3.546875 | 4 | import re
count = 0
for i in range(int(raw_input())):
s = raw_input()
match = re.findall(r'=[\"\']',s)
count += len(match)
print count
|
2cbabea534d9b10d066e5b2a977f03ac3c4507f6 | Midnight1Knight/HSE-course | /FourthWeek/Task7.py | 137 | 3.6875 | 4 | def xor(x, y):
z = 0
if x != y:
z = 1
return z
return z
a = int(input())
b = int(input())
print(xor(a, b))
|
8eaaa7b581f14333d8c276446c83957858e06094 | Midnight1Knight/HSE-course | /SecondeWeek/Task13.py | 341 | 3.890625 | 4 | a = int(input())
b = int(input())
c = int(input())
if (a >= b+c) or (b >= a+c) or (c >= a+b):
print('impossible')
elif (a**2 == b**2 + c**2) or (b**2 == a**2 + c**2) or (c**2 == a**2 + b**2):
print('rectangular')
elif (a**2 > b**2 + c**2) or (b**2 > a**2 + c**2) or (c**2 > a**2 + b**2):
print('obtuse')
else... |
56d232329f7be3da8e9a63894614c4c998ec9686 | ufiofioemmanuel/Emma_King | /New folder/Classwork4.py | 122 | 3.5 | 4 | import random
Z = random.uniform(1,10)
print("A random decimal number between 1 and 10 :", Z)
print(format(Z,'.2f'))
|
34ba06fc680dc587e32022a8a80db11b74a6e9a9 | KayhanB21/a301_code | /a301/utils/data_read.py | 4,120 | 3.5 | 4 | """
a301.utils.data_read
___________________
downloads a file named filename from the atsc301 downloads directory
and save it as a local file with the same name.
to run from the command line::
python -m a301.utils.data_read photon_data.csv
or
python -m a301.utils.data_read A20162092016216.L... |
a23c3b3b665aa6500d2c8525021ddb8d511095dc | LeonardCim/Simple-Folder-Creator | /FolDesk.py | 510 | 3.984375 | 4 | import os
quest = input("Choose the name of the folder: ")
def create_folder():
'''function to create folder'''
path = r"C:\Users\Utente\Desktop"
uni = os.path.join(path, quest)
try:
os.mkdir(uni)
print("folder '{}' created ".format(uni))
print("Well do... |
3384e10a7678a9d1cc60a6aff6ba966c10ea04ca | clabra/blackjack | /player.py | 4,519 | 3.859375 | 4 | """Blackjack dealer bot"""
from deck import Deck, Card
import settings
import math
from policy import Policy
class Opponent(object):
"""Abstract class for what Player and Dealer have in common"""
def __init__(self):
self.cards = []
# Abstract method
def choose_action(self):
raise Not... |
595ae7ac6ac282050d4c748a3a0fa37c805cea3f | shubhankarsharma00/2-particle-simmulator | /2-particle-simmulator.py | 1,490 | 3.84375 | 4 | import matplotlib.pyplot as p
import math
def direction(co_ordinte_of_mass,co_ordinate_of_object,r):
if (co_ordinate_of_object-co_ordinte_of_mass > 0):
# print float(co_ordinate_of_object-co_ordinte_of_mass)/float(r)
return 1*float(co_ordinate_of_object-co_ordinte_of_mass)/float(r)
elif (co_ordi... |
56e0e8b66f57a20eb8ece8a1c37087e73e2dff5d | SenHuang19/project1-boptest | /examples/python/controllers/pid.py | 1,216 | 3.671875 | 4 | # -*- coding: utf-8 -*-
"""
This module implements a simple P controller.
"""
def compute_control(y):
'''Compute the control input from the measurement.
Parameters
----------
y : dict
Contains the current values of the measurements.
{<measurement_name>:<measurement_value>}
... |
01e103edaaf1017b26b05b2e4e36f89c1c54acf9 | blackswanburst/mikemccllstr-python-minecraft | /davef21370_maze.py | 4,689 | 3.671875 | 4 | #!/usr/bin/env python
# Quick rough & ready maze generator for Minecraft Pi edition.
# Dave Finch 2013
# mcpipy.com retrieved from URL below, written by davef21370
# https://github.com/brooksc/mcpipy/blob/master/davef21370_maze.py
import mcpi.minecraft as minecraft
import mcpi.block as block
import sys, random
from ... |
605a1543780722de17643c3e71208a464a9c9269 | RuairiDillon1/PythonFromScratch | /IntOrStr.py | 316 | 4.0625 | 4 | # Basic program checking if the declared instances are int or str.
help(isinstance)
print(isinstance(25,int) or isinstance(25,str)) # leftmost statement is true,
print(isinstance([25],int) or isinstance([25],str)) # therefore the whole or statement is true.
print(isinstance("25",int) or isinstance("25",str))
|
1b558827aac58b2d2ea5786274f1fb98aae25772 | Makeem49/Python-pytest | /calculator.py | 2,055 | 3.796875 | 4 | import numbers
import sys
import json
class CalculatorError(Exception):
"""An exception for calculator"""
class MyError(Exception):
"""An exception error for a particular parameter"""
class Calculator():
"""Calculator for trying how pytest works"""
def add(self, a , b):
self._check_operand(a... |
f4840f830645580876f71984c090d87333a6027d | joeltg/twaiku | /syllables.py | 2,335 | 3.78125 | 4 | __author__ = 'robert'
import nltk
nltk.data.path.append("./nltk_data")
#load the giant dictionary of words
database = nltk.corpus.cmudict.dict()
def finish_word(prefix):
if prefix in database:
return prefix
#assumptions
#words only contain letters, and they are lowercase
def does_word_exist(word):
... |
f432ab4feced8ab50add3551494f5c9e20a9e0b4 | sindhumantri/common_algorithms | /longest_substring_unique_chars.py | 1,176 | 4.15625 | 4 | def longest_substring_unique_chars(s):
"""Find the longest substring of s without repeating characters."""
if len(s) == 0:
return ""
end = 1
max_len = 1
cur_len = 1
visited = [None for _ in xrange(256)]
visited[ord(s[0])] = 0
for index in xrange(1, len(s)):
prev_index =... |
6c59663547c46f322a7ca2f66a88bc124a1611c4 | sindhumantri/common_algorithms | /heapsort.py | 1,034 | 4.0625 | 4 | """Heap Sort implentation."""
def heapsort(arr):
for start in reversed(xrange(len(arr) // 2)):
sift_down(arr, start, len(arr) - 1)
for end in reversed(xrange(1, len(arr))):
arr[0], arr[end] = arr[end], arr[0]
sift_down(arr, 0, end - 1)
return arr
def sift_down(arr, start, end):
... |
73899ecbb4f51447c30e9cd7e3fb18a990e71f48 | sindhumantri/common_algorithms | /trie.py | 505 | 3.9375 | 4 | import re
def build_trie(words):
trie = {}
for word in words:
current = trie
for c in word:
if c not in current:
current[c] = {}
current = current[c]
return trie
def main():
with open("/usr/share/dict/words") as word_file:
words = [wor... |
92f7641ad7644ccc83c32fcfc6c1e52b4eb7b213 | sindhumantri/common_algorithms | /lru_cache_simple.py | 817 | 3.671875 | 4 | from collections import OrderedDict
class lru_cache(object):
def __init__(self, capacity):
"""LRU cache constructor."""
self.capacity = capacity
self.cache = OrderedDict()
def __getitem__(self, key):
"""Get value associated with key if the key exists in the cache."""
v... |
373646db7293d818169827722c5f58ba0f0a0dda | sindhumantri/common_algorithms | /kruskal.py | 1,171 | 3.59375 | 4 | from DisjointSets import DisjointSets
def kruskal(graph):
"""Find the minimum spanning tree of a graph."""
msf = set()
forest = DisjointSets()
for v in graph.keys():
forest.makeset(v)
edges = []
for u, adjlist in graph.items():
for (v, weight) in adjlist.items():
... |
32dec9b86fbdf104e62db26afd67ccd2c171268f | sindhumantri/common_algorithms | /factorization.py | 621 | 3.828125 | 4 | def factors(n):
yield (n, 1)
for factorization in set(factors_helper(n)):
yield factorization
def factors_helper(n, visited=None):
for i in xrange(2, int(n**0.5) + 1):
if n % i == 0:
factor1, factor2 = i, n // i
factorization = tuple(sorted((factor1, factor2)))
... |
03b7d8e6cb76d0dcd73c027d7d9fc924042e670a | reshma-jahir/GUVI | /set85.py | 206 | 3.65625 | 4 | strgs=list(input())
if len(strgs)%2==0:
strgs[int(len(strgs)/2)] ='*'
strgs[int(len(strgs)/2)-1]='*'
else:
strgs[int(len(strgs)/2)] ='*'
for i in range(0,len(strgs)):
print(strgs[i],end='')
|
acbfa3cd857abd9b15db3570b088620dcc173f71 | reshma-jahir/GUVI | /pro62.py | 162 | 3.6875 | 4 | pin = int(input())
a,val = 3,3
while pin > 0:
if a == 0:
val*=2
a = val
if pin==1:
print(a)
break
pin -= 1
a -= 1
|
411251c2aa68fe998b8aa7c299cb47a1f92c726d | reshma-jahir/GUVI | /reshu2.py | 80 | 3.546875 | 4 | sat,mgr=input().split()
if(len(mgr)>=len(sat)):
print(mgr)
else:
print(sat)
|
c445b83b82a9866f45ca8f8da354321e71fcc3d5 | reshma-jahir/GUVI | /set82.py | 175 | 3.78125 | 4 |
num = input()
key = 'aeiou'
for i in key:
if i in num:
num = ''
break
else:
continue
if num == '':
print('yes')
else:
print('no')
|
7a9f22f08ca55438d1bad29fbcb5429c674c5fd8 | reshma-jahir/GUVI | /settwo3.py | 103 | 3.734375 | 4 | var=int(input())
for i in range(2,var):
if(var%i==0):
print("no")
break
else:
print("yes")
|
098cfc779d1525e3552617dfed72873428a764e4 | reshma-jahir/GUVI | /pro33.py | 94 | 3.71875 | 4 | pin=input()
for i in range(len(pin)):
if(pin[i] < pin[i+1]):
print(pin[i+1:])
break
|
22cb808f1729bc1a2af92ed38d27e02e32cf68bc | reshma-jahir/GUVI | /set86.py | 188 | 3.828125 | 4 | noy = int(input())
if noy > 2:
for i in range(2, noy):
if noy % i == 0:
print('yes')
break
else:
print('no')
elif noy == 2:
print('no')
|
fb50c480401aef78da685e28e4add00f060510af | robosaurus/wrappers_delight_foldx | /pdb_parse.py | 3,904 | 3.5 | 4 | #! /usr/bin/env python3
import sys
def pdb_parse(path_to_pdb):
# this is the PDB parse function. It should take a PDB file as input
# and determine how many chains, what they are called, and which residues they
# span and maybe even which chains are identical
pdb_file = open(path_to_pdb, 'r')
pdbl... |
86f44157117e534e6963ec0638d0eb9dbae839a0 | KKshitiz/J.A.R.V.I.S | /software_Non_AI/greet_startup.py | 574 | 3.75 | 4 | from datetime import datetime
'''
initiate greeting sequence to be played on jarvis startup
'''
def greet():
greet_text=""
hour=int(datetime.now().hour)
if hour>=0 and hour<12:
greet_text="Good Morning Sir. "
elif hour>=12 and hour<18:
greet_text="Good Afternoon Sir. "
else:
... |
bca7df3b0350d8dbfd73202430c245eede93effb | Harsh652-cpu/16Novpy21 | /prac2.py | 406 | 4.40625 | 4 | #program to take input from the user and then checks whether it is a number or a character.If it is a character,determine whether it is in uppercase or lowercase
ch=input("Enter the character:")
if(ch>="A" and ch<="Z"):
print(str(ch)+" is an uppercase character")
elif(ch>='a' and ch<='z'):
print(str(ch)+" is a ... |
edae7dd1d4dd1e8ef7ab8c28aca78d282d97b218 | Harsh652-cpu/16Novpy21 | /prac4.py | 462 | 4.28125 | 4 | #program to calculate roots of a quadratic equation
a=int(input("Enter the values of a:"))
b=int(input("Enter the values of b:"))
c=int(input("Enter the values of c:"))
D=(b*b)-(4*a*c)
deno=2*a
if(D>0):
print("Real Roots")
root1=(-b+D**0.5)/deno
root2=(-b-D**0.5)/deno
print("Root1="+str(root1)+"\tRoot2=... |
06fedb4cee139a3cf5153ddffe8cf2cdd30e38a5 | ZtokarZ/cs_375 | /chapter 2/pig.py | 1,900 | 4.28125 | 4 | #Pig program by: Zach Tokarz, Luke Gentile, and Ryan Larvey.
import random
player1_name = ""
player2_name = ""
player1_score = 0
player2_score = 0
def main():
global player1_score,player2_score,player1_name,player2_name
display_welcome()
ask_player_names()
roll_dice()
next_players_turn = 1
wh... |
a301bfad459c3e48f55d94815a5a01603baf8369 | sng11asu/Water-Contained | /water_fill.py | 5,462 | 3.765625 | 4 | '''
This file/module conatains fucntions related solve the
problem of finding the amount of water retained in a platform of
specific shape and dimension
'''
import numpy as np
def CreateLevelCoords(platform,rows,columns):
'''
Creates a dictionary which contains
Key - which indicates the different height levels ... |
7fde9541005e72c2d572af02e76b784c410a1d7f | Liu-moreira/exerciciogustavo | /exercicio10.py | 537 | 3.953125 | 4 | # Faça um programa que imprima a soma de todos os números pares
# entre dois números da sua escolha.
listas = []
n1 = int(input('Digite um numero: '))
n2 = int(input('Digite outro número: '))
i = 0
while (n1<=n2):
if (n1 % 2) == 0:
listas.append(n1)
n1 = n1 + 1
somalista = sum(listas)
print(listas... |
2c2e8214ad4a79cd09b171af14f8e435d0e14901 | YoChen3086/PythonPractice | /exercise96.py | 228 | 3.6875 | 4 | # 题目:
# 计算字符串中子串出现的次数。
if __name__ == '__main__':
str1 = input('请输入一个字符串:')
str2 = input('请输入一个子字符串:')
ncount = str1.count(str2)
print (ncount) |
9942a96035f17c2839c04b7eb4668dcc9790b821 | YoChen3086/PythonPractice | /exercise05.py | 226 | 3.796875 | 4 | # 题目:
# 输入三个整数x,y,z,请把这三个数由小到大输出。
l = []
for i in range(3):
x = int(input('integer:'))
l.append(x)
l.sort()
print ()
# 寫法1
print(l)
# 寫法2
for i in l:
print (i) |
71dc7a0c2083154f59bd2b45547f8ea871294fc6 | wyd-python/Practice | /date 2/dictionary.py | 630 | 3.640625 | 4 | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# author: wangyadong
#key-valus
#info = {
# 'stu1101': "TengLan lan",
# 'stu1102': "LongZe luola",
# 'stu1103': "XiaoZe MaLiya"
#}
"""
print(info)
#print(info["stu1103"])
info["stu1101"] = "bdyjy"
info["stu1104"] = "cangjk"
print(info)
#del
#del info["stu1101... |
16c5e2be1fe54b79dd8722cc24fa3d83541d50f6 | wyd-python/Practice | /work/测试.py | 476 | 3.671875 | 4 | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# author: wangyadong
'''
A0= dict(zip(('a','b','c','d','e'),(1,2,3,4,5)))
print(A0)
A1 = range(10)
print(A1)
A2 = [i for i in A1 if i in A0]
print(A2)
A3 = [A0[s] for s in A0]
print(A3)
A4 = [i for i in A1 if i in A3]
print(A4)
A5 = {i:i*i for i in A1}
print(A5)
A6 = [[i... |
d19c1b7b3197785767ef08fe77c8ba865e599e36 | wyd-python/Practice | /date 2/集合.py | 502 | 4.09375 | 4 | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# author: wangyadong
list_1 = [1,3,2,4,23,2,34]
list_1 = set(list_1)
list_2 = set([2,6,3,2,7,5])
print(list_1,list_2)
#交集
list_1.intersection(list_2)
print(list_1.intersection(list_2))
#并集
print(list_1.union(list_2))
#差集
print(list_1.difference(list_2))
print(list_2... |
6f77741eb73023b3d2cfb827cce1ad5f4c962587 | wyd-python/Practice | /date 1/interaction.py | 738 | 4.34375 | 4 | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
# author: wangyadong
'''
name = input("name: ")
age = int(input("age: "))
job = input("job: ")
salary = input("salary: ")
info = """
---------info of %s---------
Name: %s
Age: %d
job: %s
Salary: %s
""" % (name, name, age, job, salary)
print(info)
'''
name = input("name... |
eb054acfa8312a6b8f2e5340a10a0e9e94793b0f | yorktronic/data_science | /thinkful/Unit2/univariate_analysis/testing.py | 1,960 | 3.859375 | 4 | # Goodness of fit: the Chi-Square Test
#####
# A chi-squared distribution of k degrees of freedom is a distribution of the sum of the squares of all the k variables, where k is an independent standard normal random variable
from scipy import stats
import collections
import pandas as pd
import matplotlib.pyplot as plt... |
f2cc493a3fa5d89766b82906b146d6e8d4a3a855 | yorktronic/data_science | /thinkful/Unit1/population_analysis/population_increase_2010_2100.py | 1,704 | 3.578125 | 4 | # Determine the population increase in the low elevation zones of each country from the year 2010 to the year 2100
# Input = population data file
# Output = two dictionaries, one with the population differences in numbers, and the other by percentage.
# Update this to output a single disct that has a tuple of (perce... |
7ab3b7aed2d30569209839b3ff184f2c32ca2025 | yorktronic/data_science | /thinkful/Unit1/database_exercises/scripts/ret_sqlite.py | 329 | 3.546875 | 4 | import sqlite3 as lite
import pandas as pd
con = lite.connect('../db/getting_started.db')
# Select all the rows and print the result set one at a time
with con:
cur = con.cursor()
cur.execute("SELECT * FROM cities")
rows = cur.fetchall()
cols = [desc[0] for desc in cur.description]
df = pd.DataFrame(rows, colu... |
f769898fd20458f4bcaadd12cfb0c5549d6ed7d5 | mahmudz/learn | /Python/practice.py | 1,725 | 4.09375 | 4 | # Completed Topics
# - Variables
# - Control Flow: conditional statements
# - Looping / Iterator
# - List: Collection | Array | Data Structure
# - Dictionary: Key-Value Data Structure
# - Iteration: Looping Through Data Structures
# ---- Variables
a = 100
b = 200
c = 'In Single Qutation '
d = "In Double Quta... |
aabb0d4215d015e07d3d81ebc92e007ee90cc7dc | benjaminliu1998/CS205_Recommender | /python/recommender.py | 2,269 | 3.640625 | 4 | '''
this code is based on the example provided on the Apach Spark website: https://github.com/apache/spark/blob/master/examples/src/main/python/mllib/recommendation_example.py
'''
# importing the necessary packages
from pyspark.mllib.recommendation import ALS, MatrixFactorizationModel, Rating
from pyspark import Spark... |
9384059416722b72ba5c0fff24c214c4aca025fa | STiashe/python | /lesson1/4.py | 1,217 | 3.796875 | 4 | chislo = int(input('ВВЕДИТЕ ЦЕЛОЕ ПОЛОЖИТЕЛЬНОЕ ЧИСЛО: '))
ostatok = chislo % 10 # берем последнию цифру числа (остаток)
chislo = chislo // 10 # отсекаем последнию цифру от числа (неполное число)
while chislo > 0:
# пока неполное число больше нуля запускаем цикл
if chislo % 10 > ostatok:
# сравнива... |
1da3fbed20e76fe4f487d8d05528759cb7b4c976 | hkommineni/Crypto3 | /Week5/week5.py | 3,102 | 3.609375 | 4 | import itertools
import os
# Author: Harish Kommineni
# Date: September 26, 2016
from functools import partial
from Crypto.Cipher import AES
#http://docs.python.org/2/library/itertools.html#recipes
def grouper(n, iterable, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper(3, 'ABCDEF... |
19b31de30c6e3d11a888dc05b2238bf4f6b1d2bf | kasettakorn/Machine_Learning | /SinglyLinkedList.py | 1,388 | 3.84375 | 4 | import random
class node:
def __init__(self, data=None):
self.data = data
self.next = None
class linked_list:
def __init__(self):
self.head = node()
def append(self, data):
newnode = node(data)
currentNode = self.head
while currentNode.next != None:
... |
95de1e892a5b1ef0a42ad1dd2cba50845e9ef6d5 | john-ppd/Python | /files_writing_to.py | 456 | 4.28125 | 4 | #open file in write mode, a is append mode
#this code will append color_5 onto existing list
#easy to mess up writing to file
txt_file_data = open("write_to.txt","a")
txt_file_data.write("\ncolor_5 magenta")
txt_file_data.close()
#WRITE OVERWRITES TEXT FILE FROM SCRATCH
#if you write to a file that does not exist it w... |
88925479edcf7d5a9b3f3daf7cd7ee1c2abdf4d9 | john-ppd/Python | /dictionaries.py | 679 | 4.0625 | 4 | #we are going to make a key and value pair, the way this works is that you define a word and it has a phrase associated with it, kind of like a word in the dictionary has a definition associated with it.
#all keys must be unique, jan is key, january is value
#doesn't have to be a string can be numbers too
month_conver... |
60c90562964788defba757644312dd1377f11dd0 | john-ppd/Python | /if_statements.py | 519 | 4.1875 | 4 | is_male = True
is_tall = True
if is_male and is_tall:
print("You are a tall male")
elif is_male and not(is_tall):
print("You are a short male")
elif not(is_male) and is_tall:
print("You are a tall female")
elif not(is_male) and not(is_tall):
print("You are a short female")
def max_num(num1, num2, num3... |
3f13c7164cac9e62393a5fd5d34d0917257c2bda | john-ppd/Python | /translation_change_vowels_to_g.py | 1,074 | 4.09375 | 4 | '''
These are more comment types
should probably use # on each line tho
'''
def translate(phrase):
translation = ""
for i in phrase:
print(i)
#in checks to see if the value i is within the string, in this case the value i is one of characters from the string and checks to see if that charcter is a v... |
e10940ab4f635ab4328e647b8d8b7df902ecf77f | ashishinvests/Dogs-of-the-Dow | /aa.py | 7,094 | 3.609375 | 4 | # Ashish Manandhar
# Dogs of the dow trading strategy.
# Importing Pinance module
from pinance import Pinance
# Creates a BankAccount class.
class BankAccount():
def __init__(self):
self.balance = 0
self.interest = .00
# Function to deposit cash in the bank account.
def deposit(self, amount_deposit):
if... |
db5ca22ed96da2b90477cc648655d55008acbc7e | vaishali59/HackerRank-Python | /Data Types/count.py | 218 | 3.734375 | 4 | s="abcdcdcdc"
#print(s[0:3])
'''
count=0
for c in range(len(s)-2):
print(c)
print(s[c:c+3])
if s[c:c+3]=="cdc":
count+=1
print(count)
'''
print(sum(1 for c in range(len(s)-2) if s[c:c+3]=="cdc"))
|
a49110f23554843fb0abd70c00aadb0d7c1f8d88 | vaishali59/HackerRank-Python | /Regex/re_start_end.py | 422 | 3.640625 | 4 | import re
S=input()
k=input()
r=re.compile(k)
m=r.search(S)
if not m:print('(-1,-1)')
while m:
print((m.start(),m.end()-1))
m=r.search(S,m.start()+1)
'''
print(r.findall(S))
print(match for match in r.finditer(S))
pattern = re.compile(k)
r = pattern.search(S)
if not r: print "(-1, -1)"
while r:
print... |
b428f52948f97ce115ab255568c3b68c7c33a5f1 | vaishali59/HackerRank-Python | /Binary Tree/TopView_2ndMethod.py | 1,081 | 3.921875 | 4 | #Top-View Binary Tree
'''
1
/ \
2 3
/ \ / \
4 5 6 7
'''
class Node:
def __init__(self,info):
self.info=info
self.left=self.right=None
self.level=0
def TopView(root):
if root is None:
return
q=[]
level=0
... |
cb0d372b3187454a43797d915e19336b5e1c68d6 | vaishali59/HackerRank-Python | /Binary Tree/repitition_count.py | 124 | 3.5 | 4 | #find count for repetitions
a=[1,2,1,3,4,1,2]
count={}
for i in a:
count[i]=count.get(i,0)+1
print(count)
|
1fb282a9d945202e3d5f8078b3093b82edd3792d | vaishali59/HackerRank-Python | /Binary Tree/VerticalOrderTraversal.py | 1,710 | 3.921875 | 4 | # Vertical Order Traversal
'''
1
/ \
2 3
/ \ / \
4 5 6 7
\ / \
8 10 9
\
11
\
12
'''
#Code:
import collections
class Node:
def __init__(self,data):
self... |
7a3fa53fe16f4263986b78052520a7e7a6725110 | vaishali59/HackerRank-Python | /Data Types/tuple.py | 810 | 4.1875 | 4 | """
Given an integer,n , and n space-separated integers as input, create a tuple,t ,
of those n integers. Then compute and print the result of hast(t).
Note: hash(t) is one of the functions in the __builtins__ module, so it need not be imported.
Input Format
The first line contains an integer,n, denoting the number ... |
d10d0ce540311af514cf850fd13f2ae65d5a4733 | pareksha/Python-Beginner-Projects | /Dice Rolling Simulator/Dice Rolling Simulator.py | 3,198 | 4.21875 | 4 | from random import randint # To generator random number
def Main():
clear_screen = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
while True:
print("Welcome to guess the number: ")
# Creating the variables for the dice faces
... |
d5eba2130d06bde28f0c1b585945b953143f3267 | 10brink/py3_programming | /Python Functions, Files, and Dictionaries/week-1/Assement files and dict.py | 2,094 | 4.34375 | 4 | ''' Q-1. The textfile, travel_plans.txt, contains the summer travel plans for someone with some commentary.
Find the total number of characters in the file and save to the variable num.'''
with open("travel_plans.txt","r") as file:
file_char=file.read()
num = len(file_char)
print(num)
file.close... |
ca95140f4f66f697619c6cfe4ef2a64c7b24eb7d | ubercareerprep2021/Uber-Career-Prep-Homework-Claire-Gantan | /Assignment-3/standard_sort.py | 2,525 | 4.21875 | 4 | import unittest
#standard sorting algorithms 1
#timing: 1:02
def insertion_sort(arr, compare):
for i in range(1, len(arr)):
for n in range(0, i-1):
#find where to put arr[i], shift up everything else
i += 1
return []
def bubble_sort(arr, compare):
#recursive idea: repeat unt... |
7944935f4f38f08885c98fe3ed63fb5cd11a128b | ubercareerprep2021/Uber-Career-Prep-Homework-Claire-Gantan | /Assignment-1/Part3.py | 5,344 | 4.21875 | 4 | import unittest
class Stack:
def __init__(self):
self.list = []
self.minimum = float('inf')
def push(self, num):
self.list = [num] + self.list[:]
if type(num) == int and num < self.minimum:
self.minimum = num
def pop(self):
if self.isEmpty():
... |
baa9fccb63d6d368bc0de52c29949ce8e14efa2c | ben-whitten/ICS3U-Assignement-6B-Python | /hypercube.py | 1,441 | 4.09375 | 4 | #!/usr/bin/env python3
# Created by: Ben Whitten
# Created on: November 2019
# This is a program which finds the area of a hypercube.
import math
# This allows me to do things with the text.
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[... |
451070ade50fa3842add6d445a6a04366831cd58 | linhx13/arc-nlp | /arcnlp/tf/layers/seq2vec_encoders/cnn_encoder.py | 5,980 | 3.609375 | 4 | # -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import InputSpec, Conv1D, Concatenate, Dense
from tensorflow.keras.regularizers import l1_l2
class CNNEncoder(tf.keras.layers.Layer):
""" CNNEncoder is a combination of multiple convolutional la... |
903e019a849cfab2e5fd28ec8c9adcbe63967d75 | whybux/python_learn | /day11/test06.py | 841 | 3.515625 | 4 | import json
def main():
data = {
"name": "骆昊",
"age": 38,
"qq": 957658,
"friends": ["王大锤", "白元芳"],
"cars": [
{"brand": "BYD", "max_speed": 180},
{"brand": "Audi", "max_speed": 280},
{"brand": "Benz", "max_speed": 320}
]
}
... |
01c9ddf723df8b32473a9622267b67319a14f5ec | whybux/python_learn | /day04/test06.py | 361 | 3.796875 | 4 | """
输入一个正整数判断它是不是素数
"""
import math
num = int(input("请输入一个数"))
is_pr = True
end = int(math.sqrt(num))
for x in range(2, end):
if num % x == 0:
is_pr = False
break
else:
is_pr = True
if is_pr and num != 1:
print("%d 是个素数" % num)
else:
print("%d 不是个素数" % num)
|
ffcf48dc88fe7c76abc2335427d53d831b4466d0 | whybux/python_learn | /day04/test07.py | 504 | 3.578125 | 4 | """
输入两个正整数计算最大公约数和最小公倍数
"""
aInput = int(input("请输入一个正整数:"))
bInput = int(input("请再输入一个正整数:"))
if aInput > bInput:
aInput, bInput = bInput, aInput
for factor in range(aInput, 0, -1):
if aInput % factor == 0 and bInput % factor == 0:
print("%d,%d的最大公约数是 %d" % (aInput, bInput, factor))
print(... |
fe905590480cec010acf02ebe97291efa2a9f7c8 | whybux/python_learn | /day04/test03.py | 127 | 3.578125 | 4 | """
用for循环实现1~100之间的偶数求和
"""
sum = 0
for x in range(1,101):
if x%2==0:
sum+=x
print(sum) |
91f9679d88ac6501c226beb4bf7e06b5300271f0 | genegambit/Algorithms_DNA_Sequencing | /Bisect.py | 2,660 | 3.9375 | 4 |
# Text Preprocessing: Text Preprocessing involves building an index from the Text (T),
# with substrings of specified lengths. These substrings are referred to as k-mers.
# Indexing is used to determine the location (index) at which the pattern occurs within a text.
# If the location is found then the location os re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.