blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
2ae591ad210d4fcd3748a406f0a5855d7ffd7f59
MarioGN/web-scraping-estudos
/live_20_selenium/google.py
877
3.671875
4
""" Exemplo de PO no google.com """ from selenium import webdriver class Google: def __init__(self, driver): self.driver = driver self.url = 'http://google.com.br' self.search_bar = 'q' self.btn_search = 'btnK' self.btn_lucky = 'btnI' def navigate(self): s...
42f1e79d6b99b5466d1521daf013afe3d2464655
thebatcn/python-study
/pandas/pandas_DataFrame.py
3,208
3.875
4
import pandas as pd data = { "state": ["Ohio", "Ohio", "Ohio", "Nevada", "Nevada", "Nevada"], "year": [2000, 2001, 2002, 2001, 2002, 2003], "pop": [1.5, 1.7, 3.6, 2.4, 2.9, 3.2], } frame = pd.DataFrame(data) print(pd.DataFrame(data, columns=["year", "state", "pop"])) # 如果指定了列序列,则DataFrame的列就会按照指定顺序进行排列 ...
967c018b9a496484cba2547c89666118074091e4
m-lobocki/Python-ExercisesSamples
/ex49.py
169
3.765625
4
# Write a program which can map() to make a list whose elements are square of numbers between 1 and 20 (both included). result = list(map(lambda x: x * x, range(1,21)))
e61728f6155eb36d4294d0a54e1cd0342fd746c4
uday3445/python-al-and-ds
/nivice gcd.py
378
3.921875
4
def gcd(m,n): """ gcd of all two numbers :param m: :param n: :return: """ cf=[] for i in range (1,min(m,n)+1): if (m%i)==0 and (n%i)==0: cf.append(i) return( cf[-1]) num1 = int(input("The first number is ")) num2 = int(input("The second number is ")) print('the...
b4c085111617c3ff74ded41f1c47cc2caaa6d379
Ellipse404/100-Exercises-Python-Programming-
/100+ Exercises Solved/Question - 6.py
766
3.90625
4
# -*- coding: utf-8 -*- """ Created on Tue Jul 16 17:28:16 2019 @author: BHASKAR NEOGI """ # Level - 2 import math as m c = 50 h = 30 d = input("Enter The Comma ',' Seperated Numbers : ").split(",") print("Here We Go With Your Number List",d) print(''' ''') r = [] ...
2e5132a3647f8081b28750e8b201805ae7a81df3
pgurazada/ml-projects
/wells-africa/2018-05-28_assemble.py
3,328
3.578125
4
# coding: utf-8 # In this workbook we assemble the required features of the data set as per the observations from the exploratory data analysis. # In[37]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('ticks') get_ipython().magic('matplotlib inline') ...
da9c89fee8cfcf874ee1e8bedfcf3da45a83fd3f
arjunshah1993/Algorithms
/factrecursion.py
121
3.6875
4
n = 6 def factrec(n): if n == 1: return 1 elif n == 2: return 2 else: return n*factrec(n-1) print(factrec(n))
35a780b0870b9050346561ea796f671bdbcd721b
ekaraali/gaih-students-repo-example
/Homeworks/Day3_HW.py
1,174
4.40625
4
print(""" User login system.... """) #define username and password so that input provided by the users can be checked username = "edizkaraali" password = "123456" #define an entering right value to create safer system entering_right = 3 while True: username_from_user = input("Please enter your username:...
67edf3cf50688ac4136fa0b6115bd536e26a0465
pcaenngtaeera/Information-Retrieval
/Inverted Index/compression.py
1,739
4.5
4
#!/usr/bin/env python from struct import pack, unpack def encode(integer): """ Encodes the Uses integer operations instead of bit shifts for efficiency. The integer "128" is equivalent to "1000 0000" and is used a mask. The algorithm focuses on adding byte-values to the <bytes> until the value c...
3fbe02f6284b59e5d97180a6d058bab16a511372
AninditaBasu/iPythonBluemixWatsonTone
/watson_get_tweets.py
3,489
3.703125
4
import json from twitter import TwitterStream, OAuth # # Authenticate yourself with Twitter # CONSUMER_KEY = raw_input('Enter the Twitter consumer key: ') CONSUMER_SECRET = raw_input('Enter the Twitter consumer key secret: ') ACCESS_TOKEN = raw_input('Enter the Twitter access token: ') ACCESS_SECRET = raw_inp...
b2546b464960eb71bc86723faabe1a04db6a1db1
desig53/Leetcode_Practice
/leetcode_pracitce/Replace_Elements_with_Greatest_Element_on_Right_Side.py
2,459
4.0625
4
# -*- coding: utf-8 -*- """ Created on Mon Jun 7 16:03:38 2021 @author: asus """ ##Replace Elements with Greatest Element on Right Side ''' Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. After doing so, retur...
cc4ef7f5af73080449a6a28d8445fc619e42c56e
abhijitmamarde/py_notebook
/programs/dict_methods.py
2,090
4.25
4
# two ways for defn dict d = dict() print( type(d) ) d = {} print( type(d) ) # dict is key value pair d = {'name': 'abhijit', 'age': 24, 'is_student': False, 'salary': 24.5} # key could be anyone of an int, float, bool, string or tuple but NOT list # value could be any object/type in Python # ----- basic operations...
a2c7a2e172e9f09f8a9152e80f1d5d4b381dc182
ritualnet/Euler
/Euler1.py
2,227
3.921875
4
def euler1(a, b, value): # If we list all the natural numbers below 10 that are multiples of 3 or 5, # we get 3, 5, 6 and 9. The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. sumval = 0 for x in range(1, value): if (x % a == 0) or (x % b == 0): ...
620b481dd29f76a04b85299194e085eedde93726
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/41_10.py
2,531
4.03125
4
Python – Check if List is K increasing Given a List, check if next element is always x + K than current(x). > **Input** : test_list = [3, 7, 11, 15, 19, 23], K = 4 > **Output** : True > **Explanation** : Subsequent element difference is 4. > > **Input** : test_list = [3, 7, 11, 12, 19, 23], K = 4 ...
81b06a40d05788c799a7735eff01a692f4f19532
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/word-count/097d732334c14eceb0b7047bda198ad1.py
808
4.15625
4
# Dirk Herrmann's solution version 2 for exercism exercise "Word Count" # This file implements class Phrase: # # * A Phrase object is constructed from a string. # # * The method word_count returns a dictionary (a Counter, actually). Keys # are strings holding the words from the phrase, values are integer values # ...
e353bda883873ec0c429cc0851e24d3e3dc06cc1
unsilence/Python-function
/Python基础/按照列表某一列的元素大小进行排序.py
269
3.609375
4
''' 利用set自动去重 ''' if __name__ == '__main__': a = set() for _ in range(100): a.add(1) a.add(3) b = set() b.add(3) b.add(5) # 对两个集合取交集 print(b&a) # 对两个集合取并集 print(b|a)
5cbbb33e9ae32f0ca466ed12fa8780e432e0d697
100pawan/my_code_python
/while_loop.py
148
3.75
4
# i = 1 # while i<=10: # print("pawan") # i = i+1 i = input("enter your name ") n = 1 while n<=10: print(f"{i} {n}") n = n + 1
0a438cbe88865719ba8d266722df1a547f3b2ca9
vipulsingh24/DSA
/Problems/max_balloon.py
549
3.78125
4
def max_number_of_balloons(text): count = [0] * 26 for i in range(len(text)): count[ord(text[i]) - ord('a')] += 1 print("Count: ", count) balloon_count = count[1] # b balloon_count = min(balloon_count, count[0]) # a balloon_count = min(balloon_count, count[11] / 2) # l balloon_c...
8c68c725df8dfa25e2921703cc34adc4bc0cecd3
charlieb/python-presentations
/tips_tricks.py
4,339
3.828125
4
## C-like Looping list1 = [1,2,3,4,5,6] # Bad: result = False for i in range(len(list1)): if list1[i] == 1: result = True break # Better: result = False for val in list1: if val == 1: result = True break # Best: result = 1 in list1 # "in" checks for membership in a list # it...
9b030ea113d2d1ee6dae82b2d660cd08d5532cca
ColinTing/Algorithms
/147.insertionSortList.py
1,552
4.125
4
class ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next list = ListNode(-1, ListNode(5, ListNode(3, ListNode( 4, ListNode(0))))) class Solution: def insertionSortList(self, head): if head is None or head.next is None: retu...
eb9db6ae3608e8833bde7a33b65161f96e1be5f5
axxporras/PIA-de-Contabilidad
/presupuesto maestro.py
34,279
3.953125
4
respuesta = '' while respuesta != 12: print("\nPresupuesto Maestro *Ferretería Santa Lucía* \n") print("[1] Presupuesto de Ventas") print("[2] Determinar Saldo de Clientes y Flujo de Entradas") print("[3] Presupuesto de Producción") print("[4] Presupuesto de Requerimiento de Materiales") ...
113d7bbfa4ae7b0f36316a783fb600d89791f817
lrussell21/ICPC_Template_Code
/Algorithms/problem23/main23.py
4,476
3.953125
4
import os import copy import sys from collections import defaultdict class Graph: def __init__(self, vertices): self.V = vertices # No. of vertices self.graph = defaultdict(list) # default dictionary to store graph self.output = '' self.count = 0 self.circuitCount = 0 ...
5df6d93c9478d318416209582f02d6b9e33964e0
mengyx-work/CS_algorithm_scripts
/leetcode/LC_1143. Longest Common Subsequence.py
612
3.5625
4
class Solution(object): def longestCommonSubsequence(self, text1, text2): m, n = len(text1), len(text2) res = 0 d = [[0 for _ in range(n+1)] for _ in range(m+1)] for i in range(1, m+1): for j in range(1, n+1): if text1[i-1] == text2[j-1]: ...
869324317072e944a8cf2cb2bd8ef53bc88afc47
evizitei/py-sandbox
/pig_latin.py
257
3.703125
4
word = raw_input("Give me a word...") if len(word) > 0 and word.isalpha(): word = word.lower() first_letter = word[0] midway = (word + first_letter + "ay") translation = midway[1:len(midway)] print translation else: print "It's no good, sir..."
6623abe71a0d441f21f1e6a1d9c553c7eea3fc69
JLMarshall63/myGeneralPythonCode
/CalculatorAreaCircleTriangle.py
919
4.4375
4
''' The program should do the following: Prompt the user to select a shape Depending on the shape the user selects, calculate the area of that shape Print the area of that shape to the user ''' from math import pi from time import sleep from datetime import datetime now = datetime.now() print '%s/%s/%...
8453e4ab440c1535b1bdb9f7c8d26983696bed51
TBG1006/Python-Challenge
/PyBank/analysis/PyBankMain.py.py
3,132
3.828125
4
import os import csv csvpath = os.path.join('PyBank', 'Resources', 'PyBank_Resources_budget_data.csv') with open(csvpath) as csvfile: # CSV reader specifies delimiter and variable that holds contents csvreader = csv.reader(csvfile, delimiter=',') print(csvreader) # Read the header row first (skip th...
e73ca0d006d3413c307da8a8ea657bf188007167
dongupak/Prime-Python
/src/Ch10/minus_filter_func.py
453
3.671875
4
# 코드 10-7 : 람다 함수를 이용한 음수 값 추출기능 1 ## "으뜸 파이썬", p. 581 def minus_func(n): # n이 음수이면 True, 그렇지 않으면 False를 반환 if n < 0 : return True else: return False n_list = [-30, 45, -5, -90, 20, 53, 77, -36] minus_list = [] # 음수를 저장할 리스트 for n in filter(minus_func, n_list): minus_list...
f64760c1474c178d626a4e2fca0996ffed70239e
musicGDS/CS50-tasks
/credit.py
749
3.578125
4
import re from cs50 import get_string def legitNumber(number): x = 1 y = 0 lenght = len(number) for i in range(lenght - 1, -1, -2): x = x + 2 * int(number[i]) for i in range(lenght, -1, -2): y = y + int(number[i]) if (x + y) % 10 == 0: return True else: r...
914a4473eb06e7d9e00d09a544d8506eb22670c9
mikeyj777/ProjectEuler_2
/ProjectEuler_2/0009_special_pythagorean_triplet.py
968
3.96875
4
import numpy as np import math # A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # # a2 + b2 = c2 # For example, 32 + 42 = 9 + 16 = 25 = 52. # # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. def c(b): return (1000000 - 2000 * b + 2...
4db671f2a6e83603dce394bb5304ae5cfe356ae6
radineshkumar/Python_scripts
/Bootcamp/CaptsoneProjects/number_exercises/NumbersTuple.py
345
4.15625
4
""" Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. """ def main(): usr_input = input("Enter the numbers in comma format:\n") test = usr_input.split(",") print(test) print(tuple(test)) if __name__ == "__ma...
4ce5773cb7ffefb2e4796beb5022104449b1a0cf
lvraikkonen/GoodCode
/leetcode/653_two_sum_IV_input_is_a_BST.py
2,010
3.875
4
from __future__ import print_function from collections import deque # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Tree(object): def __init__(self, root=None): self.root = root d...
8d30316add8b3861ad790cb43a7133cd81397dc5
mergehez/Eight-Queens-Problem
/EightQueen/eightqueen.py
6,658
3.703125
4
import sys import tkinter as tk import tkinter.messagebox as msgbox ## GameBoard class from http://stackoverflow.com/a/4959995/2999554 class GameBoard(tk.Frame): def __init__(self, parent, rows=8, columns=8, size=32, color1="white", color2="blue"): '''size is the size of a square, in pixels''' se...
16a3c35263acfc965ce23e6b1bd54ddc37e053e6
themikesam/1072-Python
/prime.py
957
3.859375
4
import time; # 引入time模块 def isPrime(n): # prime numbers are greater than 1 if n > 1: # check for factors for i in range(2,n): if (n % i) == 0: print(n,"不是質數") print(i,"x",n//i,"=",n) break else: print(n,"是質...
cf1e8b70cd5a8fd41292882350fb4f2ba413df17
qichaozhao/potatolemon
/src/layer.py
3,551
3.6875
4
""" A layer is a collection of Neurons """ import numpy as np from .neuron import Neuron from .activations import sigmoid from .optimisers import sgd class Layer(object): def __init__(self, size, num_inputs, type=Neuron, activation=sigmoid, optimiser=sgd, learning_rate=0.01): """ :param size: The...
4eebeabb683b05f146e7067f766ae1992df65fa3
alexandvoigt/python-csv-parser
/parser.py
3,191
3.75
4
import csv import re ''' Sort Flags: - N = Name - A = Age - L = Number of known languages Sort Order: - A = Ascending - D = Descending ''' VALID_SORT_FLAGS = {'N', 'A', 'L'} VALID_SORT_ORDER = {'A', 'D'} VALID_COLUMN_HEADERS = ["name", "age", "number_of_known_languages"] NAME_COLUMN = 0 AGE_COLUMN = 1 LANGUAGE_COLUM...
6de09919f6700751f08ac00cdb5640e73c933c6a
AnthonySimmons/EulerProject
/ProjectEuler/ProjectEuler/Problems/Problem48.py
638
3.703125
4
 #The series, 11 + 22 + 33 + ... + 1010 = 10405071317. #Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000. def SumOfSquaresInSequence(sequence): sum = 0 for num in sequence: power = pow(num, num) sum += power return sum sequence = range(1, 1000) sum = SumOfSquaresInSequence(sequence) ...
5de88ba24bf8c59e0e9c3f0e5536f0035a656578
szymek156/project_euler
/28.py
1,731
3.5
4
def main(): sizeOfSquare = 1001 sumOfDiagonals = 0 firstDiag = 1 # for i in range(2, sizeOfSquare + 3, 2): # firstDiag += (((i+1)/2) - 1) * 8 # secondDiag = firstDiag - (i - 2) # thirdDiag = secondDiag - (i - 2) # fourthDiag = thirdDiag - (i - 2) ...
4d109a120dde7fcbfd33e3c9ac4545a8405b9112
dzinrai/my_euler_proj
/e23 other.py
1,486
3.765625
4
#find the sum of all the positive integers that cannot be written as the sum of two abundant numbers #Every number above 20161 can be written as two abundant numbers #every multiple of a perfect number is abundant #every multiple of abundant number is abundant abun = [12] no_abun = [1, 2, 3, 4, 5, 6, 7, ...
284562893291732b0230143bbb85f35ed068ba72
MrX456/Algoritmos_Diversos_Python
/D035_FormarTriangulo.py
446
3.96875
4
#Ler comprimeto de 3 retas e dizer se elas podem ou não formar um triângulo r1 = float(input('Digite o comprimento da primeira reta: ')) r2 = float(input('Digite o comprimento da segunda reta: ')) r3 = float(input('Digite o comprimento da terceira reta: ')) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2 : ...
83b54e2d42257b3f027ff3ebb06b94e5981709a3
summerHuaiJin/PythonReadEMS
/TimeToName.py
1,930
3.75
4
# -*- coding:utf-8 -*- """ 这是一个将年月日时分转化为一串字符的程序 例如,2017年12月16日1点05分,将表示成201712160105 输入为年月日,输出为name,类型为list,包含当日每隔五分钟的字符串,一共288个""" def time_name(year, month, day): import time # 导入time模块 year = str(year).zfill(4) # zfill方法表示对字符串补位,高位补零 month = str(month).zfill(2) day = str(day).zfill(2) ...
355179a53bd4e66bebcf696c1f4bec89056f7eae
lilyandcy/pyLearn-1
/Learn_math/math_Learn.py
265
3.640625
4
import math def function_Complex(a,b,c): try: result1 = (-b + math.sqrt(b*b-4*a*c))/(2*a) result2 = (-b - math.sqrt(b*b-4*a*c))/(2*a) return (result1,result2) except: return 'No valid input' print function_Complex(3,12,2)
0fa3538b82519f5b8a117b61ec443816cb949517
jonqi/a-nether-calculator
/nether_calculator.py
387
3.921875
4
def get_coordinate(x): while True: x_coord = input(f"{x} Coordinate: ") try: x_coord = float(x_coord) / 8 break except ValueError: print("Please input a number.") return x_coord x_coord = get_coordinate("X") y_coord = get_coordinate("Y") * 8 z_coord ...
e97d19ec62004d65d333d83246fa4c71d4c9a775
ElManu3le/Pythoon2
/EjerciciosPythoon2/ejercicio24.py
412
3.9375
4
"Ejercicio 24 - Escribid un programa que, dado un número entero positivo, calcule y muestre su factorial. El factorial de un número se obtiene multiplicando todos los números enteros positivos que hay entre el 1 y ese número. El factorial de 0 es 1." numerofac = int(input('Dime un numero con el que poder hacer el fac...
bed82ae55c419f67558696a3f3355a48ff4d9d98
jeonghaejun/01.python
/ch14_class/ex01_class.py
1,594
4
4
# 누구의 계좌인지 # 출금(withdraw) # 클래스 설계능력이 중요!! class Human: def __init__(self, name, age): # <--쓸변수는 다넣어준다. 나중에 정의해줄 변수도 self.name = name # 나중에 정의할 변수에는 None을 넣는다 self.age = age self.gender = None def intro(self): print(f'{self.age}살 {self.name}({self.gender}...
fff3b0199cf5b029418a5405da4ea69676609c88
uopcs/euler
/001-099/029/todd.py
406
3.65625
4
def questionTwentyNine(): combinations = [] for a in range(2, 101, 1): for b in range(2, 101, 1): term = a ** b #print(term) double = False for current in combinations: if term == current: double = True if do...
d5096425a4fb0fa8467e23df962ba56188d28d67
David-E-Alvarez/Intro-Python-I
/src/05_lists.py
1,100
4.1875
4
# For the exercise, look up the methods and functions that are available for use # with Python lists. x = [1, 2, 3] y = [8, 9, 10] # For the following, DO NOT USE AN ASSIGNMENT (=). # Change x so that it is [1, 2, 3, 4] # YOUR CODE HERE x.append(4) #print(x) # Using y, change x so that it is [1, 2, 3, 4, 8, 9, 10] ...
8fd37dddf0a777ce5e762d8731ecf7e05be3de5c
Licho59/Licho-repository
/inne_projekty/problem_solving_with_algorithms/unordered_complete_linkedList.py
6,543
3.859375
4
from node_class import Node class LinkedList(object): def __init__(self): self.head = None self.tail = None self.length = 0 def add(self, data): temp = Node(data) temp.setNext(self.head) self.head = temp self.tail = self.head self.length += 1 ...
1f2934e1123fd364ac751c35f6c6dff73f3f4119
osnaldy/Python-StartingOut
/chapter5/Buget_Analysis.py
357
3.921875
4
buget = int(raw_input("Enter the amount budgeted for the month: ")) total = 0 for i in range(6): expense = int(raw_input("Enter the total for each expense: ")) total += expense if total > buget: t1 = total - buget print "Your are over with", t1, 'Dollars' else: t1 = buget - total print "Your ...
e7167d081e8bec13ba764bcc813692dc43028b7c
sarahgonsalves223/DSA_Python
/Hard/149_hard_max-points-on-a-line.py
2,076
3.75
4
# # @lc app=leetcode id=149 lang=python3 # # [149] Max Points on a Line # # https://leetcode.com/problems/max-points-on-a-line/description/ # # algorithms # Hard (16.00%) # Total Accepted: 134.7K # Total Submissions: 827.9K # Testcase Example: '[[1,1],[2,2],[3,3]]' # # Given n points on a 2D plane, find the maximum...
a87ea9ea2ef0f80bab207cbc0771bbe7c155a27d
zhoushuhua/CorPyProgPractice
/Chapter03/Test01.py
1,503
3.625
4
# user python download ftp file import ftplib import os import socket # const var HOST = "ftp.iap.ac.cn" DIR="/geog/hlens" FILE = "00001-02161.00001-01081" # defined function to download def main(): try: # connect ftp # print "> input ftp Host:" # data = raw_input() # if data != ""...
6d1c98f7739cab2c09009efd3b94ea3513648c1d
gabriellaec/desoft-analise-exercicios
/backup/user_204/ch45_2020_10_06_18_47_29_059316.py
208
4.0625
4
lista = [] novo_valor = float(input("Digite um valor: ")) while novo_valor != 0 and novo_valor > 0: lista.append(novo_valor) novo_valor = float(input("Digite um valor: ")) lista.reverse() print(lista)
cf234c912af5d81c44f9aed6eda2165b3a715e79
zhaolijian/suanfa
/leetcode/135.py
959
3.546875
4
# 老师想给孩子们分发糖果,有 N 个孩子站成了一条直线,老师会根据每个孩子的表现,预先给他们评分。 # 你需要按照以下要求,帮助老师给这些孩子分发糖果: # 每个孩子至少分配到 1 个糖果。 # 相邻的孩子中,评分高的孩子必须获得更多的糖果。 # 那么这样下来,老师至少需要准备多少颗糖果呢? # 两次遍历 class Solution: def candy(self, ratings) -> int: length = len(ratings) if length < 2: return 1 res = [1] * length f...
21e3fba95bd4f521b72e74d480e26e0d064d0543
wqzhang0/python_stu
/icode/enum/enum_test.py
1,163
3.53125
4
from enum import Enum, unique # @unique装饰器可以帮助我们检查保证没有重复值。 @unique class Weekday(Enum): Sun = 0 # Sun的value被设定为0 Mon = 1 Tue = 2 Wed = 3 Thu = 4 Fri = '5' Fri_int = 5 Sat = 6 if __name__ == '__main__': print(Weekday.Sat.value) print(type(Weekday.Sat)) print(type(Weekday...
22abfe9021fbf48281c700d70d616e5c49333b65
Meschdog18/simply-progress
/simply_progress/progress.py
2,156
3.796875
4
from os import system, name class Progress_Bar: """Init Progress Bar Parameters: range (int): total length of data, progress bar will track name (any value supported by print()): data placed infront of progress bar ({name} |{progressbar}|) (default is None) display (bool):to display don...
cb19ce83b5d1bdd29ac4052f7b03f9dd70943ebd
nanareyes/CicloUno-Python
/Nivelacion_3/colecciones.py
1,387
4.25
4
# Cadenas -> Flujos de caracteres o palabras (orden inmutables) cadena = "hola Mundo" print(cadena[0]) print(cadena[-1]) print(cadena[2]) print(cadena[0:4]) # las cadenas son inmutables, pero se pueden reordenar a partir de caracteres cadena = cadena[0].upper() + cadena[1:] # upper para mayúscula print(cadena) # Lis...
8722932b2e7c60001dbfd5dc1e332186f8f3f7bc
dgoffredo/leetcode
/palindrome-pairs/naive2.py
733
3.734375
4
from itertools import chain # leetcode.com boilerplate from typing import List class Solution: def palindromePairs(self, words: List[str]) -> List[List[int]]: return palindrome_pairs(words) def palindrome_pairs(words): result = [] for i in range(len(words)): for j in ran...
e7c1ac6dfb8a4bce7e9cd7667917b785f855d027
C-CCM-TC1028-102-2113/tarea-4-RCERVANT3S
/assignments/17NCuadradoMayor/src/exercise.py
229
3.90625
4
def main(): #Escribe tu código debajo de esta línea pass num = int(input("Escribe un numero : ")) for conta in range(1,num,1): if conta ** 2 >= num: break print(conta) if __name__=='__main__': main()
6a410f66e4391f8742ad6f83ab591b7005239d6a
meghana2812/meghana
/third1.py
101
3.859375
4
v1={'a','e','i','o','u'} m1=input().lower() if m1 in v1: print("Vowel") else: print("Consonant")
5295c251aa633169e7f3f4dd807a4e604e3166ea
codrameurs/moyenneur
/main.py
1,332
3.578125
4
from tkinter import * from moyenneur_module import * ''' ''' class Fenetre(): denom=False def __init__(self): self.fenetre = Tk() self.fenetre.title("Moyeneur") self.fenetre.geometry("700x550") self.notes=getdict() self.menu_princ() def valider_note(self,entry): ...
2731307da1f2ccfb2c91e64e29346eb30ae6a984
taoing/python_code
/3.0 python_structure/search/binary_search.py
1,836
3.9375
4
# -*- coding: utf-8 -*- # 二分查找 def binary_search(alist, item): first = 0 last = len(alist) - 1 found = False while first <= last and not found: midpoint = (first+last) // 2 if alist[midpoint] == item: found = True; else: if item < alist[midpoint]: ...
2dd7a7e94340ab6e7fd209141e714c7495fa8d3f
waithope/leetcode-jianzhioffer
/leetcode/227-basic-calculatorii.py
1,354
4.28125
4
# -*- coding:utf-8 -*- ''' Basic Calculator ======================== Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero. Example 1: Input: "3+2*2" ...
4618a34103ccc6d6e29577301c13e1f8a515dca3
vinhnh1905/pythonProject
/Cicrle Measurements.py
205
4.28125
4
import math r = float(input("Enter the radius of the circle: ")) Area = math.pi*r**2 Circumference = 2*math.pi*r print("area: %s circumfernce: %s" % (Area,Circumference)) #test github #haha print("Hello")
1799ad9e80b16702b476933420606df9f394a435
edmond-chu/OldStuff
/Python/3-starter-files/student_solution.py
507
3.625
4
# Change this file's name to "solution.py" before submitting. # Implement a basic calculator to evaluate a simple expression string. # The expression string contains only non-negative integers, +, -, *, / operators and empty spaces. # The integer division should truncate toward zero. # Make sure to follow order of ope...
a0f4ca972fae8b87d46a1f76249416b61545e138
gabrielbodrug/python
/oop/функциональное.py
375
4.03125
4
a = input('a: ') def culc(a, b, action): if action == '+': return int(a) + int(b) elif action == '-': return int(a) - int(b) elif action == '*': return int(a) * int(b) elif action == '/': return int(a) / int(b) b = input('b: ') action = input('act...
39bb034453091c4474de4a592f2a1d03fa725415
StudyForCoding/BEAKJOON
/21_DivdeConquer/Step08/wowo0709.py
1,144
3.640625
4
''' 피보나치의 수열을 분할 정복으로 빨리 풀려면 행렬의 거듭제곱을 이용하면 된다. [[Fn+1,Fn],[Fn,Fn-1]] = [[F2,F1],[F1,F0]]^n = [[1,1],[1,0]]^n ''' import sys input = sys.stdin.readline div = int(1e9+7) def find_power(matrix, power): # 행렬곱을 분할 정복으로 나누기 if power == 1: return matrix if power % 2 == 0: tmp_mat = find_po...
faa88213f394ac8aaa6fe174795f9d70fe809292
darksugar/pythonProjects
/day05/Calculater/re mod.py
3,097
3.6875
4
#Authon Ivor def addition(a): return str(round(float(a[0].strip())+float(a[1].strip()),5)) def subtraction(a): return str(round(float(a[0].strip())-float(a[1].strip()),5)) def multiplication(a): return str(round(float(a[0].strip())*float(a[1].strip()),5)) def division(a): return str(round(float(a[0].str...
6d1377d2a0b663e0cf029d52c5a0eb97dc2890a4
Flyeater/osinttools
/aopy/tweet_downloader_full.py
1,811
3.59375
4
''' Script from Justin Seitz's https://learn.automatingosint.com/ Course and Modified for Python 3 by Micah Hoffman ''' from twitter_keys import * import json import requests import time # # Download Tweets from a user profile # def download_tweets(screen_name, number_of_tweets, max_id=None): api_url = '%s/st...
d37550e4e167b5e2839c740f25138bb6047903a9
timsergor/StillPython
/176.py
1,578
3.671875
4
# 130. Surrounded Regions. Medium. 24%. # Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. # A region is captured by flipping all 'O's into 'X's in that surrounded region. class Solution(object): def solve(self, board): """ :type board: List[List[str]...
f5578488f88e81f1df0685930aabcac7694a4882
aatul/Python-Workspace
/017_List.py
725
4.4375
4
# define a list list1 = ["Java","C","CPP","Android","HTML","Dart","Go"] print(list1) # print whole list print(list1[1]) # prints 1st element # print the number of items in list i.e. length print(len(list1)) list1[2]="HTML" # replace element from given index no. print(list1) # printing list with for ...
f3c1fc75fa71ce8229ba98f7ee22a02cafdaae70
rupertbauernfeind/aiml
/PA1/AIML_PA1_3.py
733
3.921875
4
def main(): try: arr = stringToAsciiArr(input()) bubbleSort(arr) except EOFError: return def stringToAsciiArr(string): return [ord(c) for c in string] def asciiArrToString(asciiArr): return ''.join(chr(i) for i in asciiArr) def bubbleSort(arr): if len(arr) == 1: ...
d25e6c0fe7feb43b0fc38761f502583ef2e8fb0d
anyone21/Project-Euler
/gallery/Interesting-number-games/Problem-74.py
1,813
3.625
4
# -*- coding: utf-8 -*- """ Created on Sun May 8 17:41:48 2016 @author: Xiaotao Wang """ """ Problem 74: The number 145 is well known for the property that the sum of the factorial of its digits is equal to 145: 1! + 4! + 5! = 1 + 24 + 120 = 145 Perhaps less well known is 169, in that it produces the longest chai...
67275a159f8e991bc19a967394a221b6831b7602
oursoul/python-demo
/第7章/test_1.py
325
3.8125
4
def minimal(x, y): #自定义计算较小值函数 if x > y: #如果x>y成立,返回y的值 return y else: #否则返回x的值 return x #用来测试 if __name__ == '__main__': #识别当前的运行方式 r = minimal(2,3) print('测试2和3的较小值为:',r)
d8ead4e2a30b8f7632a6f32819d8c02c8dbd541d
Sinha123456/Simple_code_python
/reverse_word.py
376
4.09375
4
'''def reverse(s): if len(s) == 0: return s else: return reverse(s[1:]) + s[0] s = "Geeksofgeeks" print(reverse(s))''' '''def reverse(str): str = str[::-1] return str sent = "My name is neetu, try to print reverse string" print(reverse(sent))''' def reverse(str): str = "".join(rever...
34dc30239b80d5154661aef3a96bf9ae7e7e54d9
whywhyy/summer-code-jam-2020
/prickly-pufferfish/python_questions/zig_zag.py
851
4.03125
4
""" A sequence of integers is called a zigzag sequence if each of its / elements is either strictly less than both neighbors / or strictly greater than both neighbors. / For example, the sequence / 4 2 3 1 5 3 is a zigzag, but 7 3 5 5 2 and 3 8 6 4 5 aren't. / Write a function witch takes an array of integers and retu...
3dcb7f652c1f8a57fa6c4dcd389f6e74b682c22c
xDavidPM/Analisis-numerico-python
/lagrange.py
3,051
4.03125
4
#Super programa de Lagrange, simple y como si fuera poco multiple def main(): prueba = True while (prueba): print("LAGRANGE") print("seleccion (1) si desea usar Lagrange simple") print("seleccion (2) si desea usar Lagrange multiple:") opcion = int(input("")) if (opcion ==...
5a847f022849fd0ee30304dd7a846b18494020ab
prabhuyellina/Assignments_Python
/assignments/vowel.py
166
4
4
def vowel_check(ch): list1=['a','e','i','o','u'] if ch in list1: return'True' return 'False' print vowel_check(raw_input('Enter the Character'))
ca9ae87f5c7130af1706f61c76f95951f3f660a7
firefly2442/ProjectEuler-python
/Problem112.py
737
3.75
4
def isBouncy(num): if len(str(num)) == 1: return False #check increasing increasing = True for i in range(0,len(str(num))-1): if int(str(num)[i]) < int(str(num)[i+1]): increasing = False break #check decreasing decreasing = True for i in range(0,len(str(num))-1): if int(str(num)[i]) > int(str(num)...
4fb6e712c563b29f587a72a807e30f90de647be0
sandy1312/Fibonacci-series
/fibonacci.py
168
3.828125
4
n=int(input("Enter ur number:")) a=-1 b=1 if n<=0: print("No output") else: for i in range(n): c=a+b a,b=b,c print(c,end=" ")
903d8222654e4e843cc572685f5d239ccea3b5b3
ferrerinicolas/python_samples
/5.2 For loopss/5.2.4 Printing 10 Numbers Part2.py
110
3.9375
4
""" This program prints the numbers 1 though 10. We decided the range """ for i in range(1, 11): print(i)
6895badf0b35be4115638dd95915c16a1ee43f8d
code-drops/data-structures-algorithms
/python/graphs/adjacency matrix.py
593
3.796875
4
class Graph: def __init__(self,size): self.matrix = [] for i in range(size): self.matrix.append([0 for i in range(size)]) self.size = size def add_edge(self,v1,v2): self.matrix[v1][v2] = 1 def remove_edge(self,v1,v2): self.matrix[v1][v2] = 0 ...
3fe66651dd3e0b87e315c401bbfe72f7a8f59e75
Nanko-Nanev/python_advanced
/8_multidimensional_lists_exercise/05_snake_moves.py
584
3.546875
4
from collections import deque (row, col) = [int(x) for x in input().split()] string_input = input() string = deque("") matrix = [] for _ in range(row): matrix.append([0] * col) while len(string) <= (row * col): string += string_input for r in range(row): for c in range(col): matri...
518113a96b21d94e0fcdb2dfdc30dda1bfe3db17
samir-0711/Leetcode-Python
/461. Hamming Distance.py
552
3.6875
4
import unittest class Solution(object): def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ xor = x ^ y count = 0 for _ in range(32): count += xor & 1 xor = xor >> 1 return count class Test(u...
b3c428042ac3e0039e26bada349b89888bbc44a2
VadimSquorpikkor/Python_Stepik
/1/1_12_week_exam/5_max_min.py
906
4.4375
4
# Напишите программу, которая получает на вход три целых числа, по одному числу в строке, и выводит на консоль # в три строки сначала максимальное, потом минимальное, после чего оставшееся число. # # На ввод могут подаваться и повторяющиеся числа. # # Sample Input 1: # 8 # 2 # 14 # # Sample Output 1: # 14 # 2 # 8 # # S...
9ef323eb3bda856c5ac09fb984d169b704d76258
sarvparteek/Scientific_computation
/bracketingRootSearch2.py
951
3.8125
4
__author__ = 'sarvps' ''' Author: Sarv Parteek Singh Course: CS-600, Scientific Computation 1 HW: #5, Pr 5.4, 'Numerical methods for Engineers', 7th edition Brief: Root finding for a polynomial of degree 3 using bracketing methods ''' import _roots, _plot def f(x): return -12 - 21*x + 18*(x**2) - 2.75*(x**3) #P...
cc027949a9f686d577c232ec662ee61bcb55889d
Zhuhh0311/leetcode
/array/majorityElement.py
2,589
3.53125
4
#给定一个大小为 n 的数组,找到其中的多数元素。多数元素是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。 #你可以假设数组是非空的,并且给定的数组总是存在多数元素。 #最简单直接的想法,最开始解答忽略了数组长度为1的情况 #用时:268 ms 17.34% class Solution: def majorityElement(self, nums: List[int]) -> int: nums.sort() j=1 if len(nums) == 1: return nums[0] for i in range(len(nums)...
26ce9e1e423de7d2d6c76937f40b22979caeb94e
xuyuchends1/python
/Fluent Python/6/6.3.py
2,099
4
4
from abc import ABC,abstractmethod from collections import namedtuple Customer=namedtuple('Customer','name fidelity') class LineItem: def __init__(self,product,quantity,price): self.product=product self.quantity=quantity self.price=price def total(self): return self.price*self....
d8b147eb1071062406451ad9aecc7ccecb1f1948
adi0311/Data-Structures-and-Algorithms-in-Python
/Algorithms/kadanes_algorithm.py
456
4
4
#Kadane's Algorithm to calculate the maximum sum of the contiguous subarray of given array. def kadane(l): maxsum, cursum = l[0], l[0] for i in range(1, len(l)): cursum = max(cursum, l[i]+cursum) if cursum > maxsum: maxsum = cursum return maxsum n = int(input("Enter the size o...
02739c03106ec9796a0c8621884386d4302feace
omar00070/python_class
/game/game.py
1,570
3.625
4
import pygame import math backgound_color = (137, 223, 158) screen_width = 500 screen_height = 500 screen = pygame.display.set_mode((screen_width, screen_height)) screen.fill(backgound_color) run = True rect_color = (150, 150, 150) rectangle = (100, 45, 50, 50) grey = (150, 150, 150) class Mario: def __init__(se...
5e7adf962352023c8db7af4b4a49467a58fab797
mahanghashghaie/rsp
/gen_rnd_password.py
3,786
3.53125
4
from bs4 import BeautifulSoup as bs import requests import re import sys import random import os import pyperclip def clean_html_tags(raw_html): """ cleanses a raw html string from html tags Parameters ---------- raw_html : str raw html string literal that is to be cleansed Returns ---...
6d89392a11ae36d479965ad22d00582fd6949ee5
hassyGo/NLP100knock2015
/eriguchi/Chap1/chap1_4.py
1,346
3.75
4
#!/usr/bin/env python # coding: utf-8 """ 04. 元素記号 "Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can."という文を単語に分解し,1, 5, 6, 7, 8, 9, 15, 16, 19番目の単語は先頭の1文字,それ以外の単語は先頭に2文字を取り出し,取り出した文字列から単語の位置(先頭から何番目の単語か)への連想配列(辞書型もしくはマップ型)を作成せよ. """ import re def...
74c11e761d9b7a08ef951a062ae9f5dfd956eb18
AllanBastos/Atividades-Python
/ESTRUTURA DE DADOS/Roteiro de revisão de Algoritmos/Distancia entre dois pontos.py
199
3.53125
4
x1, y1 = input().split() x2, y2 = input().split() x1, y1, x2, y2 = float(x1), float(y1), float(x2), float(y2) distancia = (((x2 - x1)**2) + ((y2 - y1)**2))**(1/2) print("{:.4f}".format(distancia))
2a08b7ea3fc08de983d5c2d4289f26973ab94132
tub212/PythonCodeStudy
/Python_Study/Lecture/Lecture_GCD_Large.py
180
3.90625
4
"""Lecture_GCD_Large""" def gcdlarge(num1, num2): """Return GCD number""" while num2 != 0: num1, num2 = num2, num1 % num2 print num1 gcdlarge(input(), input())
bd09f8848b1797dbcf64374e230893d4235daf40
netxeye/Python-programming-exercises
/answers/q20.py
1,432
3.953125
4
#! /usr/bin/env python3 # -*- coding: utf-8 -*- from time import time def question20_devisable_by_7(end, start=0): ''' This function generator which uses for create iterate numbers, which are divisiable. paramater: start default value is 0 end the end of range, not included ''' item = ...
83d85047200c71c9c040e6672c48cd82effb534d
ColdGrub1384/Pyto
/Pyto/Samples/SciKit-Image/plot_convex_hull.py
1,208
3.734375
4
""" =========== Convex Hull =========== The convex hull of a binary image is the set of pixels included in the smallest convex polygon that surround all white pixels in the input. A good overview of the algorithm is given on `Steve Eddin's blog <http://blogs.mathworks.com/steve/2011/10/04/binary-image-convex-hull-alg...
4b2e4ac2e4aeb16792faf04fbbd3a2b2e4e92de0
wilhelminayao/thinkful-porject
/tip_calculator/tip calculator.py
970
3.609375
4
from optparse import OptionParser parser = OptionParser() parser.add_option("-m", "--meal", dest="meal", type="float", help="price of meal") parser.add_option("-t", "--tax", dest="tax_percent", type="float", help="rate of the tax",default = 0.035 ) parser.add_option("-p", "--tip", dest="tip_percent", type="float",help...
24c59b14d7c211333587fb70e9e6fbae57c21454
sabbir421/python
/even & odd number from series .py
241
4.09375
4
print("*****if you want even value then take f=1 and if you want odd number then f=0 *******") i=int(input("starting value:")) n=int(input("ending value")) f=int(input("f")) while i<=n: i=i+1 if i %2==f: continue print(i)
5c8292c8f9ea5018f888e44262b46679e54e46bb
spaparrizos/Python
/formulas/temperature_trans.py
729
3.765625
4
#!/usr/bin/env python ######################################################### # Spyros Paparrizos # spipap@gmail.com # Temperature transformation ######################################################### # Python libraries import numpy as np, netCDF4, os, sys # Kelv...
50fc1b291e015b386db47f9b2dae611fc3da6124
NipunCdev/Python_Basics
/Foundation Semester 1 - CW/DOC 333 Coursework report – 20200588/Question 2 .py
4,480
4.375
4
# Import math library for calculating Square import math # Creating Variables coefficientOfX2 = 0 coefficientOfX = 0 constantValue = 0 i = '' # Repatition Part while (i != 'X'): #to get only integer as user input. If you input string then you will get a error msg and program will start again while True: ...
a22ba9ca0f581d749ae03cf594258ce33ce4950f
PriyankaMN/OPENCV
/OPENCV/1_first_trial.py
622
3.53125
4
import numpy #library for high level mathematical function import cv2 #open cv img=cv2.imread('a.png') #reading a image gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #gray scale convertion retval2,thresh1 = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_...
455a92d13de2dcdfac4903783cf1151ffb9e5ff2
jamilcse13/python-and-flask-udemy
/22. lambdaFunction.py
587
4.3125
4
#Function definition is here sum = lambda arg1, arg2 : arg1 + arg2 # Now you can call sum as a function print("Value of total: ", sum(10,20)) print("Value of total: ", sum(20,20)) input() # Return Argument def sum(arg1, arg2): "Add both the parameters and return them" total = arg1+arg2 print("Inside the ...