blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
fba9a4da5939d667396b01d05504dd4b8f793efa
Rushi-Bhatt/Self-Study
/python_codes/CrackingTheCodingInterviewCodes/prog16.py
1,444
4.0625
4
#Queue using two stacks class MyQueue(object): def __init__(self): self.s1=[] self.s2=[] self.element=None self.popHappened=False def peek(self): if(self.popHappened==False and self.element!=None): return self.element else: if(len(self...
866ae3db2118eea53c376ad03cc463b0008a58b9
MikhailErofeev/a3200-2015-algs
/classic-algs/lab2/chumachenko/lab2.py
221
3.59375
4
def sieve(x): if x == 1: return False for i in range(2, int(x ** 0.5)+1): if x % i == 0: return False return True n = int(input()) a = [sieve(x) for x in range(1, n + 1)] print(a)
d8aa0ee121b2ca9e6b2e4d514fd7d5c955cc116e
ALICE5/Python
/py_demo/GUI与面向对象.py
1,078
3.90625
4
# GUI 图形用户界面 # 输入框 列表框 按钮 复选框 等窗口组件 def foo(): listA = [] print('input the number:') while True: num = input() if num == '.': break listA.append(eval(num)) sumList = sum(listA) return sumList if __name__ == '__main__': print(foo()) # 面向对象 # 抽象 & 继承 class D...
d45a386939d464cb9725cea9c880c49d0d06c447
adrianmalecki/SO2
/zad5/zad5.py
4,987
3.765625
4
import random the_board = {1: ' ', 2: ' ', 3: ' ', 4: ' ', 5: ' ', 6: ' ', 7: ' ', 8: ' ', 9: ' '} def print_board(board): print(board[1] + '|' + board[2] + '|' + board[3]) print('-+-+-') print(board[4] + '|' + board[5] + '|' + board[6]) print('-+-+-') print(...
299ab67c31bbe1a04864d7a6d3c699a8a8d1cac7
mohdrashid/basic_statistics_python
/statistics.py
2,040
3.609375
4
import random height = {"min": 90, "max": 200} weight = {"min": 40, "max": 90} population = [] firstName = ["Mohammed","Ahmed","Ram","Agash","John","Yahya","Jamal","Reem","Clara","Christina"] lastName = ["Mohammed","Ahmed","Ram","Agash","John","Yahya","Jamal"] size = 10000 for i in range(0,size): name=firstName[...
057aa2150f8cd4addfa05e09c31e79da98817e8a
Emanuelvss13/ifpi-ads-algoritimos2020
/cap_07_iteracao/Lista_Fábio_03/fabio_iteracao_Q18_sFracaoDecrescente.py
182
4
4
n = int(input('Digite um número: ')) fracao = 0 while n >= 1: fracao = fracao + 1 / n n -= 1 print(fracao) print(f'O resultado é: {fracao}')
3a411528ea5bf6371f87510643520b6038814527
KonradKorus/Four-in-a-row
/main_game.py
1,240
4.15625
4
import game_functions as gf import itertools game_start = True #loop for app running while game_start: number_of_rows = int(input("Choose numer of rows (basic is 7): ")) number_of_columns = int(input("Choose numer of rows (basic is 6): ")) in_a_row = 4 #number of elements in a row, which cousing win ...
2fc7693e6eb1cef939fbb609a35652e6fe273c74
gautam17pranjal/CSCI-561-Foundations-of-AI
/Checkers AI Agent/homework.py
20,944
3.625
4
from copy import deepcopy from time import perf_counter # checkers piece class class Piece: def __init__(self, row, col, color, king): self.row = row self.col = col self.color = color self.isKing = king def makeKing(self): self.isKing = True def movePiece(s...
eecb8afcdfb0a3dc86c58d272b000fa7c134786c
saitejagroove/codingpractice
/binaryTreePathSum_112.py
707
3.828125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def hasPathSum(self, root, sum): """ :type root: TreeNode :type sum:...
d48fcaa5c5ab5ed068a9a2e11d9c9a42887e4bd7
atsushi1550/python
/scr/tutorial/sample/statements/DefiningFunctionStatement.py
600
3.65625
4
def fib(n): a,b = 0,1 while a < n: print a, a, b = b, a + b def fib2(n): result = [] a, b = 0, 1 while a < n: result.append(a) a, b = b, a + b return result def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: ok = raw_input(pro...
91e3c07946d10dec22605d377004c176ff11f48a
reed-qu/leetcode-cn
/AddBinary.py
798
3.71875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/11/20 下午2:25 # @Title : 67. 二进制求和 # @Link : https://leetcode-cn.com/problems/add-binary/ QUESTION = """ 给定两个二进制字符串,返回他们的和(用二进制表示) 输入为非空字符串且只包含数字 1 和 0。 示例 1: 输入: a = "11", b = "1" 输出: "100" 示例 2: 输入: a = "1010", b = "1011" 输出: "10101" """ THINKI...
1ee11ec1b3bf7fd5947620a7dace9e34bec00049
mjoze/kurs_python
/kurs/02_instrukcje_sterujace/other/while2_3.py
864
3.90625
4
""" Zapoznaj się z modułem random. >>> import random Stwórz prostą grę zgadywankę. Komputer losuje wartość z przedziału od 1-30. Poproś użytkownika o zgadnięcie liczby. Program pyta użytkownika o podanie liczby tak długo, dopóki gracz nie zgadnie.""" """Zadanie 3 Rozszerz grę z punktu powyżej. Gracz powinen otrzymać ...
fa9cf8a64c39a447662ea9467441d735ddb14ace
SaraAnttila/day2-bestpractices-1
/matmult.py
1,022
3.828125
4
""" Answers based on cProfile & memory_profiler. Unable to install line_profiler. """ # Program to multiply two matrices using nested loops import random # this shows as very slow... but hard for me to optimize N = 250 # NxN matrix X = [] for i in range(N): x_i = [] for r in range(N): x = random.randi...
983f1c436152ab879bf1c8f78cb8f8615ee1701a
wangzhixuan/LeetCodeSolution
/src/datastructure/point.py
301
3.671875
4
class Point: def __init__(self,x=0,y=0): self.x=x self.y=y def __str__(self): return '('+str(self.x)+', '+str(self.y)+')' def listOfPoints(input_list): result = [] for point in input_list: result.append(Point(point[0],point[1])) return result
6eaeefdcb16dfaa3399d07305bdfafa7a01c915c
CarloCori/Fibonacci-Analyser
/Excercise_1_Fibonacci.py
1,641
4.46875
4
def fibonacci_number(n): """This function calculates the "n" number of the fibonacci series Args: n (int): The number of the fibonacci series required Returns: int: the number "n" of the fibonacci series """ l = [0, 1] for i in range(n - 1): l = ...
988629f7db8fe5492f1ddcbeb48118127bb795cc
Snadman/SE126
/Lab1/Lab1A.py
1,570
4.15625
4
#Name: Ethan Carrera #Date: 7/25/2021 #Lab: A #Variable Dictionary: # capR = capacity of a room # att = Attendee # hmm = How many more people can attend (will change depending on the numbers) # answer = if the loop continues or not #This program will have the user input how big the room is and how many people are ...
207cfd350cfb632a375ad9389648eca56b1ee84f
chetanrakheja/python_niit
/senRev.py
149
3.703125
4
sentence="a cat ran" words = sentence.split(" ") print(words) words=words[-1::-1] print(words) newSentence=" ".join(words) print(newSentence)
b3da84d1c13dd5a65bb1b3a1975b1d6d6a95ef49
jetpotion/Python-Algorithms
/AMS326/NewtonsMethod.py
2,530
4.21875
4
# -*- coding: utf-8 -*- """ Created on Fri Feb 8 15:24:14 2019 @author: William Zhang #ID : 110768508 @email: William.Zhang@stonybrook.edu """ import numpy as np import matplotlib.pyplot as plt "The main method as a driver to plot the graph " def main(): plotting = np.arange(-1,2,0.001) plt.pl...
6bb99a29ec7d14e519bf520d7dc29bcda46dc5ea
sssouth/south
/判断字母、数字等的个数.py
335
3.921875
4
import string letter=0 digit=0 space=0 other=0 str=input("Please input string:") for a in str: if a.isalpha(): letter+=1 elif a.isdigit(): digit+=1 elif a.isspace(): space+=1 else: other+=1 print("There are %d letters,%d digits,%d spaces,%d others."%(letter,digit,space,ot...
e5c17da00fbd11613045b9b058ab84c7372f05dd
josephchenhk/learn
/Python/python3-cookbook/chp9 元编程/9.3 解除一个装饰器/9.3 解除一个装饰器.py
1,114
3.625
4
# -*- coding: utf-8 -*- # @Time : 7/24/2019 5:50 PM # @Author : Joseph Chen # @Email : josephchenhk@gmail.com # @FileName: 9.3 解除一个装饰器.py # @Software: PyCharm """ 9.3 解除一个装饰器 一个装饰器已经作用在一个函数上,你想撤销它,直接访问原始的未包装的那个函数。 可以通过访问 __wrapped__ 属性来访问原始函数 """ from functools import wraps def decorator1(func):...
2450459a8ae72f6117665c28f6e3d700af856db8
d-matsui/atcorder
/lib/binary-search.py
957
3.984375
4
#!/usr/bin/env python3 def bs_normal(array, value): left = 0 right = len(array) - 1 while left <= right: mid = int((left + right) / 2) if array[mid] < value: left = mid + 1 elif array[mid] > value: right = mid - 1 else: return mid ret...
698386efb63ab9b5033a60f95154cdd060ed452b
maisjamil1/data-structures-and-algorithms
/data-structures-and-algorithms/data_structures_and_algorithms/stacks_and_queue/stacks_and_queues.py
5,530
4.28125
4
# from data_structures_and_algorithms.challenges.linked_list.linked_list import Node class Node: """ this class will create a new node """ def __init__(self, value): self.value = value self.next = None # _________________________________________________ class Stack: """ thi...
37725d3045c41e6aeb5380f6e0a1fcfba6d37528
bchartoff/equalhalves
/calculation.py
1,801
3.796875
4
import csv from random import randint from greatcircles import * data = csv.reader(open("data.csv","rU")) out = csv.writer(open("output.csv","wb")) head = data.next() out.writerow(["Lat1","Long1","Lat2","Long2","Pop_left","Pop_right","Percent_left","Percent_right"]) lats = [] longs = [] pops = [] lats_round = [] lo...
54cc96b5a078aed910b9a754317580bc2ee33d2d
jorgevs/MyPythonTestProject
/Functions.py
1,994
4.21875
4
# Functions ========================================================================= def addNumbers(a, b): sumNum = a + b return sumNum def add_one(x): return x + 1 def sayHello(): print ("hello world!") def foo(a=1, b=2): sumNum = a + b return sumNum # *args tells Python to take all ...
89b24820a965d9dca523d20ed1e425fe55564fa0
Averiandith/jubilant-ahri
/migratory_birds.py
403
3.640625
4
# https://www.hackerrank.com/challenges/migratory-birds/problem def migratoryBirds(arr): lookup = [0] * (max(arr) + 1) for birdType in arr: lookup[birdType] += 1 birdType = 1 maximumSighting = lookup[1] for i, sighting in enumerate(lookup[2:], 2): if sighting > maximumSighting: ...
f9d5f6e105d7a0aae467ebb09ee61caf0a709898
dgavieira/listas-python-super
/Lista_6_aula_15_06/L6_q3.py
713
3.78125
4
perguntas = ["Telefonou para a vítima?", "Esteve no local do crime?", "Mora perto da vítima?", "Tinha dívivas com a vítima?", "Já trabalhou com a vítima?"] pontos = 0 print("Responda sim ou não: \n") for i in perguntas: print(i) res = str(input("")) if re...
e3807620d58fe715c434e6dca083d7860cf4e93c
roysegal11/Python
/conditions/Test.py
81
3.765625
4
num1 = int(input("Num:")) num1 = num1%2 print(num1) #שארית חלוקה ל-2
d49bd92e7ec3ba79b8c63a701c03288977d0fe35
tubaDude99/Old-Python-Exercises
/Unit 1/Python 4 Challenge.py
210
3.671875
4
#!/usr/bin/env python # coding: utf-8 # In[5]: t = 0 for x in range(0,101): if x%2 == 0: t = t + x print(t) # In[10]: t = 1 for x in range(0,51): if x%2 == 1: t = t * x print(t)
bd337679264f8b8fe9b34dab56ff01c404b09d2a
slinskiy/learn-python
/basics.py
307
3.890625
4
if True: print 'hello' print 'world' # single line comment """ Multi line comments """ variable_name = 'Stan' num0 = 2 num1 = 3 num2 = 7 num4 = num0 * num1 # Multi line variables long_name = "This is " + "an example " \ + "of a variable that "\ + "takes more than one line" print long_name
d43dfb8dcc661093199db57db0b96c0fc9093a43
zhan01/Calculator-with-catch
/calc.py
1,200
4.34375
4
while True: try: a = int(input('Enter your first number: ')) b = int(input('Enter your second number: ')) operation = input(''' Please type in the math operation you would like to complete: + for addition - for subtraction * for multiplication / for d...
09047d6a8eb2ee607141c3d655faf48c3785730b
glory0fNothing/Ch2
/RollingDice.py
451
3.953125
4
def rollingDice(): #rolling Dice accepts no arguments #it gives a random value from 1 through 6 #it prompts for another roll import random looping = True while looping == True: number = random.randint(1, 6) print(number) ...
805801c3b96d79c96ffb497c91a26ae2de3e9d53
alexander-fraser/learn-python
/Python_203_Maze_Recursive.py
2,157
4.375
4
# Maze: Recursive # Alexander Fraser # 16 February 2020 # A maze generator using recursive division. """ Requirements: - Numpy - Matplotlib - Python_05_Maze_Depth_First The maze is generated by: 1. Starting with an empty space. 2. Creating walls that sub-divide the space. 3. Creating a random opening in the wall. 4....
1c3f5e3fee796253f461f48860a56aa65caa6ee9
sarvan80/Computer-Algorithms
/untitled folder/poly.py
3,738
4.875
5
class Polynomial: """Polynomials in one variable. Only non-zero terms are stored!! """ def __init__(self, *args): """Creates a new polynomial initialized with given terms Check the Python documentation to understand the '*args' format for a variable number of ...
dce96d6a0cf81e554d58ed47c38a21448a2546c9
bulaimei1991/MyLeetcode
/JumpGame.py
1,395
3.71875
4
#-*- coding=utf-8 -*- ''' 给定一个非负整数数组,你最初位于数组的第一个位置。 数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个位置。 示例 1: 输入: [2,3,1,1,4] 输出: true 解释: 从位置 0 到 1 跳 1 步, 然后跳 3 步到达最后一个位置。 示例 2: 输入: [3,2,1,0,4] 输出: false 解释: 无论怎样,你总会到达索引为 3 的位置。但该位置的最大跳跃长度是 0 , 所以你永远不可能到达最后一个位置。 ''' class Solution(object): def canJump(self, nums): ...
0a8ce3443765cd8bd2e37cc39819abb3c22ae4ea
thunderbump/Rosalind
/35_seto/seto.py
1,894
3.640625
4
#!/usr/bin/python """Computes union and intersection of two sets, as well as each set subtracted from eachother, and the compliment of each against a universe""" import sys argc = len(sys.argv) data_file_loc = "test_data" usage = """seto.py [data_file] Computes union and intersection of two sets, as well as each set ...
0607033368949d617402bcaa748381b65bb70c70
Nerucius/1415.datastrucgame
/adt/CircularLinkedList.py
1,417
3.921875
4
from adt.LinkedList import * class CircularLinkedList(LinkedList): def __init__(self): LinkedList.__init__(self) def insert(self, index, item): LinkedList.insert(self, index, item) # Link queue self.get_node(len(self)-1).set_next(self._head) def remove(self, item): ...
8b49e786f80c0a90f4110ce98846e68ee62aaf2e
saurabhparekh94/Online_Mathematical_Formula_Detection
/symbol.py
8,083
3.8125
4
""" File Name: symbol.py @author : Tappan Ajmera (tpa7999@g.rit.edu) @author : Saurabh Parekh (sbp4709@g.rit.edu) """ import math class Symbol: """ Create a symbol object functions include calculating geometric features """ def __init__(self, x, y, label, stroke_id=None, sym_ct=0)...
23a6be993fde460c2add09e019bff8a324f24a0c
Kevinxu99/NYU-Coursework
/CS-UY 1114/Homework/HW2/sx670_hw2_q5.py
575
3.84375
4
jd=int(input("Please enter the number of days John has worked:")) jh=int(input("Please enter the number of hours John has worked:")) jm=int(input("Please enter the number of minutes John has worked:")) bd=int(input("Please enter the number of days Bill has worked:")) bh=int(input("Please enter the number of hours Bill ...
10150f8fe82ffc53fde23b8a755858ed2b032c94
kushagra-18/codewayy_python_series-1
/Python-Task8/program.py
7,045
3.578125
4
#The user interface to the program for registrar’s office to list the available information and do the grade report. #class Person(base class for class Student) class Person: #constructor for class Person def __init__(self, fullName): self.fullName = fullName #function to print fullName ...
a9ad587c67ef3596bed162ed7c0a967f438583d7
AidanOB/PyML
/LinearRegressor.py
1,981
3.8125
4
from regressors import Regressor import numpy.linalg as la __author__ = "Aidan O'Brien" # Linear regression for pandas DataFrames class LinearRegressor(Regressor): """ This class takes a pandas DataFrame and creates a trained model based upon the data which can then be used to provide predictions and ca...
32ed21eae44144608bbbe068a954b29ddc5d8776
akamboj9034/Hashing-2
/Solutions.py
2,427
3.734375
4
''' PROBLEM 1 TIME COMPLEXITY: O(N) SPACE COMPLEXITY: O(N) - we will traverse the array and keep adding the elements to a global variable sums, maintiaing the value sums as key and the number of times sums has occured as value in a dictionary - check if sums-k is in dictionary, if yes increment the count by value of...
487c73b0854cd36756ae65a3c8113b27919eaefd
daehjeon/circleIntersection
/bens-blog-code-master/mercator/mercator.py
2,119
3.578125
4
""" converts a CSV of city/latd/latm/longd/longm/tz tuples into a JSON file containing distances between each city on a mercator projection adapted from http://stackoverflow.com/questions/14329691/covert-latitude-longitude-point-to-a-pixels-x-y-on-mercator-projection """ from math import tan, pi, log, sqrt import p...
d921115b05455b7a1457c91f178f911f1dc16499
TsubasaKiyomi/function-section
/ section4/tuple-unpacking.py
488
3.921875
4
# タプルのアンパッキング def nam(*n): sub = n return sub w = nam(1, 2, 3) print(w) print(type(w)) def name(a, b): a, b = b, a # "山田""太郎"を"太郎"山田"にする farst = a, b return farst f = name("山田", "太郎") print(f) print(type(f)) tuple_fruits = "banana", "orange", "apple" a, b, c = tuple_fruits print(a) print(b)...
31bf76103a8a4c51c0df6158b7150c90c610f500
dailycodemode/dailyprogrammer
/Python/026_repeatedLettersIntoSeperateList.py
928
4.0625
4
# # DAILY CODE MODE # def split_repeats_chars_from_word(word): # cleaned_word = "" # second_word = "" # for x in range(len(word)-1): # if word[x] == word[x+1]: # second_word = second_word + word[x] # else: # cleaned_word = cleaned_word + word[x] # cleaned_word = c...
a293c5222371a85c94ca0a7235aad151b32c1595
apalom/CS6140_DataMining
/CS6140_A3_Clustering/aviEnclosingBox.py
424
3.578125
4
# -*- coding: utf-8 -*- """ Created on Mon Feb 26 16:51:04 2018 @author: Alex """ import numpy as np import math from matplotlib import pyplot as plt print(math.pi) a=(math.pi)**0.5 d=2 b=[] c=np.zeros((10,1)) x=np.zeros((10,1)) for d in range(2,22,2): b=(math.factorial(d/2))**(1/d) g=d/2 x[int(g)-1]=g ...
6a9422b3747922ecfebf9fe5578fea7da631b209
snail15/AlgorithmPractice
/LeetCode/Python/houseRobbber.py
1,049
3.6875
4
# You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into ...
f7625ab7fac1c00b0810fdb1303dc5f440eef811
Luis2501/Curso-Python-Cientificos
/Bucles/Bucle_while_3.py
382
3.71875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 30 11:33:05 2021 @author: luis """ while True: edad = int(input("Digita tu edad: ")) if edad >= 0 and edad >= 18: print("Acceso a la página") break else: print("NO tienes a...
6703ab4a6f9d2e25b7443eb70d4d47f00b8fb4d2
axelniklasson/adventofcode
/2017/day1/part1.py
1,072
3.84375
4
# The captcha requires you to review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list. # For example: # 1122 produces a sum of 3 (1 + 2) because the first digit (1) matc...
2b090f1a6ff74231ea78feee310d965e1c82be71
VldChk/StudyProjects
/HackerRank_10Days_Of_Stats/Day1_Task3_HackerRank_10Days_Of_Stats.py
551
4.09375
4
# # Objective # In this challenge, we practice calculating standard deviation. # # Enter your code here. Read input from STDIN. Print output to STDOUT num_of_values = int(input()) values = list(map(int, input().rstrip().split())) sum_of_values = 0 for i in range(num_of_values): sum_of_values += values[i] mean...
83001776aaef351d19f66fe8ac941d57cd024ed6
jeffmylife/leetcode-problem-api
/Solutions/permutations-solution.py
2,931
3.796875
4
class Solution: def _permute(self, nums): return [[n] + p for i,n in enumerate(nums) for p in _permute(nums[:i] + nums[i+1:])] or [[]] def permute(self, nums: List[int]) -> List[List[int]]: permutations = Solution._permute(self,nums) return perm...
baf901ef20f09b74b964d808d726c4aadcd53e44
Aasthaengg/IBMdataset
/Python_codes/p02723/s066925955.py
99
3.578125
4
n = input() m = list(n) if m[2] == m[3] and m[4] == m[5]: print("Yes") else: print("No")
6e997af7a3d47c5ca770739f325ac2284481df5f
julia-ediamond/python
/loops/loops_udemy.py
866
3.84375
4
monday_tempretures = [9.1, 8.8, 7.6] for temperature in monday_tempretures: print(round(temperature)) # print(round(monday_tempretures[0])) for letter in "hello": print(letter) colors = [11, 34, 98, 43, 45, 54, 54] for number in colors: if number > 50: print(number) new_colors = [11, 34.1, 98.2,...
ff7961bbe2c86bc6a96462b65a7a1aa3ef11bd1b
mlubinsky/mlubinsky.github.com
/dynamicProgramming/coin.py
3,689
4.0625
4
# What is the maximum amount of water one could hold between two vertical sticks (disregarding any sticks in between)? # Note that the amount of water that can be held is determined # by the distance between the sticks and the height of the shorter. # let use 2-pointers approach # If we were to move the right pointer...
bc8e90414b611806d77ff6f9ac41cb963e1ef80b
piksa13/ChallengingTasks4beginners
/ChallengingTask_level_3/EvenGenerator.py
348
3.765625
4
def evenGenerator(n): i=0 while i <= n: if i % 2 == 0: yield i i += 1 n = int(input("Give me unsigned number: ")) values = [] print(evenGenerator(n)) for i in evenGenerator(n): values.append(str(i)) print('\nHere are the outcome of generator',",".join(values)) print(['%s' %d...
8b177e102a97980bebb269b7cb719b72617bd155
andrezzadede/Curso-de-Python-POO
/testes/debug.py
831
3.546875
4
# Identifica erros import logging #INFO, DEBUG, WARNING, ERROR, CRITICAL - Niveis de mensagens ''' logging.basicConfig(level=logging.INFO) print("INFO") logging.info("Mensagem informativa") logging.debug("Mensagem de debug") logging.error("Um erro aconteceu") ''' # Debug só funciona quando no level é DEBUG print(f'-...
512e8dfad7003348cf5356c6d74bf6de6e7250b1
Gaya3balu0509/program
/factor.py
90
3.578125
4
numb1=int(input()) for i in range(1,numb1+1): if numb1%i==0: print(i,end=" ")
3999235453f0003383847aecfdf11960ad24aea6
jcohen66/python-sorting
/backtracking/rat_maze.py
1,868
4.21875
4
""" Solve for a solution path to the rat maze using a backtracking algo. Uses a parallel maze to track solution path. """ # Dimensions of maze N = 4 def print_solution(solution_path): for i in solution_path: for j in i: print(str(j) + " ", end="") print("") def is_safe(maze, x,y): ...
232b335340893483171ab5e96877fe4c206566b0
Franciena/InverseMatMarc
/functions.py
13,086
3.765625
4
# --------------------------------------------------------------------------------------------------------------- # This folder contains all the functions which either writes files/folders or saves data to specific folders # Each function is explained accoringly # Francè Bresler # 12 February 2020 # -------...
73ed9a36973a836512bebda4b03c8372399d827b
rysheng/Machine-Learning-Algorithm
/Perceptron_Learning_Algolithm/process.py
564
3.609375
4
import matplotlib.pyplot as plt import pandas as pd def get_data(path): data = pd.read_csv(path) X = data[['ChieuCao', 'CanNang']].values Y = data[['Loai']].values return X, Y def draw_points(X, y): plt.scatter(X[:, 0], X[:, 1], c=y) def draw_line(X, y): plt.plot(X, y) def draw_show(): ...
c455bc7631e58438c17c5d7640bef8e752a7faab
SeanTedesco/python_practice
/movie_searcher/src/movie_services.py
1,309
3.5625
4
import requests from requests import exceptions import collections import json api_url = 'https://movieservice.talkpython.fm/api/' MovieResult = collections.namedtuple('MovieResult', 'imdb_code, imdb_score, rating, title, director, year, keywords, duration, genres') def find_movies(search_term) -> MovieResult: "...
e0cd0ced69d1f3ea9e80af852c49e5f51552115a
www2620552/Python-and-Algorithms-and-Data-Structures
/src/abstract_structures/queues/palindrome_checker_with_deque.py
854
3.75
4
#!/usr/bin/python __author__ = "Mari Wahl" __email__ = "marina.w4hl@gmail.com" import string import collections from deque import Deque STRIP = string.whitespace + string.punctuation + "\"'" """ Using our deque class and Python's deque class """ def palindrome_checker_with_deque(str1): d1 = Deque() d2 = ...
11f252b09bcb7de7f6dbdee53b3882b0b0a61b75
iepisas/python-crash-course
/functions/greet_users.py
284
3.640625
4
def greet_users(names): for name in names: if type(name) == str: msg = f"Hello,{name.title()}" print(msg) else: msg = f"Hello,{name}" print(msg) usernames = ['adhfa','adf','qw','awe',12,45,33] greet_users(usernames)
e8651a935bdf8109a32ed8322085e4abb64550ff
Jodad/python-Text-RPG
/char_data.py
759
3.6875
4
### Credit ####################################### # Created by Joshua Donahue # EMail: Jdonahue98@gmail.com or Jadonahue@mun.ca # # With help from Charles Atisele ################################################## import randCharGeneration import class_list import random ### char_data ##################...
e09ec750b49b0dea45908c2d9d5d925c554d337c
abhihimself/pythonic_algos
/implementation/sum_of_digits.py
168
3.75
4
def sum_of_digits(number): sum = 0 while(number>0): sum = sum+number%10 number=number//10 return sum sum=sum_of_digits(456466) print(sum)
c6383a5e3ec7b934eeca25c67ead345a843a900f
mattharrison/PgPartition
/pgpartitionlib/__init__.py
15,511
3.703125
4
#!/usr/bin/env python # Copyright (c) 2010 Matt Harrison ''' This code will create sql statements to partition a table based an integer column. Note that it does not run anything, it only generates sql. See http://www.postgresql.org/docs/current/interactive/ddl-partitioning.html for details Remember to run: CREATE L...
1b0b8851e7f87ddfbea44e737df4b6215d595ab9
koobeomjin/iot_python2019
/01_jump_to_python/3_control/sub/q2.py
778
3.75
4
#coding: cp949 age = 0 age1 = '' age2 = '' age3 = 'ûҳ' age4 = '' age5 = '' fee1 = '2000' fee2 = '3000' fee3 = '5000' age = int(input("̸ Էϼ")) if age >= 0 and age <= 3: print(" %s̸ Դϴ." %age1) elif age > 3 and age <= 13: print(" %s̸ %s Դϴ." %(age2, fee1)) elif age > 13 and age <= 18: print(" %s̸ ...
8b1678b3fbe287c4ff48166b81ef30786ac64d94
AnnaChemeteva/Geek_Brains.Part_1
/Home_task_3.py
218
3.65625
4
try: a = input('Введите любое число: ') b = int(a + a) c = int(a + a + a) except ValueError: print('Ошибка. Вы ввели не число') else: print(int(int(a) + b + c))
5bc312fe55080e9b515575ffb9875906c41bd68f
kschimpfiv/Trading-Machine
/database.py
1,500
3.609375
4
# Database Construction File # Imports import sqlite3 as sqlite3 import pandas as pandas import os import glob # Create connection and cursor connection = sqlite3.connect('trading.db') cursor = connection.cursor() # Create table for trading.db def create_table(): """ Create a SQLite table to be converted to...
844d105cf5b32ccf3e33fcd7c697f288472d6308
NimrahJabbin/UIT-module1-projects
/user.py
1,071
3.90625
4
import tkinter as tk from tkinter import ttk win=tk.Tk() win.title("user") #win.geometry("300x200+10+20") name_label=ttk.Label(win,text="Enter your Name") name_label.grid(row=0,column=0) username=tk.StringVar() nameEntry=ttk.Entry(win, width=20 , textvariable=username) nameEntry.grid(row=0,column=1) email...
ee17fa6864d46b46573a9f160d28231913262756
AlanHe-Xiaoyu/LeetCode
/2020/01 - Jan/442 Find_All_Duplicates.py
596
3.703125
4
class Solution: def findDuplicates(self, nums: List[int]) -> List[int]: """ Runtime: 400 ms, faster than 47.79% of Python3 online submissions for Find All Duplicates in an Array. Memory Usage: 20.3 MB, less than 35.71% of Python3 online submissions for Find All Duplicates in an Array. ...
a85aa848f353a6f05cdcb2a283dd49dd25dd23a0
TheLurkingCat/TIOJ
/1099.py
843
3.59375
4
from queue import Queue Hit = False Stop = False def BFS(x, y, z): global Hit, Stop if (x, y, z) in visited or Stop: return if not (-1 < x < n+1 and -1 < y < n+1): return if (x, y, z) == target: Hit = True Stop = True return visited.add((x, y, z)) BFS_Qu...
2fca764bcd3df185a87837bb4624271c1e2a9fc7
knight008848/My_little_Py
/searchsort/insertsort.py
766
4.09375
4
""" Insertion Sort Overview: ------------------------ Uses insertion of elements in to the list to sort the list. Time Complexity: O(n**2) Space Complexity: O(n) total Stable: Yes """ def sort(l): """Record the values in l from smallest to largest.""" i = 0 while i != len(l): ...
d493e0c8ca959fb090cc885fd464b425221dd1a5
kkelikani/Week3-Project-CIS-Prog5-2020
/weeklypay.py
915
4.09375
4
""" Program: program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay Author: Kaleo Kelikani Inputs: Hourly wage total regular hours total overtime hours output print total weekly pay weekly pay is hourly wage * regular hours + overtim...
ab7112eac61806bc7bb646bece067db34c9f5e43
sumin3/holbertonschool-higher_level_programming
/0x03-python-data_structures/6-main.py
213
3.546875
4
#!/usr/bin/python3 print_matrix_integer = __import__('6-print_matrix_integer').print_matrix_integer matrix = [[0, 1, 2, 3],[5, 6, 5],[0, 7, 8, 9]] print_matrix_integer(matrix) print("--") print_matrix_integer()
1e7f763f97bbd9c240f545a6ef4db88864e77e8b
wesenu/summer_algorithms_practice
/selectionsort.py
363
3.984375
4
def main(array): for iteration in range(len(array)-1,-1,-1): print array maxvalue = array[0] maxindex = 0 for index in range(1,iteration+1): if array[index] > maxvalue: maxindex = index maxvalue = array[index] temp = array[iteration] array[iteration] = maxvalue array[maxindex] = temp return a...
21b347c6b345c380478d445ff2a88ba4df34f855
Shristi19/GeeksforGeeks-Solved-Question
/string sort.py
198
3.921875
4
num=int(input()) arrays=[] for i in range(num): lent=input() array=list(input().strip().split()) arrays.append(array) for list1 in arrays: list1.sort() print(list1[0],list1[-1])
42767ca8d0324f8dd9e8aa7680a688f9910d72d5
sandeepraj786/Fellowship_Python_Program
/Array/reverseArray.py
758
4.21875
4
""" author -sandeep raj date -05-11-2020 time -08:56 package -array problem Statement-Write a Python program to reverse the order of the items in the array. """ class ReverseArray: #create method to reverse an array def reverseArray(self,arrOfNum): ''' :param:self ...
291fc89dfe3f46bff11cdd1ee07a49b98de93be9
areddish/python_problem_night
/triange.py
868
3.890625
4
# triangle.py # https://www.hackerrank.com/challenges/python-quest-1/problem ##### # Solution 1 # Example on how to do it with strings, but not accepted by hackerrank due to string operation. for i in range(1,int(input())): for j in range(i): print(i, end="") print() ##### # Solution 2 # Example o...
1736335e8d76627817af38f5f4bfccd7276b8083
git874997967/LeetCode_Python
/easy/leetCode1118.py
485
4.0625
4
#1118. Number of Days in a Month def numberOfDays(year, month): daysMap = {} for i in range(1,13): if i in (1,3,5,7,8,10,12): daysMap[i] = 31 elif i in (4,6,9,11): daysMap[i] = 30 else: daysMap[i] = 28 if (year % 4 == 0 and year % 100 != 0 ) or (ye...
e9f56d96cd0ac14bbc4abc217a49896827430cb6
zhh-3/python_study
/Python_code/demo3/demo2.py
311
3.65625
4
a = 100 def test1(): # a = 300 # name 'a' is assigned to before global declaration:全局变量生命应在其实用之前 global a # 定义a 为全局变量,修改后,全局变量也被修改了 print(a) a = 200 print(a) def test2(): print(a) test1() test2()
981af39a69af9d1523d6753a67b851dcea57003c
MirkoNardini/tomorrowdevs
/Workbook - cap5/Exercise_133_Does_a_List_Contain_a_Sublist.py
742
3.5625
4
def isSublist(smaller, larger): a = 0 b = 0 c = len(smaller) count = 0 check = 0 res = False while len(larger)>b: while len(smaller) > a: if smaller[a] == larger[b]: count = count + 1 check = check + 1 c = 0 ...
a88b9ca32137a9b7af2fcc686501c499d461c0bb
wanglinjie/coding
/leetcode/multiplystrings.py
830
3.953125
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # date:20160711 class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can b...
ca9405cd48264a6aecf5e0708b33ae168b6cbd17
zhoujl48/JianzhiOffer-Python
/24_反转链表.py
2,604
4.15625
4
#!/usr/bin/python # -*- coding:utf-8 -*- # # Copyright (c) 2019 github.com/zhoujl48, Inc. All Rights Reserved # """ Project JianzhiOffer-Python -- 面试题24: 反转链表 背景:无 要求:反转链表 输入:head 输出:reversed_head Usage: Authors: Zhou Jialiang Email: zjl_sempre@163.com Date: 2019-07-06 """ class LinkNode(object): def __init__(se...
98041306ae02e5b5556ecf41b38cb69195942ba2
Trinadhbabu/Artificial-Intelligence
/multiple_linear_regression_predicting _house_prices.py
2,072
4.09375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 29 18:49:09 2020 @author: Trinadh.Singaladevi """ ''' Objective In this challenge, we practice using multiple linear regression to predict housing prices. Check out the Resources tab for helpful videos! Task Charlie wants to buy a house. He does a ...
c472fc3ca6a42916200a365421963dfbce1a6433
alex440440/epi_python
/06.08/exercise_06_08.py
979
3.828125
4
import sys class Main: @staticmethod def get_primes(number): return Main.get_primes_sieving(number) @staticmethod def get_primes_division(number): primes=[] for num in xrange(2,number+1): if not Main.is_divisable(num, primes): primes.append(num) ...
0e2e4027d0b614aed41ba422c5431558b0bc3ffb
michaelzhou88/Tic-Tac-Toe
/tic-tac-toe.py
5,797
4.25
4
# ---Global variables--- # Game board board = ["-","-","-", "-","-","-", "-","-","-",] # If game is still going # When game is over this will change to false game_still_going = True # Who won? Or Tie? winner = None # Who's turn is it (X goes first) current_player = "X" # ---Functions--- # Play a ...
de369320c0b979c268a263e7228900c81a8918c7
ruslan-durrani/Python-Problems-Games-Patterns-Twisty-Concepts
/MIN max.py
224
4.125
4
#MIN AND MAX N_list = [] for x in range(5): N_list.append(int(input("Enter data :.."))) print() maxi = max(N_list) mini = min(N_list) print("The max value is :....",maxi) print("The min value is :....",mini) #
90c5ca93d3a3567cbee6882abae1dff8c96299bc
Ivoneideduarte/python-para-raspberryPi
/10 - Comandos BREAK e CONTINUE/ex001.py
350
3.8125
4
nomes = ['Maria', 'Stephane', 'Yandra','Jairo','Cleilton', 'Maycon', 'Carlos', 'Marcos', 'Bianca', 'Dayane', 'Marcos Aurélio', 'Gutemberg'] for n in range( len(nomes) ): if nomes[n][0] == 'M': print(nomes[n], ' é um nome que começa com M') #continue if len(nomes[n]) == 3: print(nomes[n]...
a9206efe6ee7746c7738efd647286596749dc9d8
carnad37/python_edu
/190123/Test09.py
1,343
4
4
#사칙연산 함수 4개 #메뉴 함수 #메뉴함수는 1~4까지만 무한반복. 5에선 종료. 1~5 외의 숫자일땐 재입력을 받게함. def plus(num01,num02): res = num01+num02 return res def minus(num01,num02): res = num01-num02 return res def mul(num01,num02): res = num01*num02 return res def div(num01,num02): res = num01/num02 return res def pri...
d9307d0e851665a18c28b8b03c7c452a59ee2f84
krasigarev/Python-3-2019
/task_7.py
732
3.90625
4
# task_7 moeto reshenie type_value = input() def type_init(argument): if type_value == 'int': num_1 = int(input()) num_2 = int(input()) if num_1 > num_2: print(num_1) else: print(num_2) def type_char(argument): if type_value == 'char': char_1...
88daafde382edaec7c83087ef82111b84624be3f
Tyresius92/rosetta-code
/sleep/sleep.py
142
3.859375
4
import time print("Enter a number of seconds to sleep:") seconds = int(input()) print("Sleeping...") time.sleep(seconds) print("Awake!")
662a40cfac0de042158ed21a818347123b8a89e3
mendezona/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python
/Problem Set 2/Problem1Recursion.py
837
3.84375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 12 17:12:48 2020 @author: josephmendezona """ # Checks unpaid balance of a credit card after 12 months if only minimum payment is met using recursion def getBalance(balance, annualInterestRate, monthlyPaymentRate, timePeriod): if timePeri...
eaaa3aa1702f5aa2f63f50f1ea8e3e7e6f96bd37
pushkardakle/DailyProgrammer
/321/easy/talking_clock.py
1,479
3.609375
4
from num2words import num2words class TalkingClock(object): def __init__(self, hour, minute): self.hour = hour self.minute = minute self.minute_word = "" self.hour_word = "" self.am_or_pm = "am" self.separator = "" self.output = "" def get_time_in_words...
1b07c57e8744bf112c938b7fe034cac7ec43708d
ClarkeCodes/programmeerproject
/scripts/formatCSV.py
1,257
3.609375
4
#!/usr/bin/env python import sys sys.dont_write_bytecode = True import csv def main(): path = sys.argv[1] f = open(path) csv_f = csv.reader(f) countries = [] age_groups = [] values = [] header = ['country', '10 to 14', '15 to 19', '20 to 24', '25 to 29', '30 to 34', '35 to 39', '40 ...
22ceb6ae07fb5c9f32d78ded037ab2b31af396a6
DogForMoon/pythontasks
/14.01.2020/Factorial.py
223
3.640625
4
def factorial(n): answer = 1 while n > 0: if n == 0: return 1 else: answer *= n n -= 1 return answer # https://www.codewars.com/kata/57a049e253ba33ac5e000212
40c081d300828cdbd82ffc3f35d4bf4b113c906b
carriga2/pythonProject
/office_booking_tool.py
7,853
3.5
4
from tkinter import * import tkinter.filedialog as fd import tkinter.messagebox as mb import csv class App(Frame): # App is name of the class def __init__(self, master=None): # inheriting from class Frame Frame.__init__(self, master) self.filename = None # list to store data in memory ...
022d6d088b04c210c81ce1dc2d5f2e77fbc6d5fd
riadnwu/Artifital_Inteligence
/DLS_Tree/DLS.py
958
3.71875
4
#riadnwu@gmail.com #06 graph = { 'A' : ['B','S'], 'B' : ['A'], 'C' : ['D','E','F','S'], 'D' : ['C'], 'E' : ['C','H'], 'F' : ['C','G'], 'G' : ['F','S'], 'H' : ['E','G'], 'S' : ['A','C','G'] } def dfs(graph, node, goal, limit, visited=[]): # else: # print("Not found ",n...
91a24e9a159640fd3d522b7e6057172c38dbef9d
Ajithkumar008/reasonably-false
/factorial.py
89
3.84375
4
x=int(input("enter a number")) i=1 mul=1 while(i<=x): mul=mul*i i=i+1 print(mul)
20781950a3f4fe62f5787f43c1721c69fa8cbe94
brunowber/transnote2
/teste_threed.py
1,347
3.65625
4
import threading import time class FractionSetter(threading.Thread): def __init__(self, stop_count): threading.Thread.__init__(self) self.stopthread = threading.Event() self.stop_count = stop_count self.count = 0 def run(self): """while sentence will continue until the...
8bff91aac7bd49f229c0573b68af7970d5812284
Abooorh0/Fourm
/ATM solution/atm1.py
547
3.671875
4
def atm(money, request): if request > money: print "Can't gvies all this money!" elif request <= 0: print "Please inter the number?" else: while request > 0: if request >= 100: request -= 100 print "Give 100" elif request >= 50: request -= 50 print "Give 50" elif request >...