blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
f83672b7d88aeb2230591e973eb511a2cfa410ee
Niteesha05/Demo
/assignment2_numbers_in_words.py
239
4.09375
4
num=int(input("enter the value between 1-5:")) if num==1: print("one") elif num==2: print("two") elif num==3: print("three") elif num==4: print("four") elif num==5: print("five") else: print("invalid")
f697507531659b25dbe17bde35735c498120a45e
pauligb/TC4002.1_Analisis_Diseno
/Lab1/src/findNumber.py
1,288
3.984375
4
import random def is_int(num): try: int(num) return True except ValueError: return False file_name = "GuessingSteps.txt" output_file = open("GuessingSteps.txt", "w") max_value = 30 random_number = random.randrange(max_value - 1) + 1 def printAll(file_descriptor, text): file_de...
0092e7007c08ba23246f842575f7c364249abec9
14gollaher/Katas
/Katas/Python/AVeryBigSum.py
275
3.515625
4
# https://www.hackerrank.com/challenges/a-very-big-sum import sys def aVeryBigSum(n, ar): sum = 0 for item in ar: sum += item return sum n = int(input().strip()) ar = list(map(int, input().strip().split(' '))) result = aVeryBigSum(n, ar) print(result)
3e04ad7fc350be9685e8c48aee40fe6b11f617b5
Kiaradamiancoloma/T07_DAMIAN-MENDOZA
/DAMIAN_COLOMA/while4.py
646
3.84375
4
#Programa que muestre el importe alto del cliente #Declaracion capital_inicial=0.0 interes_simple=0.0 #Input capital_inicial_invalido=(capital_inicial<200.9 or capital_inicial>600.9) interes_simple_invalido=(interes_simple<0.5 or interes_simple>0.9) while(capital_inicial_invalido): capital_inicial=int(input("Ingr...
d068f3649a4df8bab11eb7defa64c575b1b6443e
fatemechangizian/Machine-Learning-and-Intelligent-Systems-MALIS-
/LAB 3/utils.py
4,704
3.828125
4
import random import matplotlib.pyplot as plt import numpy as np from math import sqrt, cos, pi import pandas as pd class Dataset: ''' A class representing a dataset built reading the file whose name is stored in 'datafile'. The first layer of an instance of the SVM class should be a Dataset object. s...
1dae55d9168f137d449e164c3655b843612a0ef9
JLyndon/PLD-Assignment-05
/StagesofLife.py
965
4.0625
4
def DetermineLifeStage(Usr_Age): if (Usr_Age >= 0) and (Usr_Age <= 12): print("Kid") else: if (Usr_Age >= 13) and (Usr_Age <= 17): print("Teen") else: if Usr_Age == 18: print("Debut") else: if Usr_Age >= 19: ...
76b77d4d37492a3afb4820e94ce126d92d3578ec
lisaoverall/cryptopals-python
/pkcs7.py
1,705
3.84375
4
#!/usr/bin/env python3 # Cryptopals Set 2 - Challenge 9 # implement PKCS#7 padding # pad any block to a specific block length, # by appending the number of bytes of padding to the end of the block. # Cryptopals Set 2 - Challenge 15 # PKCS#7 padding validation def pad(s, n): assert n < 256 # highest value of a p...
8e16501f6be1966c589ff5a73ae40b797d9b2122
chutianwen/LeetCodes
/LeetCodes/Google/MissingRanges.py
4,591
3.671875
4
''' Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges. For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4->49", "51->74", "76->99"]. ''' class Solution(object): def binarySearch(self, nums, target): ...
1015caf519d3a56eb5ea236bc4ebc86721e08c84
ludwigwittgenstein2/Algorithms-Python
/programSimpleTree.py
176
3.578125
4
myTree = ['a', ['b',['d',[],[]],['e',[],[]]],['c',['f',[],[],[]],[]]] print myTree print('left subtree=',myTree[1]) print('root=',myTree[0]) print('right subtree=',myTree[2])
3d2e2cf38593e6c420061c3a4c1c15913a3b6c41
raokartikkumar24/beginners_python
/permute.py
490
3.5625
4
__author__ = 'KRao4' def nextPermutation(perm): k0 = None for i in range(len(perm)-1): if perm[i]<perm[i+1]: k0=i if k0 == None: return None l0 = k0+1 for i in range(k0+1, len(perm)): if perm[k0] < perm[i]: l0 = i perm[k0], perm[l0]...
f34611c91cf55366b0d07349c90b0078d56934cd
lagrelax/PyProject
/LeetCode/BinaryTree/SegmentTree.py
1,088
3.5
4
from typing import * import math import collections from BinaryTreeUtils import * class NumArray: def __init__(self, nums: List[int]): left = 0 right = len(nums)-1 self.seg_tree = self.constructSegTree(left, right, nums) def constructSegTree(self, left, right, nums): node = N...
23636314892ec3316f5f4d6b34ad4d9741d3bf44
sol83/python-simple_programs_1
/Variables & User Input/ages.py
834
3.875
4
""" How old are they? Write a program to solve this age-related riddle! Anton, Beth, Chen, Drew, and Ethan are all friends. Their ages are as follows: Anton is 21 years old. Beth is 6 years older than Anton. Chen is 20 years older than Beth. Drew is as old as Chen's age plus Anton's age. Ethan is the same age as...
54c4dd228fe4dfd7ee000334a19595fae10f9e49
Lomio184/Oneline_Interpreter_-binaryop-
/main.py
5,255
3.625
4
from enum import Enum import sys class TokenType(Enum): INTEGER_TYPE = 0 SYMBOL_TYPE = 1 UNARY_TYPE = 2 OP_TYPE = 3 PLUS_TYPE = '+' MINUS_TYPE = '-' MUL_TYPE = '*' DIV_TYPE = '/' class Token: def __init__(self, token, line, col, tokentyp...
91e928d68c29ad393e5a72dc57cc64b14d41dd57
dalmago/data_structure_nanodegree
/unfinished_tales/chapter 2/subsequence.py
1,704
3.65625
4
def longest_consecutive_subsequence(input_list): visited = {} smallest = None for elem in input_list: if smallest is None: smallest = elem visited[elem] = {"smallest": elem, "count": 1} if elem - 1 in visited: # increment counts visited[elem - 1...
884da5a730581fd91010075e8a3cc3a4dd28eb15
syurskyi/Python_Topics
/125_algorithms/_examples/_algorithms_challenges/pybites/topics/Algorithms/267/island.py
3,115
4.125
4
# Hint: # You can define a helper funtion: get_others(map, row, col) to assist you. # Then in the main island_size function just call it when traversing the map. rectangle = [[0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1, 0]] whole = [[1, 1, 1], [1, 0, 1], ...
25360b56032cce6769bfc1cab272b379f78cb2f3
mz-jobs/LeetCode
/085MaximalRectangle.py
1,870
3.515625
4
# matrix = [ # ["1", "0", "1", "0", "0"], # ["1", "0", "1", "1", "1"], # ["1", "1", "1", "1", "1"], # ["1", "0", "0", "1", "0"] # ] from bisect import bisect_left, bisect_right matrix = [ ["0", "0", "1", "1"], ["0", "1", "1", "1"], ["1", "1", "1", "1"], ["1", "1", "1", "1"] ]...
1249a3255abfcdd6ba84fad41f4ec55e4d61995e
Arjun-Pinpoint/Code-Book
/Python/number of count.py
164
3.53125
4
# -*- coding: utf-8 -*- """ Created on Mon May 20 23:20:29 2019 @author: Arjun """ n=int(input()) count=0 while(n>0): n=n//10 count=count+1; print(count)
b883cfcad6fc47da63b587a27665e83968fe302b
ddarkclay/programming-cookbook
/Python Programs/ananymous_even_odd.py
412
4.25
4
#Print Even numbers in a list using Lambda function my_list = [3,5,2,11,6,8] list_Even_Numbers = list(filter(lambda varX: varX % 2 == 0,my_list)) print("Following are Even numbers in the list =",list_Even_Numbers) #Print Odd numbers in a list using Lambda function list_Odd_Numbers = list(filter(lambda varX: ...
ab65fce90ee16c59efb79298977803f256ed4215
christodragnev/unit2
/lastname.py
202
4.0625
4
#Christo Dragnev #2/2/18 #lastname.py name = input('Enter your lastname: ') if name<'M': print(name, "is in the first half of the alphabet") else: print(name, "is in the second half of the alphabet")
b66d7eb49f36e51e2cbf4f4f87de9d5d840bdc9b
Crewe/und256-p0
/Task4.py
3,029
4.09375
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 4: The telephone company want to i...
b73cc282f48f1baa265eabd8567acffcd81c08af
viniciusscastro/Curso-em-Video-Exercicios-de-Python-nao-modularizados
/Coding/vini diretory/Aula12 Condições aninhadas/pratica e teoria.py
1,373
4.46875
4
#condições aninhadas são condições que nao são binarias e acabam tendo condições maiores que 2 #neste caso é necessario colocar uma estrutura condicional dentro de outra estrutura condicional # # ___________________________ # ! _______ponto_________ ! # ! ! ! ! ! ! # ...
fa264be9d4e2b2a108501b56be834808dbdb1ec3
JoshOrndorff/advent-of-code-2016
/8/8.py
2,216
3.796875
4
# Module level variable to represent the screen screen = [] def rect(a, b): """ Performs the rect operation on the screen. """ for i in range(b): for j in range(a): screen[i][j] = True def rotate_row(y, by): """ Rotates a row in the screen. """ row = screen[y] newRow = [] # Loop throu...
c0fee079507a9c94b2c25007998d017d041af717
andrecon/Python-Practice
/Tkinter/Projects/Tkinter_Checkboxe.py
750
3.625
4
import sys if(sys.version_info[0] < 3): print("This program is written with Python 3.x") print("Run \'Python3 filename.py\' to propperly run the program") sys.exit(1) else: from tkinter import * master = Tk() def var_states(): print("male: %d,\nfemale: %d" % (var1.get(), var2.get()))...
cbd45ecb34dd9ab5785e147b81480f04585a2994
ColeMaddison/hillel_python
/python_3/hw_3_4.py
357
3.953125
4
# Задача-4 # Изменить исходную строку на новую строку в которой первый и последний символы строки поменяны местами. string = 'oellh' def change_first_last(string): return '{}{}{}'.format(string[-1], string[1:-1], string[0]) print(change_first_last(string))
b2cf1e517a943ec4f11af83e5978b2b7f7c77d4a
adifakathy/app.py
/app.py
620
3.921875
4
print("hello world") print("My name is Adifa Vuyia Kathi") print(1000) print("\"Adifa") #Casting x = str(3) x = str(3) y = int(3) z = float(3) print(x) print(y) print(z) #Type() x = 5 y = "kathi" z = 3.55 print(type(x)) print(type(y)) print(type(z)) #Unpack a collection fruits = ["apple","banana","mango"] x,y,z=fruits...
1d79fe65489aaa2233d89e094d0b908b62dc788c
guptavedansh2002/university-assignments-2nd-Year
/PythonProjects/equality of numbers.py
158
4.1875
4
a=int(input("Enter an integer a : ")) b=int(input("Enter an integer b : ")) if a==b: print("a and b are equal.") else: print("a and b aren't equal.")
63f315c2b13e651fc76ac40e670a6f7ad35ed941
ao-kamal/coding-projects
/dice.py
310
3.859375
4
import random def rand(): print('The die roll returned ' + str(random.randint(1, 6))) prompt = input('Would you like to print again?\n') if prompt == 'Yes': rand() elif prompt == 'No': print('Bye!') else: print("That's not a valid answer") rand()
f5bbf974b9feff4d2bcfe07c30c360ee72329cbd
Jay-Patil1/Coding
/Code With Harry/Python Tuts/tut31 (Time Module).py
714
4.15625
4
# TIME MODULE # How to find the execution time of a program? import time initial = time.time()# This gives number of ticks.That is number of seconds. print(initial) k = 0 while(k<45): print("This is Jay") time.sleep(2) # The programm stops for () ticks. k+=1 print("While loop ran in",time.time()...
7f360c33f2287672f288872b9313f8922e170640
trendsetter37/HackerRank
/IsFibo/isfibo.py
530
4.03125
4
import math def perf_square(n): ''' A number is in the fibonacci sequence if and only if 5n**2 + 4 or 5n**2 - 4 is a perfect square ''' pos = 5*n**2 + 4 neg = 5*n**2 - 4 return True if math.sqrt(pos) % 1 == 0 or \ math.sqrt(neg) % 1 == 0\ else False ...
293622b0ad1db6c2d04ab4a3133bede3d7a159d7
yuyunli2/machine_learning
/mp2/train_eval_model.py
3,459
3.640625
4
""" Train model and eval model helpers. """ from __future__ import print_function import numpy as np from models.linear_regression import LinearRegression import random from utils import io_tools from utils import data_tools def train_model(processed_dataset, model, learning_rate=0.001, batch_size=16, ...
f9e1f99de7de31cb84266b16cb6d3c32e3a51694
Pandelov/msds510
/src/make_report.py
903
3.578125
4
import sys from src.msds510.util import util def main(): # If the number of arguments does not equal 2 (true) # then we need to say that the report generator takes two if len(sys.argv) != 3: print("this report generator takes two parameters, " "an input file and an output file") ...
f57b48227b39cb5a1e52f7609200034203dc2d82
GOPALAKRISHNAN-R/Basic-Examples
/BasicSeven.py
578
3.921875
4
''' This Python program show function basics @author R.Gopalakrishnan @author gopalakrishnanr94@gmail.com @author www.rgopalakrishnanmca.simplesite.com ''' # function without parameter and without return def say_hello(): print("Welcome to Python!!") # function with parameter and without return def add_two(a,b)...
7ad671e654ba8561f6b532ea49367385e8f42fea
ComputationalReflection/stypy
/testing/test_programs/without_classes/generator_expression/simple_if_expression.py
220
3.765625
4
# http://stackoverflow.com/questions/394809/does-python-have-a-ternary-conditional-operator a = 5 b = 6 x = 1 if a > b else -1 y = 1 if a > b else -1 if a < b else 0 z = 1 if a > b else "foo" print x print y print z
40f3828395a2261a2a8f3c7261dc2590f54b0525
Luke19950111/python_practice
/file/10_5/why_program.py
316
3.9375
4
while True: why_like = input('Why do you like programming?(enter q to quit) ') if why_like == 'q': break else: print('I like programming because ' + why_like) filename = 'why_book.txt' with open(filename, 'a') as file_object: file_object.write(why_like + '\n')
162a9e1b705f2380e6481cc3c97279cbae7dd46a
dAIsySHEng1/CCC-Junior-Python-Solutions
/2017/J3.py
455
3.859375
4
def exactly_electrical(): j = [] for i in range(3): n = input() s = n.split() j.append(s) x_diff = abs(int(j[0][0]) - int(j[1][0])) y_diff = abs(int(j[0][1]) - int(j[1][1])) charge_steps = x_diff + y_diff total_charge = int(j[2][0]) if charge_steps > total_charge: ...
b8a8c8a07909deb5ed39492bf2d1590d842d94b5
Bongkot-Kladklaen/Programming_tutorial_code
/Python/Python_Beginners/Dictionarie/dic.py
274
4.03125
4
temp = {} temp['sun'] = 33.4 temp['mon'] = 45 temp['tue'] = 30 print(temp) mail_address = {'amul':'amul@gmail.com','jenni':'jenni@gmail.com'} print(mail_address) print(mail_address.keys()) print(mail_address.values()) num = {1:'one',2:'two',3:'three'} numbers = dict(num) print(numbers)
86109fc6e41dcf030be7679dc844815266eda8ce
angelinn/HackBulgaria
/week0/simplify_fraction.py
323
3.9375
4
def simplify_fraction(fraction): first = fraction[0] second = fraction[1] if second == 0: raise ZeroDivisionError for i in range(max(first, second), 1, -1): while first % i == 0 and second % i == 0: first //= i second //= i return (first, second...
d5561f3352abe03f31cc60275517f889ae5619c9
viniciusscastro/Curso-em-Video-Exercicios-de-Python-nao-modularizados
/Coding/vini diretory/Aula15 Break/desafioAula15#67.py
249
3.875
4
while True: n = int(input('digite um numero para ver a tabuada(digite um numero negativo para parar)')) if n < 0: break print('-=' * 20) for c in range(1, 11): print(f'{c}x{n}={c*n}') print('-=' * 20) print('fim')
d93cfd3640600eb19e0945e8cc5c88ba96e4a0fb
Hermi999/Design-Of-Computer-Programs
/islandOrNot.py
4,398
3.921875
4
# -*- coding: utf-8 -*- """ Count the islands in 2d-field. There are 2 field values: 0 = water, 1 = land. Constraint: fields which border to the edge of the map are peninsulas """ class FieldIsWaterException(Exception): pass def count_islands(_map): islands = 0 width = len(_map[0]) height = len(_map) ...
c8a380b67e5b2d66350b4c2468694887b08d67f4
safecloud-project/recast
/pyproxy/pyproxy/coder/safestore/signed_hashed_splitter_driver.py
1,329
3.828125
4
"""Driver for xor encryption of a String with signature and integrity.""" class SignedHashedSplitterDriver: """ Class used to encode and decode a string using plain xor. This Encryption guarantees privacy, integrity and non repudiation- """ def __init__(self, splitter, signer): """ Initia...
2dcbd83012540b2d4c3647de94f95e5f46187d51
gitTianxy/py-algorithms
/dijkstra.py
2,692
3.953125
4
# encoding=utf-8 """ Dijkstra algorithm demo ------------------------- I. 应用场景 1. 带'非负'权值的图(之所以有非负的要求,是为了保证靠后获得的路径长度总是大于已有的路径长度) 2. 用于求指定顶点start到其余'所有'顶点最短路径 II. 数据结构 1. 点集区分U/S: S: 已经有路径的点集 U: 还无路径的点集 2. 最短路径集: 记录起点start到S中个点的最短路径及其权值 III. 算法步骤 0. init: S(empty list), U(all node), shortest_path(empty lis...
fd768ef88802581b674db48ece1ca3161e070b59
jz33/LeetCodeSolutions
/T-1302 Deepest Leaves Sum.py
1,162
3.8125
4
''' 1302. Deepest Leaves Sum https://leetcode.com/problems/deepest-leaves-sum/ Given a binary tree, return the sum of values of its deepest leaves. Example 1: Input: root = [1,2,3,4,5,null,6,7,null,null,null,null,8] Output: 15 Constraints: The number of nodes in the tree is between 1 and 10^4. The value of nodes ...
97796cf9e722c37e39862d02cd1ae165ad4a2065
ztamas97/School
/Second_lesson_empty.py
3,187
3.875
4
# Második óra 2020.09.22. # String #A string adattípus szöveges értékek tárolására szolgál. #Pythonban a string frogalma: Unicode karakterek nem módosítható sorozata. # 1a Tároljanak el egy fruit nevű változóban egy tetszőleges gyümölcs nevét, majd írassák ki képernyőre. fruit = 'alma' print (fruit) # 1b Írassa ki k...
a87e854ad313dfcc5695af0a8c8f8fc9ef5640a9
syskantechnosoft/2105PythonBatch
/Day1Python/controlflow.py
547
4.09375
4
# Python has your typical if else while for as most programming languages x = 1 # Python does NOT use curly brackets # It uses colons, new lines and indenting to create 'blocks' of code if x < 10: print("The value is less than 10") elif x==10: # else if print("The value is 10") else: print("The Value is 10...
a64e3a9785df76caec344664a66ea29ffeee0779
neerajkasturi10/Hackerrank_Python
/Itertools/itertools.product().py
166
3.640625
4
from itertools import product A = list(map(int,input().split())) B = list(map(int,input().split())) prod = product(A,B) for each in prod: print(each, end = " ")
4949ae1147d07998a518e376c62b1264c4ca8b18
kjport3/py4e
/lists.py
571
4.125
4
# Exercise 8.4 # Find all the unique words from a file and sort them fname = "romeo.txt" fh = open(fname) lst = list() for line in fh: line = line.rstrip() words = line.split() for word in words: if word not in lst: lst.append(word.lower()) lst.sort() print(lst) # Exercise 8.5 fname =...
844067e4c990b92832ce135121ee80ca1e18e548
bryanbilek/Sprint-Challenge--Algorithms
/recursive_count_th/count_th.py
1,209
4.28125
4
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' def count_th(word): # count how many times lowercase 'th' is in wor...
349292eb44030376420667ff8345fb4622b2d3e9
Dara-Shelli/PythonProjects
/python-basics/classes/ArithmeticOperationsSupport.py
851
3.75
4
class Human: def __init__(self, surname, name, intelligence): self.surname = surname self.name = name self.intelligence = intelligence def __str__(self): return f'{self.surname} {self.name}' def __add__(self, other): if isinstance(other, Human): return ...
55f283a48a78d0194d5ac658a496c987f4bedcd6
andrayantelo/hackerrank
/python_problems/funset.py
1,195
3.9375
4
# Consider the following: # A string, s, of length n where s = c0c1...c(n-1). # An integer, k, where k is a factor of n. # We can split s into n/k subsegments where each subsegment, ti, consists of a # contiguous block of k characters in s. Then, use each ti to create string ui such that: # The characters in ui are a...
e780c80338438992b51eb3e5881affadf743c84e
yawei798/AlgorithmsAndDataStructures
/用Python解决数据结构和算法/2:算法分析/two_1.py
556
3.59375
4
import time def sum_1(n): # 时间复杂度为O(n) start = time.perf_counter() # time.time() the_sum = 0 for i in range(n + 1): the_sum += i end = time.perf_counter() # time.time() m = end - start return the_sum, m def sum_2(n): # 时间复杂度为O(1) start = time.perf_counter() a = n*(n + 1)/...
201aaf2b6cec3b29428357ed00a75bc9ae1eadd7
elgrian/Tweet-Generator
/dictionary.py
733
3.84375
4
import random, timeit from sys import argv #Creates a variable for the counter i = 0 argument_int = int(argv[1]) def load_word(): """Reads the words from a dictionary""" f = open("words.txt", 'r') words_list = f.readlines() f.close() split_words = words_list[0].split(' ') return split_words ...
e2621eebc82a28eda041919974d8aa966d2b52d2
broadlxx/171-172-271python-
/dayi/Assgin 2B-XueXiang-Lv-175150-19023249/Question 1_Xuexiang_Lv_19023249_175150.py
1,898
3.890625
4
print("Name:XueXiang Lv Student ID:175150 Massey ID:19023249") #Name:XueXiang Lv Student ID:175150 Massey ID:19023249 moviefile=open("movietitles.txt","r") line=moviefile.readlines() def Notempty(): #This function is calculating lines a=0 for i in line: if i!=None: a+=1 ret...
cc513e3be0df905630ea1a90e06fe61dec737871
schintatkun/algorithms
/Python/Recursion/sigma.py
247
3.5
4
# Sigma(5) = 1+2+3+4+5 = 15 # Sigma(4) = 1+2+3+4 = 10 # Sigma(3) = 1+2+3 = 6 # Sigma(2) = 1+2 = 3 # Sigmm(1) = 1 # Time O(n) def sigma(n): if n < 0 : return 0 else: return sigma(n-1)+n print(sigma(5)) print(sigma(20))
76e7caadbe0701ee7c0916733f1e80d1f280bca7
andrew-jeremy/Fourier-Transform-Deep-Networks
/CIFAR10_TF_Dense_FFT.py
14,096
3.953125
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu May 4 18:35:38 2017 @author: kiruluta """ ''' A Multilayer Perceptron implementation example using TensorFlow library. This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/) Author: Aymeric Damien Project: h...
2a9b341210d2996d0f85e28b77c3e4da178a55bb
arvindkarir/python-pandas-code
/Py exercises/FindShortestPath.py
812
4.15625
4
# -*- coding: utf-8 -*- """ Created on Tue Dec 5 10:02:36 2017 https://www.python.org/doc/essays/graphs/ @author: User """ graph = {'A': ['B', 'C'], 'B': ['C', 'D'], 'C': ['D'], 'D': ['C'], 'E': ['F'], 'F': ['C']} def find_shortest_path(g...
979f0aeda1169f511f9295728717d3393fe4ccda
marcoavfcc01121979/curso-python
/questao3.py
320
3.765625
4
class Capacidade(object): def maxima(self, tamanho, capEmMetrosQuadrados = 1.5): capacidade = tamanho / capEmMetrosQuadrados print("A Capacidade de alunos na sala e ", capacidade) c = Capacidade() tamanho = float(input("entre com o tamanho da sala em metros quadrados ")) c.maxima(tamanho)
a8a919bf56260ecf839426a456e2fe0a4808e207
Sayakhatova/informatics
/7.while/b.py
54
3.5
4
n=int(input()) i=2 while n%i==0: print(i) i+=1
209976ed9e5686802bcb7dd55f6da3c2f837ea88
Astrobot-me/Some-mathematical-calculations
/New folder/factorial_2.py
126
4.0625
4
#y = 1 num = int(input('Enter you number--')) for x in range(1,num): num=num*x print('Factorial is = ' + str(num))
2f6d5d5bf4e3ff71b9b4255a62a56f73d5ab8905
SwaroopDandamudi/StudentRepository
/HW10_ShanthiSwaroop_Dandamudi.py
8,024
3.953125
4
""" The program has four classes where 3 classes are intialization classes for the data provided in 3 different files. The university class reads all the files and updates the values in students, majors, instructors and prints the summary tables of students, majors and instructors using pretty tables We...
3fd046feb4516615057dc421eb2b99006db921a4
josue270193/python_zookeeper
/Topics/Program with numbers/The last digit of a number/main.py
114
3.65625
4
# put your python code here eval_integer = int(input()) last_digit = str(eval_integer)[-1] print(int(last_digit))
1d86d019b68d9937bd65e2c551d57bc9c03efe4f
ChangxingJiang/LeetCode
/0201-0300/0237/0237_Python_1.py
507
3.875
4
from toolkit import ListNode class Solution: def deleteNode(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. """ node.val = node.next.val node.next = node.next.next if __name__ == "__main__": node_list = ...
dd059afa0ec0022c57fa6f581ed7f2f6c2fdd007
jguardado39/A-Kata-A-Day
/Python/Sum_Without_Highest_and_Lowest_Number.py
939
3.53125
4
# Modified: 04/11/2017 # # Author: jguardado39 (John Guardado) class Solution(): """ https://www.codewars.com/kata/sum-without-highest-and-lowest-number Sum all the numbers of the array (in F# and Haskell you get a list) except the highest and the lowest element (the value, not the index!). (The highest/lowe...
32ea68562f798f349c28b090c268cbf9bbcf2fdb
zkbaum/number-theory
/hw4/p5.py
611
3.5625
4
#!/usr/bin/env python # FRINT 20.3 # This script helps in computing all the cubic residues for a couple primes from util import is_prime # CONFIG LOWER_BOUND = 3 UPPER_BOUND = 20 for p in range(LOWER_BOUND,UPPER_BOUND): if is_prime(p): print("\n[Processing %d]\n----------------" % p) c...
3201f24c2d371e2428e458efe9dd4dbb01373fe1
SoySoy4444/Tic-Tac-Toe-AI
/game.py
6,210
3.859375
4
# Created 17/06/20 class Game: def __init__(self, player_symbol, grid_size): self.GRID_SIZE = grid_size self.player_symbol = player_symbol self.computer_symbol = "X" if player_symbol == "O" else "O" self.board = [["-" for _ in range(self.GRID_SIZE)] for _ in range(self.GRID_SIZE)]...
1bb0fff9c7b31a55d18577754f202be4e0e6b1f9
kli283/P2p-social-network
/DatabaseFunctions.py
6,956
3.625
4
import sqlite3 # This function initialises the database, creating all the necessary tables def create_database(): connection = sqlite3.connect("LiChat.db") cursor = connection.cursor() try: cursor.execute( "CREATE TABLE IF NOT EXISTS Messages(MessageID INTEGER PRIMARY KEY, Sender TEXT,...
e9570b589377e545d7cf35bb705d695cc0e77883
changhao2882/changhao0001
/django/untitled/class/单继承的实现/person.py
395
3.734375
4
class Person(object): def setMoney(self,money): if money<0: money = 0 self.__money = money def getMoney(self): return self.__money def __init__(self,name,age,money): self.name = name self.age = age self.__money = money def run(self):...
73cf5ac9a2738b7cd1e03d0d33509788b7c39c5a
Swarajsj/Python-Programes-
/GUI_8.py
1,239
3.8125
4
# %% # Radio Button from tkinter import* class mybuttons: def __init__(self, root): self.f = Frame(root, height=500, width=500) self.f.propagate(0) self.f.pack() # Create intvar class variable self.var = IntVar() self.r1 = Radiobutton(self.f, b...
7f720e1e97c33cd8882ff76a7148bbeb64576cdf
Pro-Coder-Boy/text-code
/ماشین حساب.py
1,485
4.3125
4
from math import* def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): return x / y def power(x, y): return x**y def radical(x): return sqrt(x) print("Select operation.") print("1.Add ( + )") print("2.Subtract ( ...
d100667abf60a9183cf92124cde4e71595670fc5
Sharukkhan777/Python
/Standardisation and Normalization.py
853
3.515625
4
# Standardisation And Normalization # data l=[3,3,4,4,6] #------------------------------------------------------------------------------ # standardisation # mean n = len(l) summ = 0 for i in range(n): summ = summ + l[i] mean = summ/n # sample standard deviation(n-1) sd = 0 for i in range(n): s...
c8ff8d3bbdc836dd0d35ef8100035543252d0fd7
Aeternix1/Experimentation
/socket_programming/echo-client.py
983
3.671875
4
""" Client: send data to the server and print the server's reply """ import sys from socket import * serverHost = 'localhost' serverPort = 50007 message = [b'Hello network world Hello network world Hello Network World'] if len(sys.argv) > 1: # If we want to serverHost = sy...
d8044a30f8bc322999238be777b37245d1d9e507
sampathl/DS_Algo_Python
/Linked_List/linke_list.py
2,303
3.828125
4
""" implemnts a single linked list""" from node import Node class sllist(): def __init__(self): self.head=None self.len=0 def __print_list(self): pnt=self.head if self.head: print("length: ",self.len) for i in range(1,self.len+1): print(...
0ae044af610743bbf8345213fe011dea5dbe70fd
maturivinay/python_lee
/ICP_2/Star_letters.py
647
3.90625
4
letters=["****", "*** ", " ***", "** *", "** ", " ** ", " **", "* * ", "* *", " * *", "* ", " * ", " * ", " *"] x=input("enter your name with First name") def final_program(str): if(str=="C"): i=0; str=letters[0]+ "\n" +letters[10]+ "\n" +letters[10]+ "\n"+letters[10]+ "\n" + letters[0] ...
52953a6fdab058be139022d8ec9dc760c14eaf99
claytonjwong/Sandbox-Python
/coin_change.py
3,320
4.0625
4
""" You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Example 1: coins = [1, 2, 5], amount = 11 return ...
b2341e661aaff21b160fa9caaf73b783ed8b440e
liseyko/CtCI
/leetcode/p0143 - Reorder List.py
816
3.921875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def reorderList(self, head): """ :type head: ListNode :rtype: void Do not return anything, modify head in-place instead. """ ...
8e92e034d41be24169b4799513d7eef0b4526310
Raudcu/pyrodash
/pyrodash/utils/linalg.py
1,062
4.375
4
"""Linear algebra module It only contains a function to find a pair of coplanar vectors orthogonal between them and with a given one. """ import numpy as np def perpendicular_plane_vectors(vector): """Function to find a pair of coplanar vectors orthogonal to a given one. It first finds a vector...
05244f76329f5dc0ed165536f83371a9410f8e04
ddschmidt/Euler-Project
/Problem19/E19.py
1,036
3.734375
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 17 09:12:54 2018 @author: ddsch (Python 3.6) David Schmidt Description: """ import numpy as np import matplotlib.pyplot as plt import matplotlib import time day30m=[4,6,9,11] dayslist=["m","tu","wed","th","fr","sat","sun"] def Sundays(): sundaycount=0 daysum=0 ...
7ac694e792e235f4517c121a523621ed706feb5d
petercrackthecode/LeetcodePractice
/multiplyStrings/my_pretty_inefficient_solution.py
2,608
3.84375
4
# https://leetcode.com/problems/multiply-strings/ from collections import deque def add_two_num(num1: str, num2: str) -> str: # a list of characters, using deque for better prepend ans = deque([]) num1_array = [char for char in num1] num2_array = [char for char in num2] is_adding_one_to_next_degre...
0cab57a743908bc2ff59558ec9c95bc73cb3d9ea
iorzt/leetcode-algorithms
/cousins_in_binary_tree.py
1,929
3.984375
4
""" In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. Two nodes of a binary tree are cousins if they have the same depth, but have different parents. We are given the root of a binary tree with unique values, and the values x and y of two different nodes in the tree. ...
5e3c0a909df99cbcd19b8584b8988dd3da13bc34
keshavkummari/6am_python_nit_3rdJuly2019
/datatypes/tuples/Min-and-Max_Functions.py
558
4.25
4
tuple1, tuple2 = ('abc', 'xyz', 'minnu', 'ABC'), (456, 700, 200) print ("Min value element : ", min(tuple1)) print ("Max value element : ", max(tuple1)) print("") print ("Min value element : ", min(tuple2)) print ("Max value element : ", max(tuple2)) aList = ['123', 'xyz', 'minnu', 'abc'] aTuple = tuple(aList) # Conv...
de2b22c179fe26b9ca083a9af4a7239f6de3680e
kiran1415/Python-Ds-Algo
/Data-Structure-Algorithms/Graph/PrintallPath.py
388
3.640625
4
def solve(graph,src,dest,visited,psf): if src == dest: print("path",psf) psf = '' return visited.append(src) for nbr in graph[src]: if nbr not in visited: solve(graph,nbr,dest,visited,psf+str(nbr)) print(src) visited.remove(src) graph=[[1,2],[3...
261d73dcf9bbce315a59c9ab6db481fa9773b4c8
shikhharsiingh/Team-Novus-Productathon
/traffic management.py
3,806
3.890625
4
import cv2 import matplotlib.pyplot as plt import time import turtle #python code to determine time according to determined densities starting_time = time.time() t1_light='red' t2_light='green' t = turtle.Turtle() v = turtle.Turtle() t.speed(0) v.speed(0) # taking input for the radius of the circle r = 40 # ta...
1a225d64074ee715d56f10ec80b8ec462e63984a
RobertGolosynsky/suicide_detector
/file_helpers.py
582
3.5
4
import os, errno import traceback from pathlib import Path from os import path def silent_remove(filename): try: os.remove(filename) except OSError as e: # this would be "except OSError, e:" before Python 2.6 if e.errno != errno.ENOENT: # errno.ENOENT = no such file or directory ra...
bfb3cb221ccbd104edcad6b685e922f55ed47f05
Alex-YuZ/Motivational-Meme-Generator
/src/QuoteEngine/QuoteModel.py
345
3.625
4
"""This modeul intendes to create QuoteModel object When referred to, a QuoteModel object will print out as: "{body part} - {author part}" """ class QuoteModel(): def __init__(self, body, author): self.body = body self.author = author def __repr__(self): return """"{}" - {}""".format...
a4e594895a74f6dd8d77c7f4ee051a4583f99e93
isk02206/python
/informatics/BA_1 2017-2018/series_2/Counterfeiting.py
530
3.703125
4
sid = str(input()) bal = str(input()) if sid == 'balance': if bal == 'balance': count = 9 if bal == 'left': count = 8 if bal == 'right': count = 7 if sid == 'left': if bal == 'balance': count = 6 if bal == 'left': count = 5 if bal == 'right': coun...
81b7a8632893a7eeaaf4e1a0c0e5feb025e1c2e6
jakemtl/BigDataAbbott
/square.py
539
3.703125
4
# Jacob Benedek 514-887-2148 #Draw a square import turtle def draw_square(): window = turtle.Screen() window.bgcolor("red") line = turtle.Turtle() line.color("blue") line.speed(-10) line.forward(100) line.right(90) line.forward(100) line.right(90) line.forw...
95d6894f126ff5a3a2e208fa027c9a19354da5f9
jemalicisou/MaratonaDataScience-
/Listas2.py
1,181
3.84375
4
# Sorteie 20 inteiros entre 1 e 100 numa lista. Armazene os números pares na lista PAR e os # números ímpares na lista IMPAR. Imprima as três listas. print ('') print ('Sorteia e separa números pares e ímpares') import random lista = [] par = [] impar = [] for i in range (20): n = random.randint (1, ...
556989c662e89cb04af9ec367d2997c94dac3e91
srishtishukla-20/function
/fun.py
110
3.828125
4
def string(a,b): sum=int(b)+int(a) print(sum) a=input("enter num") b=input("enter num1") string(a,b)
6544630135a7287c24d1ee167285dc00202cb9aa
MMVonnSeek/Hacktoberfest-2021
/Python-Programs/avg-parse.py
1,168
4.15625
4
# Total, Average and Count Computation from numbers in a text file with a mix of words and numbers fname = input("Enter file name: ") # Ensure your file is in the same folder as this script # Test file used here is mbox.txt fhandle = open(fname) # Seeking number after this word x x = "X-DSPAM-Confidence:" y = len(x) ...
834d092e733f4bac88010ce278eab2dcf5e7ee0f
AdemHodzic/python-learning
/Day #2/keys.py
68
3.5625
4
obj = {1:"apple", 2: "orange", 3:"kiwi"} for i in obj: print(i)
97073f69c64d84d89a3c479f1bfc052d62572cd4
Strd79/week03_weekend_homework
/app/tests/game_tests.py
3,314
3.734375
4
import unittest from app.models.game import Game from app.models.player import Player class TestGame(unittest.TestCase): def test_p1_rock_p2_scissors(self): self.player_1 = Player("David", "Rock") self.player_2 = Player("Kyle", "Scissors") self.game = Game(self.player_1, self.player_2) ...
2ea47845bf39ae50ff312930f101cb042310fb12
F28L/ProjectEuler
/9PythagoreanTripleSumTo1000.py
330
3.5625
4
import time start = time.time() for a in range(1, 999): for b in range(1, 999): c = 1000 - (a + b) if a * a + b * b == c * c: # this is a pyth triple if a + b + c == 1000: print(a*b*c) print("This code took: " + str((time.time() - start)) + " ...
732e347b6175195cb92986d112d85cc34c10783b
ivoschwalbe/coding
/ex38-extra.py
178
3.578125
4
a = { "schnick": "schnack", "foo": "bar", } print(a) b = a.copy() print(a, b) print(a.get("foo")) # a.pop("foo") print(a) a[1] = "schnack123" print("a" * 1000000)
c67089f61c9ad35fd089a2e45910f80ba9eaf44d
Qiumy/leetcode
/Python/207. Course Schedule.py
1,493
3.984375
4
# There are a total of n courses you have to take, labeled from 0 to n - 1. # # Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] # # Given the total number of courses and a list of prerequisite pairs, is it possible for you to fin...
96896c4ef68728dd3ec9e6e2735bb10b25c47606
koukijohn/holbertonschool-higher_level_programming
/0x03-python-data_structures/7-add_tuple.py
463
3.671875
4
#!/usr/bin/python3 def add_tuple(tuple_a=(), tuple_b=()): if len(tuple_a) == 0: firstelem = 0, 0 elif len(tuple_a) == 1: firstelem = tuple_a[0], 0 else: firstelem = tuple_a[0], tuple_a[1] if len(tuple_b) == 0: secondelem = 0, 0 elif len(tuple_b) == 1: secondel...
5c446e691cf7a0efc821f470e89fee1ef49b7b93
vigneshwaranl92/Python-Works-Basic_Functionaloties
/Comparison Operator.py
213
4.0625
4
num1=45 num2=35 print("Is num1 > num2", num1 > num2) print("Is num1 < num2", num1 < num2) print("Is num1 != num2", num1 != num2) print("Is num1 > num2", num1 > num2) print("Is num1 == num2", num1 == num2)
a108157dba9b7100c25f1e5f91438390e2406f87
RauzaAl/webdev2019
/week10/codingbat/String/4.py
198
3.625
4
<<<<<<< HEAD def make_out_word(out, word): return out[:2] + word + out[2:] ======= def make_out_word(out, word): return out[:2] + word + out[2:] >>>>>>> ec863b8dfbbeba8f5506e1f29976ea8308fddd9e
f0c7ac0460dbfc777b8c329ccf1a81f6ea65fc51
salilvaidya15/data_structures
/binary_trees/same_tree.py
1,294
3.78125
4
from binary_tree import BinaryTree def areStructurullySameTrees(root1, root2): # both have leaves, nothing more to process if not root1.left and not root1.right and not root2.left and not root2.right: return True # if one exists and not the other if (root1.left and not root2.left) or...
48b5c73cae6e3439c1411ea37737fd679b300744
ettolrach/Reverse-AH-CS-Project
/database.py
2,675
3.53125
4
import sqlite3, classes, pathlib from constants import DATABASE_PATH def prepare_database(): pathlib.Path("./db").mkdir(parents=True, exist_ok=True) databaseConnection = None # Attempt to connect to the database file. try: databaseConnection = sqlite3.connect(DATABASE_PATH) # Report an erro...
3b76f3e1e75cf88f811edc998788df14f13a719a
francisco-igor/ifpi-ads-algoritmos2020
/Fabio01_Parte01/f1_q15_triângulo.py
207
3.71875
4
# ENTRADA base = int(input('Valor da base: ')) altura = int(input('Valor da altura: ')) # PROCESSAMENTO área = (base * altura) / 2 # SAÍDA print(f'O valor da área do triângulo é de {área} m')
6fd43e8e211d001d2dd5fecb3747ba069c5fd631
jaeyoung-jane-choi/2019_Indiana_University
/Intro-to-Programming/pa11/pa11-a.py
1,745
4.21875
4
#"A201 / Fall 2019", "Programming Assignment 11", Jane Choi, janechoi class Bike(object): """represents a Bike attributes : name(str), tire_pressure(float)""" #default is Celerifere, 0 def __init__(self,str1 = 'Celerifere', str2 = None ): """initializes with given name and pressure ...