blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
e4ad940ac568588877d05f12ff2013d0ea5f2aa4
DineshBE/fjod7ofofk
/d2.2.py
79
3.859375
4
x=list(input()) y=list(reversed(x)) if(x==y): print('yes') else: print('no')
d9d29e3ad76408f866807dab2b6615638fa37ba7
MrHamdulay/csc3-capstone
/examples/data/Assignment_6/kndsit001/question4.py
573
3.90625
4
"""Program to categorize marks Sithasibanzi Kondleka 24 April 2014""" marks = input("Enter a space-separated list of marks:\n") mark = marks.split(" ") #print(mark) #assigning variables to print the axes a = "1 |" b = "2+|" c = "2-|" d = "3 |" e = "F |" for i in mark: #categorizing the marks if ...
dc2985cf1f2aa7f175e02fb4a1da1c2ef33dd3a9
omarbagna/firstPyhtonRepo
/paulTask.py
1,796
4.21875
4
#Defining a function to calculate the range of values. def calcValues(low_num,upper_num,choice): evenlist = []#Defining an even list array to hold even numbers oddlist = []#Defining an odd list array to hold odd numbers #statement outputs a list of even numbers or odd numbers within the range depending o...
4048c025d607ffac7fd2675d8b02733d8a8bdbf1
yipjoe/quiz
/quiz.py
215
3.53125
4
import json print("Hello World") with open('part2.json') as json_file: data = json.load(json_file) for p in data['quiz']: print('Question Number' + " : " + p['question_no']) print(p['question']) print('')
4b139af0f980350718e06b2cabe8ded3da7d3a0c
WaleedRanaC/Prog-Fund-1
/Lab 7/RandomNumbers.py
362
3.59375
4
import random #constants ROWS=3 COLS=4 def main(): #create a 2-d list values=[[0,0,0,0], [0,0,0,0], [0,0,0,0]] #fill w/ random numbers for r in range(ROWS): for c in range(COLS): values[r][c]=random.randint(1,100) #display list ...
1a06669af32d0eb75659ab44117a984efbc758da
satya-sudo/Cses
/pemutation.py
269
3.921875
4
if __name__ == '__main__': n = int(input()) if (n != 3 and n != 2): for i in range(n-1,0,-2): print(i,end=" ") for j in range(n,0,-2): print(j,end=" ") print() else: print("NO SOLUTION")
f5a51d39a9d206bfed6bb8714202c04b8b14edd7
Axect/PL2020
/07_root/main.py
607
3.828125
4
from bisect_method import bisect, log import numpy as np import matplotlib.pyplot as plt # Root root1 = bisect(lambda x: 2**x - 2 - x, 0, 10) root2 = bisect(lambda x: x - log(x+2, 2), 0, 10) root3 = bisect(lambda x: 2**x - 2 - log(x+2, 2), 0, 10) print(root1) print(root2) print(root3) # Plot x = np.arange(-1, 4, 0.0...
959e7972d5908e8d2e089b5146771074fe34563f
rack-leen/python-tutorial-notes
/chapter5_data_structures/set_example.py
622
3.859375
4
#!/usr/bin/env python # coding=utf-8 ''' sets集合 ''' basket = {'apple','orange','apple','pear','orange','banana'} #用{}创建sets print(basket)#不重复输出元素 #判断sets中的value是否在字典中 a = 'orange' in basket print(a) b = 'cranfg' in basket print(b) #对两个单词的操作 a = set('abracadabra') b = set('alacazam') print(a) #不重复输出a中的字母 c = a - b #相...
b6c055acf874acf5f40bb64c58740e9594c8413b
EricMontague/Leetcode-Solutions
/medium/problem_131_palindrome_partitioning.py
2,692
3.625
4
"""This file contains my solutions to Leetcode problem 131.""" class Solution: def partition(self, string: str) -> List[List[str]]: if not string: return [""] palindrome_partitions = [] current_partition = [] self.generate_partitions( string, 0, ...
a99a3a05c9a8b643ae8e71dafcc71c5a94840efa
nkukarl/myCoffeeProj
/test.py
314
3.984375
4
def fibo(n): """ Args: n: positive integer Returns: nth fibo number """ if n == 1 or n == 2: return 1 a, b = 1, 1 while n - 2: a, b = b, a + b n -= 1 return b if __name__ == "__main__": for i in range(1, 10): print i, fibo(i)
3741cc0fb62a921e2ceecc1d2dfafafc01552235
ShenTonyM/LeetCode-Learn
/Q189RotateArray.py
1,130
4.03125
4
# class Solution1: # def rotate(self, nums, k): # """ # :type nums: List[int] # :type k: int # :rtype: void Do not return anything, modify nums in-place instead. # """ # # length = len(nums) # # new_nums = [0 for x in range(length)] # for old_index in ...
fa5541a2f4993b1dc264deab7cdc4e150eed21bf
lwesterl/Level-Jump-Game
/game_files/config.py
13,962
3.578125
4
import os class Config(): # class variables, these are read from config file # other classes use these (below are the standard values) # this means that in the main Config object needs to be created first and read_config method called # when Config object is created level_number = 0 # this ...
37f719b7f9740d940d96abf6bb07a3733347f4e2
xpenalosa/YouTubeDataApiReader
/youtube_data_reader/api/request_handler.py
1,316
3.796875
4
import json from urllib.parse import urljoin import requests _DOMAIN = "https://www.googleapis.com/youtube/v3/" def _extract_error(response_body: dict) -> str: """Parse the JSON response from a failed request to the Youtube Data API and extracts the error(s). Expects the body to contain an error API respon...
4e1cc504cac8ac3c91a0ef06f2ff0a1f577fe18d
huiup/python_notes
/数据结构/二分查找/二分查找.py
635
3.5625
4
''' 二分查找只能作用在有序序列中 ''' def find(alist, item): find = False low = 0 high = len(alist)-1 while low <= high:#小于等于 mid = (low + high) // 2 if item < alist[mid]:# 查找的元素小于中间元素,则查找的元素在中间元素的左侧 high = mid - 1#low和high就可以表示新序列的范围 elif item > alist[mid]:# 查找的元素在中间元素的右...
17a4dbc0ab87f58f589ae7820642b36a47fea8e8
zzy1120716/my-nine-chapter
/ch03/optional/0148-sort-colors.py
1,476
4.0625
4
""" 148. 颜色分类 给定一个包含红,白,蓝且长度为 n 的数组,将数组 元素进行分类使相同颜色的元素相邻,并按照红、白、蓝 的顺序进行排序。 我们可以使用整数 0,1 和 2 分别代表红,白,蓝。 样例 给你数组 [1, 0, 1, 2], 需要将该数组原地排序为 [0, 1, 1, 2]。 挑战 一个相当直接的解决方案是使用计数排序扫描2遍的算法。 首先,迭代数组计算 0,1,2 出现的次数,然后依次用 0,1,2 出现的次数去覆盖数组。 你否能想出一个仅使用常数级额外空间复杂度且只扫描遍历 一遍数组的算法? 注意事项 不能使用代码库中的排序函数来解决这个问题。 排序需要在原数组中进行。 """ """ 三指...
09e31f9df693a71aa5891eda212f573d130509ea
deepy/chrono
/today.py
2,251
3.5625
4
#!/usr/bin/env python3 from __future__ import print_function import os def reversed_lines(file): """Generate the lines of file in reverse order.""" part = '' for block in reversed_blocks(file): for c in reversed(block): if c == '\n' and part: yield part[::-1] ...
677bb1e247f4d290f08702ec420258b2ec023c15
aliarqish/LearnPythonTheHardWay
/difference.py
397
4.0625
4
#difference between %r and %s #first example s='spam' print(repr(s)) #with quotes print(str(s)) #without quotes #second example x="example" print "My %r" % x #with quotes print "My %s" % x #without quotes # Third Example. x = 'xxx' withR = ("Prints with quotes: %r" %x) withS = ("Prints without quotes: %s" %x) print(...
2d9f3d9e5a657b89ef3eb31201a643d257e1c87d
tbarchyn/FEAST
/InputData/input_data_classes.py
5,552
3.65625
4
""" This module defines all classes used to store input data """ from abc import ABCMeta from GeneralClassesFunctions.simulation_functions import set_kwargs_attrs class DataFile(metaclass=ABCMeta): """ DataFile is an abstract super class used to store all data files that may be called in FEAST. ...
8db42195cb5c4a72b13228b39e33abf364787d62
cauthu/shadow-browser-plugin
/newweb/tools/get-servers-from-country.py
930
3.546875
4
# read the countrycode_to_webserver_names json file, and output to # stdout the list of webserver names from the country specified in # command line # # for use to get list of servers to give to # "chrome/38.0.2125.122/model_extractor/main.py change-hostnames" # command, e.g.: # # python get-servers-from-country.py U...
d91be5ab28ab91c5da3c8761051da3cec55cae29
google-code/abj-proyecto-educacion
/logico/problemas/acciones/IApagable.py
1,194
3.609375
4
# -*- coding: utf-8 -*- class IApagable(object): """ Interfaz que es implementada por todos los objetos que pueden apagarse y encenderse. @since: 4/14/2011 @version: 1.0 """ __apagado = False """ Bandera de referencia para saber si el objeto esta apagado """ def __init__(self): """ Const...
e64ce06d03681212beffa842e7d3c337af3c86fb
mollinaca/ac
/code/practice/arc/arc020/a.py
181
3.84375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- a,b = map(int,input().split()) if abs(a) < abs(b): print ("Ant") elif abs(a) > abs(b): print ("Bug") else: print ("Draw")
ccf878b21e17dee7407ffbb311171fae693ddf8f
kearnz/autoimpute
/autoimpute/imputations/series/norm.py
3,008
3.578125
4
"""This module implements norm imputation via the NormImputer. The NormImputer imputes missing data with random draws from a construted normal distribution. Dataframe imputers utilize this class when its strategy is requested. Use SingleImputer or MultipleImputer with strategy = `norm` to broadcast the strategy across...
b8a9c3f1b2eb687dbf0ad1792442dd8006ee03a4
samuelclark907/data-structures-and-algorithms
/python/queue_with_stacks/queue_with_stacks.py
738
4
4
from stacks_and_queues.stacks_and_queues import Stack class PseudoQueue(): def __init__(self): self.main = Stack() self.temp = Stack() def __len__(self): return len(self.main) + len(self.temp) def enqueue(self, value): while not self.main.is_empty(): self.tem...
9e1b346a6fd321a14e584e94ca621f3a15ca3a6c
DanMeloso/python
/Exercicios/ex070.py
1,092
4
4
#Exercício Python 070: Crie um programa que leia o nome e o preço de vários produtos. #O programa deverá perguntar se o usuário vai continuar ou não. No final, mostre: #A) qual é o total gasto na compra. #B) quantos produtos custam mais de R$1000. #C) qual é o nome do produto mais barato. total = maiorMil = 0 maisBarat...
1d8575b5f2ca085d899410e3b52fd50ffbcef978
Zorro30/Udemy-Complete_Python_Masterclass
/Using Tkinter/tkinter_button_command_1.py
532
3.625
4
from tkinter import * class MyButtons(): def __init__(self, rootone): frame = Frame(rootone) frame.pack() self.button1 = Button(frame, text = "Click Me!", command = self.printMessage) self.button1.pack() self.button2 = Button(frame, text = "Click me to Exit!", ...
8f0d52e1810315603721b44f1769091b0258de89
bmyers624/pyapi
/sewing/topcoat.py
693
3.53125
4
#!/usr/bin/python3 import threading import time def groundcontrol(x): for i in range(x, -1, -1): print(i) time.sleep(1) def orion(): print("I forgot my socks.") time.sleep(1) print("Can we stop this ride?") time.sleep(2) print("No? Alright. Ugh. I forgot to close the garage t...
2b4911e2fc9eeeceb70b3e16c49702c02c40f090
KostaPapa/Python_Works
/Practice/a19LetterGrade.py
554
4.03125
4
def getStudentScore(): '''This funtion will get the studetn scores.''' score = float(raw_input("Enter studetn score: ")) return score def calcLetterGrade(score): '''This function will calc the letter grade.''' if (81 <= score <= 90): print "A" elif (71 <= score <= 80): print...
c9de13109437fcee44bf8c590a80ebf347edd963
Funkie42/SAP
/SAT1/satConverter.py
15,584
3.640625
4
import readFile import writeFile import interface import math import random import copy #main logic counter = 0 colNumber = 0 lineNumber = 0 # convert the array syntax to an ascending number sequence def writeNumbersInFormat(line, colmun, colNumber): numberToBeAdded = str(line * colNumber + colmun +1) return ...
2bbf96092934f178e81d209958bfd2fb31caea27
sulabhbartaula/python-data-structure
/firstRepeatingCharacter.py
624
3.921875
4
""" Description Given a string str, create a function that returns the first repeating character. If such character doesn't exist, return the null character '\0'. • Input: str = "programming" • Output: 'r' """ def main(): input_string = 'programming' firstRepeatingChar = findFirstRepeatingCharacter(input_...
db32b9131cebdce3d5f8651651b1edcd484f34a4
mabioo/Python-codewar
/未完成/1.找出给定金额的所有找零方式/test.py
1,086
3.578125
4
def temp(money,coins): coins.sort() coins.reverse() count_num = 0 i = 0 while i <len(coins): j = i count1 =1 if tempMoney > coins[i]: tempMoney = money - coins[i]*count1 count1 = count1 +1 print ("$$$$$$$$$$$$$$$$$$$$$") while ( j<len(c...
7f5bf065bd41cf1d9ac6f76ff74c44b174e7fd13
MaxytZhang/F2018-507-Project3
/proj3_choc.py
11,847
3.5
4
import sqlite3 import csv import json import pprint import textwrap # proj3_choc.py # You can change anything in this file you want as long as you pass the tests # and meet the project requirements! You will need to implement several new # functions. # Part 1: Read data from CSV and JSON into a new database called ch...
846db0ccf6f7a6d4b85f0ac0ddc835540d25cd62
Cenibee/PYALG
/python/fromBook/chapter6/string/5_group_anagrams/5-1.py
465
3.6875
4
from collections import defaultdict from typing import DefaultDict, List class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: anagram_dict = DefaultDict(list) for word in strs: anagram_dict["".join(sorted(word))].append(word) return anagram_dict.values() ...
cc72d3652a6b03f819a644aceef157df4228cba0
dnisbet/pico
/lcd/demo.py
1,577
3.703125
4
"""Example using a character LCD connected to an ESP8266.""" from time import sleep from LCD import CharLCD while True: """Run demo.""" # Initialize the LCD lcd = CharLCD(rs=0, en=1, d4=2, d5=3, d6=4, d7=5, cols=16, rows=2) # Print a 2 line centered message lcd.message('Hello',...
4fe869207f750d162f30e583bb32851af5be000b
Grande-zhu/CSCI1100
/LEC/lec03/printxyz.py
115
3.5
4
x = 4 y = 2 print(x,y,sep=' ', end='\n') print("\n"+str(x),str(y),sep=',', end='\n') print(str(x)+str(y))
288a7a7f6f05638700d209d0dd9f5f592b6a0828
tianyaqpzm/book
/source/posts/Algorithm/算法专题/树/morrisTraversal.py
696
3.828125
4
class Solution: # 既不使用递归,也不借助栈, 在O(1) 空间完成这个过程 def morrisTrav(self, root): curr = root while curr: if curr.left is None: print(curr.data, end="") curr = curr.right else: prev = curr.left while prev.right is ...
81f2ac8f566f604e94a2698d1f4575aedfa45296
embersyc/udacityproj
/movie trailer project/movie.py
1,342
3.796875
4
import webbrowser # this class contains the data for a movie class Movie(): """ Use this class to store data related to a movie. """ def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube): """ Movie class constructor. @param self: This is a special para...
eae6f6a5f09737f094e91b76e7a8abf218e2e4d6
zkazi97/Tic-Tac-Toe
/Tic_Tac_Toe_ZKazi.py
1,792
3.671875
4
# Python Project: Tic-Tac-Toe by Zain Kazi #%% Import packages import pandas as pd import numpy as np #%% Create empty board emptycol = ["","",""] initialFrame = {"A" : emptycol, "B" : emptycol, "C" : emptycol} boardFrame = pd.DataFrame(initialFrame); boardFrame.index = bo...
87eb3600648bc571b7295f8de25f30e35bac2939
lihujun101/LeetCode
/LinkList/L707_design-linked-listt.py
2,841
3.75
4
class Node(object): def __init__(self, val=None, next=None): self.val = val self.next = next class MyLinkedList(object): # root->Node(1)->Node(2) def __init__(self): self.root = Node() self.tailnode = None self.length = 0 def get(self, index): if index ...
ef955b223785b6f866652a9a4d5d38453301891c
HavinLeung/CSES-problem-set
/permutations/permutations.py
297
3.828125
4
n = int(input()) if n == 1: print(1) elif n in (2,3): print("NO SOLUTION") else: def first(): for i in range(n, 0, -2): print(i, end=' ') def second(): for i in range(n-1, 0, -2): print(i, end=' ') if n%2==0: second() first() else: first() second()
abaff474d4c460857103323418c7e4b30b896fdc
avin82/PythonFoundation
/my_turtle_moves.py
195
3.703125
4
import turtle turtle = turtle.Turtle() turtle.speed(20) def make_moves(distance): turtle.forward(distance) turtle.left(distance) x = 1 while x < 190: make_moves(x) x = x + 1
68ff7f633eb13ed8e1cadfb6a145f762378e9d60
santosclaudinei/Python_Geek_University
/sec08_ex24.py
233
3.65625
4
def arvore(largura): tamanho = largura + 1 for i in range(1, tamanho): anterior = i - 1 simbolo = '*' print(f'{(anterior + i) * simbolo} ') largura = int(input('Informe a largura: ')) arvore(largura)
1032656b5f2f148b8d0ec2caac7b779568b36a1a
david-mclnnis/iot-computing-arduino-script
/cheaper02/example/chapter02-grammer-statementfor.py
134
3.78125
4
# 반복문 sum01 = 0 for x in range(0,9): sum01 = sum01 + x print(sum01) sum02 = 0 while sum02 < 9: sum02 += 1 print(sum02)
3f744de85b595cbdf474f6614a67eb68a89d7a6b
rmitio/CursoEmVideo
/Desafio029.py
431
3.78125
4
#DESAFIO029 Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 ppor cada km acima do limite. v = int(input('Digite a velocidade do carro: ')) if v > 80 : u = 7 * (v - 80) print('VOCÊ EXCEDEU O LIMITE DE VE...
e1251011dffaca9d5edb06b8f5835b4af8194925
skynetshrugged/paip-python
/run_examples.py
1,431
3.828125
4
s = "jajkfhdjbaoioiebcjhb" count = 0 for x in s: if x in "aeiou": count+=1 print(count) d = "aeiou" c = 0 for x in s: if x in d: c+=1 print(c) print(list(s)) y = dict() t = list(s) z = [] for x in t: if x in "aeiou": y[x] = y.get(x, 0) + 1 for x,y in y.items(): z.append( (y...
eac579c99580333e49b124ab265647118cc3ff66
JevgeniPillau/Algorythms
/lesson _02/lesson_02_task08.py
699
4.03125
4
'''8. Посчитать, сколько раз встречается определенная цифра в введенной последовательности чисел. Количество вводимых чисел и цифра, которую необходимо посчитать, задаются вводом с клавиатуры.''' seq = int(input('how many sequences of numbers will be?: ')) num = int(input('what number i will count?: ')) counter = 0 fo...
7a1b99a61715d0d6fbc36e2851a80fcb3a6615dd
agnaka/CEV-Python-Exercicios
/Pacote-download/Exercicios/ex076.py
464
3.796875
4
print('-' * 42) print(f'LISTAGEM DE PREÇOS'.center(42)) print('-' * 42) lista = ('Lápis', 1.75, 'Borracha', 2.00, 'Caderno', 15.00, 'Estojo', 25.00, 'Transferidor', 4.20, 'Compasso', 9.99, 'Mochila', 120.32, 'Canetas', 22.30, 'Livro', 34.9) # print(lista) # print(len(lista)) for item in range(0,len(lista), 2): prin...
4cef68dd503e276590f32fbd302dd7dc2130fcd7
zhanghui0228/study
/python_Basics/RegularExpression/regular_re_module.py
1,427
3.5625
4
#re模块 ''' re模块 findall()的使用 search()的使用 group()和groups()的使用 split()正则分割 Sub()正则替换 ''' """ re模块: re.I re.IGNORECASE 不区分大小写的匹配 re.L re.LOCALE 根据所使用的本地语言通过\w、\W、\b、\B、\s、\S实现匹配 re.M re.MULTILINE ^和$分别匹配目标字符串中的起始和结尾,而不是严格匹配整个字符串本身的起始和结尾 re.S ...
da9b5fffd03a0bb30ddfea80e0a5d444eba963e2
tjwjdgks/algorithm
/프로그래머스/두 개 뽑아서 더하기/test.py
325
3.71875
4
def solution(numbers): answers = set(); for i in range(len(numbers)): for j in range(len(numbers)): if i==j : continue answers.add(numbers[i]+numbers[j]) answer = list(answers) answer.sort() return answer if __name__ == "__main__" : b = [2,1,3,4,1] a = soluti...
af395d85a1322048dc4597b2a31931eeaaff755c
DSCBUK/project-euler
/problem2-thegezy.py
956
4.15625
4
'''Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms....
2fe4d12f458f5a8868fffe83d0367410a9929f0b
OdeclasV/movie_website
/media.py
1,363
3.90625
4
import webbrowser class Movie(): ''' This class provides a way to store movie related information ''' '''This is a constant variable (class variable), and Google StyleGuide says that these type of variables should be spelled out in all caps''' VALID_RATINGS = ["G", "PG", "PG-13", "R"] def __init__(self, movie_...
103a556747bbad7e5d221ca3315d032548f3b160
semanticmx/grupak_sys
/calculadora.py
1,248
4.3125
4
""" Implementa una calculadora que suma, resta, multiplica, divide y obtiene el residuo entero de una división """ def suma(x, y): """ suma x + y """ return x + y def resta(x, y): """ resta x - y """ return x - y def multiplicacion(x, y): """ multiplica x * y """ ...
0c207648f09a038a952c549e9b9eab883d48bc66
a100kpm/daily_training
/problem 0192.py
865
4.09375
4
''' Good morning! Here's your coding interview problem for today. This problem was asked by Google. You are given an array of nonnegative integers. Let's say you start at the beginning of the array and are trying to advance to the end. You can advance at most, the number of steps that you're currently on. Determi...
bb6dd2ad6ac004fa3045005809ccfc46089f67da
bousmahafaycal/tricks_python
/couleur.py
1,964
3.5
4
""" Module permettant d'écrire en couleur dans le terminal, de modifier l'intensité des couleurs etc ... Créé le 02/04/2017 Par Fayçal Bousmaha Codes SGR complets : https://en.wikipedia.org/wiki/ANSI_escape_code#graphics """ class Couleur: # Voici les codes couleurs : BLACK = 0 RED = 1 GREEN = 2 YELLOW = 3 BLUE...
4ea51ac49b84f2f09627ad41a0240309bee023f5
cs-learning-2019/python1fri
/Lessons/Week5/Getting_Started_With_Processing/Getting_Started_With_Processing.pyde
1,900
4.1875
4
# Focus Learning: Python Level 1 # Getting started with Processing # Kavan Lam # March 5, 2021 def setup(): print("Setting up my project") size(700, 700) def draw(): fill(255, 255, 0) rect(0, 200, 50, 50) # rect = rectangle eg/ rect(x, y, length, width) and x, y is the top left corner ...
a6a740dff7968c59177be09dde5b7407e58ed162
reddeers77/pythonTkinter
/bouncingBallAcceleration.py
743
3.5625
4
# -*- coding: utf-8 -*- """ Created on Fri Apr 16 16:10:21 2021 @author: Egemen G """ from tkinter import * from random import randint tk = Tk() W,H = 400,400 r = 50 ball_coords = ((W/2)-(r/2)), r+10, ((W/2)+(r/2)), ( 2*r )+10 canvas = Canvas(tk, width=W, height=H) canvas.pack() ball = canvas.create_oval( ...
ea14236143f485458bd7fbffa84591ea52eb8875
yred/euler
/python/problem_048.py
327
3.625
4
# -*- coding: utf-8 -*- """ Problem 48 - Self powers The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. """ def solution(): return sum(pow(n, n, 10**10) for n in range(1, 1001)) % 10**10 if __name__ == '__main__': print(solut...
65fe03b93606ebaec296277ac347f37b3d6ddc78
JaiminiNayee/hhaccessibility.github.io
/importers/utils/csv_filter.py
3,323
3.625
4
""" This script is useful for filtering locations from a CSV to a specific latitude and longitude range. """ import csv import sys from import_helpers.task_loader import get_import_config from import_helpers.import_config_interpreter import get_location_field def filter_csv(min_longitude, max_longitude, min_latitude,...
08f4e9e846c4cb9dab391bb465eba8ba992dc697
stromatolith/peabox
/algorithms/PSO/PSO_defs.py
14,731
3.984375
4
#!python """ my trial at implementing the particle swarm optimisation algorithm What is PSO? Imagine you're sitting in a rolling supermarket trolley with a bungee rope and an anchor in your hand, that allows you to hook up t a truck to get pulled along or to a lantern pole. Attached to a lantern pole you will be on an...
3273697cd996d9192ce36604368535e2d470dbbb
zhenyat/Rob
/ground/rpigpio/rpi_gpio_demo_1.py
1,060
3.53125
4
#!/usr/bin/env python3 ################################################################################ # rpi_gpio_demo.py # # Demo samples for RPi.GPIO # # 03.07.2019 Created by: zhenya ################################################################################ import RPi.GPIO as GPIO import time from pp...
372e73e9e433bbb49bc7041ce6792b7b4c2fbcdf
green-fox-academy/Niloofar3275
/week4-day1/Greeterfunction.py
334
4.125
4
al = "Green fox" def greet(a): x = " Greetings , dear " + a return x Greeting = greet(al) print(Greeting) # - Create variable named `al` and assign the value `Green Fox` to it # - Create a function called `greet` that greets it's input parameter # - Greeting is printing e.g. `Greetings, dear Green Fox` ...
522d4b820c91fdfaecec569d7ccf440b236675d6
bbert9/Data-Analyst-Nanodegree-Program
/No-show datset/Investigate_the_no_show_dataset (2).py
9,773
3.59375
4
#!/usr/bin/env python # coding: utf-8 # # # Project: Investigate the No-show dataset # # ## Table of Contents # <ul> # <li><a href="#intro">Introduction</a></li> # <li><a href="#wrangling">Data Wrangling</a></li> # <li><a href="#eda">Exploratory Data Analysis</a></li> # <li><a href="#conclusions">Conclusions</a></li...
aa6e89d58bae51ffab5f87a51b4d7fbe3c702277
linchengzeng/day7
/test_file/test_class.py
769
3.96875
4
# -*- coding:utf-8 -*- # Author:aling class Person(object): def __init__(self,name,age): #self = b, self.name = b.name self.name = name self.age = age def talk(self): print('person is talking.....') class BlackPerson(Person): def __init__(self,name,age,power):#先继承,再重构 P...
51d32c4138544ed3f7751336e1cd1dc5553bdc9e
ClaudioBotelhOSB/CompetitiveProgramming
/Codeforces/Round #682 (Div. 2)/682_D2_A.py
107
3.609375
4
for t in range(int(input())): x = int(input()) res= "" for i in range(x): res+="1 " print(res)
3d36464ebdad066f7aaa74d34a509715f466b4cf
tinbolw/Python-Stuff
/madlibs game.py
219
3.703125
4
color = input("Enter a color: ") plural_noun = input("Enter a plural noun: ") thing = input("Enter a thing: ") print("Roses are" + " " + color + ",") print(plural_noun + " " + "are blue,") print("I need " + thing)
bf54a9354ad1bef2d84a7db12d1a10c0fe6fddc7
miguel-dev/holberton-system_engineering-devops
/0x16-api_advanced/1-top_ten.py
675
3.5625
4
#!/usr/bin/python3 """ Queries Reddit API and prints the titles of the first 10 hot posts a given subreddit """ import requests def top_ten(subreddit): """Prints titles of first 10 hot posts of a given subreddit""" url = 'https://api.reddit.com/r/{}/hot?limit=10'.format(subreddit) headers = {'user-agent':...
2a575c466df0625026e206b918427cfacef9712d
stellayk/Python
/ch06/6_1_Class.py
835
3.796875
4
def calc_func(a,b): x=a y=b def plus(): p=x+y return p def minus(): m=x-y return m return plus, minus p, m = calc_func(10, 20) print('plus=',p()) print('minus=',m()) class calc_class: x = y = 0 def __init__(self,a,b): self.x=a self.y=b d...
cb7e561ea7ecd16832691a6e0e3a3962231f148a
elim168/study
/python/basic/opencv/06.face_multi_check.py
754
3.515625
4
# 定位人脸区域,包含多人脸的 import cv2 image = cv2.imread('face03.jpg') # 把原图转换为灰色图片 gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # 默认的人脸检测 detector = cv2.CascadeClassifier('/home/elim/dev/projects/study/python/venv/lib/python3.6/site-packages/cv2/data/haarcascade_frontalface_default.xml') # 检测图片,返回每张人脸的信息。每张人脸包含x,y,widt...
1226e7ac786317695fcaa47a97c0b124308b04f4
harrifeng/leet-in-python
/065_valid_number.py
1,543
4.21875
4
""" Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one. """ import unittest class MyTest(unittest.TestCase): ...
8cd1f7c6f07dc071ae635c0cb3ecf8d7210fc75b
dpres/genalg
/Atom_w_Gene.py
8,874
3.5625
4
import numpy as np import random as random class Gene: """Gene class contains x and y coords (float-types) and identities (int-types)""" index = 0 def __init__(self, value): self._value = value Gene.index += 1 def report_value(self): """reports the value of the gene""" ...
1fbd573d2647dd5c29a3520c91411ca7df852f52
incognito050924/giparang_mirror_server
/api/common/common_utils.py
374
4.125
4
from enum import Enum def enum(**enums): """ Make a Enum type. :param enums: Declare types and values what it will be represented. :return: The instance of Enum class. Example: Numbers = enum(ONE=1, TWO=2, THREE='three') >> Numbers.ONE 1 >> Numbers.TWO 2 >> Numbers.THREE ...
6996e9672e30ed401d180daeba296f22a080a8a7
cnicogd/holbertonschool-higher_level_programming
/0x06-python-classes/1-square.py
167
3.640625
4
#!/usr/bin/python3 """1-square filled by the last excersise""" class Square: """Square class assigns""" def __init__(self, size): self.__size = size
837f5dfbba9ea1bb25534735069e6fdf7020e4bc
sumanshil/TopCoder
/TopCoder/python/ntree/MaxDepthOfTree.py
1,084
3.546875
4
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def maxDepth(self, root): """ if root is None: return 0 lDepth = self.maxDepth(root.left) rDepth = self.maxDepth(root.right) ret...
8ea1b92633142538d1de7798c3ead22501957897
Indu-Palanisamy/Numbers
/digits_add.py
252
3.765625
4
try: a=int(input("Enter the value:")) sum=0 t=0 c=len(str(a)) if(a>0): for i in range(0,c): t=a%10 sum=sum+t a=a//10 print(sum) else: print("Enter only positive numbers") except ValueError: print("Enter only digits")
6bc95cd64bc12c6aa32cace1c642f4e82a999a11
pod1019/python_learning
/Interface_Test_Training/test_case/mysql_train/sql_train.py
1,209
3.515625
4
import pymysql from public import Config '''1创建连接''' conn = pymysql.connect(**Config.sql_conn_dict) '''2创建游标,用作操作数据库''' cur = conn.cursor() '''数据库操作''' # sql = 'select * from student' # cur.execute(sql) # print(cur.fetchone()) # print(cur.fetchone()) # # cur.scroll(0,mode='absolute') # 绝对移动:把游标移动到初始位置 # cur.scroll(-1...
4af4002c377583ea9921b0659d09a7439ad8f235
souvik119/157152-Introduction-to-Programming
/week 4/souvikghosh_a4.py
630
4.03125
4
############################################ # The pattern is as below: # Display number starts from 10000 # Deducted number starts from 100 # In each iteration of the loop: # - deducted number is subtracted from display number # - deducted number is in turn subtracted by 1 # - if deducted number is less than 10 reset ...
8e6cdfa57a4d624ff950d48ee64f16fa633f566a
mrFred489/AoC2017
/code12.py
594
3.546875
4
import functools f = open("data12.txt") data = dict() visited = set() for line in f: temp = line.strip("\n").split(" <-> ") data[temp[0]] = temp[1].split(", ") def visit(name, visited): children = set() for child in data[name]: if child not in visited: visited.add(child) ...
b15204302c0be9694da5164de5d2469abb1b484a
wrobdomi/AGH-UST
/01_ComputerScience/01_Python/PythonSemantics/09_control_flow_statements.py
975
4.0625
4
# There are four primary control flow statements if python: # if elif else # while loop # for loop # break, continue x = 10 y = 25 z = 20 if(x < y and x < 20): print("Yes") else: print("No") if(y // x == 1): print("x // y is 1") elif(y // x == 0): print("x // y is 0") else: print("x // y is ne...
c3df230e168f3f396c9e71f4dde84e6ab333a70f
GregApple/Number_Game
/App.py
3,206
4.3125
4
#!/usr/bin/env python3 import random #App bootup screen in the command prompt. def Welcome(): print("Welcome to Guess My Number!") print(""" Enter 'Play' to play the game. Enter 'Menu' to come back to the menu. Enter 'Exit' to quit the game. """) #Activated by the Play selection from the startup menu. d...
0909584c605ed30d7fe72a71939a8b2d3ff65d16
RaymondDashWu/SPD-2.4-Job-Search-and-Interview-Practice
/ll_problem2_reverse_linked_list.py
1,742
4.21875
4
# Given a singly-linked list, reverse the order of the list by modifying the nodes’ links. # Example: If the given linked list is A → B → C → D → E, nodes should be modified/rearranged so the list becomes E → D → C → B → A. class Node(object): def __init__(self, data): self.data = data self.next = ...
343a5661d3d98eafb430210cbf1f5d9aca7659fe
xlanor/bored
/reverse_in_place.py
857
4.28125
4
#!/usr/bin/env python """ Reverse words in place in a given string In a sentence, while preserving spaces, reverse each individual word in place. """ def reverse_in_place(current_word: list, start, end): if start >= end: return current_word current_word[start], current_word[end] = current_word[end], curren...
3351597e0d34ed8fe001d2496bed54a30f9d6326
nucleic/atom
/examples/tutorial/employee.py
2,246
3.78125
4
# -------------------------------------------------------------------------------------- # Copyright (c) 2013-2023, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # --------------------------------------...
37358a151a1e720985feafd3c391545718afedde
terasakisatoshi/pythonCodes
/scikitLearn/mlpWithTensorFlow/mlp.py
1,752
3.734375
4
""" Train MNIST dataset with Multi Layer Perceptron with tf.estimator""" import numpy as np import tensorflow as tf # load dataset (X_train, y_train), (X_test, y_test) = tf.keras.datasets.mnist.load_data() # format them its type np.float32 or np.int32 X_train = X_train.astype(np.float32).reshape(-1, 28 * 28) / 255.0 X...
566645d7920723a0cac2b4c59da36f972eb67665
josephchandlerjr/SmallPythonProjects
/ProjectEuler/p50.py
1,529
3.734375
4
""" Consecutive prime sum Problem 50 The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred. The longest sum of consecutive primes below one-thousand that adds to a prime, contain...
e7d9bf1216194e6a97fcf1a45a6c7fdc90cb8b9b
KayTate/BOMB_Bank_Simulation
/complaint.py
22,208
3.71875
4
def complaint_to_man(): print(''' Finding the service at the Bank of Mashed Beats less than desireable, you decide to speak with the manager of B.O.M.B. You glare at the employee who has given you such rudimentary service and demand that you speak to the manager. The employee stares back at yo...
bc3d7511c7a16e665d8c214c0c82cc5a60bb23e2
wzqwsrf/python-practice
/Object-Oriented-Programming/1.py
399
4.15625
4
# !/usr/bin/env python # -*- coding: utf-8 -*- # Author: Wangzhenqing <wangzhenqing1008@163.com> # Date: 2015年01月22日11:25:08 """ Problem 1: What will the output of the following program. """ class A: def f(self): return self.g() def g(self): return 'A' class B(A): def g(self): ...
16f4edb0c5b02b9b37231bc5b76678789a634f40
loidbitw/Anton
/MachineLearning/w1/ex1_multi.py
2,094
3.796875
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from ex1_utils import * ## ================ Part 1: Feature Normalization ================ print('Loading data ...','\n') print('Plotting Data ...','\n') data = pd.read_csv("ex1d...
5c27f34225efd79008f3986570f9cd9858c96886
kritikadusad/Basic-Pattern-Matching
/basic_pattern_matching.py
1,248
4.0625
4
def naive(p, t): """ Returns a list of indeces of chars in given word matching given text. p is the pattern t is the given text Example: >>> naive("ATGC", "AATGCTTTATGC") [1, 8] """ occurences = [] for i in range(len(t) - len(p) + 1): match = True for j in range(...
4594840795c44ed870fb8a50a6f185adf36caee1
parthivpatel1106/Python_hackerrank_programs
/find_a_string.py
241
4.03125
4
string=input() substring=input() count=0 print(string[2:5]) #to check the substrings print(string[4:7]) #to check the substrings for i in range(len(string)-1): if(substring==string[i:len(substring)+i]): count=count+1 print(count)
0788204bfd8ccbe2bc7a31cf047a6f282959cc60
aniketchanana/python-exercise-files
/fileio/file_modes.py
412
3.671875
4
# file modes "w" "r" "r+" "a" # with open("demo1.txt","w") as file: # # file.seek(0) # file.write("Hello i am aniket") # # file.write("ll") # # print(file.__repr__()) # with open("demo.txt","r") as file: # print(file.) # print(dict(a=1,b=2)) sen = "Hello i am aniket chanana" # print(sen.count("...
fdbc030f408d6133b7b1d45ad43d3f3bd1f3f470
Filipsnk/Learning
/Statistical_tests.py
9,741
3.765625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ STATISTICAL TESTS 1. NORMALITY TESTS 2. CORRELATION TESTS 3. STATIONARY TESTS 4. PARMAETRIC STATISTICAL HYPOTHESIS TESTS 5. NON PARAMETRIC STATISTICAL TESTS Normality tests Shapiro- Wilk test Assumptions 1. observations are independent Interpretation: H0...
07aac60531b98f8f33cc49d3aa6f48133aaff77e
ayushbansal323/TE
/python/class.py
232
3.65625
4
class mycomplex: def __init__(self,a,b): self.r = a self.c = b def getitinstring(self): return f"{a.r} + {a.c}i" a=mycomplex(4,5) print(a.getitinstring()) class myclass: r = 1 c = 2 a=myclass() print(f"{a.r} + {a.c}i")
6e49fd62ab09d68cd4f6e6e326820e113e1f0e0f
Tranqui11ion/Crypto-scraper
/menu.py
1,441
3.6875
4
import logging import csv from app import coins logger = logging.getLogger('scraping.menu') USER_CHOICE = '''Enter one of the following - 'p' print coins - 'e' export to file - 'q' to exit Enter your choice: ''' def print_coins(): logger.info("Printing coins...") for coin in coins: print(coin) def...
1a19726bf4473a3c888474bde865c8bbd81ac482
dkraczkowski/opyapi
/opyapi/schema/formatters/boolean.py
373
3.5625
4
from typing import Any def format_boolean(value: Any) -> bool: if isinstance(value, str): value = value.lower() if value in (0, 0.0, "0", False, "no", "n", "nope", "false"): return False if value in (1, 1.0, "1", True, "ok", "yes", "y", "yup", "true"): return True raise ValueE...
810eda6bbbc263748d11416825b07f37c982ba99
LucyCo/small-exercises
/squares.py
224
3.734375
4
def squares(x): return [x**2 for x in range(1, x+1)] def dict_squares(x): return {x: x**2 for x in range(1, x+1)} def main(): print squares(3) print dict_squares(3) if __name__ == '__main__': main()
9ed672d115c966ef6323c2bffc284482b94dfd7f
Ashkaneslamiii/Pytthon
/Untitled-6.py
216
3.953125
4
def fibonaci (n): if n<0: print("Incorrect Input ") elif n == 0: return 0 elif n == 1: return 1 else: return fibonaci(n-1) + fibonaci(n-2) print(fibonaci(9))
0f058bf3474d3b1b6975d08660e132389174a84a
Fr4nc3/code-hints
/leetcode/FrequencyInArray.py
1,319
3.84375
4
# Given an array of integers a, your task is to calculate the digits that occur the most number of times in the array. # Return the array of these digits in ascending order. # Example # For a = [25, 2, 3, 57, 38, 41], the output should be solution(a) = [2, 3, 5]. # Here are the number of times each digit appears in...
dc2b0be67886b61cb063c9a71ef9b7f8f5a9ceb7
hz336/Algorithm
/LeetCode/DP/H Russian Doll Envelopes.py
2,922
4.28125
4
""" You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope. What is the maximum number of envelopes can you Russian doll? (put one in...
accf949ca8d60c5aba8be637dc2a763eccde4971
GedasLuko/Python
/circle.py
424
4.1875
4
#Gediminas Lukosevicius #October 3rd, 2016 © #The circle module has functions that perform calculations related to circles import math #the area functions accepts a circle's radius as an argument and returns the #are of the circle def area(radius): return math.pi * radius ** 2 #the circumference function accepts...
2a2c9affa62e27201bca1902c52dee30cee3097e
justinharringa/aprendendo-python
/2020-10-04/tete/80.py
601
3.984375
4
# Usuario Lista # 3 [] # 2 [3] # 4 [2,3] # 5 [2,3,4] # 1 [2,3,4,5] # [1,2,3,4,5] numeros = [] for _ in range(5): print(f'a lista agora é: {numeros}') numero = int(input("me de um numero rapaz: ")) ...
973a01f2885aa639a017f1989bee0f6f8a735e2a
balrog-nona/learning_python
/git_training/git_calculator.py
865
3.546875
4
""" nacvik odstranovani konfliktu """ class StringCalculator: def add(self, a): if a: return 0 else: if a[0] == "/": delimiter = a[2] else: delimiter = "^" if "\n" in a: a = a.replace("\n", delimiter) ...