blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
ab33eed9ded9a48108f812dcda7ca6c7b648f78d
mazzuccoda/condicionales_python
/ejemplos_clase/ejemplo_2.py
1,606
4.375
4
# Condicionales [Python] # Ejemplos de clase # Autor: Inove Coding School # Version: 2.0 # Ejemplos con if anidados (elif) y compuestos # Uso de if anidados (elif) # Verificar en que rango está z # mayor o igual 50 # mayor o igual 30 # mayor o igual 10 # menor a 10 z = 25 if z >= 50: print("z es mayor o igual a...
69443133329be49a4616a1d6ad32102f20261177
mazzuccoda/condicionales_python
/ejemplos_clase/ejemplo_4.py
443
3.78125
4
# Condicionales [Python] # Ejemplos de clase # Autor: Inove Coding School # Version: 2.0 # Ejemplos varialbles de texto y condicionales compuestos texto_1 = 'a' texto_2 = 'b' # Condicionales compuestos # Si texto_1 es mayor a texto_2 e igual a "hola" o # texto_1 tiene menos de 4 letras, entonces imprimir "Correcto!"...
ddea117c8cf14be360814c08d998e01c41e7ba6f
brandonharris177/edabit-challanges
/coding.py
835
3.703125
4
def findTarget(givenList, target): check = set() answers = [] for number in givenList: difference = target-number if difference in check and number != difference: answers.append([number, difference]) else: check.add(number) print(answers) re...
25643f1d6de74fd7456a0bbb9d2413a31ae7fe08
venkatesha-ch/CN-lab
/lab-8/crc.py
1,390
3.5
4
import hashlib def xor(a, b): result = [] for i in range(1, len(b)): if a[i] == b[i]: result.append('0') else: result.append('1') return ''.join(result) def mod2div(dividend, divisor): pick = len(divisor) tmp = dividend[0: pick] w...
57fb4b6b780d04485c0829299e2ecc336773dc3f
rohit04saluja/micro-codes
/python/Data Structures/Sort/InsertionSort.py
157
3.71875
4
def sortInsertion(a=[]) for i in range(1,len(a)): temp = a[i] j = i-1 while j>=0 and a[j]>temp: a[j+1] = a[j] j = j-1 a[j+1] = temp return a
2ce7405a05b17529f672255ccc275a28000c638f
a01229599/Tarea-02
/auto.py
413
3.84375
4
#encoding: UTF-8 # Autor: Dora Gabriela Lizarraga Gonzalez, A01229599 # Descripcion: Se calculara la distancia o tiempo que tarda un auto de acuerdo a la velocidad introducida. # A partir de aquí escribe tu programa velocidad = int(input('Velocidad del auto en km/h: ')) distancia6 = (velocidad*6) distancia10 = (velo...
4e803bff30fe637c684e0624314cf600f3009c2d
elissindricau/spanzuratoarea
/joc.py
3,085
3.875
4
""" sa apara un cuvant ascuns si fiecare litera sa apara codata printr-o linie cand utilizatorul introduce o litera daca litera se afla in cuvant, reafisam cuvantul cu litera respectiva de oricate ori apare cuvantu daca s-a ghicit si ultima litera, se afiseaza un mesaj de final daca nu se gaseste litera...
64aee295be7af99988d96dfab4e7e76d0a6d8148
nguyenduongkhai/sandbox
/pract1/loops.py
559
3.890625
4
def main(): #Example for i in range(1, 21, 2): print(i, end=' ') print() #a for i in range(0, 110, 10): print(i, end=' ') print() #b for i in range(20, 0, -1): print(i, end=' ') print() #c stars =int(input("How many starts you want me to print:")) ...
5339f59f718a304990c3d25c3a9603ca244b8974
nguyenduongkhai/sandbox
/prac2/word.generator.py
377
4.125
4
import random def main(): VOWELS = "aeiou" CONSONANTS = "bcdfghjklmnpqrstvwxyz" name = input("Please enter a sequence of Consonants(c) and Vowels(v)") word_format = name word = "" for kind in word_format: if kind == "c": word += random.choice(CONSONANTS) else: ...
d407702e562704e0137d5901604487aa25ddece9
emiliotebar/Ejercicios-python
/acumulado.py
406
3.8125
4
""">>> acumulado([1, 5, 7]) [1, 6, 13] >>> acumulado([1, 0, 1, 0, 1]) [1, 1, 2, 2, 3] >>> acumulado([]) [] """ l = [1, 5, 7] def acumulado(lista): lista_acumulada = [] for i in range(len(lista)): if (i == 0): lista_acumulada.append(lista[i]) else: lista_acumulada.appe...
805ff6d1b5d8be80ab2dbd7bf617f641fe793317
yangrchen/team-jordan-leetcodes
/medium/1423-max-points-from-cards.py
972
3.859375
4
# Time: O(n), Space: O(1) # Relevant Concepts: Sliding Window Technique # set up a first sum that is the sum of first k elements of cardPoints and make this the first max # use the sliding window technique to avoid a double for loop: # in each iteration remove the deepest element at the front # add the deepest element ...
4756cfd8904e84fbc1c5d886b5b3c737f2e2efeb
poly451/Evolutionary-Algorithms
/base_libs.py
2,572
3.71875
4
""" =================================== class Tile =================================== """ class Tile: def __init__(self, x, y, contents): # print("in tile, contents are of type: {}".format(type(contents))) if not isinstance(contents, str): print("contents ({}) ...
9d91d5e289556391b01c3d294144e83aad953472
jackR288817/pg_jr
/Personality_JF.py
837
3.921875
4
import time name = "Josh" state = "Florida" city = "new york city" game = "steep" book = "Tina Fey" print(name + " likes to visit " + state + " and " + city) print("He also likes pwning on " + game + " or reading " + book) print("What's your favorite subject?") subject = input () if subject == "math": ...
3daad6e7501f7f64897b565bc83fb587c7249fea
onifs10/PythonCPE401
/multiplication.py
2,496
3.703125
4
import matplotlib.pyplot as plt def multiplication(input_a_param: str, input_b_param: str): input_a_param = binary_4bit_num(input_a_param) input_b_param = binary_4bit_num(input_b_param) a = [0] * 8 b = [0] * 8 result = [0] * 8 a[4:8] = [int(i) for i in input_a_param] copy_a = [i for i in a...
5f2d916e536f3b8b8cf0610a37c52b2a13938a8a
BW1ll/PythonCrashCourse
/python_work/Chapter_9/9.1-9.3.py
2,138
4.5625
5
''' Python Crash Course - chapter 9 - Classes [Try it your self exercises] ''' # 9.1 class Restaurant: ''' example Restaurant Class in python using a generic details a bout Restaurants to build an example class ''' def __init__(self, restaurant_name, cuisine_type): self.restaurant_name...
af668c9031314257aa1328b5689cf8e64805fe67
BW1ll/PythonCrashCourse
/python_work/Chapter 5/5.3-5.7.py
2,209
3.703125
4
''' 5.3 exersize ''' alien_color = 'green' if alien_color == 'green': print('You shot down a green aline and erned 5 points. 5.3') if alien_color == 'yellow': print('You shot down a yellow alien and erned 5 points. 5.3') ''' 5.4 exersize ''' alien_color = 'yellow' if alien_color == 'green': pri...
005e54a5ee815a416767a4bb17f8d0cb6fe2b80f
BW1ll/PythonCrashCourse
/python_work/Chapter_9/9.6-9.8.py
6,175
4.65625
5
''' Python Crash Course - chapter 9 - Classes Try it your self exercises ''' # 9.6 class Restaurant: ''' example Restaurant Class in python using a generic details a bout Restaurants to build an example class ''' def __init__(self, restaurant_name, cuisine_type): '''initialize attribut...
4e2f61a2c1986b72afd93ae90539df806f580e87
shackett/Drosophila_metabolism
/meta.rxns.writer.py
2,598
3.578125
4
import re import sys class ReactionCompound: """Represents a compound combined with its stoichiometry""" def __init__(self, name, number=1): """ Initialized with the name of the compound and optionally the number of molecules it has in a formula """ self.name = name ...
8be4c686a69c1e4a9d1fc1fcea5007775b0344b2
YonErick/d-not-2021-2
/data/lib/queue.py
2,543
4.3125
4
class Queue: """ ESTRUTURAS DE DADOS FILA - Fila é uma lista linear de acesso restrito, que permite apenas as operações de enfileiramento (enqueue) e desenfileiramento (dequeue), a primeira ocorrendo no final da estrutura e a segunda no início da estrutura. - Como co...
9c94d150bd2c3bc4f6727122d2d6d34617609686
YonErick/d-not-2021-2
/data/02_busca_binaria.py
3,035
3.796875
4
# Algoritimo de Busca Binária # # Dada uma lista, que deve estar PREVIAMENTE ORDENADA, e um valor de # busca, divide a lista em duas metades e procura pelo valor de busca # apenas na metade onde o valor poderia estar. Novas subdivisões são # feitas até que se encontre o valor de busca ou que reste apenas uma # sublista...
0ef7995dbfc5ffa785a88d5456771876897cdcd0
spentaur/DS-Unit-3-Sprint-1-Software-Engineering
/sprint/acme_report.py
1,610
4.125
4
from random import randint, uniform, choice from acme import Product # Useful to use with random.sample to generate names ADJECTIVES = ['Awesome', 'Shiny', 'Impressive', 'Portable', 'Improved'] NOUNS = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', '???'] def generate_products(num_products=30): """Generate rando...
300a9b8b8b4bcfe4d1070bfdfc814574b55ecce8
bourriquet/hackerrank
/30DaysOfCode/day18_queuesAndStacks/queuesAndStacks2.py
793
3.59375
4
import sys class Solution: def __init__(self): self.s = [] self.q = [] def pushCharacter(self, ch): self.s.append(ch) def enqueueCharacter(self, ch): self.q.append(ch) def popCharacter(self): return self.s.pop() def dequeueChar...
b1d1b348d8facec13ddcd00cf9b9098acf0c1bf3
j4s1x/crashcourse
/Projects/CrashCourse/oneMillion.py
336
3.765625
4
#make a list of the numbers 1 to 1 million, then use a for loop to print the numbers #how about just up to 100 so I don't blow up my computer numbers=[] add=1 for i in range(0,100): numbers.append(add) add +=1 print (numbers) print (sum(numbers)) #or y=list(range(1,101)) print (y) print(sum(y)) x = list(range(...
7202e752d0907a36648cc13282e113689117c0c5
j4s1x/crashcourse
/Projects/CrashCourse/Names.py
572
4.125
4
#store the names of your friends in a list called names. #print each person's name in the list #by accessing each element in the list, one at a time friends = ["you", "don't", "have", "any", "friends"] print (friends[0]) print (friends[1]) print (friends[2]) print (friends[3]) print (friends[4]) #So that was one long...
2a53c61a3b1a235e4721983b872a9785ce3db31f
j4s1x/crashcourse
/Projects/CrashCourse/slices.py
626
4.28125
4
#Print the first three, the middle 3, and the last three of a list using slices. animals = ['cat', 'dog', 'cow', 'horse', 'sheep', 'chicken', 'goat', 'pig', 'alpaca'] print(animals[:3]) print(animals[3:6]) print(animals[-3:]) #Let's make a copy of that list. One list will be my animals, the other will be a friend's...
95574484bf6a54088492ae1e69dd2d5f4babb155
j4s1x/crashcourse
/Projects/CrashCourse/polling.py
669
4.40625
4
# make a list of people who should take the favorite languages poll #Include some names in the dictionary and some that aren't #loop through the list of people who should take the poll #if they have taken it, personally thank them #elif tell them to take the poll favorite_languages = { 'jen': 'python', 'sarah': 'c', 'e...
e80dbd61d099540b05ef8366e859cb4c66c7ca6a
j4s1x/crashcourse
/Projects/CrashCourse/rivers.py
643
4.65625
5
#list rivers and the provinces they run through. Use a loop to print this out. #Also print the river and provinces individually rivers = { 'MacKenzie River': 'Northwest Territories', 'Yukon River': 'British Columbia', 'Saint Lawrence River': 'Ontario', 'Nelson River': 'Manitoba', 'Saskatchewan River': 'Saskatchewan', ...
602ded7ccd367e8a8f1fe3e3cdc389eb932a0ced
Gaskill/Python-Practice
/Spirit.py
662
4.21875
4
#find your spirit animal animals = ["Horse", "Pig", "Kangaroo", "Whale", "Pony", "Lobster", "Chicken", "Seahorse", "Wolf", "Bat", "Tiger", "Lion", "Pufferfish", "Swan", "Bear", "Pigeon", "Salamander", "Iguana", "Lizard", "Bee", "Crow", "Beetle", "Ant", "Elk", "Deer", "Jellyfish", "Fly", "Parrot", "Hamster", "Cow"] prin...
e6c0429665fe1d99b2ebd257af5d5588faf76c09
Gaskill/Python-Practice
/tuples.py
223
3.71875
4
# Tuples can't be changed or sorted or rearranged season = ("Winter", "Summer", "Spring", "Fall") print(season) season.sort() #sport = ("Basketball", "Soccer", "Tennis", "Volleyball") #print(sport) #print(sport + season)
40994d6f1d2e3d74e93020bac996355fd6625986
ShijiZ/Python_Learning
/Crossin/Crossin55.py
347
3.8125
4
import re text='Hi, I am Shirlry Hilton. I am his wife.' m=re.findall(r'hi',text) if m: print m else: print 'not match' m=re.findall(r'\bhi',text) if m: print m else: print 'not match' m=re.findall(r'[Hh]i',text) if m: print m else: print 'not match' m=re.findall(r'\b[Hh]i',text) if m: pr...
01764628721318f334596296a5cf0990d4f8eb1c
ShijiZ/Python_Learning
/Crossin/Crossin12_HW904.py
125
3.5625
4
a=1 b=0 while a<=100: b=b+a a+=1 print b #or a=1 b=0 for i in range(1,101): b=b+a a=a+1 print b
3fdd89683d8b13306e9701998373b85f20ac66d4
royan2024/Algorithm_Practice
/Sorting/SelectionSort.py
724
3.75
4
# selection sort template def find_min_number(l: list) -> int: m = l[0] for a in l: if m > a: m = a return m def selection_sort(l: list): sorted_list = [] while len(l) > 0: # find min number m = find_min_number(l) # remove from original list l...
bb3a36f70e072da652871264ff54225fdb7641b8
Obaydahm/4sem-python-handins
/week 4 - numpy/ex/ex1.py
2,966
3.9375
4
import matplotlib.pyplot as plt import numpy as np import csv # Week 4 Exercise with Numpy # Exercise 1 # 1. Open the file './befkbhalderstatkode.csv' filename = "../../befkbhalderstatkode.csv" # 2. Turn the csv file into a numpy ndarray with np.genfromtxt(filename, delimiter=',', dtype=np.uint, skip_header=1) data =...
7b478cb0bed4930dcc56acc6f344cbd831d3c73a
Venismendes/jogo-do-dado
/jogo do dado.py
7,317
3.734375
4
import random player1_points = 1000 player2_points = 1000 dado = (1, 2, 3, 4, 5, 6) players = 1 player = input('Olá qual o seu nome: ') print(f'Bem vindo ao jogo do dado {player}') quantidade_jogadores = input('Deseja jogador de 2 jogadores? [S/N]: ').upper() if quantidade_jogadores == 'S': players = 2 pl...
6418e0d3be3936b9940a423abbc967fa4013afdc
asobhi1996/ID3DecisionTree
/main.py
7,914
3.703125
4
""" Main file for generating an ID3 tree from training data and performing accuracy tests on both training and test data Input: two command line arguments. First is a file with lableled training data and second is unlabeled test data. Training data includes up to N attributes and the last attribute must be the classi...
f3aaa00f37f0506030a18fc73804e9187beb7c99
Marlysson/AppEvents
/enums/tipo_atividade.py
343
3.546875
4
# -*- coding: utf-8 from enum import Enum class TipoAtividade(Enum): PALESTRA = "Palestra" TUTORIAL = "Tutorial" MINI_CURSO = "Mini Curso" MESA_REDONDA = "Mesa Redonda" WORKSHOP = "Workshop" HACKATHON = "Hackathon" COFFEE_BREAK = "Coffee Break" def __str__(self): return "{...
769ccf78cdedae14fbf0639fe910748de6b696bb
Meowsers25/Project-Euler-Problems
/problem1.py
126
3.875
4
count = 0 for number in range (1, 1000): if number % 3 == 0 or number % 5 == 0: count = count + number print(count)
bb6ed1f4df8033a9088c37225de7efee7f0c66e2
zkmacdon/Collatz
/Collatz.py
919
4.03125
4
class Collatz: """ This class is designed for creating objects that possess a collatz conjecture value relevant to the inputted value. The collatz conjecture value is deifned by the number of cycles required when using the rules of the collatz conjecture for a number to arrive at 1. """ number: ...
75a232d1d0d4c6b0c0411bc0aac3f536038f43a0
marcosjr0816/Python
/simple-linked-list/simple_linked_list.py
1,422
3.9375
4
class Node(object): def __init__(self, value): self._value = value self._next = None def value(self): return self._value def next(self): return self._next class LinkedList(object): def __init__(self, values=[]): self._head = None for value in values: ...
9db8334bbf1e16c3d146d0305526c73482fd740a
kyon0304/BaofoJiaoIMPL
/quicksort.py
1,437
3.78125
4
#!/usr/bin/python import random import time def unsorted(length): return [random.randrange(0, length*10) for r in xrange(length)] def quicksort(l): if len(l) > 0: pivot = random.randint(0, len(l)-1) elements = l[:pivot] + l[pivot+1:] left = [e for e in elements if e <= l[pivot]] ...
172c116f9297e32e4d7cf4b6668970235a2bcb42
russellpipal/python-challenge
/python-challenge-3.py
203
3.890625
4
"""Python Challenge #3""" import re cont = open("challenge-3-text.txt").read() print(re.findall(r'[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]', cont)) # Works! Get all of the small letters and put them together.
fac86a8c9b665ae3eb7a88556b5856084e393805
cofren/Coding_Bootcamp
/Weeks/Week8/Day2/daily_challenge.py
3,909
4.625
5
""" Daily Challenge : Old MacDonald’s Farm Look carefully at this code and output File: market.py macdonald = Farm("McDonald") macdonald.add_animal('cow',5) macdonald.add_animal('sheep') macdonald.add_animal('sheep') macdonald.add_animal('goat', 12) print(macdonald.get_info()) Output McDonald'...
20974deca3f1f0e51818efdc86cfd6612fae40ca
cofren/Coding_Bootcamp
/Weeks/Week6/Day6/tc_2.py
123
3.828125
4
string = "You have entered a wrong domain" new_list = string.split(" ") print(new_list) new_list.reverse() print(new_list)
a13e7f5a36c690aee7e486d6c8d4bc6b943aa9a5
cofren/Coding_Bootcamp
/Weeks/Week6/Day4/xpGold.py
3,794
4
4
import string import random """ # Exercise 1 list1 = [1, 2, 3, 4] list2 = [6, 7, 8, 9] list1.extend(list2) print(list1) # Exercise 2 list = [] for i in range(1, 4): number = input("Please enter a number:") list.append(int(number)) print(list) print(f"The max number is {max(list)}") # Exercise 3 letter_string = ...
a6715be49b6288c06f86e43eb48388609cfc199f
cofren/Coding_Bootcamp
/Weeks/Week7/Day2/xpNinja.py
1,310
4.0625
4
# Exercise 1 list_of_strings = [] def box_printer(strings): list_of_strings = string_to_list(strings) longest_word = longest_string(list_of_strings) stars_print = "".join(stars_top_bottom(longest_word)) add_spaces(longest_word,list_of_strings) print(list_of_strings) print(longest_word) prin...
57c1a5bbbc88a39ea0eefcba6f54fcc39a1ff57f
saranguruprasath/Python
/Python_Classes.py
501
4.1875
4
# -*- coding: utf-8 -*- """ Created on Tue Aug 14 22:27:09 2018 @author: saran """ class Circle(): pi = 3.14 def __init__(self,radius=1): self.radius = radius self.area = radius * radius * Circle.pi def get_circumference(self): return 2 * self.pi * self.radius ...
776fd3c7c8b548dfdb1c6c0689aedce170c683e3
saranguruprasath/Python
/test.py
187
4.0625
4
print ("Python test program") x=1 y=2 print ("X=",x) print ("Y=",y) y=x+y print ("Y=",y) if y == 2: print ("Y is not added with X") else: print ("X is added with Y and result is:",y)
ccae406d0cae6f39f78c1f71c9556c6d7c5d90b6
TheAwesomeAray/LearningPython
/Tutorial/Exceptions.py
548
4.09375
4
student = { "name": "Andrew", "student_id": 1, "grade": "A" } try: last_name = student["last_name"] except KeyError as error: print("Error! Could not find last name. {0}".format(error)) student["last_name"] = "Ray" try: last_name = student["last_name"] print(last_name) numbered_last...
19add075be78bfdb8342d9b376aef36e82a804ca
joelpaula/Projeto-Final-EDA
/BinaryHeap.py
2,378
3.71875
4
class BinaryHeap(object): class _Node(object): def __init__(self, key, element): self._element = element self._key = key def __str__(self): return f"{self._key}: {self.element}" def __repr__(self): return str(self) def __init__(self): ...
1a8bbdd1ca8376c7921452ff114c3d818829aa8c
tylersmithSD/Basic_Cryptography-Python
/Cryptography.py
5,855
4.5
4
#Developer: Tyler Smith #Date: 10.19.16 #Purpose: The program takes an english word that the user types in # and encrypts it, making it secret. The user also has # the option to take an encrypted word and decrypt it, # revealing its english translation. There is also an # ...
f05853737710c77bfd29ac96cc5e7ce193c2096d
pulakanamnikitha/phython
/min.py
226
3.875
4
min=int(raw_input()) def smallest(arr,n): min = arr[0] for i in range(1, n): if arr[i] > max: min = arr[i] return min arr = [1,2,3,4,5] n = len(arr) Ans = smallest(arr,n) print (Ans)
863c35eef66e54f90504b5bdd1dd4b572cc8a36c
pulakanamnikitha/phython
/731.py
105
3.5625
4
n=int(raw_input()) p,q=map(int,raw_input().split()) if p<n and n<q: print "yes" else: print "no"
4f98933bfd786c20739cf775e223dfee4d6f3466
darthbeep/list_password_strength
/list.py
789
3.765625
4
import string import math lower = string.lowercase upper = string.uppercase numbers = string.digits other = ".?!&#,;:-_*" def minimum(password): l = len([x for x in lower if x in password ]) > 0 u = len([x for x in upper if x in password ]) > 0 n = len([x for x in numbers if x in password ]) > 0 print ...
56e401213a3cc3b4fbc6cf581cf8565078c1fa57
JeromeTroy/PyMath
/Python/interp.py
9,829
3.5
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 8 11:35:24 2019 @author: jerome """ import numpy as np import matplotlib.pyplot as plt import ode def polyinterp(x_nodes, y_values, new_nodes): """ Polynomial interpolation using the second barycentric form Input: x_nod...
9c81edb53d741621243d63863d055c97de8a0ced
adamrajcarless/python-coding
/codewars-kata08-6KYU-create-phone-number.py
744
4.09375
4
# Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number. # Example: # create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890" # The returned format must be correct in order to complete this challenge. # Do...
7ee1a975421e976dc3827527273f0cc1127f61b8
ParkerMactavish/QuadCopterUI
/src/DataAccess.py
713
3.84375
4
import os ''' open_File requires two parameters -fileName for target file name -mode for reading or writing[read, write] open_File returns a dictionary of values -"FileExist" for whether the target file exists[True, False] -"File" for the file object -"Mode" for the mode of the file object["read", "write"] ''' ...
0244f6450cab2d83bb15cbbfad7b17478940cd2b
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/Tianx/Lesson3/mailroom.py
5,177
3.8125
4
# ------------------------------------------# # !/usr/bin/env python3 # Title: mailroom.py # Desc: Assignment 1 # Tian Xie, 2020-04-10, Created File # ------------------------------------------# # A dictionary of donor paired with a list of donation amounts dict_of_donors = {'Jeff Bezos': [1.00, 50.00], ...
24f5ef59596ffc07dd1425129fdaed71907b41cb
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/lisa_ferrier/lesson08/test_circle.py
3,036
3.578125
4
#!/usr/bin/env python # test_circle.py # L Ferrier # Python 201, Assignment 08 import pytest from circle import* ######## # step 1 ######## def test_circle(): c = Circle(4) s = Sphere(4) # print(c.radius) assert c.radius == 4 assert s.radius == 4 ######## # step 2 ######## def test_diameter()...
658c83e0f9386126a866fb7f507528f89352d59f
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/allen_maxwell/Lesson_08/circle.py
5,215
3.9375
4
#!/usr/bin/env python3 # Allen Maxwell # Python 210 # 1/4/2020 # circle.py # ver 2 import math def is_valid_entry(value): if isinstance(value, str): raise ValueError('Value must be a number') elif isinstance(value, (int, float)): if value < 0: raise ValueError('Value must be a pos...
abb1c338ea69227d8e257f6a3a5de62e54b5d06c
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/barb_matthews/lesson2/series.py
1,809
4.28125
4
## Lesson 2, Exercise 2.4 Fibonnaci Series ## By: B. Matthews ## 9/11/2020 def fibonacci(n): #"""Generates a Fibonnaci series with length n""" if (n == 0): return 0 elif (n == 1): return 1 else: return fibonacci(n-1) + fibonacci(n-2) def lucas(n): #"""Generates a Lucas series with...
881a0180c255d7a7c771b1261bbaf31272bc04ee
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/steve-long/lesson04-dicts-sets-files/ex-4-4-file-io/copy_file_binary.py
11,848
3.890625
4
#!/usr/bin/env python3 # ============================================================================== # Python210 | Fall 2020 # ------------------------------------------------------------------------------ # Lesson04 # File Exercise (copy_file_binary.py) # Steve Long 2020-10-14 | v0 # # Requirements: # =============...
88c8c3cf010401484e6d10955296b929aa464671
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/Steven/lesson06/mailroom04.py
4,366
3.65625
4
#! bin/user/env python3 import sys from operator import itemgetter """ Program Part4: Add a full suite of unit tests: “Full suite” means all the code is tested. In practice, it’s very hard to test the user interaction, but you can test everything else. Therefore you should make sure that there is as little logic and ...
f06effa5e022502aa270993a58db4e80114fd674
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/mimalvarez_pintor/lesson03/list_lab.py
1,131
3.875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 26 20:35:32 2020 @author: miriam """ # Series 1 L = ['Apples', 'Pears', 'Oranges', 'Peaches'] print(L) F = input("Please type in a fruit: ") L.append(F) print(L) for num in L: num = int(input("\nPlease enter in a fruit number (1-5): ")) pr...
f93b924c0308a6a61d1bc5133158c89e4869620a
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/IanMayther/Lesson08/circle_class.py
1,706
4
4
#!/usr/bin/env python3 import math class Circle: """ A class-based system for rendering a circle. """ def __init__(self, rad=None): if rad is None: raise AttributeError else: self.radius = rad def __str__(self): return f'{self.__class__.__name__} w...
c10861448bb9d4be90c2405477a4cb6bb407bf95
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/ReemAlqaysi/Lesson09_2/cli_main.py
3,815
3.875
4
#!/usr/bin/env python3 import sys, os from datetime import datetime from donor_models import Donor, DonorCollection # Mailroom functions def prompt_user(): prompt = "\n".join(("Welcome to the MailRoom!", "Please Choose an action:", "1 - Send a Thank You to a single donor.", "2 - Create a R...
919274fb66cad43bd13214839b8bc7cd8b2ba625
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/Steven/lesson08/circle_class.py
2,445
4.5
4
#!/usr/bin/env python3 """ The goal is to create a class that represents a simple circle. A Circle can be defined by either specifying the radius or the diameter, and the user can query the circle for either its radius or diameter. Other abilities of a Circle instance: Compute the circle’s area. Print the circle and...
05ad62f4a837bab29deb96c360e27ffd88cdd361
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/tihsle/lesson09/mailroom_oo/cli_main.py
1,669
3.796875
4
#!/usr/bin/env python3 from donor_models import Donor, DonorCollection import sys def select_donor(donors): #select the donor for the thank you email while True: answer = input("Which donor to send Thank You to?\n" "(Type 'list' to show list of donors)\n").title() if ...
4a2a4e2d20d9bb764fac5a93b4732a6461a5d095
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/kristoffer_jonson/lesson1/warmup_2_string_match.py
191
3.578125
4
def string_match(a, b): length = len(a) if len(a) > len(b): length = len(b) count = 0 for i in range(length-1): if a[i:i+2] == b[i:i+2]: count = count +1 return count
008d725f18c563997e49a64460611c944120a0eb
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/cjfortu/lesson08/Sparse_Array.py
2,287
3.640625
4
#!/usr/bin/env python class Sparse_Array: """Class for a 1D array which functions as a list, but does not store zero values.""" def __init__(self, values=None): """Store all non-zero list values in a dict, with the indices as keys.""" self.length = len(values) if values is None: ...
496eb5424686f903c2ec4372d8275ee73cd97a32
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/bplanica/lesson04/trigrams.py
4,502
3.984375
4
#!/usr/bin/env python3 import random # ------------------------------ # # Assignment 4 (Trigrams!) for Python 210 # Dev: Breeanna Planica # ChangeLog: (who, when, what) # BPA, 8/18/2019, Created and tested script # BPA, 8/20/2019, added confirmaiton of ebook type # ------------------------------ # # ----- Data --...
b302b5c46666bc07835e9d4e115b1b59c0f9e043
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/franjaku/Lesson_2/grid_printer.py
1,311
4.4375
4
#!/Lesson 2 grid printer def print_grid(grid_dimensions=2,cell_size=4): """ Print a square grid. Keyword Arguments grid_dimensions -- number of rows/columns (default=2) cell_size -- size of the cell (default=4) Both of the arguments must be interger values. If a non-integer value is input...
96b3aff4e3e47ee94b5d4adc7dde76438c5f027c
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/calvin_fannin/Lesson09/mailroom_oo/donor_models.py
2,430
3.859375
4
#!/usr/bin/env python3 """ Class to hold a information for one donor first name lastname and donation amount """ class Donor(): def __init__(self, firstname, lastname,donation): self.fname = firstname.title().strip() self.lname = lastname.title().strip() if donation <= 0: donat...
a89dce9f76910fbacb0cfbe8b2ffab5b861a85bd
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/cbrown/Lesson 2/grid_printer.py
577
4.25
4
#Grid Printer Excercise Lesson 2 def print_grid(x,y): ''' Prints grid with x blocks, and y units for each box ''' #get shapes plus = '+' minus = '-' bar = '|' #minus sign sequence minus_sequence = y * minus grid_line = plus + minus_sequence #Create bar pattern bar_sequ...
4eb0fd45ed58ab5e57d6dba2518fab2cc325b46a
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/kyle_lehning/Lesson04/book_trigram.py
2,987
4.3125
4
# !/usr/bin/env python3 import random import re import os def build_trigrams(all_words): """ build up the trigrams dict from the list of words returns a dict with: keys: word pairs values: list of followers """ trigrams = {} for idx, word in enumerate(all_words[:-2]): wo...
c61e350a8d60402e7d6d5e05dba7fee0632ca92f
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/nick_miller/lesson03/strformat_lab.py
4,004
4.46875
4
#!/usr/bin/env python3 """PY210_SP - 3.3 - strformat_lab author: Nick Miller""" # Task 01 tuple1 = (2, 123.4567, 10000, 12345.67) # produce: 'file_002 : 123.46, 1.00e+04, 1.23e+04' """ 1. The first element is used to generate a filename that can help with file sorting. The idea behind the “file_002” is that if y...
85643b0394dde171316c7a050050df5a71726ac1
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/jack_anderson/lesson05/mailroom_pt3.py
6,377
3.921875
4
#!/usr/bin/env python3 """ Jack Anderson 02/18/2020 UW PY210 Mailroom assignment part 3 """ from datetime import date # The list of donors and their amounts donated donors_list = [ ['Bubbles Trailer',[1500.99, 2523, 3012]], ['Julien Park',[2520.92, 1623.12]], ['Ricky Boys',[345.56, 5123.25]], ['Jack An...
d962d3b9a9df195b320e91bd054e9ea78aaf56c6
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/grant_dowell/Lesson_08/test_circle.py
1,390
4.125
4
# -*- coding: utf-8 -*- """ Created on Sun Feb 9 20:13:36 2020 @author: travel_laptop """ import math import unittest as ut from circle import * def test_properties(): c = Circle(10) assert c.radius == 10 assert c.diameter == 20 print(c.area) assert c.area == math.pi * 100 c.diameter = 6...
3e41359bba03ed238200f4413d85f70325006266
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/erik_oien/lesson01/warmup_1.py
1,419
3.515625
4
# sleep_in def sleep_in(weekday, vacation): if not weekday or vacation: return True else: return False # monkey_trouble def monkey_trouble(a_smile, b_smile): if a_smile and b_smile: return True if not a_smile and not b_smile: return True return False # sum_double def sum_double(a, b): s...
01a438810a58c2b072b8a6823796408cf91bcb44
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/chelsea_nayan/lesson02/fizzbuzz.py
793
4.5
4
# chelsea_nayan, UWPCE PYTHON210, Lesson02:Fizz Buzz Exercise # This function prints the numbers from low to high inclusive. For multiples of three, "Fizz" is printed instead of the numer and for multiples of five, "Buzz" is printed. If the number both divisble by three and five, it prints out "FizzBuzz" def fizzbuzz...
a052bf6914dc8f5f93d2b1f236a46982f6bb9c4e
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/Yue_Ma/Lesson08/circle.py
1,653
4.09375
4
#!/usr/bin/env python3 import math class Circle(object): def __init__(self, radius): self.radius = radius @property def diameter(self): diameter = self.radius * 2 return diameter @diameter.setter def diameter(self, diameter): self.radius = diameter / 2 @prop...
f7b291f84604918079f08f1a86bb442b0fa2c885
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/phrost/Lesson03/Exercises/Series_2.py
400
3.84375
4
fruit = ['Apples', 'Pears', 'Oranges', 'Peaches'] print(fruit) del fruit[-1] print(fruit) fruit_2 = fruit[:] + fruit[:] print(fruit_2) polling_active = True while polling_active: fruit_d = input('Please select a fruit to delete: ') if fruit_d in fruit_2: fruit_2.remove(fruit_d) if fruit_d in fruit_2...
30901cb116e213843aa072d76b18e6073d493d05
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/mattcasari/lesson01/logic-2/lone_sum.py
227
3.5625
4
#!/usr/bin/python # -*- coding: utf-8 -*- def lone_sum(a, b, c): temp = [a, b, c] final_list = [] for num in temp: if temp.count(num) == 1: final_list.append(num) return sum(final_list)
b9929687fa1469adb1e68e0e3323051183ef7094
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/karl_perez/lesson05/mailroom3.py
4,015
3.9375
4
#!/usr/bin/env python3 #Mailroom part 3 import sys #donors donors = [["Krystal Perez", 50.00, 250.00], ["Eddie Lau", 32.50], ["Jimmy Jack", 200.00, 350.00, 400.00], ["Grace Cool", 120.00, 75.00], ["Adriel Molina", 45.00, 450.00]] # menu prompt def menu(): #Tell the user what their options are....
bef1092d43e26d2806fa42416f04588a8e5da860
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/kgolenk/lesson03/strformat_lab.py
3,949
3.671875
4
#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # # Title: Lesson 03 # Description: Slicing Lab # ChangeLog (Who,When,What): # Kate Golenkova, 10/16/2020, Created script # Kate Golenkova, 10/18/2020, Changed script # Kate Golenkova, 10/19/2020, Changed script # ----...
a57426f9e622fedf3f5da2e541a132a1f199ca9a
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/pkoleyni/Lesson02/fizz_Buzz.py
437
4.03125
4
def multiples_of_num(num1, num2): if num1%num2 ==0: return True else: return False def fizz_buzz(n): for num in range(1, n+1): if multiples_of_num(num, 3) and multiples_of_num(num, 5): print('FizzBuzz') elif multiples_of_num(num, 3): print('Fizz') ...
60c4c7cebe6342a7735d5633ec26ea31b4adc1c3
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/thomas_sulgrove/lesson02/series.py
1,899
4.28125
4
#!/usr/bin/env python3 """ a template for the series assignment #updated with finished code 7/29/2019 T.S. """ def fibonacci(n): series = [0,1] #Define the base series values in a list while len(series) < n + 1: #add one so normalize lenth and index number series.append(sum(series[-2:])) #Add last two...
c35f35adacf25a0d61b409bdddf6dbef8f98963e
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/zhen_yang/lesson06/test_centered_average.py
1,009
4.09375
4
""" test code for the centered_average.py centerted_average.py returns the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the largest and smallest values in the array. If there are multiple copies of the smallest value, ignore just one copy, and likewise for ...
7f06ec741747e5551ac76fff6afd330278d3d761
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/mark_mcduffie/Lesson5/mailroom_part3.py
4,627
3.875
4
''' Mark McDuffie 3/20/19 Mailroom part 2 It should have a data structure that holds a list of your donors and a history of the amounts they have donated. This structure should be populated at first with at least five donors, with between 1 and 3 donations each. You can store that data structure in the global namespac...
fd4077a9c410e963bf9adf65e579c0f20bcd002d
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/chrissp/lesson05/mailroom.py
4,482
3.640625
4
import sys # Global Variables donor_db = [{"name": "William Gates, III", "donations": [653772.32, 12.17]}, {"name": "Jeff Bezos", "donations": [877.33]}, {"name": "Paul Allen", "donations": [663.23, 43.87, 1.32]}, {"name": "Mark Zuckerberg", "donations": [1663.23, 4300.87, 10432.0]}...
a28d51e710b65eb777c69270cf0a4c250ad195fa
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/shumin/lesson02/fizz_buzz.py
378
4.03125
4
# This program prints from 1 to 100 # Multiples of 3 prints Fizz # Multiples of 5 prints Buzz # Multiples of 15 prints FizzBuzz def fizz_buzz(): for i in range(1, 101): if i % 15 == 0: print("FizzBuzz") elif i % 5 == 0: print("Buzz") elif i % 3 == 0: prin...
a0967efe83f65fa7f74d1edd3f8157ce6ee0aed4
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/chasedullinger/lesson04/file_parsing.py
651
3.78125
4
#!/usr/bin/env python3 # PY210 Lesson 04 File Parsing - Chase Dullinger input_file = "students.txt" languages = {} with open(input_file, "r") as file: lines = file.readlines() for line in lines[1:]: nickname_and_languages = line.split(":")[1].split(",") for item in nickname_and_languages: ...
99dc4ca468a929a6770561473da628bd3022cc99
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/rick_halsell/lesson02/exercisetwo.py
4,289
3.9375
4
# Printing a Grid # function to print the top line of the box def full_line_func(): num_full_line = [ print('+ - - - - + - - - - +') for num_full_line in range(1)] return # function to print the second line of the box def pipe_space_func(): num_pipe = [ print('| | |', end=' ') for num_pipe ...
27c58d61171367d533d4c91546a8cf6806b970f0
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/jerickson/Lesson9/mailroom/donor_models.py
6,696
3.703125
4
"""Contains the DonationData and Donor classes""" import os import re class Donor: """Holds specific donor data""" def __init__(self, name=""): # TODO remove KWARG """ Creates a new donor Parameters ---------- name : str, optional Donor Name, by default ...
50a9086efd36c837d28b017f435a767742778439
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/bcamp3/lesson03/mailroom.py
3,249
3.9375
4
#!/usr/bin/env python3 """ Mailroom script This script accepts user input to perform the following donation database tasks: 1 - Display the donor database list or update the donation database with a new donation. Then display a 'Thank You' message to the donor of the new donation. 2 - Display a dona...
9901e5006e14e1d21529996686db6dc7dd349cd5
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/Nick_Lenssen/lesson09/donor_models.py
3,373
3.609375
4
import pathlib class Donor: def __init__(self, full_name): self.name = full_name self.donations = [] @property def total_donation(self): """sum of donation history property""" return sum(self.donations) @property def num_donation(self): """number of donati...
0ce8ff95818149a1820c1cecdd983f94931c9489
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/humberto_gonzalez/session05/mailroom.py
3,965
3.984375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 13 17:53:34 2019 @author: humberto gonzalez """ import sys import tempfile import os donor_db = {"Tyrod Taylor": [1000.00, 45.50], "Jarvis Landry": [150.25], "Philip Rivers": [650.23, 40.87, 111.32], "Melvin ...
2802d4cbe44623e1cf25251f99dc532c3b1b0f27
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/shodges/lesson04/mailroom.py
3,815
3.515625
4
#!/usr/bin/env python3 import tempfile from pathlib import Path from datetime import datetime donors = {'William Henry Harrison' : [806.25, 423.10], 'James K. Polk' : [37.67, 127.65, 1004.29], 'Martin van Buren' : [126.47], 'Millard Fillmore' : [476.21, 2376.21], 'Chester A. Art...
9cca505939c2e997cf930a06e02bba161c1b90a9
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/shumin/lesson01/break.py
174
3.5
4
# NameError y = x + 3 # TypeError A = "3" y = A + 3 # SyntaxError print"This will result in a syntax error") # AttributeError x = "Book" print(x.deletethemiddleletter)
d869b4485e4a2df6cd6432bbd648b3427a0ca317
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/Nick_Lenssen/lesson03/strformat_lab.py
913
3.65625
4
#!/usr/bin/env python3 def formatter(my_tup): l = len(my_tup) out_tup = ", ".join(["{:^5}"]*l) return ('the {} numbers are: '+out_tup).format(l, *my_tup) tup = (2,123.4567,10000,12345.67) tup_2 = (1,12,2,3,3333,5,6,12,1,23) list_1 = ['oranges', 1.3, 'lemons', 1.1] print ('file{:>03d} : {:.2f}, {:.2E} , {:.2E}'.fo...
19db572f1e6e1304d43b83ed2cde9ca0845ef36c
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/jason_jenkins/lesson04/dict_lab.py
1,895
4.25
4
#!/usr/bin/env python3 """ Lesson 4: dict lab Course: UW PY210 Author: Jason Jenkins """ def dictionaries_1(d): tmp_d = d.copy() print("\nTesting dictionaries_1") tmp_d = dict(name="Chris", city="Seattle", cake="Chocolate") print(tmp_d) tmp_d.pop('city') print(tmp_d) tmp_d.update({'fruit...