blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
dbb19a6f27669ba491f9d9c7bbb1f6316cd5af15
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/vinh_le/lesson03/slice_lab.py
1,697
3.703125
4
def exchange_first_last(seq): new_sequence = (seq[-1:len(seq)] + seq[1:-1] + seq[0:1]) return new_sequence def remove_every_other(seq): new_sequence = seq[0:-1:2] return new_sequence def remove_first_last_four_and_every_other(seq): new_sequence = seq[4:-4:2] return new_sequence def reverse...
51cf6b8c764ffef5e24eede476fff19f76d66df4
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/jraising/lesson02/series.py
2,261
4.15625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 17 17:09:09 2019 @author: jraising """ def fibo(n): fib = [0,1] for i in range(n-1): fib.append(fib[i] + fib[i+1]) return (fib[n]) ans = fibo(5) print (ans) def lucas(n): luc = [2,1] for i in range(n-1): lu...
e1f1be756bda5a8452dd18deec0c7e936c17f673
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/jammy_chong/lesson03/list_lab.py
1,919
4.3125
4
def create_list(): global fruit_list fruit_list = ["Apples", "Pears", "Oranges", "Peaches"] #Seris 1 create_list() print(fruit_list) new_fruit = input("Add another fruit to the end of the list: ") fruit_list.append(new_fruit) print(fruit_list) user_number = input(f"Choose a number from 1 to {len(fruit_list)}...
380f5bd56fce950d4d6bf744f888923bb0101271
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/matthew_denko/lesson04/trigrams.py
22,613
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 5 09:04:57 2019 @author: matt.denko """ # Problem Description --------------------------------------------------------- """ (1) Use Sherlok text file to test algorithm (2) Open file & read content to a string (do not forget to close file) (3) Rem...
b6f56f753bf80fc4ab2957f216397aa76bc0caaa
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/joejohnsto/lesson03/list_lab.py
2,564
4
4
# -*- coding: utf-8 -*- """ Created on Wed Oct 23 17:48:34 2019 @author: jjohnston """ #IDEA makes each list a function, then have list4 call list3(optionally), list3 call list2, etc def list1(): """Build and return a list of fruits""" fruits = ['Apples', 'Pears', 'Oranges', 'Peaches'] print('Your ...
58d0e09d349ca8a2f6fba2d9f964020100040dd8
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/ben_carter/lesson03/slicinglab.py
2,790
3.796875
4
# -*- coding: utf-8 -*- """ Created on Wed Oct 23 13:58:54 2019 @author: bclas """ """ write a function that exchanges the first and last items in a list write a function that removes every other item in the list write a function that removes the first 4 and last 4 items and then every other item in the sequence w...
45e749325dc2d163416366a6a3046a83d97bbd76
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/matthew_denko/lesson02/fizz_buzz.py
603
4.15625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 21 20:51:19 2019 @author: matt.denko """ """Write a program that prints the numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number. For the multiples of five print “Buzz” instead of the number. For numbers wh...
b3e6fd3e4d3d2028b17d912f8334fb3149cdd2a7
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/joejohnsto/lesson03/strformat_lab.py
1,324
3.53125
4
# -*- coding: utf-8 -*- """ Created on Fri Oct 25 14:42:34 2019 @author: jjohnston """ # Task One t = (2, 123.4567, 10000, 12345.67) s = 'file_{:0=3d} : {:.2f}, {:.2e}, {:.2e}' s.format(*t) # Task Two # redo task one using f-string s = f'file_{t[0]:03} : {t[1]:.2f}, {t[2]:.2e}, {t[3]:.2e}' # Task Three t = ...
45f3e57a623f550857bb4261f6bb66287c7203ce
UWPCE-PythonCert-ClassRepos/Python210_Fall2019
/students/bishal_gupta/lesson03/list_lab.py
2,041
4.25
4
#!/usr/bin/env python3 """ Created on Mon Oct 28 18:25:04 2019 @author: Bishal.Gupta """ #Series 1 fruitlist = ['Apples','Pears','Oranges','Peaches'] print("The list has following fruit", len(fruitlist), "fruits:", fruitlist) new_fruit = input("What fruit would you like to add? ") fruitlist.append(new_fruit) print...
dda29cfb852c6093c19b19bbb8a3f4d74b5d6450
Rupesh2010/python-pattern
/pattern1.py
245
4.125
4
num = 1 for i in range(0, 3): for j in range(0, 3): print(num, end=" ") num = num + 1 print("\r") num = 0 for i in range(0, 3): for j in range(0, 3): print(num, end=" ") num = num + 1 print("\r")
48833a23ed592345e8ed8eaad8e8bd60c34ae964
zhujunbang/junbang
/pythontest1/test/error_code.py
1,756
3.765625
4
# try: # print 'try...' # r = 10 / 0 # print 'result:', r # except ZeroDivisionError, e: # print 'except:', e # finally: # print 'finally...' # print 'END' # try: # print 'try...' # # r = 10 / int('a') # # print 'result:', r # except ValueError, e: # print 'ValueError:', e # except ...
3e2b1d0d90b4d023271ffd939cde322a784d9363
fpdevil/rise_of_machines
/rise_of_machines/perceptron_classifier.py
8,398
4.125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Perceptron Classifier ----------------- An implementation of the Perceptron based mode using python in a Single Layer Neural Network. Iris data set with 2 variables is used as an example. Authors: Sampath Singamsetty :module: perceptron_classifier :created: :platfo...
52d618d8f9033b6109ae409f812458905123fa79
jshallcross/Python---School-Work
/Palindromes/tests/palindrome_test.py
1,201
3.765625
4
""" Palindrome Tests """ from palindrome import is_palindrome def test_for_error(): """ Test to assert an ValueError returns """ astring = is_palindrome(123) assert astring == ValueError def test_for_a(): """ Test to assert 'a' returns True """ still_equal = is_...
90f61c0aa52efe8f8e0d9eeaadc0daa8247d2bfe
emmaryd/bioinformatics-course
/assignment3/main_chain.py
3,613
3.890625
4
#EMMA RYDHOLM import numpy as np import math UPPER_DIST = 3.95 LOWER_DIST = 3.65 def read_file(filepath): """ Reads the positions from file, assuming that the atom numbers starts at 1 and is aranged in order Args: filepath: string that contains the filepath """ positions = [] with open(...
0343957ea74f5a436bcf992e7a195d5635720bd8
yamininagwanshi/House-Price-Prediction
/house.py
1,061
3.671875
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt from guietta import _, Gui, Quit from sklearn.linear_model import LinearRegression df = pd.read_csv('homeprices.csv') #print(df.head()) #Independent variable X = (df.iloc[:,0].values).reshape(-1,1) #Dependent variable y = df.iloc[:,...
49073184f67330b9c24573823bd71af2ee82f3a9
mmamel/Machine-Learning-and-Data-Mining-CS-434
/imp4/clustering.py
4,953
3.75
4
import numpy as np from random import seed from random import randint from math import sqrt from time import time class KMeans(): """ KMeans. Class for building an unsupervised clustering model """ def __init__(self, k, max_iter=20): """ :param k: the number of clusters :param...
8b429ea5b4a5ca928055018568188138752da6ab
Josuesant/Aulas-Python
/29-Aula29/revisao.py
2,872
3.984375
4
#--- Lista de passageiros que estão no terminal, e lista de avião vazia, pronta para receber os passageiros. from revisao2 import * aviao = [] terminal = txt_terminal() #--- Logica;/Função para mostrar/retornar a logistica de como os passageiros vão embar no avião. def transporte(): if not termina...
e7ef3c3d4208e53ed114474e982d4b0eb72f534a
BogiThomsen/NEMT
/services/edge/web_app_api/app/validator.py
9,205
3.890625
4
# This function is used when an input is required to be alphanumeric, such as with usernames and passwords. This # Ensures that code cannot be injected into queries. import re from pip._internal import req def is_alphanumeric(string): r = re.compile('^[\w]+$') if r.match(string) is None: return stri...
0e34b4ac691b95f024e399d72b4b456893f2051d
BogiThomsen/NEMT
/services/edge/device_api/app/validator.py
1,433
3.671875
4
import re # This function is used when an input is required to be alphanumeric, such as with usernames and passwords. This # Ensures that code cannot be injected into queries. def is_alphanumeric_or_point(string): r = re.compile('^[\w\.]+$') if r.match(string) is None: return string + " is not alphan...
5e43f7c49458c53f2574eb01a44a0026159601d3
emirhanese/GlobalAIHubPythonCourse
/Homeworks/Ödev1 (2.kısım).py
567
3.78125
4
# Global AI Hub Day 2, Homework 1 (Second part of the first homework) n = int(input("1-10 arasında bir sayı giriniz: ")) while n < 0 or n >= 10: print("Girdiğiniz değer 1 ile 10 arasında değil.") n = int(input("Lütfen 1-10 arasında değer giriniz: ")) print(f"0 ile {n} arasındaki çift sayılar yazdırılıyor:\n") ...
f255591d608b5f8cb5982a41c4fbd12f8aa3f0ec
akashkasliwal/DSC_Practice
/BE/Ayush.py
553
3.75
4
def convertToSet(st1): li = {' '} for i in range(len(st1)): li.add(st1[i]) li.remove(' ') return li def actualFunction(str1): n=1 cnt=0 while n<len(str1): s1 ='' s2 ='' for i in range (len(str1)): if(i<n): s1 +=str1[i] ...
9950dcebbceb58e8940ac2e08342bd8d2393b0c8
lucvutuan/PythonExercises
/Digit_factorials.py
999
3.515625
4
# program to solve problem 34 on projecteuler.net # the reason why 1.500.000 should be upper-bound limit # can be referred here: https://blog.dreamshire.com/project-euler-34-solution/ # the rest has nothing to explain, cause it totally straight codes # updated: I figured it out that, if we create a dictionary of fact...
000a7bafb0c973ba1869c322e84efb75ee41e6f1
mohamedamine456/AI_BOOTCAMP
/Week01/Module00/ex01/exec.py
249
4.125
4
import sys result = "" for i, arg in enumerate(reversed(sys.argv[1:])): if i > 0: result += " " result += "".join(char.lower() if char.isupper() else char.upper() if char.islower() else char for char in reversed(arg)) print(result)
9b342e55f537b46cb1132bf21145d59d74c8fc78
mohamedamine456/AI_BOOTCAMP
/Week01/Module01/ex02/vector.py
4,221
3.984375
4
class Vector: def __init__(self, numbers): self.values = [] self.size = 0 if isinstance(numbers, list) == False: if isinstance(numbers, int) == False: print("Vector takes list of numbers or number") return else: for i in...
d1bba0d0cbf1683d22f311ae5779121a5bb838ee
mohamedamine456/AI_BOOTCAMP
/Week01/Module00/ex02/whois.py
319
3.8125
4
import sys if len(sys.argv) > 2: print("AssertionError: more than one argument are provided") elif sys.argv[1].isdigit() == False: print("AssertionError: argument is not an integer") else: print("I'm Zero") if int(sys.argv[1]) == 0 else print("I'm Even") if int(sys.argv[1]) % 2 == 0 else print("I'm Odd")
bae1bb4e29af9ad531751a5670b6ae7a6808afc3
alivemary/time-calculator
/time_calculator.py
1,404
3.578125
4
from datetime import datetime, timedelta class TimeProcessor: def __init__(self, start, duration, weekday=None): self.show_weekday = weekday is not None self.start = self.__get_start(start, weekday) self.end = self.__get_end(duration) def __get_start(self, start, weekday): par...
84b58855a09e0bdc8fc9b8de5435d72fd35161c9
sjsrey/spopt
/spopt/region/random_region.py
20,095
3.609375
4
""" Generate random regions Randomly form regions given various types of constraints on cardinality and composition. """ __author__ = "David Folch David.Folch@nau.edu, Serge Rey sergio.rey@ucr.edu" import numpy as np import copy from .components import check_contiguity __all__ = ["RandomRegions", "RandomRegion"] ...
70b7e42cafeca4b9814baa4f39f387554452c0ad
Valery-Hyppolite/python-beginner-projects
/lover-score.py
993
3.78125
4
# GET YOUR LOVE SCORE TO SEE IF YOU ARE COMPATIBLE WITH YOUR CRUSH print("welcome to the love scroe! ") name1 = input("what is your name? ") name2 = input("what is your name? ") name3 = name1.lower() name4 = name2.lower() L = name3.count("l") O = name3.count("o") V = name3.count("v") E = name3.count("e") T = name3.co...
c6e78a00d0a0aa6b1ad44a632d898e95c5703212
Wenhao-Yang/PythonLearning
/TorchLearn/Torch_1.4_DefineAutograd.py
2,256
3.546875
4
#!/usr/bin/env python # encoding: utf-8 """ @Author: yangwenhao @Contact: 874681044@qq.com @Software: PyCharm @File: Torch_1.4_DefineAutograd.py @Time: 2019/5/19 下午9:12 @Overview: Define new autograd (ReLu) in torch. """ import torch class MyReLu(torch.autograd.Function): """ Implement custom autograd by subcl...
25173bb272ad772e3b2e5f8f2db9c0cfe16bc31a
Wenhao-Yang/PythonLearning
/Chapter 2 The TensorFlow Way/2.6_BinaryClassificationEM.py
3,137
3.515625
4
#!/usr/bin/env python # encoding: utf-8 """ @author: yangwenhao @contact: 874681044@qq.com @software: PyCharm @file: 2.6_BinaryClassificationEM.py @time: 2018/12/9 下午4:47 @overview: This is an example of binary classification. And one set of samples is from N(-1,1). And another set is from N(3,1). Create own accuracy ...
ac5f964ad12e62fbb70c616f680dade5e6697c65
gqian75/Collatz
/Collatz.py
3,504
3.921875
4
#!/usr/bin/env python3 # --------------------------- # projects/collatz/Collatz.py # Copyright (C) 2016 # Glenn P. Downing # --------------------------- # Max cycle length 1-9999, in intervals of 100. collatz_cache = [119, 125, 128, 144, 142, 137, 145, 171, 179, 174, 169, 182, 177, 177, 172, 167, 180...
99b602467ed4d3e0a999ff6c3bb71b043401c266
data-pirate/Algorithms-in-Python
/linked lists/deletion_in_linked_list.py
2,237
4.09375
4
class Node(): def __init__(self, data): self.data = data self.next = None class LinkedList(): def __init__(self): self.head = None def append(self, data): new_node = Node(data) if self.head is None: self.head = new_node return last_no...
ee9cf0a58d5b6ec21bee5b60ffe3d2dfd008ffd6
data-pirate/Algorithms-in-Python
/stacks/balanced_brackets_checker.py
1,216
3.96875
4
class Stack(): def __init__(self): self.items = list() def push(self, item): return self.items.append(item) def pop(self): return self.items.pop() def is_empty(self): return self.items == [] def peek(self): if not self.is_empty(): return s...
dffcce747fb2c794585df237849517bd8b637d9f
data-pirate/Algorithms-in-Python
/Arrays/Two_sum_problem.py
1,690
4.21875
4
# TWO SUM PROBLEM: # In this problem we need to find the terms in array which result in target sum # for example taking array = [1,5,5,15,6,3,5] # and we are told to find if array consists of a pair whose sum is 8 # There can be 3 possible solutions to this problem #solution 1: brute force # this might not be the bes...
b1353be52e4e0c4a21bb0784f47ebed4cf5ea97d
RogerFabianRozoYepez/Python
/tarea1/tarea5.py
82
3.640625
4
num1 = 92 num2 = 20 resultado = num1 % num2 print("el modulo es: ", resultado)
340275ac820cd79e3e0c93bd63461d81fc05e889
pandeymanish0786/python
/ascii_art.py
405
3.6875
4
from pyfiglet import figlet_format from termcolor import colored def print_art(msg,color): valid_colors=("red","green","yellow","blue","magenta","cyan") if color not in valid_colors: color="magenta" ascii_art=figlet_format(msg) colored_ascii=colored(ascii_art,color=color) print(colored_ascii) msg=inp...
261891e1659338ced9d0457dcce58cbd2fad48c6
pandeymanish0786/python
/rotencode.py
466
3.71875
4
key={'a': 'n', 'b': 'o', 'c': 'p', 'd': 'q', 'e': 'r', 'f': 's', 'g': 't', 'h': 'u', 'i': 'v', 'j': 'w', 'k': 'x', 'l': 'y', 'm': 'z', 'n': 'a', 'o': 'b', 'p': 'c', 'q': 'd', 'r': 'e', 's': 'f', 't': 'g', 'u': 'h', 'v': 'i', 'w': 'j', 'x': 'k', 'y': 'l', 'z': 'm'} def rot(s): rt="" for char in s: if char.islo...
52add16a114378f5173ac11476105308d4a4b151
pandeymanish0786/python
/importrandom.py
342
3.90625
4
from random import randint x=randint(-100,100) while x==0: x=randint(-100,100) y=randint(-100,100) while y==0: y=randint(-100,100) if x>0 and y>0: print("both positive") elif x<0 and y<0: print("both negative") elif x>0 and y<0: print("x is positive and y is negative") else: print("y is positive an...
c5940f3144c0aa8130e19cec1c0fea9cad98be61
pandeymanish0786/python
/mileage_converetor.py
162
3.859375
4
print("how many kilomete did u clycle today?") kms=input() print("ok,you said" + kms) miles=float(float(kms)/1.60934) print(f"ohk,it is {miles} miles")
6240bd22be8f63b4a545ae97c699b3d7c64582e2
Darkcacht/Letni
/ejlogica4.py
228
3.90625
4
#!/usr/bin/env python # coding: utf-8 import os clear = lambda: os.system('clear') clear() pal = raw_input("Ingrese una palabra: ") if pal == pal[::-1]: print("Es un palíndromo!") else: print("No es un palíndromo")
98ac380aefaf0b81eab1b6a8ca1a743f99870a1d
Darkcacht/Letni
/Ej3.py
3,235
3.5625
4
#!/usr/bin/env python #! coding: utf-8 import os clear = lambda: os.system('clear') clear() salir = 2 while salir != 1: ventas = 0 monto_mayor_cobrado = 0 Lunes = 0 Martes = 0 Miercoles = 0 Jueves = 0 Viernes = 0 importeLunes = 1 importeMartes = 1 importeMiercoles = 1 importeJueves = 1 importeViernes...
6f2a4df35721d811f4fe2012ea5e1bf3320cfd90
sdsubhajitdas/Algorithm-Collection
/Math/3_Sum/3_Sum.py
1,015
3.890625
4
def sum3_n2(array: list, s: int) -> tuple: length = len(array) array = sorted(array) for i in range(length-2): l = i+1 r = length - 1 while(l < r): if (array[i]+array[l]+array[r] == s): return array[i], array[l], array[r] elif (array[i]+array[...
a6cd1d568430104b85cf42ddc8072e1f892868c7
sdsubhajitdas/Algorithm-Collection
/Math/LCM/LCM.py
189
3.78125
4
def lcm(a: int, b: int) -> int: a, b = max(a, b), min(a, b) ab = a*b while (b != 0): a, b = b, a % b return ab // a if __name__ == "__main__": print(lcm(7,5))
244859bc98a137f1418f3d01805aa3d140c986e0
sdsubhajitdas/Algorithm-Collection
/Math/NumberFactors/NumberFactors.py
450
3.734375
4
import math # O(sqrt(n)) Complexity def factors(n: int) -> list: result = list() index = 0 for i in range(1, int(math.sqrt(n))+1): if (n % i == 0): result.insert(index, i) if (i != n//i): result.insert(-(index + 1), n//i) index += 1 return res...
1176458d775383ca664d576ee94152d61bf92b87
CodecoolKRK20171/battleship-in-the-oo-way-ikpw
/main.py
3,485
4.25
4
from squares import Square from ocean import Ocean from player import Player import os import sys def choose_all_ships(player, ocean): """ Function takes all neccesary information from player to place his ships Parameters ---------- player: actual player Returns ------- None """ ...
aa990f7844b6d49bc9eb2c019150edbc65b32833
oskar404/code-drill
/py/fibonacci.py
790
4.53125
5
#!/usr/bin/env python # Write a function that computes the list of the first 100 Fibonacci numbers. # By definition, the first two numbers in the Fibonacci sequence are 0 and 1, # and each subsequent number is the sum of the previous two. As an example, # here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13...
959cd3062b855c030b92cfe0f2edbbe141018508
kctompkins/my_netops_repo
/python/userinput.py
220
4.125
4
inputvalid = False while inputvalid == False: name = input("Hey Person, what's your name? ") if all(x.isalpha() or x.isspace() for x in name): inputvalid = True else: inputvalid = False print(name)
9f7feaa32b33d8d5e06123b87a1ddbdbd42e08e1
kctompkins/my_netops_repo
/userinput.py
143
4.0625
4
name = input("Hey person, what's your name? ") if name.isalpha(): print(name) else: print("Error: name must not include any numbers.")
4604f80fbb20f958e3ac54377b650e5675d4f402
cjwbrandon/algorithms-and-data-structure-masterclass
/s5-problem-solving-patterns/freqency_counter/refactored.py
800
3.53125
4
def same(arr1, arr2): if len(arr2) != len(arr2): return False frequency_counter1 = {} frequency_counter2 = {} for val in arr1: if val not in frequency_counter1: frequency_counter1[val] = 1 else: frequency_counter1[val] += 1 for val in arr2: i...
7d5a697672b75269d1582c2038731dce606c8f1a
cjwbrandon/algorithms-and-data-structure-masterclass
/s5-problem-solving-patterns/sliding_window/max_subarray_sum/refactored.py
352
3.703125
4
def maxSubarraySum(arr, num): if num > len(arr): return None tempSum = sum(arr[0:num]) maxSum = tempSum for i in range(num, len(arr)): tempSum -= arr[i - num] tempSum += arr[i] if tempSum > maxSum: maxSum = tempSum return maxSum print(maxSubarraySum([...
3e11c3f219043d09e90253d04aeebdf2bf560bb2
evazaja/telefon
/PythonApplication1/csucsido.py
489
3.515625
4
def csucsido(lista_1): csucskezd = 7 csucsveg = 18 csucsonbelul = 0 csucsonkivul = 0 for i in range(0, len(lista_1)): if(int(lista_1[i][0]) >= csucskezd and int(lista_1[i][0]) < csucsveg): csucsonbelul = csucsonbelul + 1 else: csucsonkivul = csucson...
4a566f2fe511e2d13fd020cf3186cd4c339cb20f
ams-bjones/Controlled_Assessment-2
/Task2.py
1,964
3.65625
4
# surnames = { # "Jackson": ["Samantha Jackson", "2 Heather Row", "Basingstoke", "RG21 3SD", "01256 135434", "23/04/1973", "sam.jackson@hotmail.com"] # "Vickers": ["Jonathan Vickers", "18 Saville Gardens", "Reading", "RG3 5FH", "01196 678254", "04/02/1965", "the_man@btinternet.com"] # "Morris": ["Sally Morr...
fcab68e4de13d3d12be6e0b2e4da05f9895c1c00
lukewrites/botlab
/com.ppc.Lesson6-Notifications/bot.py
5,201
3.515625
4
''' Created on June 9, 2016 @author: David Moss and Destry Teeter Email support@peoplepowerco.com if you have questions! ''' # LESSON 6 - NOTIFICATIONS # In this lesson, we demonstrate notifications to the user, sent whenever the user changes modes. # When you change your mode, we send a push notification and an HTM...
4aae3628b0aeed1df9b5404c79af091bb2b8263e
yuximao/2017Python_Deeplearning_LabAssignments
/NO.2 Python Assignment/2.py
96
3.953125
4
a=int(input("input a number:")); dict1={} for i in range(1,a+1): dict1[i]=i*i; print(dict1)
cf56a9e8e1dbe006c1dacb7dcf01108fffc72116
yuximao/2017Python_Deeplearning_LabAssignments
/Lab1/Ass1/3.py
129
3.953125
4
print("The number that divisi by 2 and 5 is:") for i in range(700,1700): if i%5==0: if i%2==0: print (i);
527fb660ee4fd9975aa86257e7eb289b7b7f484a
Glubs9/almostScheme
/Parse.py
1,440
3.65625
4
import Lex #parsing algo not a real algo #like not push down or bottom up algo #but it is influenced by bottom up algo as i think it has a stack kinda #oh shit algo doesn't consider pairs or ` (idk what it would be (could be like a macro lol) #tbh this algo is pre clever i'm not gonna lie #although I would...
ee5cc6747857b88236dd60d66d701f93ab036b31
dilohero/fundamentos_Pyrthon
/ciclos2.py
87
3.578125
4
# conteno 10 a 0 n = 10 while n<=10: print (n) n-=1 print ('Buen día')
65e5fde030100fc62dbc48481045298c69281ee4
L200183147/algostruk_x
/MODUL-3/1.py
1,726
3.515625
4
A = [[2,5],[6,9]] B = [[4,6],[3,7]] #a def check(A): for i in range(len(A)): if len(A[0]) == len(A[i]): print(A) else: print('error') break #b def size(matrix): return("Matrix size = " + str(len(matrix)) +" x "+ str(len(matrix[0]))) ...
0930ee8323fe5ccb4673bb2b167720295a8d72e1
minhanhc/chuminhanh-fundamentals-c4e14
/Fundamentals/session2/square-spiral.py
123
3.515625
4
from turtle import * for i in range(100): forward(5 * i) right(89) forward(5 * i) right(89) mainloop()
1869b978facb2faea7472fa0a8017113f34c11fe
minhanhc/chuminhanh-fundamentals-c4e14
/Fundamentals/homework/dem_so.py
234
3.96875
4
numbers = [1,6,8,1,2,1,5,6] num = int(input("Enter a number? ")) x = numbers.count(num) if x < 2: print("{0} appears {1} time in my list".format(num,x)) else: print("{0} appears {1} times in my list".format(num,x))
b7843a5a1fb06c17fdbd25b8cef0d6c548b2e99b
JBeto/HashCode
/src/scorer.py
652
3.59375
4
def score_submission(slides): score = 0 for i in range(len(slides) - 1): slide_0 = slides[i][1] slide_1 = slides[i+1][1] score += min(len(slide_0 & slide_1), len(slide_1 - slide_0), len(slide_0 - slide_1)) print('Score: {}'.format(score)) def print_solution(slides): print(len(...
f727b94fd81ccbc0a7192a1db73a9eefdd43aa1f
peter6888/dl_lab
/change_list_in_function.py
306
3.921875
4
def func_change_list(i, l): ''' test change list in this func Args: l: list to change Returns: ''' print("l[-1] {}".format(l[-1])) l.append(i) def test(): ll = [1] for k in range(5,10,1): func_change_list(k, ll) if __name__ == "__main__": test()
67478776cc09d8d418c2d79431f7e1e66f703c25
scholer/rsenv
/rsenv/labelprint/windows_printing.py
15,681
4.3125
4
# Copyright 2019 Rasmus Scholer Sorensen <rasmusscholer@gmail.com> """ Functions, references, and docs for printing on Windows. This module includes a range of different functions, each function using a different way to print files and content on Windows. For instance: print_file_using_copy_cmd() - uses the `co...
55a0d86d8b740f1b00447db1bfc7c298d8778e40
scholer/rsenv
/rsenv/utils/hashing_playground.py
3,134
4.15625
4
# Copyright 2019, Rasmus Sorensen <rasmusscholer@gmail.com> """ Module for playing around with different hashing functions. For instance, how to create a general-purpose hashing function that takes an object hashes it without using json or similar text-serialization. You could consider using pickle instead of json? ...
cbad3ee4b343ec72d47ded06e430cada5fb8d0fc
admay/CSCI-391
/Frequency_Analysis.py
4,518
3.984375
4
# Michael Zavarella # CSCI 391 # Frequency Analysis Program ''' The first c_text is encrypted with A = 21 and B = 1 The second c_text is encrypted with A = 11 and B = 4 The third c_text is encrypted with A = 3 and B = 19 The fourth c_text is encrypted with A = 23 and B = 14 ''' from operator import itemgetter # Need...
111ee7ad99536b8c40c5dd041b0492299ab73802
rvaccari/uri-judge
/01-iniciante/1005.py
1,189
3.765625
4
""" Média 1 Leia 2 valores de ponto flutuante de dupla precisão A e B, que correspondem a 2 notas de um aluno. A seguir, calcule a média do aluno, sabendo que a nota A tem peso 3.5 e a nota B tem peso 7.5 (A soma dos pesos portanto é 11). Assuma que cada nota pode ir de 0 até 10.0, sempre com uma casa decimal. Entrad...
dd638fa831cfc69e0eaaa70aff20f51566e2d2a2
rvaccari/uri-judge
/01-iniciante/1013.py
760
4.03125
4
""" O Maior Faça um programa que leia três valores e apresente o maior dos três valores lidos seguido da mensagem “eh o maior”. Utilize a fórmula: Entrada O arquivo de entrada contém três valores inteiros. Saída Imprima o maior dos três valores seguido por um espaço e a mensagem "eh o maior". https://www.urionline...
cf6fd13215f2ec2278c7b5c86c3dead2635e49e5
rvaccari/uri-judge
/01-iniciante/1046.py
895
3.6875
4
""" Tempo de Jogo Leia a hora inicial e a hora final de um jogo. A seguir calcule a duração do jogo, sabendo que o mesmo pode começar em um dia e terminar em outro, tendo uma duração mínima de 1 hora e máxima de 24 horas. Entrada A entrada contém dois valores inteiros representando a hora de início e a hora de fim do...
920db86935bce4a965494006d2e4bb255183dbc5
rvaccari/uri-judge
/01-iniciante/1008.py
1,259
4.21875
4
""" Salário Escreva um programa que leia o número de um funcionário, seu número de horas trabalhadas, o valor que recebe por hora e calcula o salário desse funcionário. A seguir, mostre o número e o salário do funcionário, com duas casas decimais. Entrada O arquivo de entrada contém 2 números inteiros e 1 número com ...
6b0fb29705f41da46b8699e0befa6b997978d53f
bsakari/Python-Lessons
/Lesson2/variables2.py
422
4
4
# print("Input The First Number and Hit Enter") # fNum = int(input()) # print("Input The Second Number and Hit Enter") # sNum = int(input()) # # Total = fNum+sNum # # print("The Total of the Two Numbers is",Total) print("Input The First Number and Hit Enter") fNum = float(input()) print("Input The Second Number and Hi...
8231f3597f9ebd19e87817e28b607b1dec4f4cb6
bsakari/Python-Lessons
/Lesson3/InbuiltFunctions.py
416
3.84375
4
a = "Hello Python" print(len(a)) print(a.upper()) print(a.lower()) b = -10/5 print(b) print(abs(b)) numbers = (6,4,5,8,7,9,2,4,1) print(sorted(numbers)) print(sum(numbers)) print(min(numbers)) hello = " hello " print(hello) print(hello.strip()) greeting = "Hey" print(greeting.replace("y","llo")) names = ["K...
918644a12c3b7bc373416f8be711d0015aaa78c5
schavan04/oddly-reversed-cipher
/utils.py
1,081
3.78125
4
lower_alph = list("abcdefghijklmnopqrstuvwxyz") upper_alph = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") lower_key = [e for e in reversed(lower_alph)] upper_key = [e for e in reversed(upper_alph)] def take_input(): message = input("\n (Enter ':q!' to exit) Enter message: ") return message def encode(message): enc...
3759abcbab3aff89acc59fe4228f0146ee2eaa56
HSabbir/Design-pattern-class
/bidding/gui.py
1,717
4.1875
4
import tkinter as tk from tkinter import ttk from tkinter import * from bidding import biddingraw # this is the function called when the button is clicked def btnClickFunction(): print('clicked') # this is the function called when the button is clicked def btnClickFunction(): print('clicked') # this is the funct...
0b62d0547ad02f25570f8b0731024e0a0fd94060
Pekmen/dailyprogrammer
/Easy/e.137.py
422
3.5625
4
#!/usr/bin/env python def string_trans(txt): with open(txt, 'r') as f: lines = map(str.strip, f.readlines()[1:]) mx = len(max(lines, key=len)) for i in range(mx): l = '' for line in lines: try: l += line[i] except ...
64a97cfef93b4fcecd4bfeb22973e50126a7de00
Pekmen/dailyprogrammer
/Easy/e.16.py
118
3.78125
4
#!/usr/bin/env python3 str1 = "Daily Programmer" str2 = "aeiou " print("".join([i for i in str1 if i not in str2]))
7ce9aedb29056d9c61240c9569e0eaea4caff3a4
Pekmen/dailyprogrammer
/Easy/e.9.py
141
4.0625
4
#!/usr/bin/env python3 digits = list((input("enter your digits disjunct with spaces\n")).split()) map(int(), digits) print(sorted(digits))
f4329c0c7a4c534f54d558cfc77578474db1d3ec
Pekmen/dailyprogrammer
/Easy/e.21.py
219
3.734375
4
#!/usr/bin/env python3 from itertools import permutations target = input("enter number: ") larger_perms = [int("".join(n)) for n in permutations(str(target)) if int("".join(n)) > int(target)] print(min(larger_perms))
21e6f2d8d79eb2f023c79d6e2f0a5da24ca939b9
kevin-bot/Python-pythonPildorasInformaticas
/POOHerenciaSuper.py
730
3.71875
4
class Persona(): def __init__(self, nombre,edad,lugarResidencia): self.__nombre=nombre; self.__edad=edad; self.__lugarResidencia=lugarResidencia def descripcion(self): print ("Nombre: ", self.__nombre, " Edad : ", self.__edad, "Residencia: ", self.__lugarResidencia) class Empl...
65be92949660011c3e71270233bb797f633ccd58
kevin-bot/Python-pythonPildorasInformaticas
/Listas/Lista.py
1,098
3.921875
4
lista=[1,2,3,4,5,6] def llenarlista(valor): return [valor] def mostrarlista(lista): print(lista) def acturalizar(milista, valorbuscar,valor): if valorbuscar in milista: milista.insert(milista.index(valorbuscar),valor) def eliminar(milista, valoreliminar): if valoreliminar in milista: ...
c74775167947b4fa2683edf8b02de817170a1a0f
ElBell/PythonLab1
/printevens.py
316
3.921875
4
from numbers import Number from typing import List def print_even(input_list: List[int]): new_list: List[int] = [] for number in input_list: if number % 2 == 0 and number <= 237: new_list.append(number) if number > 237: break print(new_list) return new_list
441f28ffed8a58c5a99ae80d1837c12f6527a949
AleLaht/Phonebook
/phonebook.py
1,032
4.0625
4
#Phonebook name = "" number = 0 phonebook = {name: number} del phonebook[""] def addName(name, number): phonebook.update({name: number}) print("Added: " + name + ": " + number) def delName(name): del phonebook[name] def findName(name): find = phonebook.get(name) findtring = str(find) if find...
4803a01557bba489bc7e3f95fc1c925f79cf6141
Faranaz08/py-assignment1
/areaofcircle.py
92
4.125
4
R=int(input("enter radius of circle:")) A=3.142*R*R print("the area of circle is="+str(A))
f378ce4362ae3e0a1c821d0ec0b1ad57d07247e5
max-nicholson/advent-of-code-2020
/day_6/main.py
1,038
3.640625
4
from itertools import groupby from typing import List import os def read(): with open(os.path.join(os.path.dirname(__file__), "input.txt"), "r") as f: yield from f def unique_answers(group: List[str]) -> int: return len(set(answer for person in group for answer in person)) def common_answers(group...
5742ade8674a255fe4ecc9957c18e5d21fdc8219
EnricoRuggiano/LorenzoMagnifico
/utils/card_converter.py
1,531
3.546875
4
import csv import json import sys def isInt(number): try: int(number) return True except ValueError: return False def parse_csv(path): card_list = [] with open(path) as csv_file: reader = csv.DictReader(csv_file) for line in reader: card_list.append(...
b7f62dd1ee4d040d81336200c58f9f2926c51168
What-After-College/Python-Batch-056
/day03/arr1.py
1,112
3.65625
4
# student1 = 40 # student2 = 60 # student3 = 30 # student4 = 50 # student5 = 55 # print(student1) # print(student2) # print(student5) # 0 1 2 3 4 students = [40, 60, 30, 50, 55] # print(students[1]) i=0 # while i<5: # print(students[i]) # i += 1 # 0,1,2,3,4 # for i in range(0, 5)...
449917f06e85afc76dfbaf700cc04a47c3550a12
What-After-College/Python-Batch-056
/day09/fileHandling/findandreplace.py
325
3.90625
4
find = input("Enter Word: ") rep = input("Enter New Word: ") with open('replace.txt', 'r') as file: fileData = file.read() print("replacing data after input") var = input() fileData = fileData.replace(find, rep) with open('replace.txt', 'w') as file: print("check file") var = input() file.write(file...
8a9c5ea10b3285a5aa0931e08625fa24ce67f026
What-After-College/Python-Batch-056
/day07/kwagr.py
87
3.671875
4
def printHello(num=2): for i in range(num): print('hello') printHello(10)
cd79e3b1ce72569bb62b994695e4483798346a0c
Luke-Beausoleil/ICS3U-Unit3-08-Python-is_it_a_leap_year
/is_it_a_leap_year.py
926
4.28125
4
#!/usr/bin/env python3 # Created by: Luke Beausoleil # Created on: May 2021 # This program determines whether inputted year is a leap year def main(): # this function determines if the year is a leap year # input year_as_string = input("Enter the year: ") # process & output try: year = ...
1aaa42ee16dc68dcdf8d266032e9202a16c5d350
ryoiwata/cooking_recipe_graph_analysis
/src/data_processing/flavor_molecule_matrix/flavordb_dict_creator.py
2,144
3.5625
4
#Python Libraries for Mongos Database import pymongo from pymongo import MongoClient #Python Library for Dataframe usage import pandas as pd #Serializing to a file import _pickle as pickle #accessing mongoDB client = MongoClient() database = client['food_map'] # Database name (to connect to) collections = database...
a32d3dcd2405b41435ddb0c7a5d960571fe8abda
runnersaw/ComplicatedLeague
/csv_writer.py
682
3.703125
4
import csv class CSVWriter: def __init__(self, teams, currentYear): self.teams = teams self.currentYear = currentYear def writeToCSV(self, filename): with open(filename, "w", newline="") as csvFile: writer = csv.writer(csvFile, delimiter=",") writer.writerow(["", "Position", "Status", "Year Drafted", s...
73e8defb0a461f8fb25523f1e9917699e6bec825
ThomasLouch/ProjectEuler
/001.py
305
4.09375
4
""" Problem 1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. ANSWER: 233168 """ print "ANSWER: " + str(sum([x for x in xrange(1000) if x % 3 == 0 or x % 5 == 0]))
fb39990bca63a4a89f05dbf893da2b9a2382b9a4
kannandreams/awesome-python-advance-concepts
/oops/encapsulation.py
625
3.984375
4
class Account(): def __init__(self): """ Access modifiers example """ self.bank = "Citi Bank" # public self._owner = "US" # private because of underscore before the variable self.__secretcode = "000" # strictly private with double underscore def main(): a = Account() print(...
ea452ffdca8095e261a8a5d4e9058c009587d42f
quickly3/fun-python
/python/name_csv.py
844
3.5625
4
#!/usr/bin/python # -*- coding: UTF-8 -*- def gender_features(word): return {'last_letter':word[-1]} from nltk.corpus import names import random,nltk import csv names = ([(name,name[-1],name[-2:],'male') for name in names.words('male.txt')] + [ (name,name[-1],name[-2:], 'female') for name in names.words('female....
33454eda7ba3fcba39df4e0878d3d9593ea2908e
ShivamBhosale/CTCI
/Arrays_strings/checkpermutation.py
284
3.9375
4
def check_permutation(str1, str2): str1=str1.lower() str2=str2.lower() if len(str1) != len(str2): return False else: if(sorted(str1) == sorted(str2)): return True return False print(check_permutation("Hello","lloeHt"))
d2d5b2b04561782f790080b25ab63bf9b307a21e
nplp/adventOfUnexpectedSolutions
/day5/day5.py
890
3.59375
4
import re import math with open("input","r") as file: inputFile = file.read().splitlines() maxRow = 127 maxColumn = 7 highestValue = 0 seats = [["free" for i in range(8)] for j in range(128)] print seats for seat in inputFile: top = 127 bottom = 0 right = 7 left = 0 for symbol in seat: print "symb...
b025b3cb2db1da59f8d2a29062bc87cac6f4e765
thechicagoreporter/cop-matcher
/utils/types.py
607
3.828125
4
import parsedatetime from time import mktime from datetime import date def parse_str_date(string): """ make a date out of string using parsedatetime lib, return for import https://pypi.python.org/pypi/parsedatetime/ """ if string: try: the_date = date.fromtimestamp(mkt...
4fc6b1068dfd8391736998db9ff2a12b7ffaf8c9
FourThievesVinegar/Chemhacktica
/Code/nist_modules.py
5,276
3.859375
4
from lxml import html import random import time import re def getCASnumbers(stringlist): cas_numbers = [] cas_indices = [i for i,x in enumerate(stringlist) if x=='CAS Number'] for ind in cas_indices: cas_numbers.append(stringlist[ind+1]) # make sure there are three items in list to be returned ...
4ae3e06f61bbc2e54973a7cdd14e7a56cceb32b3
Manoji97/Data-Structures-Algorithms
/Binary Trss.py
2,914
3.875
4
class node_BT: def __init__(self,data): self.data = data self.left = None self.right = None class Binary_tree: def __init__(self): self.root = None def insert(self,data): if self.root is None: self.root = node_BT(data) else: ...
37c49fd42fb1984cce2155c33458ff8956227a3d
ekarlekar/MyPythonHW
/olympicrings.py
680
3.796875
4
import turtle t=turtle turtle.pen() colors=['blue','black','red', 'yellow', 'green'] pen_color=t.pencolor def draw_rings(my_ring,start_x,start_y,pen_color,pen_size): t=my_ring t.up() t.goto(start_x, start_y) t.down() t.pensize(pen_size) colors=['blue','black','red', 'yellow', 'green'] pen_co...
4b54752d8e64fd786950dcd51eb8bf4e83c2ad24
ekarlekar/MyPythonHW
/2variablefib.py
96
3.953125
4
x=0 y=1 f=int(raw_input("Enter a number:")) while (x<=f): print(x) print(y) x=x+y y=y+x