blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
3fd3e478fca7c57d6282ef54e8ac953d25369bb4 | KojiNagahara/Python | /TextExercise/13-2/rootedBinaryTree.py | 2,979 | 3.78125 | 4 | """動的計画法に使用するRooted Binary Treeのpython実装。
このツリーでは個々のList要素に対して拾う(左側と呼称)-拾わない(右側と呼称)と
決定した場合についての組み合わせをBinary Treeとして再帰的に表現する。
当然、対象のList要素を拾った場合に重量オーバーになる場合はそれ以上の左側の評価は
無駄なので、拾わない(右側)場合のツリーのみを評価対象として再帰を続けていく。
一度導出したツリーの構造が他の部分でも導出されることが十分に予想されるので
max_value_fastでは使う/使わないにかかわらず一度導出したツリー構造をキャッシュすることで
高... |
dacbf40e0f3faa76f1fa7796f82277a738050a92 | rohinarora/InterviewBit | /2. Arrays/12. Wave Array/sol2.py | 191 | 3.578125 | 4 | def wave(a):
for i in range(0,len(a)-1,2):
if (a[i]<a[i-1]) & (i!=0):
a[i],a[i-1]=a[i-1],a[i]
if a[i]<a[i+1]:
a[i],a[i+1]=a[i+1],a[i]
return a
|
9991bdc0197ab1d324b688949cd441419f8e8e24 | Yagomfh/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/100-weight_average.py | 382 | 3.6875 | 4 | #!/usr/bin/python3
def weight_average(my_list=[]):
res = 0
if my_list:
mul = []
for elem in my_list:
a = 1
for nb in elem:
a *= nb
mul.append(a)
for nb in mul:
res += nb
weight = 0
for nb in my_list:
... |
c644b5ec873f522f5382058b64e932dbd4486195 | mariliamelo/python-programming | /atcoder/20150711/welcome.py | 349 | 4.0625 | 4 | # Your task is to process some data.
# You are given 3 integers a , b , c and a string s.
# Output result of a+b+c and string s with a half-width break.
# get an integer
a = int(raw_input())
# get two integers separated with half-widt break
b, c = map(int, raw_input().split())
# get a string
s = raw_input()
# outpu... |
3a6476e0ff9a443ca386a350f7090059eb138387 | luhralive/python | /WangZhou/0000/insert_num_angle.py | 584 | 3.796875 | 4 | from PIL import Image, ImageDraw, ImageFont
def insert_angle_num(img):
"""
Insert a num on the right-upper angle,then save the new image.
:param img:string : filename of an Image object
"""
with Image.open(img) as im:
width, height = im.size
draw_image = ImageDraw.Draw(im)
... |
2bdfc5dc0dea17c1221e708eb253fd386546ae9c | Aminaba123/LeetCode | /516 Longest Palindromic Subsequence.py | 1,246 | 3.859375 | 4 | #!/usr/bin/python3
"""
Given a string s, find the longest palindromic subsequence's length in s. You
may assume that the maximum length of s is 1000.
Example 1:
Input:
"bbbab"
Output:
4
One possible longest palindromic subsequence is "bbbb".
Example 2:
Input:
"cbbd"
Output:
2
One possible longest palindromic subsequ... |
1de249e3a52785d47e41b40efc48b04b708478f5 | Wxshy/Code | /Neural-Network-CI.py | 1,446 | 3.71875 | 4 | import numpy as np
import matplotlib.pyplot as plt
class NeuralNetwork():
def __init__(self):
np.random.seed(1)
self.synaptic_weights = 2 * np.random.random((3,1)) - 1
self.allOut = []
def sigmoid(self, x):
return 1 / (1 + np.exp(-x))
def sigmoid_derivative(self,x):
... |
3f3a3e09b00239e08e7962b6f3f6f261dc092d94 | nimeresam/code_training | /algorithms/search.py | 995 | 3.78125 | 4 | import math
def binarySearch(el, arr, l, r):
if l > r:
return -1
# find mid
mid = l + (r - l) // 2
if arr[mid] == el:
return mid
if arr[mid] > el:
return binarySearch(el, arr, l, mid-1)
return binarySearch(el, arr, mid+1, r)
def jumpSearch(el, arr):
n = len(a... |
24f317223fd1a0d253f0f83e59a15b25ba6d6730 | savimanner/100-coding-challenges | /5.py | 471 | 3.90625 | 4 | #Question: Define a class which has at least two methods:
# getString: to get a string from console input
# printString: to print the string in upper case.
# Also please include simple test function to test the class methods.
class Puppy():
def __init__(self):
self.string = ""
def getString(sel... |
b6a576b69dbbf41e7cfb8e78fb4333c2cedcac4a | DreEleventh/python-3-object-oriented-programming | /ch03/mixin.py | 634 | 3.65625 | 4 | from contact import Contact
class MailSender:
"""Demonstration of a mixin. MailSender enables subclasses to send email."""
def send_mail(self, message):
# Warning: this class depends on the implementation of Contact
print("Sending mail to " + self.email)
# Email logic goes here
class E... |
b2ebac076c3a14a3d843238de9bc419dabad3884 | rlarca/Segment-Slice | /Segment-Slice.py | 1,057 | 3.953125 | 4 | #Segment-Slice
#useful in text analysis where the authorship is in question paragraph by paragraph but paragraphs are too small of a sample size
#Made entirely by Robert Larca
print('Please enter the name of the file you would like to segment (remember to include the extension of the file (".txt") and to have th... |
87ff6d5b3922135f5c3bc6de16d11717c55c5d15 | kevinelong/network_python | /regex_solutions/01_contains_certain_sets.py | 342 | 3.75 | 4 | import re
# 1) String contains only a certain set of characters (in this case a-z, A-Z and 0-9).
def is_allowed_specific_char(string):
charRe = re.compile(r'[^a-zA-Z0-9.]')
string = charRe.search(string)
return not bool(string)
print(is_allowed_specific_char("ABCDEFabcdef123450"))
print(is_allowed_speci... |
f35578578bbfe2179226261ffa6c94dedb7f2bd0 | anjosanap/faculdade | /1_semestre/linguagem_programacao/the_huxley/pratica-1/convert.py | 491 | 4 | 4 | """
Faça um programa que receba um valor em polegadas, converta e imprima o resultado em milímetros.
A entrada será um número real e não deve ser impresso nenhum texto para pedi-la.
A saída deverá ser o valor em polegadas e o resultado em milímetros.
Os números devem ser exibidos sem nenhuma formatação explícita quanto... |
5405dd6c3ea5efb5da7b8f143f67d2bfc58a80ea | razvanbaboiucs/lab-homework-manager | /Domain/StudentProblemsDTOClass.py | 801 | 3.90625 | 4 | '''
Created on Nov 26, 2018
@author: Razvan
'''
class StudentProblemsDTO:
'''
A DTO for a student and the number of problems of that student
'''
def __init__(self, st_id, name, number_of_problems):
'''
IN:
st_id - integer
name - string
... |
f7ef5fae8ed6b0498c3c8e915f523e3b38b0b087 | haedal-with-knu/PyGame | /PygamePrac/PygameTwelve.py | 3,874 | 4.0625 | 4 | #함수 객체지향 메서드
'''def add(a,b): #함수정의
c = a+b
return c #반환받는 리턴값
def main():
x = 3
y = 5
z = add(x,y)
print(z)
if __name__ == "__main__": #__name__ == "__main__"은 인터프리터에서 직접 실행했을 경우에만 if문 내의 코드르 실행하라
main()'''
'''def main():
total = 0
for index in range(100):
total += i... |
917851443562464ec1c5a02db3a84d6f7884fab9 | dorajam/Algorithmic-problems | /exercise1v2.py | 320 | 3.6875 | 4 | try1 = 'abcd'
try2 = 'abb'
try3 = 'zszd'
def uniqueStr(word):
checker = 0
for i in range(len(word)):
dif = ord(word[i]) - ord('a')
if checker & (1 << dif) > 0:
return False
checker |= (1 << dif)
return True
print uniqueStr(try1)
print uniqueStr(try2)
print uniqueStr(try3) |
d65f4138f74b00d52a5cea1a04e05291ebf8e78f | JavierVaronBueno/python_3.x_Estructuras_Datos_Busquedas_Hilos | /Estructura listaCircularSimple/listaCircularSimple.py | 1,750 | 3.96875 | 4 | """
ESTRUCTURA LISTA CIRCULAR SIMPLE:
Es una lista en la que cada nodo tiene un enlace, similar al de las listas enlazadas
simples, excepto que el siguiente nodo del ultimo apunta al primero.
Como en una lista enlazada simple, los nuevos nodos pueden ser solo eficientemente insertados
después de uno que ya tengam... |
c2c9bd782a0b6cbf3e4a2a6b75c46d1ec4a998d8 | iambonface/andela-word-count | /count.py | 368 | 4.09375 | 4 | """
Function that counts frequency of words in a sentence
Arg:
String
Result:
Dictionary with key value pair. key is the string and value the frequency of occurance
"""
def word_count(my_string):
if isinstance(my_string, str):
word_split = my_string.split()
my_dict = {}
for w in word_split:
my... |
79b6cb82ba430e7ead333b6304b47d9a6c613b20 | yairsep/next.py-1 | /main.py | 701 | 3.90625 | 4 | import functools
input_file = open("./files/names.txt", "r")
word_Split = input_file.read().split("\n")
# numOfWords = len(word_Split)
def createNameLengthFile():
file = open("files/name_length.txt", "w")
for word in word_Split: file.write(str(len(word)) + "\n")
file.close()
def printNamesByInputName()... |
30216c784bd36bbb8db3e261aba55150847a4e56 | Jashwanth-k/Data-Structures-and-Algorithms | /2.OOPS/Else and Finally.py | 802 | 3.796875 | 4 | class ZeroDenominatorError(ZeroDivisionError): #here denominator calls divisionError since it is parent class
pass
while True:
try:
n = int(input('enter the numerator :'))
num = int(n)
n = int(input('enter the denominator :'))
denom = int(n)
if denom == 0:
... |
c26d32eb0530174604be978a429b1cae357d9e16 | 8sagh8/Python | /Matplotlib/messy_Bar_Graph_2.py | 1,041 | 3.703125 | 4 |
"""
Matplotlib is a Python 2D plotting library which produces publication quality
figures in a variety of hardcopy formats.
It is for data visualization, it can be used in python scripts
can generate plots, histograms, power spectra, bar charts, pie charts, error charts, etc
Matplotlib is a sponsered project of Num... |
22ba06cb4fc5e6b889656c3128a77f89cb3fdf9c | dagrawa2/ssb_detection_ising | /phasefinder/compressor.py | 1,756 | 3.53125 | 4 | # https://stackoverflow.com/questions/5940416/compress-a-series-of-1s-and-0s-into-the-shortest-possible-ascii-string
# A set of 64 characters, which allows a maximum chunk length of 6 .. because
# int('111111', 2) == 63 (plus zero)
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_'
def encod... |
cf69c82a29112db824f6c984364766f06255a994 | MadnessPy/Object-oriented-programming | /pbo-adit.py | 5,560 | 4.03125 | 4 | print()
print("===================================")
print("Program untuk menghitung pajak penghasilan")
print("===================================")
print()
from abc import ABC, abstractmethod #mengambil nilai abc dan melakukan import terhadap modul ABC dan abstractmethod
class Storage(ABC): #class Stora... |
5dd7c42a5aae1223390157b49babe3bf17ac11bd | EddiePerez38/data_science | /sandbox matplotlib.py | 1,598 | 3.65625 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
# In[2]:
get_ipython().run_line_magic('matplotlib', 'inline')
# In[3]:
import numpy as np
# In[4]:
x = np.linspace(0, 5, 11)
y = x ** 2
# In[5]:
x
# In[6]:
y
# In[8]:
plt.plot(x,y)
plt.xlabel('X Axis')
plt.ylabel('... |
29ec6df2a9a8e9fa99c40c914c724d6786e05b41 | DanielBrito/ufc | /Monitoria - Fundamentos de Programação/Lista 5 - Ítalo/exe6.py | 245 | 4.15625 | 4 | # Lista 4 (Ítalo) - Questao 6
numeros = []
maior = -1
for i in range(1, 6):
n = int(input("Digite um elemento: "))
numeros.append(n)
for n in numeros:
if n>maior:
maior = n
print("\nMaior elemento da lista: ", maior) |
2245c3292e1ac9413eda3b04cec29b566367bcca | key70/day0405 | /ex04.py | 420 | 3.859375 | 4 | #연습) student01과 student02의 파일의 내용을 읽어들여
# 각각 df1과 df2에 담아봅니다.
import numpy as np
import pandas as pd
df1 = pd.read_csv("../Data/student01", sep="::", engine="python")
# line terminate 은 engine이 c만가능해요 ==> 실험
df2 = pd.read_csv("../Data/student02", sep="::", engine="python")
# print(df1)
# print(df2)
... |
640b326b102d626ff9bb02dd616f025a573f25d5 | Shivang-21/TIC-TAC-TOE | /tic-tac-toe.py | 5,071 | 3.875 | 4 | import random
board=[' ' for x in range(10)]
def insertLetter(letter,pos):
board[pos]=letter
def spaceIsFree(pos):
return board[pos]==' '
def isBoardFull(board):
if board.count(' ')>1:
return False
else:
return True
def printBoard(board):
print(' | | '... |
d6f49776ddf31eec268f57adff06e1477881dbc7 | DilyanTsenkov/SoftUni-Software-Engineering | /Python Fundamentals/Final exam/03_pirates.py | 1,626 | 4 | 4 | places = {}
while True:
target = input()
if target == "Sail":
break
city, population, gold = target.split("||")
population = int(population)
gold = int(gold)
if city not in places:
places[city] = [population, gold]
else:
if city in places:
... |
d97d37289808c35e4e094437ab5a1c4daa9ce1b3 | gabriellaec/desoft-analise-exercicios | /backup/user_173/ch162_2020_06_15_19_06_32_240409.py | 204 | 3.5625 | 4 | def verifica_lista(lista):
lista = []
for i in lista:
if i %2 != 0:
return 'impar'
elif i %2 == 0:
return 'par'
else:
return 'misturado' |
0e421584df3a3fe9a9fe63592aca06e73a76eb44 | 274337383/OPENCV | /test.py | 648 | 3.828125 | 4 | # -*- codeing = utf-8 -*-
# @Time : 2021/8/5 15:33
# @Author : 张涛
# @File : test.py
# @software : PyCharm
import random
num = random.randint(0, 10)
end = 0
print('------------------猜数字------------------')
temp = input("猜数字(1~10之间):")
guess = int(temp)
if guess == num:
print("你猜对了!")
else:
print("猜错了!")
... |
304119e76533496b37ac5cb8076f2b88e365bd94 | PradeepDongre/PythonCode | /Calculations.py | 395 | 3.578125 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sat May 5 18:58:01 2018
Calculation
@author: dongrp2
"""
def add(a,b):
return a + b
#print(add(10,5))
def sub(a,b):
return a - b
#print(sub(10,5))
def mul(a,b):
return a * b
#print(mul(10,5))
def div(a,b):
if b == 0:
raise ... |
3ebc4d2260df023206a0d1060b678b28b8f4b111 | estrellafel/readingDbSqlite | /FlaskSQLiteProject/book.py | 649 | 4 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This class will contain the information needed for the author.
@author: felixestrella
"""
class book:
# A constructor for book that takes in the ISBN, title, and year published.
def __init__(self, ISBN, title, yearPublished):
self.ISBN = ISBN
... |
e47d009374f8a36c442970d02920da91dc258cbb | nsg1999/Number-Theory | /EulerTotientFunction.py | 664 | 3.859375 | 4 |
# A simple Python3 program to calculate Euler' Totient Function
# Function to return gcd of a and b
def gcd(a, b):
if (a == 0):
return b
return gcd(b % a, a)
def phi(n):
result = 1
for i in range(2, n):
if (gcd(i, n) == 1):
result+=1
return result
... |
836f3fefe6f87b726f11d22ae9280589da391f0f | mikpim01/Google-IT-Automation-with-Python-Professional-Certificate-1 | /Using Python to Interact with the Operating System/Wk1/pygrams/using_python_in_ops.py | 347 | 3.515625 | 4 | passwordFile = open('SecretPasswordFile.txt')
secretPassword = passwordFile.read()
print('Enter your password
if typedPassword == secretPassword:
print('Access granted')
if typedPassword == '12345':
print('That password is one that an idiot puts on their luggage.')
else:
print('Access denied')
... |
41a17bfff740eb322874195939dcc314b3c08a1b | SheshankShekhar/Code--in | /Text summarization.py | 2,506 | 3.59375 | 4 | # -*- coding in python -*-
"""
Created on Mon Feb 10 22:59:08 2020
"""
# Import all the library
import bs4 as bs
import urllib.request
import nltk
import nltk
nltk.download('punkt')
nltk.download('stopwords')
import urllib.request
import re
import pandas as pd
import heapq
# Gettings the data so... |
2da4595b0127892d9f12631d29988936ff85b96f | tanyachitranshi/python-programs | /fibonacci.py | 271 | 3.796875 | 4 | num=int(input())
a=0
b=1
if num>0:
if num==1:
print(a)
elif num==2:
print(a,b,end=" ")
else:
print(a,b,end=" ")
for i in range(2,num):
c=a+b
print(c,end=" ")
a=b
b=c |
ad75e0f5545b87a9e22172432adf725969fca85e | daniel-reich/ubiquitous-fiesta | /B2jcSh2RG4GpQYuBz_6.py | 289 | 3.65625 | 4 |
def is_valid_phone_number(txt):
fb = txt[1:4]
sb = txt[6:9]
tb = txt[10:]
if len(txt)==14:
if txt[0]=="(" and txt[4]==")":
if txt[5]==" " and txt[9]=="-":
if fb.isdigit()==True and sb.isdigit()==True and tb.isdigit()==True:
return True
return False
|
979ed555e3078b3ee2fb6645cd4b100c2c2595cf | kazmer97/pydata_group_assignment_1 | /Group_Assignment_1.py | 2,631 | 3.59375 | 4 | # Question 1
import sys
import os
from typing import List
## a
boeing_data = "BA.csv"
with open(boeing_data, 'r') as f:
data = f.readlines()
print(data)
header = data[0]
allData = data[1:]
N = len(allData)
prices = []
dates = []
for line in allData:
prices.append(float(line.split(',')[1]))
dates.ap... |
f23c6cc0555540084db4304a9073f7920e10692f | ChunaLiu/biosys-analytics | /assignments/03-python-grad/grid.py | 990 | 3.84375 | 4 | #!/usr/bin/env python3
"""
Author : chunanliu
Date : 2019-02-04
Purpose: Rock the Casbah
"""
import os
import sys
# --------------------------------------------------
def main():
num = sys.argv[1:]
if len(num) != 1:
print('Usage: {} NUM'.format(os.path.basename(sys.argv[0])))
sys.exit(1)
... |
e5fa1b357097ffcb08e53cee4f22d4aee0dbca11 | jinalbangur16/567-B | /jini_567Assignment1.py | 1,689 | 4.03125 | 4 |
import unittest
def classify_triangle(a, b, c):
s=""
sides = [a,b,c]
sides.sort()
if sides[0] + sides[1] <= sides[2] or sides[1] + sides[2] <= sides[0] or sides[2] + sides[0] <= sides[1]:
s += "Not a Triangle"
else:
if sides[0]**2 + sides[1]**2 == sides[2]**2:
s += "Rig... |
9fbf5c60b1695d8104de141141505e9a1cc8be04 | gauffa/mustached-dubstep | /ch9/ch9ex3.py | 1,699 | 4.40625 | 4 | #Matt Hall
#ISY 150
#Chapter 9 Exercise 3
#10/27/2013
#Write a program that reads a string from the user containing a date in
#the form mm/dd/yyyy. It should print the date in the form March 12, 2012.
#add input validation to insure months,days,years are valid numbers/positions
#on a calendar
def user_input():
prei... |
5273cb4934621bd8f1a58f311a8f122236541f40 | panggggg/TDD | /fizzbuzz.py | 990 | 4 | 4 | # หาร3ลงตัว -> fizz , หาร5ลงตัว -> buzz ถ้าไม่ใช่ return ตัวเลข
# 3, 6, 9 -> fizz
# 5, 10, 20 -> buzz
# 15, 30, 45 -> fizzbuzz
# 1, 2, 4 -> number
def fizzbuzz(num):
result = get_result_buzz(num, str(num))
if is_divide_by_three(num):
result = "fizz"
result += get_result_buzz(num, "")
ret... |
4d3fecd643d578866647161181e16dbacadbb610 | LaBravel/Tedu-code | /python_base/2019.1.9/homework3.py | 732 | 3.578125 | 4 | DATE = []
while 1 :
name = input("请输入姓名")
if name == '' :
print(DATE)
break
Ages = input("请输入年龄")
Scores = input("请输入成绩")
D = {'姓名':name,'年龄':Ages,'成绩':Scores}
DATE.append(D)
width_name = max([len(i['姓名']) for i in DATE]) + 4
print('+','-' * width_name,'+','-' * 8,'+','-' * 8,'+'... |
7e1d11c350b790bd4e58891249956d7540909206 | RaySin8411/Python_Asyncio | /chapter2/cutlery_test.py | 4,045 | 3.625 | 4 | import threading
from queue import Queue
from attr import attrs, attrib
class ThreadBot(threading.Thread):
# A ThreadBot is a subclass of a thread
def __init__(self):
# The target function of the thread is the manage_table() method,
# defined later in the file.
super().__init__(target=... |
499f102b51fc4fcc14f81886a671220273095bbe | jae-hun-e/python_practice_SourceCode | /뼈대코드/4/4-48.py | 397 | 3.890625 | 4 | def days_in_month(year, month):
# assume year >= 0 and 1 <= month <= 12
if month == 1 or month == 3 or month == 5 or month == 7 or \
month == 8 or month == 10 or month == 12:
return 31
elif month == 4 or month == 6 or month == 9 or month == 11:
return 30
elif month == 2:
i... |
8784f56f872cea6ffab7517f482296ea9904a1b4 | SerdarKuliev/proj1 | /4/4-1.py | 622 | 4.15625 | 4 | #Реализовать скрипт, в котором должна быть предусмотрена функция расчета заработной платы сотрудника.
#В расчете необходимо использовать формулу: (выработка в часах*ставка в час) + премия.
#Для выполнения расчета для конкретных значений необходимо запускать скрипт с параметрами.
import my_func
print(str(my_func.my_f(in... |
cf06d3df1accd5f28fdd013289d83ec2273dd0c6 | superpigBB/Happy-Coding | /Algorithm/Find Minimum in Rotated Sorted Array.py | 1,926 | 4.03125 | 4 | """
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
Find the minimum element.
You may assume no duplicate exists in the array.
Example 1:
Input: [3,4,5,1,2]
Output: 1
Example 2:
Input: [4,5,6,7,0,1,2]
Output: 0
... |
a1e4b4cd0d79f82f74b1631432cd4e189167fb62 | erjan/coding_exercises | /bomb_enemy.py | 11,314 | 3.640625 | 4 | '''
Given an m x n matrix grid where each cell is either a wall 'W', an enemy 'E' or empty '0', return the maximum enemies you can kill using one bomb. You can only place the bomb in an empty cell.
The bomb kills all the enemies in the same row and column from the planted point until it hits the wall since it is too s... |
785f57a377e0b7665414427be82475374a6fd89e | timkaing/cartman-tweet-generator | /stochast_sampling.py | 1,683 | 4.09375 | 4 | import random
def unweighted_random(histogram):
"""
"""
my_words = list(histogram.keys())
return random.choice(my_words)
def weighted_random(histogram):
'''This function will return a random word based on a
weighted probability -use random.randint'''
# converts list of keys and values
... |
53e5e35832f0316b7ee0223f8d5440ffc7c215c1 | poojaelkal/LeetCode-solutions | /Python/#500_findWords.py | 381 | 3.625 | 4 | class Solution:
def findWords(self, words: List[str]) -> List[str]:
result = []
lines = [set("qwertyuiop"),set("asdfghjkl"),set("zxcvbnm")]
for word in words:
uni = set(word.lower())
if uni.issubset(lines[0]) or uni.issubset(lines[1]) or uni.issubset(lines[2]):
... |
16bc4d8b30e6c05ad78c3d32ebef5aa291dc9349 | myd1/basic-use-of-packages-and-classic-algorithm-set | /Numpy.py | 499 | 4.15625 | 4 | #-*- coding= utf-8 -*-
# numpy基本操作
import numpy as np #创建numpy别名
a = np.array([2,1,3,4,5,1,6,7])
#输出该数组
# sorting
a.sort()
print(a)
#对前三个数字进行切片
print(a[:3])
#对后面的数据进行输出
print(a[-3:])
#进行逆序输出#################
b = a[::-1]
print(b)
################################
#output min
print(a.min())
# sorting... |
8b5e43ee50ab4d2f9b86a51cc3ad41e06d15267a | BursacPetar/GIS_programiranje_Domaci_zadatak | /GIS_programiranje_Vezba_br_1/GISP_Vezba_br_1_Zadatak_br_2_PetarBursac1540-16.py | 616 | 3.671875 | 4 | # Kodiranje skripta
# -*- coding: utf-8 -*-
## Zadatak br. 2
# pretpostavlja se da je unos korektan
br1 = input("Unesite prvi ceo broj: ")
br2 = input("Unesite drugi ceo broj: ")
print "Uneti prvi ceo broj je: {0:d} \n" \
"Uneti drugi ceo broj je: {1:d} \n" \
"Zbir je jednak: {2:d} \n" \
... |
45da467a75ac4849bbc6c14d10553bae7289f729 | Delictum/python_algorithms_and_data_structures | /module02_loop_rec_func/task3_reverse_num.py | 690 | 4.53125 | 5 | """
The task 3:
Сформировать из введенного числа обратное по порядку входящих в него цифр и вывести на экран.
Например, если введено число 3486, надо вывести 6843.
P.S.
отваратительно решать эту задачу без срезов, написал бы так:
print(f'Перевернутое число: {input("Введите число: ")[::-1]}')
"""
num = int(input('Введ... |
571471e3629075d9d7404e6deb8e545436abdf6e | AlainDlcTVOP/Python-Core | /Python-Core-Advanced-Course/assigment/collection.py | 236 | 4.25 | 4 | #List of countries
lst= ["Spain","Portugal","Norway"]
print(lst)
#Add an country at the end
lst.append("Mexico")
print(lst)
#Remove by index
lst.remove("Mexico")
print(lst)
#Add a country in the middle
lst.insert( 1,"Brazil")
print(lst) |
577e4ad57e89f182160cedf5258f5b72a597b001 | jeffvswanson/CodingPractice | /Python/Zelle/Chapter9_SimulationAndDesign/ProgrammingExercises/8_BlackJackDealerBust/blackjackGameDealerBust.py | 4,302 | 3.90625 | 4 | # blackjackGameDealerBust.py
# A program that simulates multiple games of blackjack and estimates the
# probability the dealer will bust.
"""Blackjack (twenty-one) is a casino game played with cards. The goal of the
game is to draw cards that total as close to 21 points as possible without
going over. All face cards c... |
14d13e43ddf5d65448528977fa1f7d7d304cdfd6 | mamijaz/Project-Euler | /src/pro70.py | 973 | 4.03125 | 4 | def Prime_Factors(num):
prime_factor=[]
while not num%2:
prime_factor.append(2)
num/=2
primer=3
while num!=1:
while not num%primer:
prime_factor.append(primer)
num/=primer
primer+=2
return list(set(prime_factor))
def Totient_Function(num):
... |
114b8e68be148d875268eb238561d27969c0db61 | NVOkunev/Python | /GetUniqueElementsOfList.py | 510 | 4.4375 | 4 | #!/usr/bin/env python
# Create empty lists for user data and resulting list
lst = []
uniq = []
# User define the number of elements in list
n = int(input("Enter number of elements : "))
# User define the n values of list's elements
for i in range(0, n):
ele = input()
lst.append(ele)
print('Initial list is: ... |
eeaf23aee4bf810ff9b0bff8bf0d44754e79a972 | Nawaf-Almansour/Fill-in-the-Blanks | /Fill-in-the-Blanks.py | 7,656 | 4.125 | 4 | # -*- coding: utf-8 -*-
#pyhon2.7
#Thu 12 Apr
#progrming nawaf almansour
# IPND Stage 2 Final Project
#Game has 3 or more levels and each level contains 4 or more blanks to fill in
# You've built a Mad-Libs game with some help from Sean.
# Now you'll work on your own game to practice your skills and demonstrate what y... |
e8dc6c28cee02bb9441692160e0fdfb889b8821b | Sahej-Singh/Python-test | /123.py | 207 | 4.125 | 4 | #Python program to find the prime factors of an integer.
def factor(n):
b = int(n)
d = []
for i in range(1,b+1):
if int(n)%i == 0:
d.append(i)
return(d)
a = input("enter no.: ")
print(factor(a))
|
af2e56b67464fca264880abf8aa2f2b3aae8a830 | Daffy2418/LeetcodeTop100 | /124.Binary Tree Maximum Path Sum.py | 2,013 | 3.8125 | 4 | '''
4
/ \
11 13
/ \
7 2
对于一条路径来说,可以分为两种情况,一是当顶节点是当前点,另一种是顶节点是父节点。例如,对于节点11来说,
1. 当顶节点是当前节点,对于节点11,路径为 7->11->2
2. 当顶节点是父节点4时,对于节点11,路径为 7->11->4->13
对于DFS来说,其递归过程中必定会对某节点的子节点调用,那么其返回值应该适用于上面第二种情况,但是最终结果肯定是第一种情况,那么如果保存并更新最终结果呢,我们可以将其放在参数中传递。那么对于任意一个节点n来说,
DFS(n) = max(DFS(n->left) + n->val, DFS(n->right)... |
0d7e4e04c734ac06948befe22653f237f55d014a | sxb427/Number-patterns | /numberpattern.py | 2,819 | 3.671875 | 4 | n=int(raw_input('enter number between 1 to 9'))
# 1
# 121
# 12321
# 1234321
# 123454321
#12345654321
for i in range(1,n+1):
s=' '
for l in range(n-i):
print s,
for j in range(1,i+1):
print j,
for k in range(i-1,0,-1):
print k,
print
for i in range(n-... |
93901f59f64b2c50e2120d4b3c9aa4daa0e49ed0 | fumendan/code_Aaron | /PycharmProjects/test/student_manage/student.py | 526 | 4.03125 | 4 | #!/usr/bin/env python3
# print('Import module')
student=[
{'name':'Aaron','age':23}
]
def showStudent(li):
for l in li:
print("name:%-10sage:%-10s" % (l['name'],l['age']))
def addStudent(li):
name=input('name:')
age=input('age:')
li.append({'name':name,'age':age})
def delStudent(li):
... |
67a0fab8a86f3139bde096c6fdc22bdf6226686a | zzzfight200/PythonPractice | /RockPaperScissors.py | 2,957 | 3.921875 | 4 | import random
ComputerScore = 0
PlayerScore = 0
while True:
Choice = input("Choose Rock Paper or Scissors!").capitalize()
Computer = random.choice(["Scissors", "Rock", "Paper"])
CaseSample = Choice + Computer
def RockScissors():
print("Your Choice is Rock and Computer's Choice is Scissors")
... |
9a0ba53e8c921d17642a6b284ff509624f8bf984 | stainsteelcrown/first-assignment-300 | /valid_month.py | 832 | 4.34375 | 4 | #-------------
#I am copying the answer to valid month in an attempt to learn python
#This program verifies that a user enters a valid month
Month = ['January', 'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',... |
bed87cab33b313356e5fe5be45f44e5752b01400 | JulyKikuAkita/PythonPrac | /cs15211/ProjectionAreaof3DShapes.py | 2,626 | 3.875 | 4 | __source__ = 'https://leetcode.com/problems/projection-area-of-3d-shapes/'
# Time: O(N^2)
# Space: O(1)
#
# Description: Leetcode # 883. Projection Area of 3D Shapes
#
# On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes.
#
# Each value v = grid[i][j] represents a tower of v... |
24c3697c3199124abd4c87e0a5be8c6695f76d5f | humburg/pirates | /pyrates/sequence.py | 15,980 | 3.640625 | 4 | """Classes and functions to handle sequence data.
"""
import itertools as itools
import pyrates.utils as utils
class SequenceWithQuality(object):
"""A sequence and its quality scores.
Args:
sequence (:obj:`str`): The sequence to be stored.
quality (:obj:`str`): Quality scores for base calls i... |
2869dddb10dd8491110a9b6f31b2722b5996aed4 | cinnamonbreakfast/uni_implementations | /Semester 1/FP/BattleShips/Table/playerTable.py | 5,138 | 3.59375 | 4 | from texttable import Texttable
from unittest import TestCase
from Player.player import PlayerField
class TableGame:
def __init__(self, player):
self._tiles = []
self._playerOBJ = player
self.size = 8
self._generate_table()
def free_space(self, x, y, lng, deg):
'''
... |
3cf57d0a438d9e1e66fee2d2a90295628fbe5abc | timpark0807/self-taught-swe | /Algorithms/CTCI/1.2_Check_Permutation.py | 1,263 | 3.859375 | 4 | import unittest
class Solution:
def check_permutations(string1, string2):
if type(string1) != str and type(string2) != string:
return False
elif len(string1) != len(string2):
return False
freq = {}
for letter in string1:
if lette... |
ab62ff19cb4968fccea9286b03522bd75c6f6325 | dashuai888/Python_Study | /Python_Study/dashuai/chapter01/1-simpleIO/Helloworld.py | 1,440 | 3.875 | 4 | #!/usr/bin/env python3
# 命令行直接运行py文件的方法
# 在Windows上是不行的,但是在Mac和Linux上可以,方法是在.py文件的第一行加上一个特殊的注释
# 在linux命令行运行Python,需要通过命令给x.py以执行权限:
# chmod 744 x.py
# 用print()在括号中加上字符串,就可以向屏幕上输出指定的文字。
print('hello, world') # hello, world
# print()函数也可以接受多个字符串,用逗号“,”隔开,就可以连成一串输出,print()会依次打印每个字符串,遇到逗号“,”会输出一个空格
print('wang', 'da'... |
46539d90e7210e1803f7587d2318524e6aa5fc1c | varaste/Practice | /Python/PL/Python Tkinter Basic-Exercise-2.py | 368 | 4.34375 | 4 | '''
Python tkinter Basic: Exercise-2 with Solution
Write a Python GUI program to import Tkinter package and create a window.
Set its title and add a label to the window.
'''
import tkinter as tk
parent = tk.Tk()
parent.title("Arya Python tkinter GUI")
first_label = tk.Label(parent, text = "Arya Varaste")
fi... |
8d85732ad55943305f988eafcb2165ed0c96b864 | jxxiao/leetcode | /python/019_Remove_Nth_Node_From_End_of_List.py | 1,048 | 3.71875 | 4 | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeNthFromEnd(self, head, n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
"""
current, temp = head, head
... |
6246166c814a3a2b9bf09fc496c633845c581886 | XiongMMaq/python-test | /example2.py | 1,292 | 4.03125 | 4 | #!/usr/local/bin/python3
def changeme1(mylist):
'可变'
mylist.append([1,2,3,4])
print("内部调用:",mylist)
mylist = [10,11,12]
changeme1(mylist)
print("外部调用:",mylist)
'''
请注意:上面特意用了引号标准的部分,对可变类型或者引用的操作修改的是传过来的对象的属性。
可以这么理解(例子有点随意):我在画画,小明来了说他也要画,我让他和我一起画,他如果和我在同一个画板上画,那么我们两的画就会同时改变。 而如果他说不,我要另外用一块画板,然后重新拿了块画板... |
a284cec1aacb5b3a7a2d1b49857e9d61cba1c748 | whywhyy/summer-code-jam-2020 | /juicy-jaguars/Web95/Web95/html_parse.py | 6,069 | 3.59375 | 4 | """Module used to parse HTML pages."""
from bs4 import BeautifulSoup # For parsing HTML code
import re # For matching multiple/all variations of elements
import urllib.parse # To parse urls to determine if they are relative or absolute
class HtmlParser:
"""Class used to parse HTML."""
def __init__(self, ... |
8cef56a37efe3a5097183fadfa84304fe72b0636 | liuzhipeng17/python-common | /python基础/迭代器/标准迭代器.py | 977 | 3.984375 | 4 | # coding=utf-8
# 迭代的定义:给定一个list或tuple,
# 我们可以通过for循环来遍历这个list或tuple,这种遍历我们称为迭代(Iteration)
# 为什么要迭代器:
# 迭代器提供了一种不依靠下标索引方式来遍历可迭代对象,如字典,文件
# 迭代器和列表更省内存,迭代器是惰性计算
# 缺点:
# 只能往后取值
# 判断一个对象是否可迭代:
from collections import Iterable
print(isinstance('cc', Iterable))
# 遍历list,推荐采用enumerate
for i, value in enumerate([1,2,'3... |
4d209ceb12c034a5848b19e52874effb152d6a41 | nmessa/Python-2020 | /Lab Exercise 1.6.2021/problem2.py | 229 | 3.890625 | 4 | ##Lab Exercise 1.6.2021 Problem 2
##Author:
##This program will calculate the area of a circle
from math import pi
#Add code here
##Sample output
##Enter the radius of a circle: 1.1
##Area = 3.8013271108436504
|
35a4f00601c10870876ff3fc83c6f9993829c9e6 | YuriiKhomych/Coursera-Algorithms-Part-1 | /week_3/mergesort_standard.py | 311 | 4.03125 | 4 | # Mergesort: O(n log(n))
from heapq import merge
def mergesort(w):
"""Sort list w and return it."""
if len(w) < 2:
return w
else:
# sort the two halves of list w recursively with mergesort and merge them
return merge(mergesort(w[:len(w) // 2]), mergesort(w[len(w) // 2:]))
|
0e4d104b2e4db1df75ce4bead4cf653f1b1adec4 | DanLux/minstack | /min_stack.py | 594 | 3.671875 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class MinStack:
def __init__(self):
self.stack = []
self.min_stack = []
def min(self):
return self.min_stack[-1] if self.min_stack else None
def push(self, value):
older_min = self.min()
current_min =... |
085e1cedcf5a9e6dae2c57c81d7165bdbbd50445 | Wildog/python-practices | /0010/0010.py | 913 | 3.65625 | 4 | # -*- coding: utf-8 -*-
#使用 Python 生成类似于下图中的字母验证码图片
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import string
import random
def generate(length=4):
width, height = 240, 60
img = Image.new('RGB', (width, height), (200, 200, 200))
font = ImageFont.truetype('Arial.ttf', 50)
draw = ImageDraw... |
e7148f0aabe82a38a7627f55ef0bf02eb5ec756f | Aasthaengg/IBMdataset | /Python_codes/p03564/s334279413.py | 185 | 3.65625 | 4 | # coding: utf-8
import math
ans = 1
count = 0
num1 = int(input())
num2 = int(input())
for i in range(num1):
if ans < num2:
ans *= 2
else:
ans += num2
print(ans) |
78c9b59a3c784769baa701cc024cce121f25d264 | mehranagh20/isfahan-university-AI-challenge | /client/put_strategy.py | 6,275 | 3.5 | 4 | from Pos import Pos
from random import shuffle, randrange, choice
def pos_dooz(game, checkers, mp):
doozes = []
for dooz in game.lines:
num_ok = 0
for checker in checkers:
num_ok += 1 if checker in dooz else 0
if num_ok == 2:
for cell in dooz:
... |
c51477df08901809f2730635748d89188dbed3cb | harsham4026/DSA | /dsa/MergeSort.py | 883 | 4.1875 | 4 | '''Merge sort is basically divide and conquer algorithm. Divide the list into half and make them to left and right arrays
and split them until the length becomes 1 and sort them and merge finally.
Time complexity of O(n * log(n))'''
def merge(left, right):
result = []
i, j = 0, 0
while i< len(left) and j<... |
8d8c3e3e2cf17de3e9d040cd6818ecf48ca2740f | ganesh-07-hail/python-set-1 | /to count number of digits in a number.py | 161 | 3.84375 | 4 | #to count number of digits in a number
def dig(g):
c=0
while(g > 0):
g=g//10
c+= 1
return c
g= int(input())
print(count(g))
|
1875ce08eab8f9bf26e24ed1d95eb7a85b335558 | Maximizer07/python-practice | /practice02_extra/script.py | 1,037 | 3.640625 | 4 | import os
# Написать утилиту командной строки, формирующую дерево каталогов и файлов с учетом вложенности и начиная с заданного
# пути. Результат должен быть выдан в виде текста в формате graphviz.
def result(s):
if s == 'start':
print('digraph G {')
elif s == 'end':
print('}')
return s
... |
82226612a9ca6a36463bd468f8e19676b67e7571 | mou7686/Python-bible | /email slicer.py | 330 | 3.96875 | 4 | # get user email address
email=input("what is your email address?:").strip()
#slice out user name
user_name=email[:email.index("@")]
#slice domain name
domain=email[email.index("@")+1:]
#format message
output="Your username is {} and your domain name is {}".format(user_name,domain)
#diplay output message
print... |
99ebc0e64de73241df46bd02568e4d6db03bbcd2 | TroyTianzhengWang/alphago0 | /go_utils.py | 10,778 | 3.765625 | 4 | from collections import deque
def make_move(board, move):
"""Make a move (row,col) on a go board
Args:
board: current board: including dimensionm grid, player and history
move: (r, c) tuple indicating the position of the considered move
Returns:
new board config if the move was succ... |
40f54ed645123b717898ba7e3380c79a04e95276 | Mumujane/PythonAdvance | /Re/Introduction/ReMultipleStr.py | 1,360 | 3.5 | 4 | """
匹配多个字符
* 匹配前一个字符出现0次或者无限次, 可有可无
+ 匹配前一个字符出现1一次或者无限次, 至少一次
? 匹配前一个字符出现1次或者0次 要么一次要么没有
{m} 匹配前一个字符出现m次 \d{3}
{m,n} 匹配前一个字符出现m到n次 \d{4,6}
"""
import re
# {1,4}从1到3位的数据 匹配
str = "hello12323"
print(re.match("hello\d{1,4}", str).group())
# 匹配手机号11 位
str = "123456789012"
print(re.match('\d{11}', str).group())
# 判断电话号... |
d8ccbc15f4000645ccb37a51e5c50791a97cb3ce | aruneshmee/Syntax_Basics | /algorithm_basics.py | 490 | 3.6875 | 4 | # Time conversion from 12 hour to 24 hour format
import re
def timeConversion(s):
x = re.findall(r"[^\W\d_]+|\d+", s)
dn = x[-1]
h = x[0]
m = x[1]
s = x[2]
if dn =='AM':
if h == '12':
print('00'+':'+m+':'+s)
else:
print(h+':'+m+':'+s)
else:
if ... |
3ab5dbd6436183e69a9f256c883671738b9e17b6 | fantasylsc/LeetCode | /Algorithm/Python/50/0028_Implement_strStr.py | 2,235 | 4.1875 | 4 |
'''
Implement strStr().
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Example 1:
Input: haystack = "hello", needle = "ll"
Output: 2
Example 2:
Input: haystack = "aaaaa", needle = "bba"
Output: -1
Clarification:
What should we return when... |
f8bd9c2dae2c03cca95daee7212e3554ebc4409d | pohily/checkio | /box-probability.py | 715 | 3.578125 | 4 | def checkio(marbles: str, step: int) -> float:
result = [[(marbles, 1)]]
count = 0
while step - count-1:
if len(result) < count + 2:
result.append([])
for i in result[count]:
if 'w' in i[0]:
tmp = i[0].replace('w', 'b', 1)
result[count+... |
7da3290ed2e7933a0f0bc4f3c0e43d5bb7f55d63 | CINick72/project_euler | /pe2.py | 472 | 3.9375 | 4 | """
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
"""... |
4e4d5224291e67c7196084e4fc48ee7651b7201e | Amathlog/MTH6412B | /TP1/node.py | 1,099 | 3.9375 | 4 | # -*- coding: utf-8 -*-
class Node(object):
"""
Une classe générique pour représenter les noeuds d'un graphe.
"""
def __init__(self, name='Sans nom', data=None):
self.__name = name
self.__data = data
self.__id = None
def get_name(self):
"Donne le nom du noeud."
... |
0072fe8a6780500026ebc31bc25ccbd01b6a668a | M1rn4/Ahorcado_final | /proyecto2/venv/list_and_dicc.py | 813 | 3.734375 | 4 | def run():
# my_list = [1, "hello", True, 4.5]
# my_dict = {"firstname", "Mirna", "lastname", "Ampuero"}
super_list= [
{"firstname": "Mirna", "lastname": "Ampuero"},
{"firstname": "Maria", "lastname": "Hernandez"},
{"firstname": "Juana", "lastname": "Arco"},
{"firstname": "J... |
3c42d2c225aa00cd4128ae0ad4284a2055512cfa | umaimakhh/python-mini-projects | /Coprime_Logic_UKA.py | 3,592 | 3.671875 | 4 | '''
Assigment No: 1 - Grading Logic Assigment
Name: Umaima Khurshid Ahmad
Youtube Link: https://youtu.be/hz-m7Imsf9c
Date: 04/05/2020
I have not given or received any unauthorized assistance on this assignment
'''
import timeit
def coprime_test_loop():
'''Prompts the user if their entered numbers are c... |
4aa3a748eca639f7b21bf693ea74e2ae8d0cca00 | mnallammai/games | /guessmovie.py | 3,863 | 3.78125 | 4 | import random
movies=['anand','anbe sivam','vickram vedha','visvasam','mersal','kaaka kaaka','alaipayuthe','fidaa','lkg','taare zameen par']
def create_question(movie):
n=len(movie)
letters=list(movie)
temp=[]
for i in range(n):
if letters[i]==' ':
temp.append(' ')
else:
... |
cafd2821d3e6f9394439d91098afb176e62bfcb8 | JagadeeshLTTS/Python_assignment_Genesis2021_99004951 | /Ass_Qn-10.py | 1,204 | 3.96875 | 4 | def convertToDecimal(hexa_number):
res=""
for item in hexa_number:
if item=='a':
res=res.__add__("10.")
if item=='b':
res = res.__add__("11.")
if item=='c':
res = res.__add__("12.")
if item=='d':
res = res.__add__("13.")
if ... |
4bde8918c7de07bc1fca5f8ec73137b178132870 | petercort/ProjectEuler | /ProjectEuler/Problems/problem2.py | 525 | 3.578125 | 4 | #Find the sum of even valued terms of the Fibonacci Sequence
#for values less than 4 million
#brute force technique
def problem2Name() :
return "Problem 2"
def problem2Description() :
return "Find the sum of even valued terms of the Fibonacci Sequence for values less than 4 million"
def problem2Params() :
retur... |
3f217b58cc4ef385997e152eb103015fad4353a6 | panye819/python3_study | /section-2-python-advanced/06-thread/thread_08.py | 441 | 3.828125 | 4 | #!/user/bin/python3
#!coding=utf-8
#非全局变量在不同线程中不会互相影响
from threading import Thread
import threading
import time
def work1():
name = threading.current_thread().name
print("----thread name is %s ----"%name)
g_num = 100
if name == "Thread-1":
g_num += 1
else:
time.sleep(2)
print("---thread is %s ----g_num=%d"... |
fba6f74f03543a4c1947000b02701b1db2de6126 | yuju13488/pyworkspace | /Homework/integrate/integrate4.py | 2,428 | 3.859375 | 4 | # 4. 日期的練習-my_calendar
# 輸入一個正整數,列印出那一年的年曆。
# 輸入兩個整數,第一個數字代表那一年,第二個數字代表那一月,列印出那一年那一月的月曆。
# 注意閏年
# import datetime
# datetime.timedelta(days=n)
# t = datetime.datetime.now()
# print(t.year) # 2018
# print(t.month) # 6
# print(t.day) # 1
# print(t.hour) # 21
# print(t.minute) # 34
# p... |
785f46854a1e06779312568e19b3db160e5cdd52 | Balu862/everyday_assignments | /day7assignment-27july/27July2021-Balasubramaniyam-Day7/menu.py | 286 | 4.0625 | 4 | while(1):
print("select an option:")
print("1)addition :")
print("2) subtraction : ")
print("3) exit:")
option=int(input())
if option==1:
print("Addition is selected")
elif option==2:
print("Subtraction is selected: ")
else:
break |
08ad016473c85dd1e8c2c1783df3235bf8928520 | liupy525/LeetCode-OJ | /53_Maximum-Subarray.py | 655 | 4.21875 | 4 | #!/usr/local/env python
# -*- coding: utf-8 -*-
'''
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [−2,1,−3,4,−1,2,1,−5,4],
the contiguous subarray [4,−1,2,1] has the largest sum = 6.
'''
class Solution:
# @param A, a list of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.