blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
9a97752be113a448204e743a396e4dd06d8783bd
CYanLong/learn-python3
/chapter3-oop/summer.py
2,126
3.765625
4
'''总结:面型对象 一:继承和多态: Python支持多继承. 由于Python语言的动态类型,变量没有类型. 所以Python的多态不需要继承关系(鸭子类型) 二:成员 1.类成员(静态成员). 1).类方法:方法的第一个参数不是self. 2).类变量:直接在类声明内部定义的字段(没有使用self并且不再任何方法体内) 2.实例成员 1).实例成员变量:通过self关键字创建的.(主要在__init__方法中) 2).实例成员方法:方法的第一个参数是self. 三:访问权限:在属性前面加两个下划线 '__'可将属性设为私有. 四:专有方法:__str__, __iter__,...
26a7304010500b4e6c5564ce1dd1ea635e512f5a
baby5/HackerRank
/DataStructures/LinkedList/GetNode.py
810
3.546875
4
#coding:utf-8 #stupid def GetNode(head, position): prev = None node = head while node: temp = node.next node.next = prev prev = node node = temp cur = node while position: cur = cur.next position -= 1 return cur.data def GetNode_smart(head, ...
4a9d5e67dd1a39979e26ea5bc55fc2ec739baa99
pydevjason/Python-VS-code
/coding_exercise_24.py
1,613
4.21875
4
# Define a nested_sum function that accepts a list of lists of numbers # The function should return the sum of the values # The list may contain empty lists # # EXAMPLES # nested_sum([[1, 2, 3], [4, 5]]) => 15 # nested_sum([[1, 2, 3], [], [], [4], [5]]) => 15 # nested_sum([[]]) ...
5365bce593feb7bd3544261e56817897dfa8ee35
09260131/Python
/LeetCode/1合并两个无序数组.py
625
3.5625
4
# !/usr/bin/python # -*- coding: utf-8 -*- # ScriptName: 合并两个无序数组 # CreateTime: 2018-06-01 # UpdateTime: 2018-06-01 import numpy def mergeTwoList(l1, l2): len1 = len(l1) len2 = len(l2) l3 = [] index = 0 while((index < len1) or (index < len2)): if index < len1: l3.append(l1[index...
a422113468a6c96123ed1f738658a25a9cfb72ef
DongliangLarryYi/Python-data-structure
/job_queue.py
3,610
4.4375
4
# This is used to simulate parallel processing """ Task. You have a program which is parallelized and uses 𝑛 independent threads to process the given list of 𝑚 jobs. Threads take jobs in the order they are given in the input. If there is a free thread, it immediately takes the next job from the list. If a thread has ...
5975b652e7c4fa49b122ade33624f128b00657a5
ionescuig/Project-Euler
/Problem 16.py
220
4
4
""" 2**15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2**1000? """ prod = 2**1000 suma = 0 for i in str(prod): suma += int(i) print(suma)
0b6f6ff490bc515007392f0b3245c5710f70262c
ai-times/infinitybook_python
/chap11_p207_code1.py
76
3.640625
4
n = 1 while n<=10 : print( n ) n = n + 1 print("숫자세기 끝")
b35656131e59e40f0b9e64d02c23320947c63308
vckfnv/Python_datastructure
/datastructure/SimpleLinkedList2.py
988
3.671875
4
class Node: def __init__(self, data, next=None): self.data = data self.next = next class SimpleLinkedList: def __init__(self): self.head = Node(None) self.tail=head self.head.next=self.tail def HeadInsert(head,a): node = Node(a) node...
5921473c6aa4bc18bbe69987d649e958ff3ac303
PetarSP/SoftUniFundamentals
/Lab4_Functions/01. Smallest of Three Numbers.py
187
3.90625
4
x = int(input()) y = int(input()) z = int(input()) def smallest_num(x, y, z): list_of_int = [x, y, z] result = min(list_of_int) return result print(smallest_num(x, y, z))
dcc380fd888fe34e14d15677d1ae40c1e6a8f7e3
satyampandeygit/ds-algo-solutions
/Algorithms/Implementation/Cavity Map/solution.py
677
3.90625
4
#the number of rows and columns in the grid n = int(input()) city = res = [] # function to find all the cavities on the map and # replace their depths with the uppercase character X def checkCavity(i, j) : global city ; global n if(i == 0 or j == 0 or j == n-1 or i == n-1) : return city[i][j] if(city[i][j]...
22250ce46a25801561b85123b7e615231e99bd4e
osbornetunde/100daysOfPython
/day86.py
697
3.9375
4
#With a given list [12,24,35,24,88,120,155,88,120,155], write a program to print this list after removing all duplicate values with original order reserved. lis = [12,24,35,24,88,120,155,88,120,155] values = [x for x in lis and set(lis) if x in set(lis) and lis] print(sorted(values)) # values = [] # for x in set(lis...
9fe152ed738545e84f7ba6c718e9ff149ed57dea
daphnenyapola/bootcamptuts
/day2/datatypes.py
388
4
4
def data_type(i): if type (i)==str: return len(i) elif type(i)==bool: return i elif i is None: return"no value" elif type( i)==int: if i < 100: return"less than 100" elif i ==100: return"equal to 100" else: return"more than 100" elif type(i) == ...
506a36cf92ba430d80e9fb7e7f8ccc24e674addd
462548187/python
/StudentManagerSystem/student.py
686
3.75
4
#! /usr/bin/env python # -*- coding: utf-8 -*- """ @Author : Sandy @Version : ---------------------------------- @File : student.py @Description : @CreateTime : 2020/4/5 1:13 下午 @Software : PyCharm ----------------------------------- @ModifyTime ...
5adbc01257b3636e60c0e863e018a47cb4d63650
i-Aditi/fibonaccis-series-python
/fibonacci series.py
327
3.921875
4
def fib (n): n= int(input("enter the no. of terms you wish to see ")) a=0 b=1 if n==1: print (a) else: print (a) print (b) for i in range (2,n): c = a+b a=b b=c print (c) fib (3) ...
5ce50176dd19f3ac043851605d15444a8f2bea58
greatavi/pokeshop
/test.py
2,577
3.8125
4
import unittest from Shop import Shop # 1.Pikachu # 2.Squirtle # 3.Charmander class ShopTesting(unittest.TestCase): # create a shop poke_list = ["Pikachu", "Squirtle", "Charmander"] prices = [6, 5, 5] poke_discount = {1: 0, 2: 10, 3: 20, 4: 40} shop = Shop(poke_list, prices, poke_discount) #...
7c3af2609b76ee7f2b992b07a01d79d95c026514
pjmrocha/python
/scripts/repeat.py
187
4.0625
4
#!/usr/bin/python def repeat(n): res = [] for i in range(1, n+1): res = res + [i]*2 return res print repeat(3) # [1,1,2,2,3,3] print repeat(5) # [1,1,2,2,3,3,4,4,5,5]
559f8665737b3bb7a6af221754e58ab6d10f03bf
artbohr/codewars-algorithms-in-python
/7-kyu/count-consonants.py
905
4.40625
4
def count_consonants(text): return len([x for x in set(text.lower()) if x not in 'aeiou' and x.isalpha()]) ''' Complete the function that counts the number of unique consonants in a string (made up of printable ascii characters). Consonants are letters used in English other than "a", "e", "i", "o", "u". We will c...
6b9a8dcd729ea2f0728201335c48349a1781b195
kh896424665/Python
/pystudy/iterable.py
212
3.75
4
def findMinAndMax(L): max = L[0] min = L[0] for item in L: if item > max: max = item if item < min: min = item return (max, min) print(findMinAndMax([7,1]))
6782fb23ebebe56bc6e29120b7205290e7c7947c
shayaansaiyed/Python-Sudoku-Solver
/main.py
1,247
3.53125
4
import sudoku9 as s9 import time as t def printTW(s, end='\n'): for char in s: print(char, end='', flush=True) t.sleep(0.2) print(end) def getUserInput(): print() print("Hello! Welcome to my Sudoku Solver") t.sleep(1) print("Please input each line of your Sudoku puzzle, with ...
b96abdf6f0255451b546554fb8acd0fd7bc23e19
zointblackbriar/QuestionAnswering
/AlgorithmQuestionAnswering/Utils.py
1,647
3.640625
4
#!/usr/bin/env python # coding: utf-8 from datetime import datetime import arrow def conv_to_str(value): if isinstance(value, datetime): return arrow.get(value).format("MMMM D, YYYY") else: return unicode(value) def isfloat(value): if value is None: return False try: ...
b4a676d84f3d67e15988dae4f0af9b3c5227d183
CarlosUrda/Coursera-Especializacion-Python-para-Todo-el-Mundo
/Libro Python para Informaticos/Capitulo 03/ejercicio3-1.py
380
3.703125
4
#coding=utf-8 try: horas = raw_input( "Introduce las horas: ") horas = float( horas) tarifa = raw_input( "Introduce la tarifa: ") tarifa = float( tarifa) except: print "Tienes que introducir datos numéricos" quit() if horas > 40: salario = 40*tarifa + 1.5*tarifa*(horas-40) else: salari...
fae36b05243516c65107f14760723632c934f957
dsentr/py-translator
/translate.py
1,220
3.515625
4
import requests, sys import json import argparse def translate_text(source, target, input_): url = "https://translation.googleapis.com/language/translate/v2" # make apikey global?? apikey = "YOUR API KEY HERE" querystring = { "source":source, "target":target, "q":input_, "key":apikey, } ...
895d1fc861a4688041fbe341817d0c85d6a3c323
lm-t/cs9h
/project4/Statue.py
397
3.78125
4
from Turtle import Turtle from Vector import * from Color import * class Statue(Turtle): """docstring for Statue""" def __init__(self, position, heading, fill=blue, **style): Turtle.__init__(self, position, heading, fill=fill, **style) def getshape(self): forward = unit(self.heading) ...
6f8cc39ea29b120c53a87ba266995f62d13a01a7
Micseb/cardinal
/examples/plot_digits_metrics.py
10,025
3.609375
4
""" Active Learning on Digit Recognition and Metrics ================================================ In this example, we run an experiment on real data and show how active learning can be monitored, given that in real life scenario there is no access to the ground truth of the test set. Based on these metrics, we ide...
253e653ee844524a015b20a3e9ea6046b4ef9d3b
spiderjako/Python-101
/week4_5/oop/oop.py
893
3.65625
4
class Panda: current_panda = 'lyusi' def __init__(self, name, food, weight, age, city = 'Sofia', **kwargs): self.validate_init_params(name,food,weight) self.panda_name = name self.food = food self.weight = weight self.age = age self.city = city def validate_i...
eb4d56eb1588fbf743296d2e37bdf3918391d9be
Metkom/Kode-Praktikum-GP2103-Metode-Komputasi-versi-Python
/pm5e.py
685
3.734375
4
""" Modul Praktikum GP2103 Metode Komputasi, Program Studi Teknik Geofisika, Universitas Pertamina Oleh: Mohammad Heriyanto Website: https://osf.io/h6d5w/ Link Kode: https://github.com/Metkom/Kode-Praktikum-GP2103-Metode-Komputasi-versi-Python DOI: 10.17605/OSF.IO/H6D5W @ Desember 2018 """ a = 1 y = " " wh...
e724a90de9fbc7830ab9de13b38719aba24273a4
samiulhoque67/datastructure
/queueusingstack.py
1,403
3.953125
4
class Queue: def __init__(self): self.s1 = [] self.s2 = [] def enqueue(self, x): g=len(self.s1) for i in range(0,g): self.s2.append(self.s1[-1]) self.s1.pop() self.s1.append(x) h=...
1aae2aafcb9a64938f10bc3d7ae0fe7d377278d5
lkmflam/05-Python-Programming
/List Lessons/del_list.py
168
3.640625
4
# The del statement #initialize list my_list = [1, 2, 3, 4, 5] print('Before deletion:', my_list) # del statement del my_list[0:2] print('After deletion:', my_list)
ec186f47e7256c52444b5179f01927d407a663bf
Lubhani/My_Captain
/file_extension.py
119
3.84375
4
f_name = (input("Input the filename:")) f_ext = f_name.split(".") print ("The extension of the filename is:" f_ext[1])
23eb6637852b4fc86c63e6590d7526b8fa0696a8
tomato-pan/Aim_to_offer
/fundationDemo/Abstraction.py
1,504
4.125
4
# 理解 # 为了将抽象和实现都能独立的变化 # 例子 # 就是用面试宝典上的一个例子吧,将笔和画出的线条进行分离,例如,用蜡笔做大中小,红绿蓝三种线条就需要9只笔 # 若是用毛笔,只需要3只毛笔,3种颜料即可,这样即使颜色增多也不会大量的增加笔类 # implementor class Implementor(object): def OperationImp(self): pass class ConcreteImplementorRed(Implementor): def OperationImp(self): print("red line") class Concre...
770b5f55acb96e7e69224b7840967cf9e2a3db33
loweffortwizard/Python-Activities
/function/pyfunction3.py
962
4.25
4
import time # importing use of time. import math #importing math to use math.sqrt ### creating function to wait for 1 second. ### def wait(): time.sleep(1) # waiting for 1 second #end of def ''' this prog will calc the square root ''' print("Welcome") #print above. wait() #calling d...
d73b09b4b7f9b151ded2f79f405dc7d1f27ff400
sam-huang1223/learn-algorithms
/sorting/bubble.py
449
4.15625
4
from sorting import RANDOM_ARRAY from utils import time_functions @time_functions.timeit_1x def bubble_sort(arr): """inverse of insertion sort - maintains sorted order in last i elements of output""" for idx in range(len(arr)): print(arr) for j in range(len(arr) - idx - 1): if ar...
8bb10f4ae441df6edae9df4e31d941ecd5963f30
DrkSephy/practice
/ic/q19_queue_with_two_stacks.py
973
3.84375
4
# Implement a queue with 2 stacks. Your queue should have an # enqueue and a dequeue function and it should be "first in first out" (FIFO). # Optimize for the time cost of m function calls on your queue. # These can be any mix of enqueue and dequeue calls. # Assume you already have a stack implementation and it give...
2208a024e24e4d595b84753cb1c1fccda12b98d9
RupertMa/LeetCode-Playground
/1382.Balance a Binary Search Tree.py
935
3.828125
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def balanceBST(self, root: TreeNode) -> TreeNode: nodes = [] stack = [root] if root else [] ...
4f4242e68a0cc8dcb940a38cebac5e38e72d3a7c
RGGH/Python
/Solo/js.py
364
3.84375
4
# fibonacci # n, n1, nth = 0,0,0 for i in range(0,8): if i == 0: n = 0 n1 = i nth = n1 + n print(nth) elif i == 1: n = 1 n1 = nth nth = n1 + n print(nth) elif i > 1: n = n1 n1 = ...
51a20d210e0c1359fd2427086129f85f9fd60efc
julianogomess/Space-Invaders
/bancopalavras.py
5,786
3.921875
4
class Banco(object): def __init__(self,palavras,dificuldade): self.ordem = palavras if dificuldade==1: self.frase = 'SUJEITO + VERBO + PREDICATIVO' elif dificuldade==2: self.frase = 'SUJEITO + VERBO TRANSITIVO + OBJETO' elif dificuldade==3: self.fr...
caee178cafb8aa00d940d994fb33d889dc4e0a9f
MorLiberty/WoG
/CurrencyRouletteGame.py
1,857
3.640625
4
import random import time from Utils import current_currency_rate, range_validator, max_retries, bad_return_code def get_money_interval(difficulty): currency = current_currency_rate() random_number = random.randint(1, 100) total_value = random_number * round(currency, 1) interval = ((total_value - (5 ...
5b4c97b1e52ac205c5300a12fb9ed76537168f0e
charlesjavelona/realpython_book2
/project1/sqlg.py
1,070
4.125
4
import sqlite3 #Connect to database as connection: with sqlite3.connect("new.db") as connection: #Grab cursor from database conn = connection.cursor() #Create table called region, with city as text, and region as text #If it exists #conn.execute("""CREATE TABLE regions # (city TEXT, region TEXT) # """) ...
932755c39862cf98d39a5edaf5f2dc03dcf758b2
howard199113/Python-Assignments
/Making Dctionaries.py
157
3.59375
4
howard = {"name":"Howard","Age":"26","country of birth":"Taiwan","favoirte language":"Python"} for obj in howard: print "My "+ obj + " is " + howard[obj]
5801e63e89d9b8159b84698a749b00fbe75e176e
Suha4321/Projects
/Informatics/Smallest.py
509
4.1875
4
## This program talks about the None being used instead of infinity. ## Usage ## x = [30,28,45,67,23,54] ## smallest(x) def smallest(x): smallest = None ## this sets the value of smallest to the first element of x for i in x: ## 'is' is stronger than '==' more used in terms of true and false statement...
cb4873efab56bf8662fd4b3996e258779044fe75
michruggeri/ProjectEuler
/09_pythagorean.py
601
4.0625
4
#!/usr/bin/env python3 """ Project Euler, problem 9 A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a**2 + b**2 = c**2 For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ found = False for c...
e58c927ad4b20624570b03afbd875f9722c766f9
mochilive/mi_primer_programa
/Pruebas/comer_helado.py
637
4.09375
4
apetece_helado_input = input("te apetece un helado? (si / no): ").upper() tienes_dinero_input = input("tienes dinero para comprarlo? (si / no ): ").upper() esta_senor_helados_input = input("¿esta el señor de los helados? (si / no): ").upper() esta_tu_tia_input = input("estas con tu tia? (si / no): ").upper() apetece_...
8b8ed71ebcba673de7a4f57039e9663d60ad39e2
judebattista/CS355_Homework
/hw01/conditionsAndLoops.py
1,559
3.8125
4
a = 9 if a < 10: print('The number is less than 10') print('Also, do another thing in the if block') else: print('The number is greater than or equal to 10') print('And do something else in the else block') print('Always printed') greetings = 1 while greetings <= 3: print('Hello! ' * gre...
b43baee069dd16a97f9304a959813dbcf77a43da
lesp/LinuxVoice_Pibrella
/Project 2 - Dice Game/Python/dicegame.py
527
3.75
4
import random import time import pibrella def dice(): guess = random.randint(1,6) print("I'm going to think of a number between 1 and 6 and I will flash the lights on your Pibrella to indicate the number I chose") print("The number is "+str(guess)) for i in range(0,(guess)): time.sleep(0.5) ...
ceba9a044710c8336321fd7a3c892212fe6b1a57
yojuna/easy_easyocr
/easy_easyocr.py
2,740
3.5625
4
#!/usr/bin/env python3 from easyocr import Reader import argparse import cv2 # for converting urls to images for opencv import numpy as np import urllib def cleanup_text(text): # strip out non-ASCII text so we can draw the text on the image # using OpenCV because opencv's putText function can't display #...
108a7ba2936d3278cfa752b4e0f5778ea731d742
ramudasari123/PythonPractice
/UdemyDemo/OopsSpecialMethods.py
338
3.734375
4
class drunds(): def __init__(self,name, author,pages): self.name=name self.author=author self.pages=pages def __str__(self): return "author is "+self.author def __len__(self): return self.pages drunds=drunds('The Voice of Silence','Ram','101') print(str(drunds)) print...
76624da759454b1620b4fb241f02527a6bdd046c
Arun-07/python_100_exercises
/Question_54.py
472
4.375
4
# Assuming that we have some email addresses in the "username@companyname.com" format, # please write program to print the company name of a given email address. # Both user names and company names are composed of letters only. # Example: If the following email address is given as input to the program: john@google.co...
57765a15f4ccc6adedd169c198e3865ae3c7f1d0
bishalkunwar/Data_Science_Python
/DateTime.py
566
4.1875
4
import datetime print('The Date and Time Today is :', datetime.datetime.today()) date_today = datetime.date.today() print(date_today) print('This Year :', date_today.year) print('This Month :', date_today.month) print('Month Name:',date_today.strftime('%B')) print('This Week Day :', date_today.day...
22dd09c131bfd7ae7435ba818805f6efe7422cbd
MaheshChavan1264/Scripts
/Python/Week3/infytq.py
1,311
3.734375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 12 19:48:13 2019 @author: root """ #%% import re temp='indiaparker@ind.com' temp1='' if(re.search(r,'@ind\.',temp)): temp1=re.sub(r,'i\w+(\.com)',r,'edu\1',temp) print(temp1) #%% f=lambda x: (x*2)%3!=0 def pick(f,list1): for item in list1:...
e766c93f1ca37a9cba6ee49bdb6efe4d7e074d3f
yamada46/Python_class
/Mod4_Lab2.py
1,388
4.375
4
''' Module 4 - Lab 2 Dictionaries are great data structures to use for grouping and counting information. For this lab, we're going to create a list of names to group by length, and then count how many names occur in each group. Create the following name list and add in at least five female names (with repeats) to su...
92dd8b818e00a2a26d2ace35d5658ff24a62cf2b
josealbm/PracticasPython
/Práctica 6/P6E4.py
523
4
4
#Práctica 6 - Ejercicio 4 - José Alberto Martín Marí #Escribe un programa que permita crear una lista de palabras y que, #a continuación, pida una palabra y elimine esa palabra de la lista. lista=[] palabras=int(input("Dime cuántas palabras va a tener tu lista ")) for i in range(palabras): palabra=input("Dime la ...
d8c2f74ee245bd5590e8ea984adf47f90fa1d884
abhi8893/Intensive-python
/exercises/average_grade.py
754
3.890625
4
# Define a function that takes a list of lists and returns a new list of # lists with a student's name and their average grade in each sublist. from .conv_to_num import conv_to_num from statistics import mean def average_grade(lst): """ Return students' names and their average grades. >>> average_gr...
f7d58c41637e5d28d9316e779f34b4877ea2cf50
juhuiii/Baekjoon_Algorithm
/백준/Silver/7785. 회사에 있는 사람/회사에 있는 사람.py
268
3.8125
4
import sys input = sys.stdin.readline name = set() for i in range(int(input())) : a, b = input().split() if b == 'enter' : name.add(a) elif b == 'leave': name.remove(a) new_name = sorted(name, reverse = True) print(*new_name, sep = '\n')
2ffa9ab4b7a80e1352f6283dd5bd587df24fec39
JLee21/tech-prep
/code-problems/drills_archive/drills.2.py
2,376
3.96875
4
from trees import root """ 1 2 3 5 6 7 8 Given a root node to a binary tree... return the values Preorder - recursively - [1, 2, 5, 6, 3, 7, 8] return the values Preorder - iteratively return the values Inorder - recursively - [5, 2, 6, 1, 7, 3, 8] return the values Inorder - iterative...
b30d271340ed5bb357c3755cf8064827d1d9f08e
DMarchezini/UriOnlineJudge-Python
/Uri1019.py
239
3.734375
4
"""Exemplo de Entrada Exemplo de Saída 556 0:9:16 1 0:0:1 140153 38:55:53 """ segundos = int(input()) minutos = int(segundos/60) segundos -= minutos*60 horas = int(minutos/60) minutos -= horas*60 print(f'{horas}:{minutos}:{segundos}')
17256ce521afeecc52932347526693ed45bba0bf
ganeshskudva/Algorithms
/HackerRank/itertools.product.py
266
3.65625
4
# # AUTHOR: Ganesh S Kudva # https://www.hackerrank.com/challenges/itertools-product/problem # from itertools import product A = map(int,raw_input().split()) B = map(int,raw_input().split()) A.sort() B.sort() ans = [A,B] AxB = list(product(*ans)) for i in AxB: print i,
1690392b6837024688c7ee5594f3beaf14883101
MaxIakovliev/algorithms
/old/Session002/TopInterviewQuestions/VerifyinganAlienDictionary.py
2,919
3.515625
4
class Solution: """ https://leetcode.com/problems/verifying-an-alien-dictionary/description/ """ def isAlienSorted(self, words, order): """ :type words: List[str] :type order: str :rtype: bool """ d={} for i in range(len(order)): d[orde...
dba524b656ddb61028e9b7b7e283f9b7ce3446f1
nimitbhargava/TravelGame
/backend/src/main/resources/scripts/syllables.py
277
3.671875
4
print("syllables script start") import sys from estnltk.vabamorf.morf import syllabify_word txt = sys.argv[1] arr = txt.split("%20") syllables = {} for i in range(len(arr)): syllables[i] = syllabify_word(arr[i]) print("syllablesDictionary:" + str(syllabify_word(txt)))
411c51ffdd1c4d98bb13f95eb2e8323a8190b4a4
Sergey7111968/Skillup_course
/Lesson_3.10_zoom_9.py
3,478
3.6875
4
# class Myclass: # __slots__ = ['a', 'b'] # def __init__(self, a, b): # self.a = a # self.b = b # m = Myclass(10, 20) # print(m.a) # print(m.b) # m.c = 30 # print(m.c) #Полиморфизм # class T1: # n = 10 # def total(self, N): # self.total = int(self.n) + int(N) # class ...
7f3f3126665aaba8d405beffd5ec2544f7b4cc9b
quochuy201/Python_Practices
/countValey.py
418
3.703125
4
def countingValleys(n, s): strs= s.split() ints = [1 if i =='U' else -1 for i in s] countvl =0 path = 0 isdown = False for s in ints: path += s if (path <0 )and not isdown: isdown = True if (path ==0 ) and isdown: countvl +=1 isdown = F...
2d3226b49a432954eb67f69c0c252a1543b15e93
GanLay20/The-Python-Workbook-1
/pyworkbookex052.py
702
4.28125
4
print("Grade Point Converter\n") grade_point = float(input("Enter a Grade Point Average:\n>>> ")) if grade_point <= 0.00: grade = "F" elif grade_point <= 0.1: grade ="D" elif grade_point <= 1.3: grade = "D+" elif grade_point <= 1.7: grade = "C-" elif grade_point <= 2.0: grade = "C" elif grade_poi...
1d11ffe2161d1157d3adcc6afee74cc7d7070ee7
cesarhg/cursos_gauss
/operaciones.py
297
3.96875
4
#Este programa muestra los operadores matematicos valor1 = 7 valor2 = 2.5 print "la suma es" print suma = valor1 + valor2 print "la resta es" print resta = valor1 - valor2 print "la multiplicacion es" print multiplicacion = valor1 * valor2 print "la division es " print division = valor1 / valor2
db196c00fbbdd9cf40b46c1760bc45a320065879
Macdeini/Row-Reducer
/main.py
4,991
4.40625
4
from typing import * import fractions as fr class Matrix: """A matrix like in linear algebra _elements: the elements in a matrix denoted as a list of lists. _augmented: whether the last column is augmented or not. Follows Matrix[row_num][col_num] """ _elements: List[List[fr.Fraction]] _aug...
9a3c6fc13b5be74e649a482c374da6348a22f1a0
deborahwalz/Exercism
/python/triangle/triangle.py
383
3.921875
4
def is_triangle(sides): cond_1 = sum(sides) > 0 cond_2 = sorted(sides)[0] + sorted(sides)[1] >= sorted(sides)[2] return cond_1 and cond_2 def equilateral(sides): return len(set(sides)) == 1 and is_triangle(sides) def isosceles(sides): return len(set(sides)) <= 2 and is_triangle(sides) def scalene...
5672d414b2cbe89867c84ab4fa181e3d922eb5e7
Jesselinux/Data-Structures-and-Algorithms
/001,Data Structures and Algorithms Basics/003,递归算法(2)-回溯.py
8,065
4.125
4
# 1,子集:回溯法 class subsets1_BackTracking(object): def subsets_recursive(self, nums): lst = [] result = [] self.subsets_recursive_helper(result, lst, nums, 0); return result; def subsets_recursive_helper(self, result, lst, nums, pos): result.append(lst[:]) ...
007faea4a53881cc593180fd63d9aa9d35e0c731
windellevega/stackleague
/number_to_roman.py
1,479
3.609375
4
import math def number_to_roman(number): romanDict = { 1: "I", 5: "V", 10: "X", 50: "L", 100: "C", 500: "D", 1000: "M", 5000: "G", 10000: "H" } div = 1 while number >= div: div *= 10 div /= 10 res = "" whi...
20325275f6f0c1d011dc965f48b9af420ffd2d3f
vitorgabrielmoura/Exercises
/Python 3/Curso_em_video/d30.py
158
3.875
4
print('### LEITOR DE PAR OU IMPAR ###') print('\n') a1=float(input('Digite um número')) a2=a1%2 if a2 == 0: print('É PAR!') else: print('É ÍMPAR')
02fd15558962edc875790cdb41171796c024a1b3
jonDuke/lambdata-jduke
/my_lambdata/my_mod.py
2,752
3.8125
4
# my_lambdata/my_mod.py import pandas as pd import numpy as np def say_hello(): """ says hello """ print('Hello there!') def add_column(data, dataframe, col_name): """ takes a list (data) and adds it as a new column to dataframe param col_name = the name of the new column returns the modi...
2af57e092e7173681790bc3db0c56cd324dee53d
daria19-meet/meet2017y1lab3
/Ages.py
109
3.765625
4
age1=input("How old is person 1?") a=int(age1) age2=input("How old is person 2?") b=int(age2) c=b+a print(c)
f711656aacb8749cb0394d3aa5f46254fb2ecb06
AndersonHJB/Student_homework
/早期代码/lesson_1.py
1,460
3.65625
4
""" # -*- coding: utf-8 -*- # @Author:AI悦创 @DateTime :2019/9/29 21:46 @Function :功能 Development_tool :PyCharm # code is far away from bugs with the god animal protecting     I love animals. They taste delicious.               ┏┓      ┏┓             ┏┛┻━━━┛┻┓             ┃      ☃      ┃             ┃  ┳┛  ┗┳  ...
d0a7e3d5e4ed8a780a0ea47ce93fe04cf206c62a
srgzyq/study
/PythonStudy/books/liaoxuefeng/hello.py
595
3.90625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- class Hello(object): def hello(self,name='world'): print('Hello, %s.' % name) """ ' a test module' __author__ = 'Michael Liao' import sys def test(): args = sys.argv if len(args) == 1: print 'Hello, world!' elif len(args) == 2: p...
840f673a373bcdafefd4b70a94ccd19547a0fe96
wolf132132/comprehension
/NESTED_COM_CHALLENGE.py
595
4.59375
5
burgers = ["beef", "chicken", "spicy beans"] toppings = ["cheese", "egg", "beans", "spam"] meals = [(burger, topping) for burger in burgers for topping in toppings] print(meals) print() #first iterator runs first, returning the result beef and then the second iterator runs #this is not a nested comprehension. Just a...
617e00a96070ec7dfea5e3b0e265f8ea10195904
licsky/checkio
/ElectronicStation/findSequence.py
1,867
3.625
4
def checkio(matrix): #没搞出来,只能测试横向和纵向的数据 flag = False count = 0 l =[] for i in matrix: for n in range(0,len(matrix)): for e in i: if e == i[n]: count += 1 if count >= 4: flag = True count = 0 for i in ...
721c4234cfb346f6ef98bb8fb9f68ffe3a70fd01
LeoLorenz/Rosalind
/INI4/ini4.py
382
3.734375
4
"""Given: Two positive integers a and b (a<b<10000). Return: The sum of all odd integers from a through b, inclusively.""" with open ('rosalind_ini4.txt', 'r') as input_file: limits = input_file.read() limits = limits.split(' ') result = 0 for number in range (int(limits[0]), int(limits[1])): i...
7aadd6102a2c0b6843a293835e39c7dcb070d550
caseyezimmerman/RPG-game
/class.py
2,282
3.640625
4
import os from random import randint ##3rd part pygame imports ##custom modules (ones that I made) from Joker import Joker #vampire from Bane import Bane #goblin from Batman import Batman #hero batman = Batman() ##instantiate a hero object from class hero bane = Bane() joker = Joker() monsters = [] ##before the g...
d63ad893c22ae5906d1795a769fc886f79a8137f
sohag2018/Python_G5_6
/25.5.1.Abstraction.py
1,210
4.4375
4
from abc import ABC,abstractmethod #abc: python file #Abstract Base Class(ABC): #ABC Helper class that provides a standard way to create an ABC using inheritance.""" class Shape(ABC): def __init__(self,dim1,dim2): self.dim1=dim1 self.dim2=dim2 #method declared: @abstractmethod def are...
23498cd019a37a0bd5de89c0eeee41d14fa7bf26
janhenke/project-euler
/common/binomial.py
419
4
4
#! /usr/bin/env python3 """This module provides functions related to binomials.""" from math import factorial def binomial_coefficient(n, k): """Calculate the binomial coefficient 'n over k' :param n: The value of 'n' :param k: The value of 'k' """ if k < 0 or n < k: raise ValueError('In...
598de55612f90f476e8cdbb631942995067e9387
aastronautss/programming-exercises
/210-small-problems/easy_2.py
2,589
3.8125
4
import random import re import math from functools import reduce # Ddaaiillyy ddoouubbllee def crunch(string): new_string = '' for idx, char in enumerate(string): if idx == 0 or char != string[idx - 1]: new_string += char return new_string # Bannerizer def print_in_box(string): l...
ab42ef14dd77f50bfe7e31c19b7026bdd5f82bfa
rincher/algorithm
/leetcode_Python/14. Longest Common Prefix.py
377
3.875
4
def longestCommonPrefix(strs): strs.sort(key=lambda x: len(x)) if len(strs) == 0: return "" else: for i in range(len(strs[0])): for j in range(1, len(strs)): if strs[0][i] != strs[j][i]: return strs[0][:i] return strs[0] strs = ["flo...
cdb89202e89daf522526a7c99649459b3709f9f3
joanaritacouto/fdpython
/2017-2018/AULA_4/contagem_decrescente.py
193
3.921875
4
#encoding:utf8 #contagem decrescente n=int(input("Insira o numero pelo qual quer começar a contagem: ")) """ while n>=0: print(n) n=n-1 """ while True: print(n) if n<0: break n=n-1
e060b3d984bb8294e6f705369b2868d30135323a
MigHer74/Results
/results.py
2,551
3.75
4
import os import minis as fm os.system ("cls") # Main Menu - The user select the type of game sel = input("Please select the game you want to analyse (N - Normal | L - Long | X - Salir): ") if sel == "N": numbers = fm.enter_data(1) numbers = fm.review_file("N",numbers,0,0) numbers = fm.convertion(numbers...
6dc01c6aa697bafec6507c8b34e5e481f461c358
songwenju/BeautyDeepLearning
/chapter5/5.07_normalized.py
231
3.5
4
import numpy as np # 构建一个矩阵 a = np.array([6, 2, 14, -6, 10]) # 求最大值,最小值 a_min, a_max = a.min(), a.max() print(a_min, a_max) # 求归一化矩阵 a_normal = (a - a_min) / (a_max - a_min) print(a_normal)
697f235f16c007d51f508b5f4348250ec2093885
haorenxwx/Cousera_Python_Note
/CouseraPythonDataStructure/Week5/week5_dictionary.py
854
3.609375
4
#week5_dictionary.py purse = dict() purse['Money'] = 12 # find key content for 'Money' in purse: # get : if exist key get the key value, otherwise return 0 x = counts.get(name,0) ###eg: calculate the counts = dict() names = ['aa','bb','cc','aa'] for name in names: counts[name] = counts.get(name,0)+1 print(counts) ...
84df11801d1e459cc9c3c45117183476367e481e
frances-zhao/ICS207
/homework/input output variable practice/cost.py
1,225
4.3125
4
#***************************************************** # #Program Author: Frances Zhao #Completion Date: April 28 2021 #Program Name: Lesson3_Cost #Description: asking the user for the price of a book and outputting total wholesale cost #with 40% discount, $2.5 shipping for first copy + 55 cents for each additional cop...
db93751e9bbab2e3aa041d9116c6671d75cd1151
blindgemaster/kacs_go_max
/Random number sum to 100.py
463
3.546875
4
from random import randint total = 0 x = 100 the_list = [] while True: if total == 100: break if x == 0: break sign = randint(1, 2) if sign == 1: number = randint(1, x) x = x - number total = total + number the_list.append(f'+ {number}') elif sign == 2...
f07b8dfd2620dfa23dbf77ed6d7b2e46fe61ad2e
here0009/LeetCode
/Python/736_ParseLispExpression.py
9,758
3.71875
4
""" You are given a string expression representing a Lisp-like expression to return the integer value of. The syntax for these expressions is given as follows. An expression is either an integer, a let-expression, an add-expression, a mult-expression, or an assigned variable. Expressions always evaluate to a single i...
77a55efb59f418e3589ad1a07c1731adbd92561e
hghimanshu/CodeForces-problems
/bose/python/bst/bst.py
2,504
3.90625
4
class BST: def __init__(self): self.root = None self.size = 0 def length(self): return self.size def __len__(self): return self.size def __iter__(self): return self.root.__iter__() def put(self,key): if self.root: self._put(key,self.roo...
e8c8e48445cb1f0ae90b4b82cf0aee4cac42711b
a6361117/code
/Day31-Day45/Day41/function.py
1,956
3.828125
4
#异常和函数 def faulty(): raise Exception('Something is wrong') def ignore_exception(): print(faulty()) def handle_exception(): try: faulty() except: print('Exception handled') print(ignore_exception()) print(handle_exception()) #使用模块中的函数warn(想发出警告,指出情况偏离了正轨) from warnings import war...
5d0afe3170da075ce80e00d3c1fb7dff80df06b8
JSkye3293/Python
/basecon.py
812
3.921875
4
#basecon.py def bincon(num,addSpace): n = num s = addSpace print(n,s) #debug print(n, " = ", end = " ") # bincon_loopy.py peter # Convert a base 10 number to binary # Use 191 base 10 equal to 1011 1111 base 2 # q(quotient) d(divisor) r(remainder) n(integer input) # div 128 #n = int(input("Input and integer less ...
75cf459b1e2845867e1c7b32f7acb45ac69fc8e9
pythonCore24062021/pythoncore
/HW/homework07/obartysh/hw07_05.py
173
3.890625
4
def bank(a, years): for year in range(years): a *= 1.1 return a b = float(input("enter $ ")) n = int(input("enter year to calculate % ")) print(bank(b,n))
12512196d238be8e6be504d5bb1a6533e8a00295
DavidFontalba/DAW-Python
/condicionales/8.py
1,380
4.21875
4
""" Algoritmo que pida dos números ‘nota’ y ‘edad’ y un carácter ‘sexo’ y muestre el mensaje ‘ACEPTADA’ si la nota es mayor o igual a cinco, la edad es mayor o igual a dieciocho y el sexo es ‘F’. En caso de que se cumpla lo mismo, pero el sexo sea ‘M’, debe imprimir ‘POSIBLE’. Si no se cumplen dichas condiciones se ...
5055367b79d915f97cf10525739340d4f0ad9032
dev-arthur-g20r/how-to-code-together-using-python
/How to Code Together using Python/EVENT DRIVEN PYTHON/areaofsquare.py
207
4.125
4
import os def areaOfSquare(s): a = s ** 2 return a side = float(input("Enter length of a side of a square to check its area: ")) area = areaOfSquare(side) print("Area of square: ", area) os.system("pause")
2e736e8a80ec6399e073695958de239c864e24e8
BiaHawk/Hacktoberfest-Algorithms
/Searching Algorithm/Linear Search.py
527
4.09375
4
#commit by Suyash def linearsearch(char_list, findChar): for i in range(len(char_list)): if char_list[i] == findChar: #checking if element exixts or not return i+1 return -1 character=input("Enter numbers/characters/words separated by space: ") character_list=character.split() print(character_list) find...
374815cc7796553363b4a8d1c755bd95a7f8d8a1
mostiguy/Euler
/Euler project no 24.py
842
3.796875
4
# -*- coding: utf-8 -*- """ A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: 012...
02be04839f99ca5d61ce9c175e5f37b7eaf6f84c
gonz4lex/sandbox
/Neuron.py
999
4.46875
4
""" Following the tutorial at https://victorzhou.com/blog/intro-to-neural-networks/. Next steps: https://victorzhou.com/blog/intro-to-cnns-part-1/ """ import numpy as np # ! Define the activation function def sigmoid(x): return 1 / (1 + np.exp(-x)) # ! Build a Neuron class class Neuron: def __init__(se...
1abdaaecfcd6681e8fd7e4f7f85e04bdeacaf39d
kolarav/Coding-Problems-Arrays
/missing_element.py
261
3.546875
4
from typing import List class Solution: def missing_number(self, nums: List[int]) -> int: n = len(nums) s = int((n*(n + 1))/2) return (s - sum(nums)) solution = Solution() print(solution.missing_number([1, 2, 7, 3, 8, 4, 6, 0]))
95c1d7e58d7841674f30adf44a6f931277ab1edb
ramangugnani/python-ds
/136-SingleNumber.py
303
3.5625
4
from typing import List # https://leetcode.com/problems/single-number/ class Solution: def singleNumber(self, nums : List[int]) -> int: result = 0 for i in nums: result = result ^ i return result sol= Solution() mylist = [1,2,1] print(sol.singleNumber(mylist))
85f65073c52aea7f76a13117ae7e06ec1b87798f
sauravkaushik8/randomaze
/randomaze/randomaze.py
4,169
3.796875
4
class Maze(): def __init__(self, len_x, len_y): import numpy as np self.len_x = len_x self.len_y = len_y self.maze = np.zeros([self.len_x * self.len_y]) self.player_x_coordinate = None self.player_y_coordinate = None self.goal_x_coordinate = N...
b5f08663abaaa102e0fa677f32bb701f9c19d164
andreferreira4/Programa-o1
/ficha 2 entregar/ex1.py
732
3.734375
4
#Exercicio 1 percnota1= .25 percnota2= .35 percnota3= .40 #Nota1 nota1 = float(input("Escreva a primeira nota: ")) while nota1 < 0.0 or nota1 > 20.0: nota1 = float(input("Escreva a primeira nota: ")) #Nota2 nota2 = float(input("Escreva a segunda nota: ")) while nota2 < 0.0 or nota2 > 20.0: nota2 = float(inpu...
a05196f2d319191626efdb0bc1a14913352ff2de
sumitkrm/lang-1
/python/review/epi_5_8_alternation.py
745
4
4
def rearrange(A): n = len(A) for idx in range(n - 1): if idx % 2 == 0: if A[idx] > A[idx + 1]: A[idx], A[idx + 1] = A[idx + 1], A[idx] else: if A[idx] < A[idx + 1]: A[idx], A[idx + 1] = A[idx + 1], A[idx] return A def longest_increasi...