blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3a2757a475ab406af61d18d472f6e98c8c6c6486
xiaojiangzhang/algorithm010
/Week09/Assignment/[85]最大矩形.py
1,106
3.578125
4
# 给定一个仅包含 0 和 1 的二维二进制矩阵,找出只包含 1 的最大矩形,并返回其面积。 # # 示例: # # 输入: # [ # ["1","0","1","0","0"], # ["1","0","1","1","1"], # ["1","1","1","1","1"], # ["1","0","0","1","0"] # ] # 输出: 6 # Related Topics 栈 数组 哈希表 动态规划 # 👍 539 👎 0 # leetcode submit region begin(Prohibit modification and deletion) class Solu...
a457e98793396b428a5c0620b50861b481faa2d9
Apizz789/DATA_STRUCTURES_AND_ALGORITHM
/LAB_04_Queue/4.4.py
3,083
3.796875
4
class Queue: def __init__(self): self.item = [] def enqueue(self, data): self.item.append(data) def dequeue(self): self.item.pop(0) def print_program1(self): print('My Activity:Location = ', end='') i = 0 while i < len(self.item)-1: pri...
d55e1469880f9f4db974e21f739e4e1d8373c49b
jshafto/tdd_project
/app/roman_numerals.py
354
3.5625
4
def parse(numeral): translator = { "I":1, "V":5, "X":10, "L":50, "C": 100, "D": 500, "M": 1000 } vals = [translator[c] for c in numeral] total = 0 for i in range(len(vals)-1): if vals[i]>=vals[i+1]: total+=vals[i] else: total-=vals[i] total += vals[-1] ret...
4bf45238e5fafadf8406218b3f0301e6abfad53b
kamladi/harder_puzzles
/flow/flow.py
8,189
3.671875
4
from random import randint import time import copy # Pipe object to connect End Points class Pipe(object): def __init__(self, color): self.color = color def __str__(self): return "Pipe:" + str(self.color) # End Points set at beginning of game class EndPoint(object): def __init__(self, col...
4a7f97a31ff4fe52d0da8992feb3b9713ad218cb
DzulCancheJ/Ejercicios-Python
/Programa7.py
264
3.90625
4
#Programa 7 Intervalo de cuadrados de n numeros mayores a 100 numero=int(input("Ingresa un numero: ")) def intervalo(X): for x in range(X): resultado = pow(x+1,2) if resultado>100: print(x+1,"^2 es:", resultado) intervalo(numero)
f33e5381871821b2d9d2bfae7577a75131a1c943
breadpitt/SystemsProgramming
/python_stuff/tuple_test.py
119
3.71875
4
#!/usr/local/bin/python3 tuple = ("hello", 3, 4) print(tuple[0]) print(tuple[1]) print(tuple) f = tuple[0] print(f)
615f4b371a0aaebfe9cee01c80a11a8b9875164a
tahir24434/py-ds-algo
/src/main/python/pdsa/lib/Heaps/max_heap.py
6,730
4.0625
4
""" Binary Heap Data Structure is an array object that we can view as a nearly complete binary tree. The tree is completely filled on all levels except possibly the lowest, which is filled from the left up to a point. In a max-heap, the max-heap property is that for every node i other than the root, A[Parent(i)] >= A[...
d77424cb96b871a0319ca766f6bdfbf174162c4c
MandeepSingh35/Training
/table.py
124
3.828125
4
a = int(input("Enter the number of which table you want to print")) for i in range(1, 11): print(i , " X ", a, " = ", i*a )
32de5f1a1efd188c92992adf668a483f4482f66b
Jasoncho1125/PythonTest
/py_p167.py
282
3.796875
4
import turtle import random import time t = turtle.Turtle() t.speed(0) t.width(3) colors = ["red","green","blue","orange","purple","pink","yellow"] for angle in range(100): t.color(random.choice(colors)) t.left(angle * 7) t.circle(100) time.sleep(3) # t.mainloop()
136cd2871e62c6d1cdf071d2e523926611196b01
MajorGerman/Python-Programming-Georg-Laabe
/Депозит и Футбольная команда.py
1,447
3.9375
4
#Набор в футбольную команду print("Программа набора в футбольную команду") while True: sex = input("Выберите пол (М/Ж) : ") if sex == "Ж": print("Вы нам не подходите!");break elif sex == "М": age = int(input("Введите ваш возраст: ")) if age in range (16,19): prin...
2bf16a28b351a74c94ccdc2849442ecf7eb7a595
AbbelDawit/Python
/Float_Average/FloatAverage.py
458
4.21875
4
#Name: Abbel Dawit #Date: 09/15/2015 #Email: abbeldawit@gmail.com #Description: Script takes in 3 floating point numbers and calculates the average. def main(): number1 = input("Please enter a floating point number: ") number2 = input("Please enter a floating point number: ") number3 ...
9b63444f7b4e4aad95011a034a8644a52af82515
JigarShah110/Python
/Pattern/pattern1.py
548
3.953125
4
class SimplePlaybutton: row_counter = 1 # Class variable for counting row def __init__(self): """Constructor of which will be called automatically""" self.height = input("Enter Height: ") self.symbol = "*" self.total_height = self.height*2 - 1 def draw(self): """Method which will draw pattern""" for ro...
90d8dbb82881991a3818bebf5c426f114d44b7ec
katherinehuwu/Word_Fit
/vocab_resources/lemma.py
516
3.8125
4
"""Creates a lemmatized dictionary of all academic words""" def create_lemma_dict(lemma_file): """Creates a dictionary of lemmatized academic words. For each pair, the key is the word inflection; the value is the stem.""" academic_words= open(lemma_file) LEMMA_DICT = {} for line in academic_words: line =line...
6015fef2dbd9cb7ab940198eb30b57b11c7db6b6
Oussama1342/RecomandationSystem
/FonctionModuChap5.py
1,220
3.8125
4
import math def table_par_7(): nb = 7 i = 0 # Notre compteur ! L'auriez-vous oublié ? while i < 10: # Tant que i est strictement inférieure à 10, print(i + 1, "*", nb, "=", (i + 1) * nb) i += 1 # On incrémente i de 1 à chaque tour de boucle. ########################...
2f3c0ff1eb25456fb23571150c0f3377b723f8a9
QuartzShard/Turtle-Client-and-server
/Client/Programs/TestTurt2.py
191
3.859375
4
import turtle def triangle(length): for i in range(3): turtle.forward(length) turt.right(120) for i in range(8): triangle(25) turtle.right(45) turt.exitonclick()
465da8501ba191711ea6566a7ac1d240dc515def
BlueMonday/advent_2015
/12/12.py
697
3.859375
4
#!/usr/bin/env python import json import sys def sum_of_all_numbers(o): if isinstance(o, dict): sum_of_dict = 0 for _, v in o.items(): if v == 'red': return 0 sum_of_dict += sum_of_all_numbers(v) return sum_of_dict elif isinstance(o, list): ...
f9c19d43cf8d0aaa75e34122549883049b837d49
Hassanabazim/Python-for-Everybody-Specialization
/2- Python Data Structure/Week_4/8.5.py
1,008
4.375
4
''' 8.5 Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line: From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who s...
e066645abef01fe4754cb6d545dc7645c1e1e2a7
dpaneda/code
/jams/euler/29.py
147
3.75
4
#!/usr/bin/env python3 MAX = 100 terms = set() for a in range(2, MAX + 1): for b in range(2, MAX + 1): terms.add(a**b) print(len(terms))
40593a314660770b97667c58bb78a7d880d93f66
RonaldoDs/...
/ListaDuplamenteEncadeada.py
2,954
3.578125
4
'''Universidade Federal de Pernambuco (UFPE) (http://www.ufpe.br) Centro de Informtica (CIn) (http://www.cin.ufpe.br) Graduando em Sistemas de Informao Autor: Ronaldo Daniel da Silva (rds) Email: rds@cin.ufpe.br Data: 06/06/2018 Descrio: Implementao de Lista Duplamente Encadeada utilizando POO. Copyri...
f5e08be961af6b18383ea6bfef138fa1ff3ee06c
xiangkangjw/interview_questions
/leetcode/python/103_binary_tree_zigzag_level_order_traversal.py
1,121
3.78125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def zigzagLevelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ ...
bde33bdc63fd18132677c34354f3b92c5965c16e
j16949/Programming-in-Python-princeton
/1.5/test.py
214
3.890625
4
#num_list = [1, 2, 2, 4, 5] num_list=[1, 1, 0, 2, 0, 0, 8, 3, 0, 2, 5, 0, 2, 6] print(num_list) for item in num_list: if item == 0: num_list.remove(item) else: print(item) print(num_list)
328b1e2d82cf4b201e8a556d22f979993ab903ba
praj0098/income-prediction
/Assignment/prime and armstrong.py
817
3.796875
4
## prime numbers 100 to 300 ## brute force ##prime=[] ##for i in range(100,301): ## c=0 ## for j in range(1,i+1): ## ## if(i%j==0): ## c+=1 ## ## if(c==2): ## prime.append(i) ## ##print(*prime) ################################################################## ########...
97b02768d943030313bffacb0beb32c886b35942
HankerZheng/LeetCode-Problems
/python/064_Minimum_Path_Sum.py
1,219
3.59375
4
# Given a m x n grid filled with non-negative numbers, # find a path from top left to bottom right which minimizes # the sum of all numbers along its path. # Note: You can only move either down or right at any point in time. # Subscribe to see which companies asked this question # Key Point: DP # Subprobl...
b7670eae848e3cfb0accc93a3f83df89a4893d9a
kxu68/BMSE
/examples/AY_2017_2018/semester_1/Week 6- Object-oriented design/original_person.py
12,522
3.65625
4
""" Person, with heredity and other characteristics :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> :Date: 2017-10-12 :Copyright: 2017, Arthur Goldberg :License: MIT """ class Person(object): """ Person Attributes: name (:obj:`str`): a person's name gender (:obj:`str`): a person's gender ...
65c6ca4ec30f1cd82061c562bf3b3c0f64ef5a2c
RRoundTable/Data_Structure_Study
/sort/RedixSort.py
946
3.546875
4
import random import time import numpy as np N=100 lstNumbers=list(range(N)) random.seed(1) random.shuffle(lstNumbers) print(lstNumbers) def get_digit(num, index): """ :param num: 10진법 숫자 :param index :return: index번째 digit """ return int(num / (10 ** index)) % int(10) def reditSort(lstNum)...
62ec91bdabcd51a880eeb034e1af43683981fc95
yaoYiheng/PythonPractice
/小甲鱼练习/@course_1.py
369
4.15625
4
import math def area_triangle_sss(side1,side2,side3): """ Return area of a triangle, given the lenths of its three sides. """ #Heron's formula semi_perim = (side1 + side2 + side3)/2.0 return math.sqrt(semi_perim * (semi_perim - side1) * (semi_perim - sid...
fecf837113a250656d7e73d849b658b6ebc49d99
tflhyl/FFXIII-2ClockSolver
/FFXIII-2ClockSolver.py
1,431
3.625
4
CLOCK_SIZE = 12 def get_input(): input = raw_input("Enter clocks (12 values from top-most clockwise): ").strip() if len(input) != CLOCK_SIZE*2 - 1: print 'Invalid size!' return None else: return input.split(" ") #idx - index of current node #val - value of current node #d ...
dee02b6a94621111f1c2cee39cc6a9ff9cc14b42
codeAligned/coding-practice
/Pramp/flatten-dictionary.py
1,036
4.09375
4
""" Given a dictionary, write a function to flatten it. Consider the following input/output scenario for better understanding: Input: { 'Key1': '1', 'Key2': { 'a' : '2', 'b' : '3', 'c' : { 'd' : '3', 'e' : '1' } } } Output: { 'Key1': '1', 'Key2.a': '2', 'Key2.b' : '3', 'Key2....
67bb00cbb493f04f9505d0e547ef38f324f33fde
hsyao/algorithm
/模拟训练/day04/选择排序.py
692
3.75
4
""" """ def selection_sort(alist): n = len(alist) # 需要进行n-1次选择操作 for i in range(n - 1): # 记录最小位置 min_index = i # 从i+1位置到末尾选择出最小数据 for j in range(i + 1, n): if alist[j] < alist[min_index]: min_index = j # 如果选择出的数据不再正确位置,进行交换 if m...
2fd9b7437e551b978626abb1831a564392085209
quyixiao/python_lesson
/listxx.py
134
3.5625
4
list = [1,2,3,"zhangsan",{"username":"瞿贻晓","age":28}] print(list) print(list[3]) a = {"username":"瞿贻晓","age":28} print(a)
91c49b4d072a76342baa8aef9c90dfdc27379a39
Mariappan/LearnPython
/Excercises/findListSizeInArray.py
328
3.671875
4
#!/usr/bin/env python def solution(A): # write your code in Python 3.6 index=0 count=0 viewedIndex = set() while (index not in viewedIndex) and index !=-1: viewedIndex.add(index) index=A[index] count+=1 return count a = [1, 4, -1, 3, 2] print ("Count is " + str(soluti...
13babfebfa5b92a403ac897a5afbec2c45f7d5eb
panbenson/adventofcode2020
/13.py
2,931
3.71875
4
def load_file(file: str): lines = [] # just load all the lines with open(file, 'r') as reader: lines = [line.strip() for line in reader] return (int(lines[0]), lines[1].split(',')) def day_thirteen_part_one(file: str): start, busses = load_file(file) # ignoring x for now busses = ...
e879db6b80eb1ee188075a8c073fff04cd9f1c29
ryanyoon/lovelybot-emotion
/tasks.py
1,377
3.640625
4
from microsoftbotframework import ReplyToActivity import requests import json # https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment """ POST https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment Ocp-Apim-Subscription-Key:4cfe6f744f1b486db3fa83d874bafdd9 Content-Type:application/...
4288d3f3da61b534747ae75adfccff220f5882d7
ultraasi-atanas/MIT-6.00.1x-Exercises
/MIT6.00.1x-Week2-function-iteration-vs-recursion.py
1,779
4.4375
4
# -*- coding: utf-8 -*- """ Created on Thu Oct 8 16:56:41 2020 @author: Atnaas Kozarev - github.com/ultraasi-atanas Week 2 MIT 6.00.1x Introduction to Computer Science and Programming Using Python https://learning.edx.org/course/course-v1:MITx+6.00.1x+2T2020a """ # Exercise: iter power - Your code must be iterative -...
79a25e7eebd5c187e1e95b8bdc9bd7a51c2b83ed
laurentziudmm/PythonProject
/Exercices/dictionary.py
651
3.84375
4
# name: John Smith # email: john # phone: # customer = { # "name":"John Smith", # "age": 30, # "is_verified":True # } # customer["name"] = "Jack Smith" # customer["birthdate"] = "Yan 1 1980" # # print(customer["name"]) # # print(customer.get("birthdate", "yan 1 1980")) # print(customer["birthdate"]) #...
041b486478ae82657129b3430669d0ffd2dea833
gargisha29/Hello-World
/If_else.py
190
4.125
4
name=input(" enter your name") age=int(input ("enter your age")) if age<30: print("your name is"+ name + "you are" + str(age) + "years Old") else: print(" You may leave")
09e9ccc2a2d468d70943fb84020c1fec902bd9d0
PeterGrainfield/AltCoder
/py/abc126_b.py
244
3.53125
4
S = input() first = int(S[0:2]) second = int(S[2:4]) if 1 <= first <= 12: if 1 <= second <= 12: print("AMBIGUOUS") else: print("MMYY") else: if 1 <= second <= 12: print("YYMM") else: print("NA")
358acaff7f6d766573773ffa7eb1e90858b44ee5
HamzaQahoush/data-structures-and-algorithms--Python
/tests/test_merge_sort.py
827
3.703125
4
from data_structures_and_algorithms_python.challenges.merge_sort.merge_sort import * def test_insert_sample(): sample_array = [8, 4, 23, 42, 16, 15] actual = f'{mergeSort(sample_array)}' expected = '[4, 8, 15, 16, 23, 42]' assert actual == expected def test_insert_reverse_sorted(): reverse_sorte...
d96fa3c5f00eb0dd32ab0fee5b69137eb0f75bfc
wecsam/CS4783-Project-1
/frequencies/json_to_brace_init.py
2,323
3.609375
4
#!/usr/bin/python3 # This script converts JSON data on STDIN to a C++ 2011 brace initialization list for a map. # Any data that is not a dict/object or list/array is left as-is. # The result is written to STDOUT. import json, sys # This class keeps track of the indentation level in the output text. class PrettyPrinter:...
d5918dba39a56ec95963f764e48017b623aead95
ChrisProgramming2018/algoritm
/Graphs/SingleCycleCheck/python/program.py
512
3.703125
4
# Check array for single cycle def hasSingleCycle(array): """ Checks the given array O(n) time | O(1) space n := length of array Args: param1:(list) array of int Return bool """ counter = 0 pos = 0 length = len(array) while counter < length: jump = array[pos]...
a5318d036c5beb3bdcae3e70e46562c7995e05ee
grosuclaudia/dojos
/firstweek/palindrom.py
297
3.890625
4
#s= input("word: ") s="abba" text = list(s) print(text) i=0 size = len(text) ispalindrom=1 while i<(size/2): n=size-1-i if text[i]==text[n]: i=i+1 else: ispalindrom=0 break if ispalindrom==1: print("a palindrom") else: print("not a palindrom")
59168227f1c34e6568c92b1c9f34688615492a87
dassowmd/UsefulTools
/hash_cash.py
742
3.546875
4
import string import random import hashlib example_challenge = "9Kzs52jSfxa65s4df6s5a4" def generation(challenge=example_challenge, size=25): answer = "".join( random.choice(string.ascii_lowercase) + random.choice(string.ascii_uppercase) + random.choice(string.digits) for x in ran...
8c707e411513ef77ccc52a7366b7f5b857289c76
wookiekim/CodingPractice
/codility/genomic_range_query.py
1,686
3.890625
4
# Find the minimal nucleotide from a range of sequence DNA # Medium ``` A DNA sequence can be represented as a string consisting of the letters A, C, G and T, which correspond to the types of successive nucleotides in the sequence. Each nucleotide has an impact factor, which is an integer. Nucleotides of types A, C...
115cab933e589c0536b236d325b9ca76a03ed9a8
chengong825/python-test
/343整数拆分.py
704
3.53125
4
# 给定一个正整数 n,将其拆分为至少两个正整数的和,并使这些整数的乘积最大化。 返回你可以获得的最大乘积。 # # 示例 1: # # 输入: 2 # 输出: 1 # 解释: 2 = 1 + 1, 1 × 1 = 1。 # 示例 2: # # 输入: 10 # 输出: 36 # 解释: 10 = 3 + 3 + 4, 3 × 3 × 4 = 36。 class Solution: def integerBreak(self, n): """ :type n: int :rtype: int """ if n==2: re...
93c74c9e9b18efed0a6d0e5dbebac1c85c31731b
amragl/Project1
/Functions/function_return.py
151
4.0625
4
def maximum(x,y): if x>y: return x elif x==y: return 'The number are equals' else: return y print(maximum(2,3))
45a6ea3707b2b379a0fa398db98cf185c006fa61
amazingrobocat/python-project-lvl1
/brain_games/games/gcd.py
1,202
4.03125
4
"""Brain-Greatest common divisor game module.""" import random FIRST_MIN_NUMBER = 1 FIRST_MAX_NUMBER = 45 SECOND_MIN_NUMBER = 1 SECOND_MAX_NUMBER = 15 RULES = 'Find the greatest common divisor of given numbers.' def gcd(number_one, number_two): """Find greatest common divisor of two numbers. Args: n...
9113437dd59c0579ae0399ef3f1d86f4aae4845a
dicao425/algorithmExercise
/LeetCode/strobogrammaticNumber.py
488
3.640625
4
#!/usr/bin/python import sys class Solution(object): def isStrobogrammatic(self, num): """ :type num: str :rtype: bool """ d = {'6': '9', '9': '6', '1': '1', '8': '8', '0': '0'} if set(num) - set(d.keys()): return False new = [] for n in n...
54bbc72996b1dbe9476ac541429bcdf3d3e38ce5
cjim8889/Practice
/LongestCommonPrefix.py
1,234
3.5
4
class Solution: def longestCommonPrefix(self, strs: 'List[str]') -> 'str': if (not len(strs)): return "" if (len(strs) == 1): return strs[0] firstStr = strs[0] strs = strs[1:] currentPrefix = "" for i in range...
49c09759bb866c28e181151f1e5f28f19e7a8732
gabriellaec/desoft-analise-exercicios
/backup/user_348/ch65_2020_04_27_21_58_38_841423.py
197
3.703125
4
def capitaliza (string): resto = string[1:] primeira_letra = string[0] captaliza = string.upper(primeira_letra) soma = captaliza + resto return soma print(capitaliza ('Thais'))
7dc6a7d230f1eed6f8f0f860b21128ae6810579d
lalaboom/algorithm-practice
/LeetCode/验证回文字符串.py
643
3.625
4
class Solution: def isPalindrome(self, s: str) -> bool: if len(s) == 0: return True s = s.lower() left = 0 right = len(s) - 1 while left < right: if (s[left] in "1234567890qwertyuioplkjhgfdsazxcvbnm" and s[right] in "1234567890qwertyui...
2042e4d1d110d05aede2155e5d180a31ab7ac927
sx1616039/ecnp-simulation
/Task.py
674
3.5
4
class Task: def __init__(self, id, time, target): """ initializes a new task Arguments: id: id of the task : integer time: when will the task be published/offered for Agents : integer target: target node (city/place) of a task : tuple ...
1faf6cf09c80b0a339fda57d4d6879e8e80f4d31
kevinfal/CSC120
/Assignment5/short/reverse_list.py
1,068
4.375
4
""" File: reverse_list.py Author: Kevin Falconett Purpose: reverses a linked list """ from list_node import * def reverse_list(head: ListNode): """ Reverses a linked list (head) without constructing any new nodes or using arrays Parameters: head (ListNode): front ...
5c7130e155c6a5265a17493df238d47009316edc
Ash0492/DataStructures
/toh_testing.py
386
3.90625
4
count = 0 def Hanoi(count , N , fromm, to,aux): if(N == 1): print("move disk", N, "from rod", fromm, "to rod", aux) count+=1 return count count = Hanoi(count , N-1, fromm, to, aux) print("move disk", N, "from rod", fromm, "to rod", aux) count+=1 count = Hanoi(count , N-1, to,...
ebd6e9a98a979c46d0b85544def2c93ffe87062b
OokGIT/pythonproj
/nlp/facts.py
857
3.703125
4
import spacy import textacy.extract # Загрузка английской NLP-модели nlp = spacy.load('en_core_web_lg') # Текст для анализа text = """London is the capital and most populous city of England and the United Kingdom. Standing on the River Thames in the south east of the island of Great Britain, London has been a major ...
57118357dbe6fa99c4ff23edb1fe0eb32f8b883f
shibata-kento/AtCoder
/ABC043/a.py
88
3.671875
4
n = int(input()) candy = 0 for i in range(n+1): candy = candy + i print(candy)
9444e1d63176ba63b188fbcf2231b3b496b0f1f6
redbassett/CS112-Spring2012
/hw10/dicts.py
2,122
4.65625
5
#!/usr/bin/env python """ dicts.py Dictionaries ============================================================ In this section, write some functions which build and manipulate python dictionaries. """ # 1. freq # Return a dictionary of the number of times each value # is in data. # >>> freq([ 1, 2,...
299140a9c1afee360c499311ba012e5101ce5675
ofisser86/jb-rock-paper-scissors
/Problems/Stick together/main.py
103
3.59375
4
numbers = [int(x) for x in input().split()] # print all numbers without spaces print(*numbers, sep="")
a64f6343d17421b43891c5b10083e65d003f2280
jackalsin/Python
/15112/Quiz/H2P7_nthPowerfulNumber.py
1,359
3.734375
4
import math def almostEqual(x,y): if abs(x-y)<0.0000001: return True def isFactor(factor,n): if n%factor==0: return True else: return False def isSquare(n): #to test n contain a square factor factor=1 limit=round(math.sqrt(n))+1 for factor in range(1,limit): if is...
0c2ebfdff13a2c5556315e3962e062d77513e50c
brunoprela/keras_mnist
/keras_mnist.py
4,004
3.65625
4
# external import numpy as np import matplotlib.pyplot as plt # keras from keras.datasets import mnist from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.utils import np_utils # make the plot figures bigger plt.rcParams['figure.figsize'] = (7,7) # loading the train...
feeb7e3d079b434304d7659abf6633ee294b183e
vpisaruc/Python
/Программирование 1 сем/Лабараторные Python/laba.py
385
3.875
4
try: x=int(input('Введите значение X: ')) a=int(input('Введите значение A: ')) b=a*x y1=-(x**6+a**6)+b*(x**4+a**4)-b**2*(x**2+a**2)+b**3 y2=-x**6+a*x**5-a**2*x**4+a**3*x**3-a**4*x**2+a**5*x-a**6 print(y1) print(y2) input('Нажмите ENTER') except ValueError: print('Неподходящиее значе...
d80460ba0c0da44745483c0b5081c77a69259022
Redfield2007/repo2
/one_billion.py
1,078
4.25
4
# my first program print('Вашему вниманию, предлагается игра "кто хочет стать миллиардером"') question_1 = "как называют футболиста обладающего плохой техникой?" print(question_1) variants_1 = ("слон", "дерево", "бомбардир", "кидала") print(variants_1) answer_1 = input("введите ответ: ") if answer_1 == "дерево": ...
3ecc57378b55bb838435dae4f7a7fdaad8775c67
chengong825/python-test
/binarysearch.py
1,697
3.65625
4
# def remove_list(what_list,cla): # # i = 1 # a = 0 # lenght = len(what_list) # while i <= lenght: # if what_list[a] == cla: # what_list.remove(cla) # a -= 1 # i += 1 # a += 1 # def fun(list,num): # i=0 # while i<len(list): # if list[i]==nu...
014afca8e2b043fb498f8edb195b17f03726088a
AdamZhouSE/pythonHomework
/Code/CodeRecords/2645/60586/308363.py
195
3.671875
4
s=input() k=int(input()) if s=='[3,6,7,11]': print(4) elif s=='[30,11,23,4,20]'and k==6: print(23) elif s=='[30,11,23,4,20]'and k!=6: print(23) else: print(s) print(k)
3212c062564effe45f8dd602b57a546f1d2d4abe
Emine-bc/holbertonschool-higher_level_programming
/0x03-python-data_structures/7-add_tuple.py
245
3.75
4
#!/usr/bin/python3 def add_tuple(tuple_a=(), tuple_b=()): x = tuple_a + ('0', '0') y = tuple_b + ('0', '0') a = int(x[0]) b = int(y[0]) s = a + b c = int(x[1]) d = int(y[1]) s1 = c + d k = s, s1 return(k)
80a61ae256d54135ea0a554de277ca33443a4483
shaunakgalvankar/itStartedInGithub
/stack.py
718
4.125
4
class stack: def __init__(self): self.store = [] #this method adds the entered arguement tot the top of the stack def push(self,value): self.store .append (value) #this method removes a value stored fromm the top of the stack def pop(self): self.store =self.store[:-1] #this method tells us what is t...
4b38824ffae1bce14a4cb5e922c18bc04874f0c9
cwalk/PythonProgramming
/Python-2/search.py
2,008
4.1875
4
''' Clayton Walker 12/2/11 COP-3223H search - program 6 A program that generates a random point in a x-y grid user guesses what the coordinates are ''' import random def guess(): #Asks user to guess a x and y value for the game x, y = raw_input('Enter your guess for x and y.\n').split(' ') x = int(x) y =...
cb67a222b923e0b9810f2867ce8ca87aef4cbeb7
huynhminhtruong/py
/interview/closure_decorator.py
1,565
3.90625
4
# First class function # Properties of first class functions: # - A function is an instance of the Object type. # - You can store the function in a variable. # - You can pass the function as a parameter to another function. # - You can return the function from a function. # - You can store them in d...
0fba916ae269cb17b44eb2878774f3267e6c7fa4
yuanba/Study
/Optimisation/Report/OptimMethJLB/lesson12F/neighbor.py
5,234
3.90625
4
def neighbor1(pb,s,target): """Computation of the neighbors of s The neighbors of s are provided by swapping two consecutive elements s[j] and s[j+1] Input: pb = list of (p1,p2,d) an instance of the pb s: a permutation of [0, 1, ..., n-1] target: the value to improve (probably tbar(...
35794fe45cf4dac363eb5f715e694aa3ce8c49b0
sheriaravind/Python-ICP4
/Source/Code/Class_Demo.py
1,456
4.0625
4
class Employee(object): employee_count=0 totalsal=0 avgsal=0 def __init__(self,name,family,sal,dept): # init method in the class to instantiate the class member variables self.name = name self.family = family self.salary = sal self.department = dept Employee.empl...
bf0c9fd4920493287ac84f48152a196144f2c05b
Armin-Tourajmehr/Learn-Python
/Classic_algorithms/bubble_sort.py
675
4.34375
4
# Python program for implementation of Bubble Sort def bubbleSort(arr): n = len(arr) # Traverse Through all every elements for i in range(n - 1): # range(n) also work but outer loop will repeat one time more than needed for j in range(n - i - 1): # Traverse the array from 0 to n...
f0c0d91168aeddc1d86a6ed5d37912b780b79c30
perglervitek/Python-B6B36ZAL
/05/rand.py
219
3.75
4
import random arr = [] for i in range(10): arr.append(random.randint(1,1000)) def maxValue(arr): max = arr[0] for i in arr: if i > max: max = i return max print(maxValue(arr))
ab7ba2286b9cc824cc08bb63cdf46eb4d3280024
Patrikejane/problemSolving
/altering_characters.py
229
3.578125
4
T = int(input()) for i in range(T): X = input() count = 0 for i in range(1,len(X)): if(X[i-1] == 'A' and X[i] == 'A'): count +=1 if(X[i-1] == 'B' and X[i] == 'B'): count +=1 print(count)
4213cccbd2ce238c01398e0047b2e06a90605ee1
sultonexe/PythonClock
/clock2.py
1,564
3.9375
4
#Simple Clock with Python3 Programming #Coded By @sulton.exe #Version 0.2 #TOLONG JANGAN RECODE YA :) HARGAI SI PEMBUAT TERIMA KASIH :D import time import turtle wn = turtle.Screen() wn.bgcolor("black") wn.setup(width=600, height=600) wn.title("Simple Clock With Python Version 0.2 by @sulton.exe") #drawing pen pen ...
4b49823ee08bc8d722762fe2bdcf1f643e8ba9b1
clair513/DIY
/Fashion MNIST Classification/ann_fashion_mnist.py
2,327
3.71875
4
# -*- coding: utf-8 -*- """ ANN Implementation on Fashion MNIST [ Source: Kaggle (https://www.kaggle.com/zalando-research/fashionmnist) ] using TensorFlow 2.0.0 on CPU. Training dataset contains 60,000 image/records & Testing dataset contains additional 10,000 records. Dataset has 10 different label/classes of 28*28...
21c1b4d2c72acb2278d001fd10ba185f0b745a1b
msypetkowski/MEDProj
/myclustering/kmeans.py
1,942
3.765625
4
""" Author: Michał Sypetkowski Implementation of k-means algorithm (https://en.wikipedia.org/wiki/K-means_clustering). """ import numpy as np class MyKMeans: def __init__(self, n_clusters, max_iter=300, initialization_type='MeanStd'): """ Parameters ---------- n_clusters : int ...
68d31ddc62b904bd1204c545a169052b1407975d
sylviocesart/Curso_em_Video
/PythonExercicios/ex002.py
322
4.125
4
""" Entre com um nome e mostre uma mensagem de boas vindas """ nome = input('Digite seu nome: ') print('É um prazer te conhecer,', nome,'!') # Outra forma de imprimir o resultado print('É um prazer te conhecer, %s!' %(nome)) # Mais uma forma de imprimir o resultado print('É um prazer te conhecer, {}!'.format(nome))
d5663498be13b69c7aa008570b672482bcae6e07
Edyta2801/Python-kurs-infoshareacademy
/code/Day_6/funkcje_8.py
759
3.703125
4
# argument domyslny jest typem referencyjnym def dodaj_imie(imie, imiona=None): if imiona is None: imiona = [] imiona.append(imie) return imiona # jesli nie podamy argumentu domyslnego # to Python utworzy typ referencyjny tylko przy pierwszym # wywolaniu funkcji # w tym przypadku jest to typ None #...
9b8547273625e826ff7fb6cfd693514358a91fc5
Ved005/project-euler-solutions
/code/lattice_quadrilaterals/sol_453.py
829
3.859375
4
# -*- coding: utf-8 -*- ''' File name: code\lattice_quadrilaterals\sol_453.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #453 :: Lattice Quadrilaterals # # For more information see: # https://projecteuler.net/problem=453 # Problem Stat...
f27429827e719212a47052eb4a0c272047ab1792
dsbrown1331/Python2
/Recursion/three_times_x.py
290
3.9375
4
def three_times_x(x): print("three_times_x({})".format(x)) if x == 0: return 0 else: return 3 + three_times_x(x-1) def x_times_y(x,y): if y == 0: return 0 else: return x + x_times_y(x, y-1) print(three_times_x(7)) print(x_times_y(4,6))
db9b084be3296e3cb2667f29297e6e3607f15861
goondall1/our_point_robot
/Circle.py
327
3.53125
4
import math from Interfaces import * class Circle(Obstacle): def __init__(self, radius, x, y): self.radius = radius self.x = x self.y = y def isInObs(self, state: State): (x , y) = state.getCoordinates() return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2) <= self....
438c8a4cc99b929175614c4b3cf44eb02bea8548
networkcv/Framework
/Language/Python/py/01~05/02_语言元素.py
209
3.78125
4
# 单行注释 """ 多行注释 """ print(ord('a')) print(chr(97)) t = True print(t) f = False print(t and f) print(t or f) print(not t) print("%.1f" % 1.111) print('%d' % 1) print('%s' % 's') print('%s' % 1)
caffc1f88628a6a68977c3183915e76efdf1259b
Introduction-to-Programming-OSOWSKI/4-6-double-last-RainerMauersberger23
/main.py
130
3.703125
4
def doubleLast(x): x.append(x[len(x)-1]) return x print(doubleLast(["cat", "dog", "pig", "bear", "bear"]))
ff4ae30a5bc2aa2818fcf1314ca8b8c98913fbaf
wlgud0402/pyfiles
/array_list_repeat.py
393
4.03125
4
#반복문을 사용한 리스트 생성 array = [] for i in range(0,20,2): array.append(i * i) print(array) print() #리스트 안에 for문 사용하기 list_a = [z * z for z in range(0, 20, 2)] #최종결과를 앞에 작성 z*z print(list_a) print() #if문도 추가하기 newarray = [1,2,3,4,5,6,7,8,9] output = [number for number in newarray if number != 3] print(output)
dd2aeaa5a6dc2fa52da040aebda2ca867cef1aea
Dearyyyyy/TCG
/data/3919/AC_py/508174.py
526
3.59375
4
# coding=utf-8 a,b ,c=map(int,input().split()) while a!='': if a + b <= c or a + c <= b or b + c <= a: print('ERROR') else: if a == b and a == c: print('DB') else: if a == b or a == c or b == c: print('DY') else: if a **...
86005b85e5b1d265d5a763a956347363302d568c
JohnCook17/holbertonschool-interview
/0x19-making_change/0-making_change.py
860
4.15625
4
#!/usr/bin/python3 """A change making program for money""" def makeChange(coins, total): """tries to give exact change given a list of coins with a specified values if unable to do so returns -1""" if total == 0: return 0 coins.sort(reverse=True) new_total = total total_change = ...
f38243e661afaf1a4d16f0f60786c336eca1ee60
Saianisha2001/pythonletsupgrade
/day3/day3 assignment.py
480
3.84375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: n=int(input("enter the altitude")) if(n<=1000): print('Safe to Land') elif(n>1000 and n<=5000): print('Bring down to 1000') elif(n>5000): print('Turn around') # In[12]: for num in range(2, 201): # all prime numbers are greater than 1 if num > 1:...
114e022c3d231f4d5d786778f7231c9217fc0dce
yuva671/Guvi
/Day6/gcd.py
158
3.6875
4
a=int(input()) b=int(input()) if(a>b): small=b else: small=a for i in range(1,small+1): if(a%i==0 and b%i==0): gcd=i print(gcd)
46cfd440137cb2629c3e883bd0086c2fa425be40
KaroliShp/Quantumformatics
/src/dirac_notation/ket.py
802
3.5625
4
import numpy as np from src.dirac_notation.matrix import Matrix class Ket(Matrix): """ Class representing a column vector in Dirac notation """ def __init__(self, obj): if type(obj) == np.ndarray and len(obj.shape) == 1: self.matrix = obj elif type(obj) == list: ...
f72c2358ce1b1164011c5d5cd473c54dea2715d1
MAPLE-Robot-Subgoaling/IPT
/data/HW3/hw3_468.py
606
4
4
def main(): temperature = float(input("Please enter the temperature: ")) scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ") if scale == "C": if temperature <= 0: state = "(frozen) solid" elif temperature >= 100: state = "gas" else: ...
83fb28f0b680cc33e3c074c44beb7a00c40b3967
RoadToML/face_comparison_and_sorting
/face_rec.py
2,941
3.640625
4
import os import shutil import cv2 import face_recognition from PIL import Image def compare_faces(known_face_dir, unknown_faces_dir, transfer_dir, size = 300, tolerance = 0.6): """ this function is responsible for comparing faces and returning the pictures where that face is present (given tolerance) into a n...
992260ca08c0ea7a4e6e882ca95a28c0cd582763
SimRose/primer-intento
/comer_helado.py
442
3.921875
4
si = "Y" no= "N" valor_del_helado = 80 respuesta_usuario = input("Quieres comer un helado? Y/N: ").upper() if respuesta_usuario == si: dinero_del_usuario = int(input("Cuanto dinero tienes?:")) if dinero_del_usuario >= valor_del_helado: print("Entonces compralo") else: print("No tienes ...
922ecacb5780ecdf6078bf547631236a48b0caf7
AndrewVazzoler/jogos-forca-velha-python
/jogo.py
695
3.78125
4
import os import forca import velha def cls(): os.system('cls' if os.name == 'nt' else 'clear') def menu(): print('Vamos jogar ?') print('1 - jogo da velha') print('2 - jogo da forca') print('3 - para sair') valido = False while not valido: op = int(input('Sua esco...
760a0abae93f98f275255ca7df08a4002ab92567
Alek2750/Python-github
/python_sandbox_starter/tuples_sets.py
2,679
4.21875
4
# A Tuple is a collection which is ordered and unchangeable. Allows duplicate members. # Create tuple fruits = ('Apples', 'Oranges', 'Grapes') # Using a constructor # fruits2 = tuple(('Apples', 'Oranges', 'Grapes')) # Single value needs trailing comma fruits2 = ('Apples',) # Get value print(fruits[1]) # Get the la...
8f87b25113369c261fc83de811f88385e6443eee
TahaCoder43/TahaCoder43
/Unidentified testts/tuple_compairing_test.py
210
3.78125
4
Tuple = ('Taha', 'Munawar','14','Rawalpindi') *names, age, city = Tuple x = '' for i in names: if i != 'Taha': x = x + ' ' + i else: x = x + i full_name = x print(full_name)
6f0e72d1b685e506ae0689311ef12253e5432041
JohnHaines/datawranglingMongoDB
/udacity_2_1_parsecsv.py
1,371
3.78125
4
""" From Udacity Data Wrangling With MongoDB Processes a csv file . Each file contains information from one meteorological station about the amount of solar and wind energy for each hour of day. The first line of the datafile describes the data source. The name of the weather station is extracted from it. ...
9b5e95a1e638e37aa409c918434f251bdae28f07
govindak-umd/HackerRank_Python
/arrays_reversed.py
213
3.6875
4
import numpy def arrays(input_array): input_array = numpy.array(arr, float) reversed_arr = input_array[::-1] return reversed_arr arr = input().strip().split(' ') result = arrays(arr) print(result)
3deadfb840460f4c165a7ef53f2bcf03b0cfc713
te14017/ML_Q-learning
/helpers.py
4,831
4.09375
4
# copyright (C) Team Terminator # Authors: V. Barth, A. Eiselmayer, J. Luo, F. Panakkal, T. Tan class Position(object): """ Position in the maze """ def __init__(self, row, column): self.row = row self.column = column def __eq__(self, other): return self.row == other.row ...
f95de29aeebc6827320854cb43ff4ca769e41196
jasonwee/asus-rt-n14uhp-mrtg
/src/lesson_algorithms/operator_sequences.py
918
3.515625
4
from operator import * a = [1, 2, 3] b = ['a', 'b', 'c'] print('a =', a) print('b =', b) print('\nConstructive:') print(' concat(a, b):', concat(a, b)) print('\nSearching:') print(' contains(a, 1) :', contains(a, 1)) print(' contains(b, "d"):', contains(b, "d")) print(' countOf(a, 1) :', countOf(a, 1)) print...
73a71a6e84f6314a7dbe472618669011d18be62d
ajaycc17/password-generator
/password-generator.py
1,496
3.875
4
import random # define the set of characters we want to use digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] lowercase = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] uppercase = ['A', 'B', 'C', 'D', 'E', 'F', 'G', ...
5a53c7bd1c085e02ceca3154b580f8beece1aadb
robjailall/stack-ranking
/review_game.py
12,876
4.0625
4
import csv import random from argparse import ArgumentParser from collections import defaultdict from sys import stdout def _map_bins_to_labels(bins): """ Maps integers 0-99 to a label according to the distribution specified in `bins`. Example: bins = [10, 20] # implies bin sizes of 10 - 20 - 70 ...