blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
acb5ffaf7c1b3d0ff74419af235ff1ba3a4d5320
cavid-aliyev/HackerRank
/collection-counter.py
727
3.703125
4
# Collection-counter -> https://www.hackerrank.com/challenges/collections-counter/problem from collections import Counter # Ölçülərin sayını əlavə edirik mallarin_razmerlerinin_sayi= int(input("Ölçüləri sayını əlavə edin: ")) #Öıçüləri bir listə yığırıq myList = Counter(list(map(int, input().split()))) #Mallarin db...
dcdaaceba0365796d4de0b9b6135d70969e7a2bf
VISHAL2981/python_basic-s
/shorthand_ifelse.py
155
4.0625
4
a=int(input("enter a\n")) b=int(input("enter b\n")) if a>b: print("a b sai bda hai sir ji ") print("b a sai bda hai") if b>a else print("a b sai bda hai")
c08b38aece4e85f90c9cf1a91e79ffb735fca56c
maxkagan/cs-21a
/assignment5/aggregator.py
5,048
3.671875
4
# ----------------------------------------------------------------------------- # Name: Max Kagan aggregator.py # Purpose: CS 21A - implement a simple general purpose aggregator # # Author: Max Kagan # ----------------------------------------------------------------------------- """ Implement a simple general purpo...
e481b74acdbeda2da4f78662d84b29980c7ce556
pratikap41/Python-Program
/Employee Tracker.py
2,855
3.984375
4
class Employee: def __init__(self, name, designation, gender, doj, salary): self.name = name self.designation = designation self.gender = gender self.doj = doj self.salary = salary emp_list = [] def registration(): while(1): print('note :- to exit press 0 ') ...
ccef15f2576a847142e21736d618ba263855c4ab
natj/tov
/label_line.py
1,820
3.703125
4
import numpy as np import math import matplotlib.pyplot as plt """ Simple script to label line similar to what contour function does credits: Thomas Albrecht https://stackoverflow.com/questions/19876882/print-string-over-plotted-line-mimic-contour-plot-labels """ def label_line(line, label_text, n...
691c9ef8e4f37b88e68fb62286d4297d0909c65a
StephenElishaClarke/Code
/fibonacci.py
796
4.03125
4
def memoize(f): memo = {} def helper(x): if x not in memo: memo[x] = f(x) print(memo) return memo[x] return helper @memoize def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1)+fib(n-2) n = input("E...
362751f874de9393b7b41d2489390206fb061549
snehavaddi/DataStructures-Algorithms
/LL_reverse_list_in_set_of_k_set2.py
1,431
3.953125
4
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def reverse(self, head, k): curr = self.head prev = None next = None count = 0 new_stack = [] wh...
79f2053847dcc22554d9d37b1fee4fabc7ac05d7
mwthe78/My-python-Code
/Week11/exo1.py
49
3.578125
4
b=float(input(" give a number")) c=b*2 print (c)
4a2bf9a5a0f87217505033d52bc6798b428c7015
andrewzhang1/Selenium-1
/Calculate-class.py
385
3.609375
4
''' Alex helped to create this class 03/10/2017 Add unit test: 1. Add ''' ## Test a python class class Calculate(object): # May or may not define "zeor": #zero = 90 def add(self, x, y): return x + y + self.zero if __name__ == '__main__': calc = Calculate() calc.zero = 9 ...
48bca3b0721fe6f79a37e078fde2f404bd2ce1d5
claudianguyen/easy-lemon
/utils/FormatUtils.py
976
4.21875
4
""" Utils method for formatting text. """ def format_job_info(job_info): """ Checks each characteristic in the job_info object. If the charc is None, return "N/A", otherwise, return the stripped text. :param job_info: the job_info that needs to be formatted. :return: job_info: this job_i...
623093fa7e86b289940e00b923e8e314447094d5
dalaAM/month-01
/day06_all/day06/demo01.py
644
4.15625
4
""" 深拷贝 exercise:exercise01 """ # 准备拷贝工具 import copy list01 = [ [10, 20, 30], [40, 50, 60], ] list02 = list01[:] # 浅拷贝 list03 = copy.deepcopy(list01) # 深拷贝 # 验证: # 浅拷贝修改深层,互相影响 # list02[0][0] = "十" # print(list01) # [[10, 20, 30], [40, 50, 60]] # 浅拷贝修改第一层,互不影响 # list02[0] = "列表" # print(list01)# [[...
e10ab7dddeb39d64c80cc0c4e8796cfb8e671c76
kateflorence/motion_parallax
/motion_parallax.py
4,703
4.21875
4
### ### Author: Kate Martin ### Course: CSc 110 ### Description: This program is designed to display a nature scene ### using graphics. It utilizes if-statements, while loops, ### indexing, the random module, parameters and arguments ### within functions, and incorporates motion ...
0b2728a7b809f2ee3ed76d36905555a0dfe2193d
saycmily/vtk-and-python
/leecode/1-500/1-100/95-不同的二叉搜索树Ⅱ.py
787
3.8125
4
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def generateTrees(self, n: int): def func(start, end): if start > end: return [None] ans = [] ...
fcd325367dcbef7d1db51809003889a4ce97cf5f
karel1980/advent-of-code-2015
/day11/day11b.py
1,629
3.703125
4
import re def make_alphas(start, end): return "".join([chr(c) for c in range(ord(start),ord(end)+1)]) alphabet = make_alphas('a','z') class Validator: def __init__(self): sequences = [ alphabet[n:n+3] for n in range(len(alphabet)-2) ] self.seq_regex = re.compile("(%s)"%("|".join(sequences))) self.iol_reg...
aadf0dce54d1eaa1d6d4d9d1ab4f8cbd9660e308
fpgodoy/Exercicios-Python
/ex028.py
340
3.765625
4
from random import randint num = randint(0,9) chute = int(input ('O computador escolheu um número entre 0 e 9. Tente adivinhar qual foi: ')) print('Você escolheu {}.'.format(chute)) if chute == num: print('Parabéns, você acertou, o número era {}.'.fomart(num)) else: print('Você errou, o número era {}.'.f...
0e95c78c70cac67447b357690689122dc27a96d9
greatwallgoogle/Learnings
/other/learn_python_the_hard_way/ex32.py
1,639
4.1875
4
# 循环和列表 # list初始化:将数据放入[ ]之间,用逗号分隔 # ele = []; --声明一个空列表 # ele.append(x); 向列表尾部添加一个元素x # for i in list : 遍历列表list # 列表中可以存放不同类型的元素 # range(start,end) :表示生成一个列表,其元素为从start开始,最后一个元素为(end - 1),即区间为[start,end)。 # 可以使用[index]访问元素 hairs = ["brown","blond","red"] eyes = ["brown","blue","green"] weights = [1,2,3,4] print("h...
870bc02197b7fd046aa1b19cec33a3b7b5dce55d
josulaguna/Python
/calculo-areas.py
811
3.859375
4
#Josué Laguna Alonso #01/03/18 #coding: utf8 import os os.system ("clear") from math import pi print """ ******************** Calculadora de áreas ******************** a) Triángulo b) Círculo """ figura = raw_input ("¿Qué figura quiere calcular (Escriba T o C)? ") if (figura == "T"): base = input ("Esc...
917b3f1faba9e31cb433a7ac1852fce12c051e29
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/zhen_yang/lesson02/series.py
1,634
4.09375
4
# define function fibonacci() def fibonacci(num): if num == 0 : return 0 elif num == 1: return 1 else: return fibonacci(num-1) + fibonacci(num-2) # define function lucas() def lucas(num): if num == 0 : return 2 elif num == 1: return 1 else: retu...
2322d67df1990dd9b19ee2e18940b906866325ca
gmontoya2483/curso_python
/Section_09_Advance_buit_in_Functions/generator_classes_and_iterators.py
965
3.8125
4
class FirstFiveGenerator: def __init__(self): self.number = 0 def __next__(self): if self.number < 5: current = self.number self.number += 1 return current else: raise StopIteration() class FirstFiveIterator: def __init__(self): ...
96c7640e8d4cc31482a9e0ea99a6a0ededa43024
surajmapa/CodeBreakthrough
/OOP/oop.py
2,927
3.734375
4
from enum import Enum from abc import ABC, abstractmethod class SecurityDevice(ABC): def __init__(self, active): self.active = active @abstractmethod def reset(self): pass class Sensor(SecurityDevice): def __init__(self, silent, distance): self.silent = silent self.d...
5edc0b5105d59936db89d249a16aa156ed5ac0e6
iamrustamov/Telegram-Lesson-Bot
/db_helper.py
7,877
3.578125
4
import sqlite3 def prepare_db(db_name): conn = sqlite3.connect(db_name) cur = conn.cursor() cur.execute('''CREATE TABLE IF NOT EXISTS students( number TEXT PRIMARY KEY NOT NULL, last_name TEXT NOT NULL, first_name TEXT NOT NULL, midd...
218eaf7901a402ec0c14289bb615c4e596871f2f
tomtang110/comp9021
/quzzi/quiz-4/Week 5 - quiz_4.py
1,319
4.375
4
# Uses National Data on the relative frequency of given names in the population of U.S. births, # stored in a directory "names", in files named "yobxxxx.txt with xxxx being the year of birth. # # Prompts the user for a first name, and finds out the first year # when this name was most popular in terms of frequency of n...
05d455120fb3d27e256e0e3321a92b2f42906dab
Shaheel23/Application1
/DICTIONARY/Dictionary_App.py
898
3.53125
4
import json from difflib import get_close_matches data=json.load(open("076 data.json")) def translate(word): word=word.lower() if word in data: return data[word] elif word.title() in data: return data[word.title()] elif word.upper() in data: return data[word.upper()] elif l...
399d7c12e5820d46f68e75f4d30627504cfea920
RuomeiYan/CCC-My-solutions
/2001/01-J3.py
1,284
3.796875
4
hand = input() def output(suit): string = "" for i in suit: string = string + i + " " return string def points(suit): point = 0 for i in suit: if i == "A": point += 4 elif i == "K": point += 3 elif i == "Q": po...
87fe03ef3e8bb3654997545884f5771ad94a53bf
naveenakallagunta/python
/large.py
108
3.625
4
a=int(raw_input()) b=int(raw_input()) c=int(raw_input()) if a>b: print a elif b>c: print b else: print c
f883f29a891a7dea272836f5461aa9d6a928286b
Vaishnav2103/Coffee_Machine_Software
/main.py
2,364
4.28125
4
MENU = { "espresso": { "ingredients": { "water": 50, "coffee": 18, }, "cost": 1.5, }, "latte": { "ingredients": { "water": 200, "milk": 150, "coffee": 24, }, "cost": 2.5, }, "cappuccino": { ...
7644233fdec2ca3e1c1735a2ac1d7cfe2eae3dd9
danielamendozach/introprogramacion
/práctico_2/ejercicio3.py
164
3.6875
4
def contador(palabra): contador=0 for i in palabra: contador= contador+1 return contador plb=input("Ingrese la palabra: ") print(contador(plb))
e4e8b06d97f1c41482109877cf3b8157e8ab52c7
sreece52/remoteroomalerts
/remoteRoomAlertsServer/modules/motionSensorModule.py
971
3.703125
4
import RPi.GPIO as GPIO from gpiozero import MotionSensor import datetime import time from time import sleep import piCameraModule from piCameraModule import Camera class motionSensor: pir = MotionSensor(25) # setup pin 25 as input for the motion sensor def __init__(self): # configure the GPIO pin ...
17165c12fc59bbc416ca26f77b3935baf19d2bb4
ibrahimgurhandev/mycode
/collectedLap/calculator.py
1,151
4.28125
4
#!/usr/bin/env python3 import operator def calculator(): print("Calculator App") def get_operand(): while True: op = input("what will you like to do,\n " "'+' to add, '/' to divide, '-' to subtract, '*' to multiply ").lower() if op in ["+", "/", "-", "*"]...
14385d5d7aefaf0d324fb617890f4d9139a511aa
jiarmy1125/Kata
/Counting_Duplicates.py
508
3.828125
4
# "aabBcde" -> 2 # 'a' occurs twice and 'b' twice (`b` and `B`) # "indivisibility" -> 1 # 'i' occurs six times # duplicate_count("abcde"), 0 # duplicate_count("abcdea"), 1 # duplicate_count("indivisibility"), 1 def duplicate_count(text): text=text.lower() x=[] for t1 in text: if (text.count(t1)) !=...
9fc36269df64c9f0f11161280e85299b979100a5
NicVic81/PythonbookProjects
/Chapter7.py
8,101
4.40625
4
# message = input("Tell me something, and I will repeat it back to you: ") # print(message) # # name = input("Please enter your name: ") # print("Hello, "+name.title()+"!") #user_promt = 'If you tell us your name we can personalize the message for you.' #user_promt += '\nWhat is your name?' #name = input(user_promt)...
b79cc598d2b49e60e2524fc04f098a3bac6b9f5c
paulojuanifpb/IFTERACT
/ifteractWEB/ifteractApi/Model/Grupo.py
2,050
3.5
4
import sqlite3 def criarTabelaGrupo(conn): cursor = conn.cursor() cursor.execute(""" CREATE TABLE tb_Grupo( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, nome VARCHAR(70) not null, data date, administrador int not null, foreign key (administrador) references...
e55aaecfea24242abdaf5a2e164d56688e05a280
PdxCodeGuild/class_mouse
/1 Python/solutions/lab7_rock_paper_scissors_no_if.py
1,525
4.125
4
### Modules ### import random ### Variables ### choices = ['rock', 'paper', 'scissors'] # dictionary to assign inputs to values choice_dict = { 'rock': 0, 'paper': 1, 'scissors': 2 } # Calculate result message using a list of lists. -1 is lose, 0 is tie, 1 is win, 2 is invalid input results = [ #rock paper sci...
0208c0d636d4458763ea24a61605d7278c1ca382
busa2004/snippet2
/크루스칼.py
671
3.71875
4
def find_parent(parent, x): if parent[x] != x: parent[x] = find_parent(parent,parent[x]) return parent[x] def union_parent(parent,a,b): a = find_parent(parent,a) b = find_parent(parent,b) if a < b: parent[b] = a else: parent[a] = b def solution(n, costs): v = n ...
379d2317c380061f1ff6295c5e34def03a9c88c9
daniel-reich/ubiquitous-fiesta
/jQGT8CNFcMXr55jeb_12.py
69
3.65625
4
def numbers_sum(lst): return sum(x for x in lst if type(x)==int)
e7ba37425cea9e74b248a827a6e2837fc51d7957
nvyacheslav/python-project-lvl1-2
/brain_games/core.py
1,214
3.890625
4
"""Brain-games print-out function module.""" import prompt def welcome_user(): """Prompt User name and print welcome message. Returns: User name """ print('Welcome to the Brain Games!') user = prompt.string('May I have your name? ') print('Hello, {0}!'.format(user)) return user...
0c1cff71aa6d3c9da65408cd5e0a457d19a4906e
p-v-o-s/infrapix
/src/infrapix/core.py
1,318
3.625
4
import numpy, Image def fig_to_data(fig): """ @brief Convert a Matplotlib figure to a 4D numpy array with RGBA channels and return it @param fig a matplotlib figure @return a numpy 3D array of RGBA values note: this code was orginally taken from http://www.icare.univ-lille1.fr/wiki/index.php...
da1047ca994c5464c621bf7efd3c420fbffcb9ab
tian0zhi/BaseAlgorithm
/insertsort.py
520
3.625
4
def insertsort(li): '''插入排序''' Length = len(li)# 列表长度 for i in range(1,Length):# 只需排序1 - len(li) for j in range(0,i):# 比较待排序数与已经排好序(有序区)各元素大小 if li[j] > li[i]:# 升序排序,如果待排序数li[i]<有序区li[j],交换他们 temp = li[j] li[j] = li[i] li[i] = temp else:# 如果待排序数li[i]!<有序区li[j],结束这次 待排序数li[i] 排序 brea...
80306d26a3c47bcf371238cbe4f6d6ffffe54506
shortdistance/algorithms
/chapter-3/BinarySearchST.py
2,562
3.921875
4
#! usr/bin/python # -*- coding: utf-8 -*- class BinarySearchST(object): def __init__(self): self.__Keys = [] self.__Vals = [] def get(self, key): N = len(self.__Keys) i = self.rank(key) if len(self.__Keys) == 0: return None if i < N and self.__Keys[i] == key: ...
b7d62ec23aea421f10e333cc1026cb18694f7329
jkbockstael/leetcode
/2020-06-month-long-challenge/day06.py
1,185
4.21875
4
#!/usr/bin/env python3 # Day 6: Queue Reconstruction by Height # # Suppose you have a random list of people standing in a queue. Each person is # described by a pair of integers (h, k), where h is the height of the person # and k is the number of people in front of this person who have a height # greater than or equal...
e02d644668cd8f11b963088c7769ed88ef830c69
kinseyreeves/Interview-Questions
/binary_tree.py
2,149
4.125
4
""" Binary-tree implementation with different functionality. for reference. Kinsey Reeves """ class Node: def __init__(self, data): self.left = None self.right = None self.data = data def insert_node(element, tree): # print(tree.data) if (element <= tree.data): # print("...
bf4425eae629200c466ae9a5d012dadc2fdec988
tuneman7/property_scraper
/tester.py
1,376
4.03125
4
#!/usr/bin/python my_input = "bozo" next_string = '' m_len=len(my_input) print(m_len) while m_len > 0: print(m_len) next_string = next_string + my_input[m_len-1] m_len-=1 print(next_string) s1 = '' for c in my_input: s1 = c + s1 # appending chars in reverse order print(s1) s2='' new_string = [s2 +...
3f7967c78dce1cbeb78533ae8285f7083169e4f8
krisograbek/nba_recaps_nlp
/scraper.py
4,158
3.515625
4
import requests import datetime as dt from datetime import timedelta from bs4 import BeautifulSoup def get_games_info(date, days): """ Parameters ---------- date : str (format YYYYMMDD) The most recent day (default is yesterday) days: int, optional The number of days back (default...
c51396de72a07374f96a1d59389e10782335a5c8
beststrelok/pareto
/criteria.py
6,597
3.546875
4
# -*- coding: utf-8 -*- # python3 # import sys # os.getcwd() # print(sys.version) # sys.exit() # gradient-animator.com # http://thecodeplayer.com/walkthrough/animating-css3-gradients # /*----------------------------------------------*/ # !!!! IMPORTANT # import cmd # import platform # from pprint i...
66a7ba991a006787a23f4b70d5871227847a4d42
leafeon00000/AtCorder
/ABC162/A.py
131
3.734375
4
# coding: utf-8 # 標準入力<str> N = input() ans = "No" for n in range(3): if N[n - 1] == "7": ans = "Yes" print(ans)
26fd02dcafb96baa3b62e9aba360fce5190b16d8
tedgey/while_loop_exercises
/print_a_box.py
582
4.125
4
# Print a box with a given height and width box_width_input = input("What should the width of the box be? ") box_width = int(box_width_input) box_height_input = input("What should the height of the box be? ") box_height = int(box_height_input) width_count = box_width * ("*") inner_width_count = box_width - 2 inn...
ed5e12a431e0b6f0ace14804a5b4df4c8f037928
mateusrmoreira/Curso-EM-Video
/desafios/desafio13.py
255
3.71875
4
''' 13/03/2020 by jan Mesu Faça um algoritimo que peça o salário de um funcionário e mostre o novo valor com 15% de aumento. ''' salario = float(input('Escreva o salário do funcionário R$ ')) nousalario = salario * (15/100) print(f'O salário do funcionário de R$ {salario}. após o aumento de 15% passa a ser R$ {sa...
34f161c98eadf74df8bd1696d9776532fea9d1db
niufuren/bigdatr_test
/src/movement.py
293
3.640625
4
class Movement: def __init__(self): self.x = 0 self.y = 0 def move_down(self): self.y = self.y - 1 def move_up(self): self.y = self.y + 1 def move_right(self): self.x = self.x + 1 def move_left(self): self.x = self.x - 1
686c71766a75cc84ce9a1dc389acc6a24ddef2ec
MiniPa/python_demo
/advanced/01 dataStructureAlgorithm 数据结构和算法/1.3 集合 查找符合规则的若干元素.py
1,717
3.78125
4
# 1.3 保留最后N个元素 "collections.deque" ========== deque 队列 from collections import deque def search(lines, pattern, history=5): previous_line = deque(maxlen=history) for line in lines: if pattern in line: previous_line.append(line) yield line, previous_line ## Example use on a file if ...
499511c4243ac71e9e5d0714fe1e70ad1b9eb59b
wilbertgeng/LeetCode_exercise
/934.py
1,501
3.71875
4
"""934. Shortest Bridge""" class Solution(object): def shortestBridge(self, A): """ :type A: List[List[int]] :rtype: int """ m = len(A) n = len(A[0]) res = float('inf') def dfs(i, j): if i < 0 or j < 0 or i >= m or j >= n or A[i][j] == "#"...
aa8c1b08de127ffd932d4006b8c052ca6ac98a32
AprajitaSingh/numpy
/matrixpro.py
136
3.984375
4
#program to generate a matrix product of two arrays import numpy as np x = [[1, 0], [1, 1]] y = [[3, 1], [2, 2]] print(np.matmul(x, y))
3830da5d26a3e5972b71105d4e8cb2cf1f0dc12b
tomasabril/caesar_cipher
/tutorial.py
2,340
4.03125
4
sample = [1, ["another", "list"], ("a", "tuple")] mylist = ["List item 1", 2, 3.14] mylist[0] = "List item 1 again" # We're changing the item. mylist[-1] = 3.21 # Here, we refer to the last item. mydict = {"Key 1": "Value 1", 2: 3, "pi": 3.14} mydict["pi"] = 3.15 # This is how you change dictionary values. mytuple = (1...
3b21ae0a2c2ee5357c1ab1742728c6da5158e50f
Zh0nek/web
/lab7/8/Logic-2/4.py
558
3.6875
4
def no_teen_sum(a, b, c): def fix_teen(n): return n if n not in [13,14,17,18,19] else 0 return fix_teen(a)+fix_teen(b)+fix_teen(c) """ Given 3 int values, a b c, return their sum. However, if any of the values is a teen -- in the range 13..19 inclusive -- then that value counts as 0, except 15 and 1...
32c6e42d3329373d945241f902653c1bda311f0b
adastraperasper/coding-with-bro
/name.py
120
4
4
name = input("Enter your name please:") age = input("Enter your age please:") print("Olla"+ name+ "You are " +age)
060cd5bef861d2892d8465e2f383079a67685ec4
Samrat0009/Python_REPO1
/#10 Recursion_1/Printing_using_recursion.py
417
3.71875
4
# printing numbers from 1 to n : # base case : 1 to n def print1ton(n): if n==0: return smalloutput = print1ton(n-1) print(n,end=" ") return n = int(input()) print1ton(n) print() #__________________ for reverse : def revprint1ton(n): if n==0: return print...
6df3193c7a9d95eb79c0f529b04651926adb0718
ChristianLiinHansen/workspace_python
/Tutorials from Udacity/rename_files.py
812
3.921875
4
# -*- coding: utf-8 -*- """ Created on Tue Sep 9 14:24:42 2014 @author: christian """ #Imports import os #Introduction note print("This program renames the files") def rename_files(): #Get the file names file_list = os.listdir("/home/christian/Dropbox/E14/MasterThesis/PythonTutorials/prank") #...
7be4ca18ecb9d35853ba0c5f3a50ac51ace2bbd6
sasha-n17/python_homeworks
/homework_2/task_4.py
290
3.78125
4
text = input('Введите строку из нескольких слов, разделённых пробелами: ') print(f'Количество слов в введённой строке: {len(text.split())}') for i, el in enumerate(text.split()): print(f'{i+1}. {el[:10]}')
fa30adb4bdbd452c2a6494fc0a5a77de4ac86f39
hhoangphuoc/data-structures-and-algorithms
/cracking_the_coding_interview/moderate_problems/intersection.py
912
3.921875
4
# Given two straight line segments, find intersection point of two line segments def slope(p): x1 = p[0][0] x2 = p[1][0] y1 = p[0][1] y2 = p[1][1] return (y2-y1)/float(x2-x1) def intercept(p, m): return p[0][1] - (m * p[0][0]) def is_between(p, intersect_x, intersect_y): if intersect_x > p[0][0] and intersec...
a433feba1b669702485fb98c61f1dc8ce5fa536c
sohag2018/Python_G5_6
/group.py
161
4.34375
4
list =[1,5,6,8] # print(list) # print(list[0]) # # for x in list: # print(x) # print("-------------------------") for x in range(3,0,-1): print(list[x])
3511ffe8d56683feaa459c02ef673ed3486ad5b6
LoGOuT92/ZadaniaPython
/main.py
2,842
3.6875
4
def task_5(): import random tablica = [] tablica2 = ['abecadlo', 'z', 'pieca', 'spadlo', 'musztarda', 'pilot', 'telefon'] for i in range(0, 10): tablica.append(random.randint(1, 100)) def sort(tablica): for i in range(len(tablica) - 1, 0, -1): for j in range(i): ...
7a16e045fab947c71dc5fbd5edd9bcfde5041cd4
fernandooliveirapimenta/python
/lista/src/ex35.py
122
3.703125
4
r1 = 2 r2 = 2 r3 = 2 if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print('triangulo') else: print('náo')
3fb22a1bca5f17f04d6a99ba4a62104b76f316b3
dhnanj2/TS-Codes
/qwewd.py
522
3.703125
4
def rle (input_string) : length_of_input = len(input_string) result = "" i = 0 while i < length_of_input : count = 1 if (i+1 <length_of_input and input_string[i] == input_string[i+1] ) : while (input_string[i] == input_string[i+1]) : count += 1 ...
e69ce1e7885db7b95cce5726361fa154df7705a0
Isthares/Small-Python-Projects
/Special-Pythagorean-Triplet/specialPythagoreanTriplet.py
830
4.375
4
# File Name: specialPythagoreanTriplet.py # Author: Esther Heralta Espinosa # Date: 04/06/19 # Description of the program: 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 t...
863ae42e7a48ae3b5b4a361a85c3cef771527f6d
iCodeIN/Data-Structures-and-Algoritms
/Array & Pointers/reverseString.py
424
3.625
4
def reverseWords(self, s: str) -> str: l,r=0, len(s)-1 while l<=r and s[l] == " ": l+=1 while l<=r and s[r] == " ": r-=1 d= collections.deque() word=[] while l<=r: if s[l] == ' ' and word: d.appendleft("".join(word)) word=[] elif s[l] !=...
a25f81fb8edc28e0b87e2aaf186ef0f3cdb8f5be
lingdantiancai/face-FD-FR
/makerHello/OpenCV-Face-detection/database/insert.py
737
3.671875
4
import sqlite3, sys def insert(a, b, c, d, e ): conn = sqlite3.connect('sayHello.db') c = conn.cursor() c.execute("INSERT INTO COMPANY (DATA1,DATA2,DATA3,DATA4,DATA5) \ VALUES ('%s', '%s', '%s', '%s', '%s' )" % (a, b, c, d, e)); conn.commit() c = conn.cursor() cursor = c.execute("SELECT DATA1,DA...
6a26e1cb0fd4d2ddc94b287c0b7be2ff41695762
romanbog/adventOfCode2020
/day7/part2/main.py
1,870
3.65625
4
from collections import defaultdict def search(searchTerm, ruleDict, bagResult): #if(searchTerm not in ruleDict): #return 0 #print(searchTerm) #bagResult.add(searchTerm) summation = 0 setInside = ruleDict[searchTerm] #print(setInside) for element in setInside: print(element) elementArray = element.split()...
2a9f25ca132a6007f73737c25b669d92548ee317
SOURABHDHEKALE/introduction-py
/decorator.py
1,307
3.90625
4
# ## GENERATOR ## # # def disp(a,b): # yield a # yield b # result = disp(20,30) # # lst = list(result) # # print(lst) # print(result) # print(type(result)) # print(next(result)) # # # # def show(a,b): # while a<=b: # yield a # a+=1 # result = show(1,5) # print(result) # print(type(result)) #...
585c2111eee77a105dc8d7e6dce5e2d18b3b13e3
Richard-Joe/python_advanced_programming
/generator/generator_4.py
532
3.5
4
# -*- coding: UTF-8 -*- import time def squares_1(): cursor = 1 while True: yield cursor ** 2 cursor += 1 def squares_2(cursor=1): while True: response = yield cursor ** 2 if response: cursor = int(response) else: cursor += 1 if __name__...
6560684c886e255d88149bc6b6adfdbc0a450e1b
lschnellmann/LPTHW
/ex15.py
1,803
4.59375
5
# Exercise 15: Reading Files # You know how to get input from a user with raw_input or argv, Now you will learn about # reading from a file. You may have to play with this exercise the most to understand what's # going on, so do the exercise carefully and remember your checks. Working with # files is an easy way to...
801997006d2d834cbe60473fa2f96885c3bda5ee
ashNOLOGY/pytek
/Chapter_4/ash_ch4_WordJumbleGame.py
1,514
4.125
4
''' NCC Chapter 4 The Word Jumble Game Project: PyTek Code by: ashNOLOGY ''' #------ The Imports import math import random import os #Greeting the player print("\n\t\t\tWelcome to the Word Jumble Game" "\n\t\t\t-------------------------------") ''' SECTION 1 -We create a list of words ...
88b87d666101c9874f43a09b594bdbdd6c606216
shank1608/walkman_project
/walkman.py
1,522
3.640625
4
class Walkman(): def __init__(self, songs): self.songs = self.convert_lower(songs) self.status = False # shows walkman status def play(self, song): song_lower = song.lower() if song_lower in self.songs: print("playing song ", song) self.current_song = s...
cfd5cbf4c889dfdce607b5a09c34d97ebbb1f9dd
wuqx/BesTVQoS
/BesTVQoS/BesTVQoS/common/date_time_tool.py
4,630
3.828125
4
# -*- coding: utf-8 -*- '''获取当前日期前后N天或N月的日期''' from time import strftime, localtime, time from datetime import timedelta, date, datetime import calendar year = strftime("%Y",localtime()) mon = strftime("%m",localtime()) day = strftime("%d",localtime()) hour = strftime("%H",localtime()) min = strftime("%M",localt...
fa48b6178e3261a403a597e8f487a9027a9e0116
Luciano0000/Pyhon-
/object/私有化/QianFeng024object3.py
522
3.90625
4
#父类的私有属性子类中无法访问与修改 #但是可以通过在子类中重写父类私有属性,访问自己私有属性即可 class Person(object): def __init__(self): self.__money = 200 self.name = 'da' def show1(self): print(self.name,self.__money) class Student(Person): def __init__(self): super().__init__() self.__money = 500 def s...
3cf2d780654b54776241949f65fbd9af129ff176
ruanhq/Leetcode
/Algorithm/116.py
2,943
3.765625
4
#116. populating next right pointers in each node: from collections import deque class Solution: def connect(self, root: 'Node') -> 'Node': if not root: return None currentList = deque([root]) while currentList: numberNodeThisLevel = len(currentList) for i in r...
aff3519643c6a39c5ab8cf318ec43c6e53ed778b
kopwei/euler
/030_digits_fifth_powers/solve.py
312
3.578125
4
def is_wanted_number(num): nums = [int(c) for c in str(num)] return num == sum(map(lambda x: x **5 , nums)) def main(): sum_val = 0 for i in range(10, 295245): if is_wanted_number(i): print(i) sum_val += i print(sum_val) if __name__ == '__main__': main()
c3a7b6bfd8aa3708119a8c990ed7da205a9af175
mateus-ocabral/exercicios-prog
/exercicios/ex006.py
164
3.890625
4
nota1=float(input("Primeira Nota: ")) nota2=float(input("Segunda Nota: ")) print("A media entre {:.2f} e {:.2f} e igual {:.2f}".format(nota1,nota2,(nota1+nota2)/2))
150eefbbc1d77de7a53d386b169653353c4ca735
SantiagoYoung/eVeryDay
/liaoxuefeng/Inheritence_EX.py
1,881
4.46875
4
# coding: utf-8 # 在OOP程序设计中,当我们定义一个class的时候, # 可以从某个现有的class继承,新的class称为子类(Subclass), # 而被继承的class称为基类、父类或超类(Base class、Super class)。 class Animal(object): def run(self): print 'Animal is running...' class Dog(Animal): # pass def run(self): print 'Dog is running...' def eat(self): ...
55de2e60cefade69cad7c1261d3a0cd3e6eaa9e2
qiwsir/LearningWithLaoqi
/PythonAdvance/0801pyad.py
911
3.640625
4
#coding:utf-8 import datetime, calendar def last_friday_1(today): last_Friday = today one_day = datetime.timedelta(days=1) while last_Friday.weekday() != calendar.FRIDAY: last_Friday -= one_day return last_Friday.strftime("%A, %Y-%b-%d") #Friday, year-month-date def last_friday_2(today): ...
22a6aac0c75d09020fb83cdd15b195581c4974c8
urosisakovic/imagelib
/imagelib/utility.py
1,772
3.5
4
import numpy as np from PIL import Image #TODO: form exception in case of an error. def imopen(img_path): """ Given filepath to an image, this function loads it as an numpy.ndarray of type float32. Args: img_path(string): Filepath to an image. Ret: Image as an numpy.ndarray. ""...
4f54d2696e3f9a40f18fb4b4f00dfd818a3c7c7f
Vith-MCB/Phyton---Curso-em-Video
/Cursoemvideo/Exercícios/exer24 - SANTO.py
91
3.8125
4
nome = input('Insira o nome da cidade: ') pn = nome.upper().split() print('SANTO' in pn[0])
f1d1f1cef0839f993a59e86f3940f6278c8eb1ee
yeodongbin/PythonLecture
/01.PythonLecture/07.list.py
7,771
3.796875
4
# 리스트, 튜플, 딕셔너리, 셋 l = [10, 20,30, 40] s = {10,20,30,40, 50} d = {'one' : 1, 'two':2} for i in d: print(i) for i in range(10): print(i) #리스트 : 변경이 가능한 자료형, 순서가 있는 자료형 l = [100,200,300,400] print(l) print(type(l)) len(l) del(l) print(l[1]) l[1] = 1000 print(l) print(dir(l)) # 매서드 확인 l.append(300) #l.cle...
766f03aa9656c9e5fdef5140243bb264fb2d3439
marquesarthur/programming_problems
/leetcode/amazon/2020/pythagorean_triplet.py
631
3.8125
4
import math class Solution(object): def __sums_up_to(self, nums, value): for i in nums: target = value - i**2 if target > 0 and math.sqrt(target) in nums: return True return False def triplet(self, nums): # 1st sort numbers nums = sort...
0c5e592278d88d440caaa06b5603cb9217557d0e
umair3/pytorial
/basics/strings.py
481
3.84375
4
name = "umaiR anwar" age = 31 print("Hello %s, age = %d" % (name, age)) print('Hello %s, age = %d' % (name, age)) data = ("Umair", 31) print("Name = %s, Age = %d" % data) print(len(name)) print(name.index('a')) print(name.count('t')) # find occurrences print(name.capitalize()) # capitalize fist letter, and other...
de19b6ffadb89f5a9f8fb8c6e4ca996c92413c3c
marinov98/Python_Learning
/MergeSort.py
574
3.859375
4
def isEmpty(arr): if (len(arr) == 0): return True else: return False def mergSort(array): leftIndex = 0 righIndex = 0 leftArray = array[:len(array) // 2] rightArray = array[len(array) // 2:] for i in leftArray: for j in rightArray: if ( i >= j): ...
cdc903529640c39cc5ea36367cfd82b065310b87
podgeh1/CloudComputingRepo
/Lab3/palindrome.py
270
4.4375
4
# check if entered is a palindrome # Ask user to enter a word entered_word = raw_input("Enter a word: ") # Reverse the entered word rev_word = reversed(entered_word) # Compare the strings if list(entered_word) == list(rev_word): print("True") else: print("False")
445014959f91bf3e3617c0780556e5eddc85917c
Slawak1/pands-problem-set
/collatz.py
1,640
4.15625
4
# Problem No. 4 # Write a program that asks the user to input any positive integer and outputs the # successive values of the following calculation. At each step calculate the next value # by taking the current value and, if it is even, divide it by two, but if it is odd, multiply # it by three and add one. Have the pr...
7583910c5e421980ae02c26498a49d989c7d8aab
acc-cosc-1336/cosc-1336-spring-2018-jjmareck
/src/assignments/assignment9/main.py
892
4.09375
4
#Write import statements for classes invoice and invoice_item from src.assignments.assignment9.invoice import Invoice from src.assignments.assignment9.invoice_item import InvoiceItem ''' LOOK AT THE TEST CASES FOR HINTS Create an invoice object In the loop: Create a new InvoiceItem Create a user controlled loop to con...
b03a201f18f4ea2be4248c6ae808e7058eb9bafe
reetzjl/python-challenge
/PyBank/main.py
1,875
4.09375
4
import csv # Files to Load input = "budget-data.csv" # Variables to Track TotalMonths = 0 TotalRevenue = 0 PrevRevenue = 0 Date = 0 RevenueChange = 0 MaxIncr = {"Date":"", "RevenueChange":0} MaxDecr = {"Date":"", "RevenueChange":0} # Read Files with open(inpu...
0147f59b076abc8259b16013f605dcfa6c4ac95f
FerhatSaritas/PythonMorselExcersises
/AddMatrices/add.py
1,064
3.6875
4
def add(*argv): sum = list() for j in range(len(argv)): if len(argv[j]) != len(argv[j-1]): raise ValueError("Given matrices are not the same size.") for i in range(len(argv[j])): if len(argv[j][i]) != len(argv[j][i-1]): raise ValueError("Given m...
eb3c38b1d66fbde9ef435085876b3dd5851d7c4b
mariabelenceron/Python
/RoadtoCode/07_reloj.py
411
3.703125
4
def calcular_hora_a_segundos(hora): una_hora = 3600 return una_hora * hora def calcular_minuto_a_segundos(minuto): un_minuto = 60 return un_minuto * minuto if __name__ == "__main__": hora = int(input('Ingrese una hora: ')) minuto = int(input('Ingrese los minutos: ')) print(f'{hora}:{minuto...
ccfe63ede5977b2f915a05dbeb7610d7afe8fbc8
qingdaodahui/PSI_KOMI_PYTHON
/BruteForce.py
991
3.625
4
import math import itertools class BruteForceMethod(object): def __init__(self, listOfPoint, strategy): self.listOfPoint = listOfPoint self.strategy = strategy def resolveProblem(self): self.permutations = list(itertools.permutations(self.listOfPoint, len(self.listOfPoint))) re...
e014aaf1c8ce92771a0ab9395cd7fa5d66a5b65c
deeplhub/python-demo
/src/com/xh/demo/python/demo14_set_05_判断.py
706
3.671875
4
''' Title: 无序列表判断 Description: @author H.Yang @email xhaimail@163.com @date 2020/03/05 ''' print("== 无序列表判断 ==") set1 = {'a', 'b', 'c'} set2 = {'a', 'b' } set3 = {'z', 'v' } # 判断指定集合是否为该方法参数集合的子集。 print("set2.issubset(set1) :", set2.issubset(set1)) # 判断该方法的参数集合是否为指定集合的子集 print("set1.issuperset(set2):", set1.iss...
502d1a43415fea94a5eb4b00234c481ae1cc75b0
hevalenc/Analise_com_Pandas_Python
/2_estrutura_dados.py
1,593
4.1875
4
print("\nListas\n") #Criando uma lista chamada animais animais = [1,2,3] print(animais) animais = ["cachorro", "gato", 12345, 6.5] print(animais) #Imprimindo o primeiro elemento da lista print(animais[0]) #Imprimindo o 4 elemento da lista print(animais[3]) #Substituindo o primeiro elemento da lista animais[0] = "pa...
756ea7144f3c9058fa701633502618609f3fc486
scotontheedge/john
/quiz.py
4,698
4
4
""" Main quiz management logic. Creates the classes and manages the flow through the application. """ # Import classes to be used from classes import Quiz, HighScores # Import methods to be used from login import get_list, check_list, save_list, load_highscores, save_highscores # Import list and dictionary data from...
a7d944053ec84df6bd786b4ad9d8bb3a80bda715
aminsol/FTP_Server_Client
/Client/client.py
4,309
3.78125
4
#!/usr/bin/python3 # This is client.py file import socket import os import sys import re # For file transfer ftp = 3333 # For communicating to server serverPort = 2222 # For communicating to Client clientPort = 1111 host = socket.gethostname() def send(data): # create a socket object client_socket = socket.s...
0f4b7d2976e7a7f7a2f222986cd9bc60cb3bac8c
SRIDEVI98/Python-Programming
/Beginner_level/addlist.py
560
3.65625
4
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: student # # Created: 04/02/2018 # Copyright: (c) student 2018 # Licence: <your licence> #------------------------------------------------------------------------------- ...
50c59464d0c6ee2799358bd08ac0e5daeea51f21
giselemanuel/programa-Ifood-backend
/qualified/sem7_qualified_6.py
2,623
3.671875
4
""" Descrição Utilizando as mesmas 8 funções das atividades Pilha- Funções Básicas e Fila - Funções Básicas: cria_fila() tamanho(fila) adiciona(fila, valor) remove(fila): Implemente a função fila_prioridade(lista) que recebe uma lista com números inteiros que representam idades de pessoas. A lista representa a ordem d...
be7cece8a8099fa99e53f287402a9ea0629859b5
giuzis/Oficinas-2
/sensores_plus_motores.py
1,714
3.671875
4
# CamJam EduKit 3 - Robotics # Worksheet 8 - Line Following Robot from time import sleep import time # Import the Time library from gpiozero import Robot, LineSensor, Button # Import the GPIO Zero Library # Set variables for the line detector GPIO pin pinLineFollowerLeft = 11 pinLineFollowerRight = 12 pinLineFollowe...
5adc93ab4c024fab74c528d8b0cb879fe16e567b
vannesspeng/Algorithm
/sort/selectsort.py
537
3.890625
4
# 最优时间复杂度:O(n2) # 最坏时间复杂度:O(n2) # 稳定性:不稳定(考虑升序每次选择最大的情况 def select_sort(alist): n = len(alist) for i in range(0, n): min_index = i for j in range(i+1, n): if alist[j] < alist[min_index]: min_index = j if min_index != i: alist[i], alist[min_index] ...
b66324071df49d068505c48fcac4537905296551
steve-cw-chung/codewars_Python
/3.Take a Ten Minute Walk.py
2,506
4.09375
4
""" You live in the city of Cartesia where all roads are laid out in a perfect grid. You arrived ten minutes too early to an appointment, so you decided to take the opportunity to go for a short walk. The city provides its citizens with a Walk Generating App on their phones -- everytime you press the button it sends y...