blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
f5ef0e9544cb94a252b79825dead4f71f81c456d
AndreySperansky/TUITION
/CONDITIONS/BREAK/break_2.py
277
3.90625
4
"""Вариант 1""" for letter in "Python": if letter == "h": break print ("Carrent letter: ", letter) """Вариант 2""" var = 10 while var > 0: print("Carrent variable value: ", var) var -= 1 if var == 5: break print("Good bye")
440e290e45f7f35a43d1f6a29cac6b11ab7a8999
AndreySperansky/TUITION
/RECURSION/Super_Recursion/task_4/task_4_1.py
767
4.09375
4
""" 4. Найти сумму n элементов следующего ряда чисел: 1 -0.5 0.25 -0.125 ... Количество элементов (n) вводится с клавиатуры. Пример: Введите количество элементов: 3 Количество элементов - 3, их сумма - 0.75 ЗДЕСЬ ДОЛЖНА БЫТЬ РЕАЛИЗАЦИЯ ЧЕРЕЗ ЦИКЛ """ SUM = 0 ITEM = 1 try: NUM = int(input('Введите число: ')) whil...
232d713055f68efef47c05b2ba87fedf5fc15c62
AndreySperansky/TUITION
/EXCEPTION/ASSERT/test_.py
274
3.65625
4
shoes = {'имя': 'Модные туфли', 'цена': 14900} def apply_discount(product, discount): price = int(product['цена'] * (1.0 - discount)) assert 0 <= price <= product['цена'] return price print(apply_discount(shoes, 0.25)) print(apply_discount(shoes, 2))
63bb5ce6d605f98fe4c90da9b4d84b993685ca4d
AndreySperansky/TUITION
/_STRUCTURES/NUMBER/number_comma.py
482
4.0625
4
def commas(N): """ Форматирует целое положительное число N, добавляя запятые, разделяющие группы разрядов: xxx,yyy,zzz """ digits = str(N) assert(digits.isdigit()) result = '' while digits: digits, last3 = digits[:-3], digits[-3:] result = (last3 + ',' + result) if result...
0fbeae86ee7b6972b0b40955b6a596076867df95
AndreySperansky/TUITION
/IO_/Dict_List_Count/dict_list_to_num_sum.py
1,160
3.78125
4
""" 4) Необходимо создать (не программно) текстовый файл, где каждая строка описывает учебный предмет и наличие лекционных, практических и лабораторных занятий по этому предмету и их количество. Важно, чтобы для каждого предмета не обязательно были все типы занятий. Сформировать словарь, содержащий название предмета и ...
1b6e764ba8abaefbb662719fdc74540c42be910c
AndreySperansky/TUITION
/_STRUCTURES/NUMBER/SUM/count_digit_in_num.py
961
4.03125
4
""" 8. Посчитать, сколько раз встречается определенная цифра в введенной последовательности чисел. Количество вводимых чисел и цифра, которую необходимо посчитать, задаются вводом с клавиатуры. Пример: Сколько будет чисел? - 2 Какую цифру считать? - 3 Число 1: 223 Число 2: 21 Было введено 1 цифр '3' ЗДЕСЬ ДОЛЖНА БЫ...
bc0fa865fec5e72fe9c969ad06d4d60e721dc22f
AndreySperansky/TUITION
/_STRUCTURES/LIST/Nested_list/2d_Nested_Lists/enline_nested_list_6.py
115
3.671875
4
data = [[1, 2, 3], [4, 5, 6]] for _ in range(len(data)): data += data.pop(0) print(data) # [1, 2, 3, 4, 5, 6]
fe76e51517f7d6128c0024d3c5acbc4207668cf9
AndreySperansky/TUITION
/_STRUCTURES/NUMBER/Prime/01-primes.py
550
3.6875
4
# -*- coding: utf-8 -*- """ Программа к учебнику информатики для 11 класса К.Ю. Полякова и Е.А. Еремина. Глава 6. Программа № 1. Решето Эратосфена Вход: нет Результат: Простые числа от 2 до 100 """ N = 100 A = [True]*(N+1) k = 2 while k*k <= N: if A[k]: i = k*k while i <= N: A[i] = False ...
96474898d72a768308a78aad55bacc303e0f0a32
AndreySperansky/TUITION
/RECURSION/Super_Recursion/task_3/task_3_2_1.py
402
3.9375
4
def recur_reverse(num, flip = 0): if num == 0: return flip else: flip = (flip * 10) + (num % 10) num = num // 10 return recur_reverse(num, flip) try: NUM = int(input('Введите целое число: ')) REV_NUM = recur_reverse(NUM) print(REV_NUM) except ValueError: prin...
f99d852d58df1c3d311210f40eb4730a19448ff1
AndreySperansky/TUITION
/ITERATOR_GENERATOR/ITERATOR/Itertools_module/Cycle/cycle_sampl.py
289
3.65625
4
"""!""" """Это функция, создающая итератор для формирования бесконечного цикла набора значения.""" from itertools import cycle c = 0 for el in cycle( "ABC" ): if c > 10 : break print(el) c += 1
2dc0f36b9a8e5b8da25c6ac9ff303249e246b18c
AndreySperansky/TUITION
/EXCEPTION/RAISE/raise_sampl.py
188
3.6875
4
try: x = 5 if x < 10: raise ValueError('x should not be less than 10!') except ValueError as err: print("Вы ввели неправильное число! \n", err)
5ddc699adfe68855bb604e9f4a0cb8ebc8295816
prakhar897/Image-Processing-Assignments
/Tutorials/thresholding.py
798
3.625
4
import cv2 import numpy as np #if thresholding is done on gray image,we get only black and white #In colour images,each value of rgb is converted to either 0 or max. #Hence,different colours will be visible. img = cv2.imread('Albert.jpg') retval,threshold = cv2.threshold(img,12,255,cv2.THRESH_BINARY) grayscaled = c...
2da161d09a63cfa5033800aa19f34d6add2b4350
Wojtic/LiveCamSudokuSolver
/solver.py
1,600
3.75
4
import numpy as np def contains_in_row(row, num): for i in range(9): if sudoku[row][i] == num: return True return False def contains_in_col(col, num): for i in range(9): if sudoku[i][col] == num: return True return False def contains_in_box(row, col, num): ...
5f540eb2774f10e739144830bc7aed3a5829c986
Dizboyz/workshop2
/variable/global_ex_2.py
116
3.515625
4
x = "awesome" def myFunc(): x = "fantastic" print("[-] Pyrhon is " + x) myFunc print('Pyrhon is " + x')
623baf9d589a736348411f6c4afeddfacddb4168
chrisbonifacio/hello-world
/MyFirstPythonApplication/LearningMathPython/LoanCalculator.py
1,269
4.59375
5
#Have the user enter the cost of the loan, the interest rate, #the number of years for the loan #Calculate monthly payments with the following formula: # M = L[i(1+i)n] / [(1+i)n - 1] # M = monthly payment # L = loan amount # i = interest rate ( for an interest rate of 5%, i = 0.05) # n = number of payments #__...
a1778db51d58c3c07d9b1a6c98511d180eda0791
cyyeh/nlptutorial
/assignments/00-intro/ex0.py
524
3.828125
4
import sys def word_count(file_name): word_count_dict = {} with open(file_name) as f: for line in f: # split line into words words = line.strip().split(' ') for word in words: if word in word_count_dict: word_count_dict[word] +=...
9f32b5890680e94491d146b20e3836e9e993b865
kirillismad/algorithms
/graphs/bfs.py
1,031
3.734375
4
from collections import deque from graphs import Node, init_tree, init_graph, init_cycle_graph def bfs_tree(root: Node, searched): dq = deque([root]) while dq: node = dq.popleft() if node.name == searched: return node dq += node.children def bfs_graph(root: Node, search...
50602ffa8780490d5730e1201e2bba05a628d64a
kirillismad/algorithms
/other/partition.py
311
3.796875
4
import math def partition(sized, part_len): parts = math.ceil(len(sized) / part_len) for i in range(parts): yield sized[i * part_len: i * part_len + part_len] def main(): lst = list(range(1, 13)) for p in partition(lst, 3): print(p) if __name__ == '__main__': main()
65a7606572e6f30c6d2edf9fd37b1316962ee614
AditiPawaskar/bins
/test.py
243
4.03125
4
''' lista = [[1,2],[3,4],[5,6]] print(lista) ''' ''' i = 10 j = 11 matrix = [] matrix.append([]) matrix[0].append(i) matrix[0].append(j) matrix.append([]) matrix[1].append(i) matrix[1].append(j) print(matrix ) ''' num = 3 print(num**3)
9cb6e1b2d983cbb179afa73cec707e857f2098ff
tsvielHuji/Intro2CSE-ex2
/shapes.py
1,333
4.65625
5
################################################################# # FILE : shapes.py # WRITER : Tsviel Zaikman , tsviel , 208241133 # EXERCISE : intro2cs2 ex1 2020 # DESCRIPTION: Help the Muggle solve a Quadratic Equation with some magic # STUDENTS I DISCUSSED THE EXERCISE WITH: No one # WEB PAGES I USED: https://www.w...
7bd709761cd4303c44fcf40ae2f53b027630b6b4
omega1510/pythonClass
/Notes/rot13.py
584
3.65625
4
def rot13(inp): letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" out = "" for i in range(len(inp)): character = inp[i] if letters.find(character) == -1: out = out + character else: index = le...
dc638abe896e522b3df35cc8431f8ba74ac0c9b8
omega1510/pythonClass
/Notes/filterAndMap.py
409
3.796875
4
a = [100, 2, 8, 60, 5, 4, 3, 31, 10, 11] # creates lambda function and accepts items that are # multiples of 2. Assigns returned tuple to var filtered. filtered = filter(lambda x: x % 2 == 0, a) # prints filtered as a list print(list(filtered)) # creates lambda function and applies to every item in list. # returns a...
67c868719d5acbaeb321bfe4ada2cb5b719d171c
Sankti/Collabo_Tests
/Herzog_Dungeon.py
7,428
3.578125
4
import random import HerzDungDicts all_possible_coordinates = [(2, 2), (2, 1), (1, 2), (3, 2), (2, 3)] x_axis_coordinate = 2 y_axis_coordinate = 2 current_position = (x_axis_coordinate, y_axis_coordinate) herzog_defeated = False videotape_found = False sadness_induced = False key_found = False exit_open = False incorr...
5dc8b7da08ec786b09ba291f91adc04f82a6adb7
Sankti/Collabo_Tests
/guess_the_country.py
2,043
4.4375
4
from random import choice poland = { "population": "about 38m", "continent": "Europe", "colours": "red and white", "ethnicity": "slavic", "name": "Poland" } germany = { "population": "about 80m", "continent": "Europe", "colours": "black, red and yellow", "ethnicity": "germanic", "...
3213dd00d6abdc45cdf49cf9bc6b9c7d0d2e5fd7
putaretheprogrammer/Rock-Paper-Scissors
/RockPaperScissors.py
2,835
3.8125
4
import random # imports random from random import randint # imports randint import time # imports time rounds = 0 playerScore = 0 comScore = 0 def CallRound(): global playerScore # if playerScore goes up to 3 then player wins global comScore # if comScore goes up to 3 then computer wins global rounds ...
cbea309fda54698b7160a8713c738bbed45ca7a7
jb-neubauer/Anti-virus
/python/linuxconfig.org/lesson2.py
216
3.625
4
name = "Justin Neubauer" print(name) an_int = 3 a_float = 3.3 the_answer = 3 * 3.3 print(the_answer) an_int = 45 a_float = 1.5 the_answer = 45 / 1.5 print(the_answer) print(the_answer == an_int / a_float) print(3**3+3 > 30)
f07d570b02311c84fcee93b2fe433cbd5febd53c
jb-neubauer/Anti-virus
/python/learnpython/partialfun.py
333
4.125
4
from functools import partial #*returns 8* def multiply(x, y): return x * y #create function that multiplies by two dbl = partial(multiply, 2) print(dbl(4)) #create function that multiplies by two tri= partial(multiply, 3) print(tri(4)) def func(u, v, w, x): return u*4 + v*3 + w*2 + x p = partial(func, 5, 6, 7)...
997b81a20744da9647453010d5c23ad761e55fb4
jb-neubauer/Anti-virus
/python/learnpython/sets.py
321
4.125
4
print(set("My name is Justin and Justin is my name".split())) a = set(["Justin", "Jeff", "Connor"]) print(a) b = set(["Jeff", "Jill"]) print(b) #shows up in both lists a.intersection(b) b.intersection(a) # only appear once a.symmetric_difference(b) b.symmetric_difference(a) #only a.difference(b) b.difference(a) ...
ec07388ed4c74bbef1ee7d011b32763d769cfb1a
furkinq/Programlama_Odevleri
/fonksoyonlar-2/s1.py
563
3.515625
4
def KDC(tsm,hm,bog,sg,sahg): global KDC KDC=tsm-(hm+bog+sg+sahg) if (KDC>=1000): print("İşletme Katma Değer Cirosu Yüksek") elif (500<KDC<999): print("İşletme Katma Değer Cirosu Normal") else: print("İşletme Katma Değer Cirosu Düşük") tsm=int(input("Toplam Satış Mi...
2c0e0514d4ba1facbd978d617a3171ea1cce0b38
furkinq/Programlama_Odevleri
/ödev3.py
210
3.625
4
def AdambasiCiro(): a=int(input("Satış Miktarı:")) b=int(input("Birim Satış Fiyatı:")) c=int(input("Toplam Çalışan Sayısı:")) ciro=a*b AdambasiCiro=ciro/c print(AdambasiCiro)
642927f4d207629fffa2246df12b430a272b865a
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/PalindromeChecker/PalindromeChecker2.py
175
4.125
4
def PalindromeCheck2(s): if(s==s[::-1]): return True return False s=input() if(PalindromeCheck(s)): print("It is a palindrome!") else: print("It is not a palindrome..")
89e7e142e5b4a8a245e55d1b36e9e1f035178fe2
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/MontyHall/montyhall.py
1,608
4.125
4
#!/usr/bin/python3 # Monty Hall Problem # A simulation of the Monty Hall Problem # Darren Zhang import random num_doors = 3 # Number of doors player can choose from simulations = 100000 # Number of simulations to be run # A simulations value of anything over a million pretty much confirms the probability numbers #...
2f7e119acc818338370b29890276f80d8c4c7dc4
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/PushZerosToEnd/PushZeros.py
934
4.15625
4
# Objective : # Push all the zero’s of a given array to the end of the array. # The order of all other elements should be same. # # For example : # If the given arrays is {1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0} # Then it should be changed to {1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0} # # Time complexity is O(n) and Space complex...
86e56b52ed3a6a0f706a96680003e5543b5187ba
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/search/breadth-first-search.py
2,623
3.75
4
# Descricao do problema em https://www.thehuxley.com/problem/805?quizId=5243 # Solucao por @OtacilioN ADJ = "adjacencias" DST = "distancia" ANT = "anterior" vertices, arestas, testes = map(int, input().split()) grafo = {} for vertice in range(vertices): grafo[vertice] = {} grafo[vertice][ADJ] = [] for arest...
212966000b88ae17dc26573a18188f6b6cc86905
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/Hangman/hangman_main.py
5,724
4.03125
4
# This is the hangman game # The user will have to answer 10 different questions # If they get the wrong answer, they will hang the man # If they got 6 mistakes, the man dies # If they got less than 6 mistakes, they win the game win = 0 loss = 0 def hangman(): global win global loss score = 0 # first...
4405156bb942a1d1880832ba6d1079641d824605
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/Morse Code Translator/morse_code_translator.py
2,420
3.6875
4
import string #morse code dict morse = { "a": ".-", "b": "-...", "c": "-.-.", "d": "-..", "e": ".", "f": "..-.", "g": "--.", "h": "....", "i": "..", "j": ".---", "k": "-.-", "l": ".-..", "m": "--", "n": "-.",...
429646cc4a646338d83e4b45b50d7b1774e2b6c2
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/search/linear_search.py
413
3.765625
4
l = int(input("Enter number of elements in the list:")) li = [] print("Enter elements one by one:") for x in range (0,l): li.append(int(input())) etf = int(input("Enter element to find: ")) found = False location = -1 counter = 0 for x in li: if(x==etf): found = True location = counter break counter+=1 if(foun...
c4405064d2f7eb9247b45508a74fff74b9cf8cde
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/isitwednesdaymydudes/isitwednesday.py
175
4.09375
4
import datetime as day myDay = day.datetime.today().weekday() if (myDay == "2"): print("It is Wednesday, my dudes\n") else: print("It is not Wednesday, my dudes\n")
e4fe7551c7c56390b0342d4a6e93534a3c1a0e40
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/sort/shell/shell_sort.py
616
3.765625
4
import random def shell_sort(array): length = len(array) gap = length // 2 while gap > 0: for i in range(gap, length): temp = array[i] j = i while array[j-gap] > temp and j >= gap: array[j] = array[j-gap] j -= gap arr...
b8293cad9aa9788612210698437dd05a8377d363
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/Doomsday/doomsday.py
1,607
4.5
4
#!/bin/python3 """ Originally contributed by XVR147 in Haskell functional programming language. "The Doomsday algorithm is a simple algorithm used to determine the day of the week for a given date, Besides being really simple to use mentally, making it a cool party trick, it's really interesting. For more info https...
b9355ec268564249a3aa9bd8c468e0c28e155b77
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/Tower_of_Hanoi/Tower_Of_hanoi.py
485
3.53125
4
class GFG: def __init__(self): n = 4 self.towerOfHanoi(n, 'A', 'C', 'B') def towerOfHanoi(self, n, from_rod, to_rod, aux_rod): if (n == 1): print("Move disk 1 from rod " + from_rod + " to rod " + to_rod) return self.towerOfHanoi(n-1, from_rod, aux_rod, ...
6d4863b9713b6fd70bb82b2d6b698c4bd9966948
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/StoogeSort/stooge_sort.py
349
3.578125
4
def stoogesort(L, i=0, j=None): if j is None: j = len(L) - 1 if L[j] < L[i]: L[i], L[j] = L[j], L[i] if j - i > 1: t = (j - i + 1) // 3 stoogesort(L, i , j-t) stoogesort(L, i+t, j ) stoogesort(L, i , j-t) return L numbers = [2,4,6,8,10,9,7,5,3,1] print(numbers) numbers = stooges...
67b5f884a23b418ac912eb4e37c1938745769da4
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/UniqueInOrder/uniqueinorder.py
525
4
4
# This method was used for problem like -> # uniqueInOrder('MMMMBBBCCDAABBB') == ['M', 'B', 'C', 'D', 'A', 'B'] # uniqueInOrder('ABBCcAD') == ['A', 'B', 'C', 'c', 'A', 'D'] # uniqueInOrder([1,2,2,3,3]) == [1,2,3] # original rewritten from uniqueinorder.js def uniqueInOrder(s): s_orig = [s[0]] ...
86e1764cfa2dd4ac2ed68c3198e9b67949fab31c
Sudipta2002/UEMK-CSE-RESOURCES
/Advanced Algorithms/sort/kMessedArraySort/K_messed_array_sort.py
1,473
4.0625
4
"""Sort question from mocking coding interview. Given an array of integers arr where each element is at most k places away from its sorted position, code an efficient function sortKMessedArray that sorts arr. For instance, for an input array of size 10 and k = 2, an element belonging to index 6 in the sorted array will...
59aa6454d918dd8b5324542aa5b370cd0170478a
aparajita2508/learning-python
/script/Exe17.py
850
3.75
4
from sys import argv from os.path import exists # we are importing another handy command from os named exists, it produces either true or false script, from_file, to_file = argv print "copying from %s to %s" %(from_file, to_file) # printing the names, from exist file to new file in_file = open(from_file) # opening the...
2624dc656a61dc4476036ce8b1663e726334172f
aparajita2508/learning-python
/script/Exe24.py
893
3.734375
4
print "Let's practice everything.\n" print 'You\'d need to know \'bout escape with \\ that do\n newlines and \t tabs.' poem = """ \t Ba Ba blacksheep have you any wool? \tyes Sir! yes Sirh! three bags full\n one for my master\n one for, my dane one for the little boy \n\t who lives down a lane """ print "---------" pri...
38dcbee1e1fc297223fb66913dd2a33e9ac6921b
Srinivasareddymediboina/Web-Development-Srinivasa-Reddy-
/Applied Data&OOP's/self_concept.py
506
3.671875
4
class cal(): def __init__(self,a,b): self.n1=a self.n2=b #print(self.n1,self.n2) def display(self): print(self.n1,self.n2) def add(self): return self.n1+self.n2 def sub(self): return self.n1-self.n2 def mul(self): return self.n1*self.n2 def...
0ce9bf85afca5733a6a4e1111d5310866168a871
axnchat/Study
/PracticeProblems/maxStack.py
722
3.859375
4
class MaxStack(): def __init__(self): self.stack = [] self.maxStack = [] def push(self,value): self.stack.append(value) if self.maxStack and value < self.maxStack[-1] : self.maxStack.append(self.maxStack[-1]) else: self.maxStack.append(value) ...
271663dd1b7caadc3e59b76cfa6b967a9fef23d7
axnchat/Study
/PracticeProblems/lowIdxighidxsearch.py
1,120
3.578125
4
class Solution(): def searchList(mylist,number): low = binsearch(mylist,number,idxL,idxH,True) high = binSearch(mylist,number,idxL,idxH, False) return(low,high) def binsearch(mylist,number,Low,High,findLow): mid = Low + int((High - Low)/2) low,high = Low,High retl...
4d3f6bb05b55051ef4f8285ee4a3e365fc531616
axnchat/Study
/PracticeProblems/kthLargestInList.py
878
3.59375
4
import random class Solution(): def kLargest(self,mylist,k): return self.largestinpart(mylist,0,len(mylist) - 1,len(mylist)-k) def largestinpart(self,mylist,start,end,idx): pivotIdx = random.randint(start,end) print("pivot:",mylist[pivotIdx]) mylist[pivotIdx],mylist[end] = mylis...
7dff2f6f702092f1109605ce91a1f1920414527f
Incogniter/incognito
/colour_print.py
1,227
3.765625
4
# Some ANSI escape sequences for colours and effects import colorama BLACK = '\u001b[30m' RED = '\u001b[31m' GREEN = '\u001b[32m' YELLOW = '\u001b[33m' BLUE = '\u001b[34m' MAGENTA = '\u001b[35m' CYAN = '\u001b[36m' WHITE = '\u001b[37m' RESET = '\u001b[0m' BOLD = '\u001b[1m' UNDERLINE = '\u001b[4m' REVE...
f0fcbc982aa08f1ed3f84b6981a959ac1c8420ac
Incogniter/incognito
/banner.py
2,412
3.5
4
def banner_text(text): screen_width = 80 if len(text) > screen_width - 4: print("EEK!!") print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH") if text == "*": print("*" * screen_width) else: centred_text = text.center(screen_width - 4) output_stri...
ad3066c2c719fadf47b8b100f4e40007da26eb55
Incogniter/incognito
/joining nd split.py
1,815
3.828125
4
#deleting "spam" in nested list #with .join() function menu = [["egg", "bacon"], ["egg", "sausage", "bacon"], ["egg", "spam"], ["egg", "bacon", "spam"], ["spam", "bacon", "sausage", "spam"], ["egg", "bacon", "sausage", "spam"], ["spam", "egg", "spam", "spam", "bac...
793636b16b30ea9f4ffddd640c3bd37a8bab7821
Incogniter/incognito
/Arguments.py
322
3.6875
4
def bio_data(name,age):#name , age are formal aguments or argumengs #def bio_data(name,age=18) here age =18 is default values executes only if actual arguments have no value print(name,age) bio_data("Abino",5) #"Abino",5 are actual arguments #bio_data("Abino",age=5) #here age = 5 is the keyword print("_"*40)...
cb31030330a7c82ada83d422c3813fd9147669eb
Incogniter/incognito
/CGPA.py
1,022
3.921875
4
from Library import department from Library import dep from Library import grade_points for val in dep: print(val) grade_point = [] TotalCredits = 0 numerator = 0 num = 0 n = int(input("Enter your department: ")) depart = department.get(n) sem = int(input("Enter the semester to calculate: ")) if sem != ...
b99bdcbed0dd18d272eff73abf4cbdb3df466d0f
Incogniter/incognito
/Read.py
1,723
4.09375
4
# file = open ("/Users/Abino Robilin/PycharmProjects/Input_Output/2.1 sample.txt", 'r') # use / or \\ for mentioning a path # file = open ("\\Users\\Abino Robilin\\PycharmProjects\\Input_Output\\2.1 sample.txt", 'r') file = open("2.1 sample.txt", 'r') for line in file: #print(line) #prints line with spaces ...
e78c1b873da0a4845324162e6628aa923b58934e
gzl0035/projectEuler
/euler7.py
301
3.796875
4
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. # What is the 10 001st prime number? import euler3 def thprime(i): a = 1 while i != 0: a += 1 if euler3.is_prime(a): i -= 1 return a print(thprime(10001))
d7e0296964ed271c158a5f11cd99b6c9e75f7d27
csyu1/project-euler
/0009.py
362
3.984375
4
""" There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ for a in range(1, 1000): the_one = False for b in range(1, 1000 - 1): c = (a * a + b * b) ** 0.5 if a + b + c == 1000: print(a, b, c, a * b * c) the_one = True ...
80ef9e9dbbb790bd6d43fcbc269f41cf7da292ca
MarquezLuis96/CompThink_Python
/02 - Numeric Programs/01 - Brute-force Search/brute-force_search.py
602
4.375
4
# Date: 2020/11/05 # Author: Luis Marquez # Description: # This is a demostration of brute-force Search algorithm, in this program we'll calculate # an exact square root of a number 'n' -> Objective #run def run(): answer = 0 objective = int(input(f"Type an integer: ")) while a...
0173e132929979ca5d854724b31f899cdcb6a84c
MarquezLuis96/CompThink_Python
/04 - Structured Data, Mutability & High Level functions/02 - Functions like expressions/functions_like_expressions.py
390
3.578125
4
# Date: 2020/11/17 # Author: Luis Marquez # Description: # This is a program to lear how to use functions like expressions # # #plus plus = lambda x, y : x + y #multiplication mult = lambda x, y : x* y #run: On this function we will run all the other functios written in our program def run(): ...
709658e5ebc76e7e82db818c2a8429c9ed24f955
MarquezLuis96/CompThink_Python
/04 - Structured Data, Mutability & High Level functions/05 - Range/range_nones.py
855
4.375
4
# Date: 2020/11/20 # Author: Luis Marquez # Description: # This is a program in which we will gonna use the numbers of a range and store in a list only the none numbers # # #verify(): This is a function that verify if the number is none def verify(n): if(n%2 != 0): return True else: ...
5d9415c1e86b9a39bd2167b246f45d87c228922d
nsaikiran/MyPrograms
/Python/Number.py
2,151
3.78125
4
#A program to represent the given number in words .. import platform def Add(List,st):#sub function ... for w in List: st=st+w return st.replace(st[1],st[1].upper(),1)+"." def number(List,Number):#sub function ... List.sort() for w in List: if w<=Number: Max=w return Max def SaiKiran(Number,String):#Main ...
70835a66019774ce5689cfc21654171b9385b1c6
Fabieri/FAU_DL-1
/ex01/src/generator.py
4,691
3.625
4
import os.path import json import numpy as np import matplotlib.pyplot as plt import random import sklearn # In this exercise task you will implement an image generator. Generator objects in python are defined as having a next function. # This next function returns the next generated object. In our case it returns th...
c2e14ffb0fd0ef27c5ffd78021618c90c8278e77
salvadorgonmo/aboutPythons
/analizadorFinal/analizadorSintactico2.0.py
16,550
3.6875
4
from getpass import getpass while (1): print ('Menu') print ('1.- Agregar una palabra') print ('2.- Validar una palabra definida') print ('3.- Imprimir archivo') print ('4.- Palabras reservadas') print ('5.- Operaciones') print ('6.- Salir') opcion=input('Elige una opcion\n') if opci...
da58d559c2058b23b23cdfc46fa029a8011fc1dc
deliachis/Week5
/division.py
79
3.640625
4
# Division a=10 x=2 print("a/x=",a/x) a/x= 5.0 print("a/x=",int(a/x)) a/x= 5
13931e382da358def839bb1c69fa907b4f64d073
Yash-2903/PythonCalc
/src/Calc.py
1,028
3.796875
4
def addition(a, b): return int(a) + int(b) def subtraction(a, b): return int(b) - int(a) def multiplication(a, b): return int(a) * int(b) def division(a, b): return int(b) / int(a) def square(a): return int(a) * int(a) def squareRoot(a): return int(a) ** (1 / 2) class Calc: # Ini...
a52e0c30475941983ee6ae15505a780b24864454
AnikaZN/Graphs
/objectives/islands/islands.py
1,845
3.578125
4
def get_neighbors(node, islands): row, col = node neighbors = [] step_north = step_south = step_west = step_east = None if row > 0: step_north = row - 1 if row < (len(islands) - 1): step_south = row + 1 if col > 0: step_west = col - 1 if col < (len(islands) - 1)...
4ea1f5bc593a1c03fbcf80a908a432d39feca109
chronisf/22-mini-projects-with-Python
/floatyield.py
149
3.609375
4
def frange(start=0.1,end=1.0step=0.1): num=start while num<=end: yield num num +=step for i in frange(): print(i)
21f98ed93adfcce1273b80ca6233db4cef2ce3b2
akki-live/games
/checks.py
765
4.09375
4
#This is a guess the number game import random import os name = input("Hello! what is you name: ") print("Hello " + name + " Can you gues what number i am thinking between 1 to 20: ") num2 = random.randint(1, 21) print("DEBUG: secret number is :" + str(num2)) for num in range(1,7): print("Take a gue...
e10daac602fb58764dbf45ef79eb63f7499ebc8d
Anri-Lombard/python-course
/Section4/c60.py
135
4.125
4
# Nested for loops for i in range(1, 13): for j in range(1, 13): print(f"{j} times {i} is {j*i}") print(f"{'-' * 20}")
a78c6fb61f53b3f4f1b5e084a7d8e58fdafd0341
Anri-Lombard/python-course
/Section4/c53.py
380
4.125
4
name = input("What is you name? ") age = int(input("What is your age? ")) if 18 < age < 31: print(f"Welcome {name}! We hope this adventure will leave memories you won't ever forget!") elif 18 > age: print(f"Sorry {name}, rather come back in {18 - age} years.") elif age > 31: print(f"Age is wisdom {name}. I...
c7c7c07d66b9b101d324e5f47d571e16507cb44f
ravisingh0007/python-project1
/2.py
68
3.5625
4
X = ['ab','cd'] for i in X: a = i.upper() print(a) print(X)
0e65c7bc7fe8a5484650236487422ed89b3285e8
949429516/Cloud
/SelectSordFindSmallest.py
875
4.375
4
""" 选择排序: 将列表按照从小到大的顺序排序 分为两个函数: def findsmallest 寻找当前列表中最小的值 def selection 将findsmallest中返回的值添加到新列表中,再从原始列表中删除 """ def findsmallest(arr): """ 找到当前列表中最小值 :param arr: 目标列表 :return: 当前列表中最小值的下标 """ smallest = arr[0] # 存储最小值 smallest_index = 0 # 存储最小值的索引 for index in range...
e6aeb8e71480dd2a1ded70a2135b1faa973633a4
949429516/Cloud
/twoSum.py
859
3.734375
4
""" 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target  的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。   示例 1: 输入:nums = [2,7,11,15], target = 9 输出:[0,1] 解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。 """ class Solution: def twoSum(self, nums, target): arraylen = len(nums) ...
969ce6d626b8b5f8bf592a490e7af41a2494828d
949429516/Cloud
/leetcode_Longeststr.py
1,399
3.609375
4
""" 给定一个字符串 s ,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: s = "abcabcbb" 输出: 3 解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。 示例 2: 输入: s = "bbbbb" 输出: 1 解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。 示例 3: 输入: s = "pwwkew" 输出: 3 解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。   请注意,你的答案必须是 子串 的长度,"pwke" 是一个子序列,不是子串。 示例 4: 输入: s = "" 输出: 0 """ class Solution: ...
fcafea7a3f702c10833281d8568449bebcbad785
kwongjose/CodingChallenges
/Search B-Tree/Python/solution1.py
780
3.921875
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def searchBST(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]: # if we are past a le...
ae59aa3e88956f92f458e896e1a872de1ba0fd5f
kwongjose/CodingChallenges
/Flood Fill/Python/solution1.py
1,297
3.53125
4
class Solution: def floodFill(self, image: List[List[int]], sr: int, sc: int, newColor: int) -> List[List[int]]: originalColor = image[sr][sc] self.fill(image, sr, sc, newColor, originalColor) return image def fill(self, image, sr, sc, newColor, originalColor): ## if th...
7613da85465a601e578943a644c98f4ef4881511
Shiva2095/Pattern_python
/14.py
357
3.59375
4
"""Pattern-14: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *""" #Input r=int(input("Enter Number OF Rows : ")) #code 1 """for i in range(0,r): print("*"*(r-i)) """ # code 2 for i in range(r,0,-1): for j in range(0,i): pr...
929d417aebd29da99a2a0a16a79a32f26fb232fb
harishrithish7/Tic-Tac-Toe
/training/match.py
2,764
3.59375
4
import operator from numpy import * from predict import predict from checkWin import checkWin from checkComplete import checkComplete def match(player1,player2,n,win1,win2,loss1,loss2,draw1,draw2) : """ The function is used to play a game between player1 and player2 player1,player2 - vector containing the...
11d523480c01707a9528e6044ae49c52bea4c5e7
Preshh0/ProjectsFromKyle
/RockPaperScissors.py
752
4.15625
4
import random def play(): user = input("What's your choice? 'r' for rock, 'p' for paper, 's' for scissors: ") computer = random.choice(['r','s','p']) display = computer if user == computer: print("It's a tie!") print(f"Computer choose {display}") if win(computer, user): p...
adcb2e4fa733660dfd3a7b4af200be34aa80d3a7
shriyavanvari/Array-3
/Problem1.py
1,338
3.875
4
#Time Complexity:O(n) #Space Complexity:O(1) #Approach:The amount of water trapped will depend on the minimum. of the two bars on left and right. If right bar is longer than the left bar then. the amount of water that can be stored depend on the height of left bar. That's why we move the left pointer. until we find a...
deea4ae07778f396c1b83189a8e6a9bc91e9b937
youthweh/regression
/other/uber.py
2,219
3.65625
4
import streamlit as st import pandas as pd import numpy as np st.title('Uber pickups in NYC') #fetch some data DATE_COLUMN = 'date/time' DATA_URL = ('https://s3-us-west-2.amazonaws.com/' 'streamlit-demo-data/uber-raw-data-sep14.csv.gz') @st.cache def load_data(nrows): data = pd.read_csv(DATA_URL, nrows=...
ace2fc4ac3d75858637b8eb82805b2c7ac29ad2b
gerardoojeda/Python
/CLASS12_READ FILES_EDXCOURSE.py
2,082
3.65625
4
import urllib.request url = 'https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/labs/Module%204/data/example1.txt' filename = 'Example1.txt' urllib.request.urlretrieve(url, filename) #-----------------------------------------------------------------------...
e14f570413697de89a24ae3db297e0099107020b
gerardoojeda/Python
/CLASS3_LISTS_EDXCOURSE.py
1,730
4.34375
4
import sys #indexing # Create a list L = ["Michael Jackson", 10.1, 1982] print(L) # Print the elements on each index print('the same element using negative and positive indexing:\n Postive:',L[0], '\n Negative:' , L[-3] ) print('the same element using negative and positive indexing:\n Postive:',L[1], '\n Negative:' , ...
08eb13296614e4a18e656325e08f32f42c2c0846
n7huang/emart
/EMart.py
30,624
3.859375
4
# Import Tkinter libraries from Tkinter import * import tkMessageBox # Import classes and methods from objects.py from objects import * class GUI(object): def __init__(self): """Creates GUI object, initializes its methods, and opens the GUI interface for main user interaction. returns: ...
37551b97ebdcde7977be4c0f171535738615f7eb
danm9/BUAIL
/scraper.py
1,179
3.5
4
import requests from bs4 import BeautifulSoup def download_file(url): # Creates a filename to write to; assumes we'll put the downloaded files in a folder called Output - make sure you create this folder first... # The filename is the last bit of the URL print("Download found! Let's smash " + url) fil...
87788d17ba19d8a8b9e868b1e36a59c63ffff771
duanzhihong/python--language
/title/5-longest-substring.py
1,034
4.21875
4
#计算一个字符串中的回文 # 给定一个字符串小号,发现最长的回文子小号。您可以假设s的最大长度为1000。 # 例1: # 输入: “babad” # 输出: “bab” # 注意: “aba”也是一个有效的答案。 # 例2: # 输入: “cbbd” # 输出: “bb” #思路: 遍历字符串,从指向的字符串开始向两侧扩散 def findString(string): #奇数,偶数两种情况 res = '' for i in range(len(string)): tmp = strString(string, i , i) #总长为奇树的情况 if len(tmp...
b93806e476c2dd3d27855f65eedb0b4c08ce66c6
duanzhihong/python--language
/algorithm/guibing.py
988
3.84375
4
#归并排序,采用分而治之的思想,不断的将列表拆分为一半,排序完成后,执行合并的操作 def mergeSort(arr): if len(arr)>1: mid = len(arr)//2 lefhalf = arr[:mid] righthalf = arr[mid:] mergeSort(lefhalf) #左排序 mergeSort(righthalf) #右排序 #将两个有序合并 i = 0 #left length j = 0 #right length k = 0 ...
8569c11eac39bb89ad33fa7ef6bc3632369841c3
duanzhihong/python--language
/shu/shu.py
2,164
3.65625
4
#树的表示方法: #可以使用列表进行表示 # myTree = ['a', # ['b', ['d', [], []],['e', [], []]], # ['c', ['f', [], []]] # ] # print(myTree) # print("left = ", myTree[1]) # print("root = ", myTree[0]) # print("right = ", myTree[2]) #每个节点都是一个对象 class BinaryTree: def __init__(self, rootObj): self.k...
f4f4bd2ec9c7b833cab4b3c70882cbfab74e6a5a
maksimsfjodorovs/DMI
/PYTHON/if.py
308
3.671875
4
# -*- coding: utf-8 -*- a = input ("Ievadi skaitli: ") if a > 0: print "Ievadīts pozitīvs skaitlis" elif a == 0: print "Ievadīta nulle" else: print "Ievadīts negatīvs skaitlis" ''' if a > 0: print "Ievadīts pozitīvs skaitlis" else: print "Nav ievadīts pozitīvs skaitlis" '''
84d9e30ce9a9f1534b5a70a46edbd547cf97088d
suganyaarjunan/123
/re.py
96
4.1875
4
def reverse(string): string="".join(reversed(string)) return string a=input() print(reverse(a))
cdcb2839079c0460767f3dac002a87bdac40ca54
authuir/leetcode
/algorithm/python/99.py
988
3.84375
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def __init__(self): self.order = [] def getOrder(self, root): if root.left != None: self.getOrde...
591de4e358684a37e8c1a9c74124349fe67044f9
tcloud1105/python_projects_1
/tkinter section/main.py
472
3.859375
4
from tkinter import * window = Tk() # create an instance of the window GUI def km_to_miles(): # print(e1_value.get()) miles = float(e1_value.get())*1.6 t1.insert(END, miles) b1 = Button(window, text="Execute", command=km_to_miles) b1.grid(row=0, column=0, rowspan=2) e1_value = StringVar() e...
ab4cf47c9f925ff936f1a9cc2de6b3bdd4006ed9
PET-Tele/LabRemoto
/ladisan/Servidor/base_server_teste.py
2,780
3.53125
4
#Server TCP/IP from socket import * import time import json def cria_servidor(ip, porta, num_clientes): """ Use porta = 50007 Use ip = localhost Cria um objeto socket. As duas constantes referem-se a: família do endereço (padrão é socket.AF_INET) Se é stream(socket.SOCK_STREAM, o padrão) ou datagram(socket....
df92fe7b091794a80440c940ca4013e537f187c0
delereyus/ProLog
/back_end.py
3,697
3.53125
4
import sqlite3 class Database: def __init__(self, db): self.conn = sqlite3.connect(db) self.cur = self.conn.cursor() def view_users(self): self.cur.execute("SELECT * FROM users") user_names = self.cur.fetchall() return user_names def view_exercises(self): ...
fc00dc9169c6b3d468b9e680106562a5ee46e46d
pedro-escobar/Parcial-1-Analisis-Numerico
/main.py
2,087
3.890625
4
from sympy import * #Pedro Escobar #punto1 n=int(input("Ingrese el valor de n: ")) arreglo=[] matriz=[] for j in range(0, n): for i in range(0, n): arreglo.append(int(input("Ingrese valor"))) matriz.append(arreglo) arreglo=[] print("Matriz insertada:") for j in range(0, n): for i in range(0, ...
a02dfcb8d44bfca3e43025a471fd281ddf7d6227
gosatya/learning
/mypolygon.py
700
3.859375
4
import turtle import math bob = turtle.Turtle() def square(t, length): for i in range(4): t.fd(length) t.lt(90) #square(bob, 100) def polygon(t, n, length): angle = 360 / n for i in range(n): t.fd(length) t.lt(angle) #polygon(bob, 7, 70) def circle(t, r): circumferen...
a2c2bf9bdaa314a600f6dd148e25ea122a5de56d
Tianyu00/Data-Structures
/week3_hash_tables/3_hash_substring/hash_substring.py
1,621
3.578125
4
# python3 def read_input(): return (input().rstrip(), input().rstrip()) def print_occurrences(output): print(' '.join(map(str, output))) def polyHash(S, p, x): hash = 0 for i in range(len(S)-1, -1, -1): hash = (hash*x + S[i]) % p return hash def precomputeHashes(T, lenP, p, x): lenT ...
bb1edc817cb60d2fe453c0bb0757dab96ce3dc1e
cct-datascience/sorghum_100_masks
/scripts/merge_csv.py
6,400
3.703125
4
#!/usr/bin/env python3 """Python script merging CSV files into a root folder """ import argparse import os import sys def _merge_csv(source_path: str, target_path: str, has_headers: bool = True, header_count: int = 1) -> None: """Merges the source CSV file into the target CSV file Arguments: source_p...
080b8a2e34dbb3f8f5e1e7c0bade018be6a9bd07
KhangNguyen22/hackerrank
/count_number_substring_in_string/find_string.py
735
3.953125
4
def count_substring(string, sub_string): count=0 i_count = 0 length_substring = len(sub_string) idx = 0 for char in string: if char != sub_string[idx]: i_count =0 idx = 0 continue if length_substring != 1: idx+=1 i_count+=1 ...