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 |
|---|---|---|---|---|---|---|
91c7e627278fe3386b9db69c2bf8636072abbeaf | PdxCodeGuild/class_mudpuppy | /Assignments/Eboni/lab09-unit_converter.py | 1,154 | 4.46875 | 4 | """
Ask the user for the number of feet, and print out the equivalent distance in meters. Hint: 1 ft is 0.3048 m. So we can get the output in meters by multiplying the input distance by 0.3048. Below is some sample input/output.
"""
# import decimal
# print("Enter number of feet ")
# number_feet = float(input(''))
# me... |
2deae52c1bab7a98738c027df30c62d50ee50ccc | PdxCodeGuild/class_mudpuppy | /Reviewed/Brea/python/lab14/lab14_v1.py | 1,510 | 3.5625 | 4 | #Lab 14, version 1.py
import random
winner_card = []
my_card = []
def pick_six():
card = []
for _ in range(6):
card.append(random.choice(range(1, 100)))
return card
def num_matches(winner_card, my_card):
matching_counter = 0
for _ in range(len(winner_card)):
if wi... |
cc27d88befb5c37dbf60154209dd3aaac7b590b9 | PdxCodeGuild/class_mudpuppy | /Assignments/Brea/Python Labs/Lab25_version3.py | 2,614 | 4.0625 | 4 | #Lab 25, version 3, April 17th, 2020
class Atm:
def __init__(account, balance = 0):
account.negative = False
account.balance = balance
account.interest_rate = .01
account.transactions = []
def check_balance(account): #returns the account balance
print(f"Your account... |
934737b34c7ffe58f092243fd4036019a57da25c | PdxCodeGuild/class_mudpuppy | /1 Python/class_demos/200323/scratch.py | 954 | 3.6875 | 4 | counter = 0
output = ''
while counter < 10:
output = 'a' + output + 'bb' #changed
counter = counter + 2
print(output)
'''
while True:
user_input = input("Please type cat: ")
if user_input == 'cat':
break
'''
'''
pieces = ''
for piece in ['a', 'b', 'c', 'd', 'e']:
pieces = pieces + piece
... |
ad522fcec25bc4b7d7ddf0e89a5473b070aa5a87 | PdxCodeGuild/class_mudpuppy | /Assignments/Haoua/PYTHON/lab12.py | 3,449 | 4 | 4 | import random
# choices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# user = int(input(f"pick a number between 1-10 : "))
# num = int(random.randint(0,10)) #random integer between 1 and 10
# print(num)
# # user = ''
# guess_count = 0
# guess_limit = 10
# out_of_guesses = False
# # while guess <= guess_limit:
# # if num !=... |
e22e5470c09538653b22d42dfd800bbb11dbba05 | PdxCodeGuild/class_mudpuppy | /Assignments/Devan/1 Python/labs/lab03-grading.py | 586 | 4.09375 | 4 | user_grade = int(input('What is your score? '))
second_digit = user_grade % 10
if second_digit < 5:
suffix = '-'
elif second_digit > 5:
suffix = '+'
elif second_digit == 5:
suffix = ''
if user_grade >= 90:
print(f"Congrats you got a A{suffix}")
elif user_grade >= 80 and user_grade < 90:
print(f"Cong... |
c5d508427ca54175b9b640d81d451807aa07ac21 | PdxCodeGuild/class_mudpuppy | /Assignments/Racheal/python/test.py | 1,247 | 4.34375 | 4 |
import random
#Twinkle, twinkle, little star,
#How I wonder what you are!
#Up above the world so high,
#Like a diamond in the sky.
# little = input("Enter adjective:")
# wonder = input("Enter verb:")
# world = input("Enter noun:")
# high = input("Enter adjective:")
# diamond = input("Enter noun:")
# sky =input("Ent... |
76f115e3224919ec85f85e033a29ea86cbe1307d | PdxCodeGuild/class_mudpuppy | /Assignments/Devan/1 Python/labs/lab05-random_emoticon_generator.py | 642 | 3.671875 | 4 | import random
from huepy import *
def _main_():
how_many = int(input('How many emoticons do you want? '))
list_of_emoticons = []
seperator = red(' or ')
for i in range(how_many):
list_of_emoticons.append(make_face())
print(seperator.join(list_of_emoticons))
user_choice = int(input('Whi... |
0bb505f1ef1cdaeea4fc60ad3d1091a63e1d29a6 | PdxCodeGuild/class_mudpuppy | /Assignments/Terrance/Python/lab02-mad_lib.py | 257 | 3.875 | 4 | lab02-madlib.py
'''
You must be the change you wish to see in the world.
'''
person = input("Name a person: ")
pronoun = input("Name a pronoun: ")
place = input("Name a place: ")
print(f"{Person} must be the change {pronoun} wish to see in the {place}.") |
42996f16ee0b8d80e5cfcb2bc60e20bb875d67e1 | PdxCodeGuild/class_mudpuppy | /Assignments/Brea/Python Labs/hello32020.py | 130 | 3.875 | 4 |
pieces = ''
for piece in ['a', 'b', 'c', 'd', 'e']:
pieces = pieces + piece
print(f"The letter is {pieces}")
print('bye') |
a8dd0814e6f3294f7c65ed85b0c49311589f6fb8 | PdxCodeGuild/class_mudpuppy | /Assignments/Terrance/Python/lab25-atm.py | 2,171 | 4.15625 | 4 | #lab25-atm.py
class ATM:
def __init__(self, balance=0, interest_rate=.01):
self.balance = balance
self.interest_rate = interest_rate
self.transactions = []
def check_balance(self):
'''returns the account balance'''
print(f"Your balance is {self.balance}")
... |
4e17ad1e21e211e490a7e0b4ef34b71052415dc9 | PdxCodeGuild/class_mudpuppy | /Assignments/Brea/Class Examples/Test_042220.py | 225 | 4.1875 | 4 | #Test Examples, April 22nd, 2020
data1 = {'a': 1}
data2 = {'a': {'b': 1}} #if we call 'a', it'll return the dictionary
data3 = {'a': {'b': 1}, 'z': ['Portland', 'Seattle', 'LA']} #if we call data3['z'][0], returns 'Portland' |
d8fca062d064a604256c2e1df1392debd589ece1 | PdxCodeGuild/class_mudpuppy | /Assignments/Haoua/PYTHON/lab25.py | 2,366 | 3.9375 | 4 | User_Bal = 250
class Bank_Account():
def __init__(self, balance=0, print_transactions=[], interest=.1):
self.balance = balance
# self.print_transactions = print_transactions
self.print_transactions = []
self.interest = interest
def ch_bal(self):
return f"Your Current Ba... |
710e3aff3001f8d68ba758bf1472992bb021c904 | PdxCodeGuild/class_mudpuppy | /Assignments/Eboni/lab25.py | 1,803 | 3.921875 | 4 | class ATM:
def __init__(self, balance, interest):
self.balance = balance
self.interest = interest
self.transactions =[]
# self.check_withdrawl = True
# def __repr__(self):
# return f"balance:{self.balance}"
def deposit_amount(self, deposit):
self.balance += d... |
3826fbad1118f1c86d3bed7104589caf027a53d4 | PdxCodeGuild/class_mudpuppy | /1 Python/hints/lab_17/double_letter_finder.py | 488 | 4.03125 | 4 | # double_letter_finder.py
s2 = "I have a book in my bag."
s1 = "I have a jacket in my bag."
# found_letter = ''
found_double_letter = False
for index in range(len(s1) - 1):
# print(index, s1[index], index + 1, s1[index + 1])
if s1[index] == s1[index + 1]:
found_double_letter = True
found_letter... |
a35cffa0ab2b6c4424709cf8693ef70106688eb9 | PdxCodeGuild/class_mudpuppy | /Assignments/Brea/Class Examples/Test_042120.py | 1,464 | 4.1875 | 4 | #Test Examples April 21st, 2020
#average numbers lab re-do
# nums = [5, 0, 8, 3, 4, 1, 6]
# running_sum = 0
# for num in nums:
# running_sum = running_sum + num
# print(running_sum)
# aver = running_sum / len(nums)
# print(f"The average of your numbers is {aver}.")
#--------REPL Version of average number... |
850e221c13bbdc7bb9f70adb622070a42ccdfcea | PdxCodeGuild/class_mudpuppy | /Assignments/Brea/Python Labs/Lab12_v1_3.26.20.py | 477 | 3.890625 | 4 | #Lab 12 Version 1, March 26th, 2020
import random
num1 = random.randint(1,10)
guess_num = 0
while True:
user_guess = int(input("What number do you guess? : "))
if user_guess == num1:
guess_num = guess_num + 1
print(f"You're correct! You guessed {guess_num} of times.")
break
if ... |
a402906c2b218262ba0afbafa8a1a600dd58b028 | PdxCodeGuild/class_mudpuppy | /Assignments/Manny/Python/scantron_checker.py | 462 | 3.5625 | 4 | import random
scantron_choices = ['a', 'b', 'c', 'd', 'e' ]
nephews_answers = []
for piece in range (0,5):
nephews_answers = nephews_answers.append(random.choice(scantron_choices))
answer_sheet = []
counter = 0
for piece in range(0,5):
answer_sheet.append(random.choice(scantron_choices))
for i in range(5):... |
74bbe23731059f641662d2d577b36f2ecdd4db66 | bob1b/blakes7 | /server/FuncServer.py | 8,479 | 3.515625 | 4 | """ This code handles basic client/server transactions in he blake's 7 game """
# from https://github.com/Pithikos/python-websocket-server
from websocket_server import WebsocketServer
import pprint
import json
import requests
pp = pprint.PrettyPrinter(indent=4)
class FuncServer(object):
""" handles all server-r... |
750437c3c078315b3a3ee1981aa1173e2dfaeefe | charlotteviner/project | /land.py | 1,632 | 4.21875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 28 17:37:12 2017
@author: charlotteviner
Credit: Code written by Andrew Evans.
Create elevation data for use in the project.
Provided for background on how the artificial environment 'land' was
created.
Returns:
land (list) -- List containi... |
92d209d4a9a200a2be4cee6c61d66892a10a08bb | koushik-chandra-sarker/PythonLearn | /a_script/f_Booleans.py | 462 | 3.71875 | 4 | print("========1=========")
print(5 > 4) # Output: True
print(5 == 4) # Output: False
print(5 < 4) # Output: False
print("========2=========")
print(bool("Hello")) # Output: True
print(bool(11)) # Output: True
bool(["apple", "cherry", "banana"])# Output: True
print("========3=========")
print(bool("")) # Out... |
a13f132c3ac6e87e313570bcc86e470c096ae0b5 | koushik-chandra-sarker/PythonLearn | /a_script/o_Built-in Functions.py | 1,608 | 4.125 | 4 | """
Python Built-in Functions: https://docs.python.org/3/library/functions.html
or https://www.javatpoint.com/python-built-in-functions
"""
# abs()
# abs() function is used to return the absolute value of a number.
i = -12
print("Absolute value of -40 is:", abs(i)) # Output: Absolute val... |
0b2bea62a44bc4696c77b6f2b387c3235cadbc67 | koushik-chandra-sarker/PythonLearn | /a_script/p_Lambda.py | 266 | 3.78125 | 4 | """
A lambda function is a small anonymous function.
A lambda function can take any number of arguments
Limitation: can only have one expression.
"""
sum = lambda x, y: x + y
print(sum(5, 6)) # Output: 11
sub = lambda x,y: x-y
print(sub(10, 2)) # Output: 8
|
596f08af3fe1f2f0b3be54503071b133b543cabc | wangxin4278/store | /gaojicaiziyouxi.py | 409 | 3.65625 | 4 | import random
import time
num1 = random.randint(0, 101)
num = 5000
num0=1
while True:
num2=int(input("请输入数字:"))
if(num0<=5):
if (num2 >= num1):
num0=num0-1
print('猜对了现有金额为:', num)
else:
num0 = num0 + 1
num = num - 500
print('猜错了现有金额为:',... |
64ebb368789ed8a5fb2b079e9853dc1e787ea1a7 | leandro-hl/python | /cadenas/4_1_capicua.py | 523 | 3.703125 | 4 | def esCapicua(cadena):
largo = len(cadena)
mitad = largo // 2
if(largo % 2 == 0):
return cadena[:mitad] == cadena[:mitad-1:-1]
else:
return cadena[:mitad] == cadena[:mitad:-1]
def main():
cadena = "Yo tengo un ojo de un color y otro de un color distinto"
palabras = cadena.spli... |
53319274e57b7f20d666664f2c195ac53ec58ccd | leandro-hl/python | /matrices/Trasnponer.py | 711 | 3.65625 | 4 | # Intercambiar filas por columnas
# Solo voy a admitir cambiar filas y columnas con el mismo indice
#Funciones
def intercambiarFilaYColumna(matriz, x):
for i in range(len(matriz)): # matriz cuadrada
aux = matriz[x][i]
matriz[x][i] = matriz[i][x]
matriz[i][x] = aux
matriz=[[1,2,3,4... |
9885dc2361806599239214a33c4057f61507f245 | leandro-hl/python | /matrices/matrices_1_i.py | 952 | 3.53125 | 4 | import matrices_tools as tool
def MatrisEsSimetrica(matriz, esDiagonalPrincipal):
esSimetrica = True
area = len(matriz)
if(esDiagonalPrincipal):
for i in range(area):
for j in range(i):
if(esSimetrica and j != i and matriz[i][j] != matriz[j][i]):
... |
bb518f39c168fc64c8204076c3e2e4b9803944a5 | leandro-hl/python | /4_22_5_Archivos/ejemplo2.py | 204 | 3.546875 | 4 | fecha=[22,5,2020]
dia,*resto=fecha
dia=[dia]
print("La lista es:",fecha)
#print("Dia",dia,"Mes:",mes,"Año:",año)
print("Dia",dia,"Mes y año:",resto)
resto[0]=6
print("Resto",resto)
print("Lista",fecha) |
ceb491feae8660e30a40c502595e182283048021 | leandro-hl/python | /listas/1_d.py | 745 | 3.640625 | 4 | import random as r
# Determinar si el contenido de una lista cualquiera es capicúa, sin usar listas
# auxiliares. Un ejemplo de lista capicúa es [50, 17, 91, 17, 50].0,1,2,3,4
def EsCapicua(lista):
fin = -1
cantElementos = len(lista)
esCapicua = True
iteraciones = cantElementos // 2
if(cantElem... |
b80c5a8f4f9a23befe7694f451965baa447081d4 | leandro-hl/python | /6_05_6_Diccionarios/TP7_ejercicio2.py | 639 | 3.984375 | 4 | # TP7 - ejercicio 2
# Desarrollar una función que reciba un número binario y lo devuelva convertido a base decimal.
# 1 0 1 1 -> 1*2**0 + 1*2**1 + 0*2**2 + 1*2**2 + 0
# cada recursividad resuelve un termino
def binarioDecimal(binario, exp=0):
'''Convertir a decimal.
Recibe un numero en binario'''
if... |
5bfbe16edb5d230e5b4588b40eab33748629d2b9 | leandro-hl/python | /tp_integrador/ej1_p2.py | 964 | 3.65625 | 4 |
import tools as t
import random as r
# Crear una lista al azar, luego informar para cada valor,
# cuántas veces se repite(Utilizar el métodocount). El informe no debe repetir el número.
#Funciones
def EliminarOcurrenciasValorInformado(lista, numeroInformado, cantidadVeces):
for j in range(cantidadVece... |
4f0a9df8c1260a3d253611c13bd5dbda31828fde | leandro-hl/python | /Clase 3/Modulos/Ejemplo1/importparcial.py | 216 | 3.875 | 4 | from math import pi, degrees
from random import randint as aleatorio
print("2 pi radianes a grados:")
radianes = 2 * pi
grados = degrees(radianes)
print(grados)
print("Numero aleatorio:")
print(aleatorio(1,100))
|
97e2e7317e4e63e7da49967f834d641e93db752c | leandro-hl/python | /cadenas/4_5_filtrar.py | 1,396 | 4.03125 | 4 | #Escribir una función filtrar_palabras() que reciba una cadena de caracteres conteniendo
#una frase y un entero N, y devuelva otra cadena con las palabras que tengan
#N o más caracteres de la cadena original. Escribir también un programa para
#verificar el comportamiento de la misma. Hacer tres versiones de la función,... |
886715f02a0c80386c679882817bc53885eb30c1 | leandro-hl/python | /recursividad/tp_3.py | 141 | 3.578125 | 4 | def sumar(n):
if(n == 0):
return 0
return n + sumar(n-1)
def main():
n = 4
suma = sumar(n)
print(suma)
main() |
42d954d455970600a224ee327a4741a539a4734a | leandro-hl/python | /5_29_5_Recursividad/Ejemplo_rec6.py | 938 | 3.828125 | 4 | def contarVocalesIterativa(cad):
'''Cuenta cuantas vocales tiene una cadena en forma iterativa.'''
cont = 0
for letra in cad:
letra = letra.lower()
if letra in ['a','e','i','o','u']:
cont += 1
else:
cont += 0
return cont
def contarVocalesRecursivo(ca... |
87dcf6f2ad171789589c8c4ef9e30ff1a7fed93c | leandro-hl/python | /matrices/matrices_1_k.py | 872 | 3.75 | 4 | # Determinar qué columnas de la matriz son palíndromos (capicúas), devolviendo
# una lista con los números de las mismas.
def obtenerColumnasCapicua():
matriz = [[1,2,3,2],
[2,1,3,2],
[1,1,3,2]]
columnasCapicuas = []
cantColumnas = len(matriz[0])
filasAEvaluar = len(matriz)... |
644477c96e2a062b64077407c1b77b88b752a940 | leandro-hl/python | /test/HerenuLeandroEj2.py | 1,459 | 3.90625 | 4 | #Desarrollar un programa para que cree
#un conjunto de N elementos al azar
#entre A y B (N,A y B puede solicitarlos por teclado o crearlos al azar)
#Mostrar el conjunto creado por pantalla y
#luego informe la suma de sus elementos utilizando
#exclusivamente una función recursiva para sumar los valores.
import rand... |
64dccfa80fdfdfcdd8b2dbe5c9591c0d7586408a | JoshGrant5/advent-of-code-2020 | /day_2.py | 3,898 | 3.890625 | 4 | # --- Day 2: Password Philosophy ---
# Your flight departs in a few days from the coastal airport; the easiest way down to the coast from here is via toboggan.
# The shopkeeper at the North Pole Toboggan Rental Shop is having a bad day. "Something's wrong with our computers; we can't log in!" You ask if you can take a... |
30130a10cfc749aefba92d7ca287e62b88e0bf04 | bryanhann/pyforth | /utilities.py | 422 | 3.546875 | 4 | try: input = raw_input
except NameError: pass
def out(a):
print( repr(a) )
def eq(a,b):
try:
x=list(a)
y=list(b)
return x==y
except:
return a==b
def backward( aList ):
ret = aList[:]
ret.reverse()
return ret
def try_eval( x ):
try: return int(x)
except... |
0e3d8ae79d9542d7267a6a92463cb09806099893 | victorboneto/Python | /src/sqc/exe4.py | 371 | 3.984375 | 4 | #Faça um Programa que peça as 4 notas bimestrais e mostre a média.
number_1 = float(input("Digite a primeria nota: "))
number_2 = float(input("Digite a segunda nota: "))
number_3 = float(input("Digite a terceira nota: "))
number_4 = float(input("Digite a quarta nota: "))
media = (number_1 + number_2 + number_3 + numb... |
681879f34aefef0a7ad1737bffab3fae05566bd1 | victorboneto/Python | /src/sqc/exe9.py | 266 | 4.1875 | 4 | #Faça um Programa que peça a temperatura em graus Fahrenheit,
#transforme e mostre a temperatura em graus Celsius.
#C = 5 * ((F-32) / 9).
graus = int(input("Digite o graus Fahrenheit aqui: "))
celsius = 5 * ((graus - 32) / 9)
print("Tem {}ºc" .format(celsius)) |
9a0fdc01b6bd00433b64bfc31279209e740b6a2b | SherifMounir/Deep-Neural-Network-for-Image-Classification | /LRC_Functions.py | 15,756 | 3.625 | 4 | #!/usr/bin/env python
# coding: utf-8
# # Logistic Regression with a Neural Network mindset
# * This is a Practical Programming Assignment . I'll build a Logistic Regression Classifier to Recognize Cats
#
# # 1 - Packages
# * First, let's run the cell below to import all the packages that I need during the assignmen... |
6ae3776c21efd8345c033af243dedee384bf5580 | gniusranjan/algorithms | /crawler.py | 380 | 3.625 | 4 |
'''
import urllib.request
from bs4 import BeautifulSoup
w = urllib.request.urlopen("https://www.cafecoffeeday.com/cafe-menu/beverages").read()
raita= BeautifulSoup(w)
print(raita.find_all('a'))
for x in raita.find_all('nav'):
print(x)
'''
inp=input()
a,b=list(map(float,inp.split()))
if a%5==0 and a<b:
print("{... |
19c94192bbd45a17858bd0b0348a077042c144b7 | gibsonn/MTH420teststudent | /Exceptions_FileIO/exceptions_fileIO.py | 2,762 | 4.25 | 4 | # exceptions_fileIO.py
"""Python Essentials: Exceptions and File Input/Output.
<Name>
<Class>
<Date>
"""
from random import choice
# Problem 1
def arithmagic():
"""
Takes in user input to perform a magic trick and prints the result.
Verifies the user's input at each step and raises a
ValueError with ... |
1242058400bb98a528c7370854d52dc264ba64b1 | jerry0707-github/products | /products.py | 342 | 3.8125 | 4 | products =[]
while True:
name = input('請輸入商品名稱: ')
if name == 'q':
break
price = input('請輸入價格: ')
# p = []
# p.append(name)
# p.append(price)
p = [name, price] #上面2維清單簡寫法
# products.append(p)
products.append([name, price]) #上面2維清單簡寫法
print(products) |
6a452c335d58900c661a1504240a5e0775b53260 | yuankang134/python-mro-language-server | /mrols/parsed_class.py | 2,321 | 3.53125 | 4 | import jedi
from abc import ABC, abstractmethod
from typing import Tuple, Sequence, Dict
from jedi.api.classes import Name
class ParsedClass(ABC):
"""
This class encapsulates a class definition parsed for MRO list calculation
and all the intermediate results during the calculation.
All the necessary ... |
6e11e0e47eeb678382cd33ec0c9d414dbb2c166f | patjonstevenson/Sorting | /src/recursive_sorting/quicksort.py | 449 | 3.984375 | 4 | def quicksort(arr):
if len(arr) == 0:
return arr
else:
print(arr)
pivot = arr[0]
right = []
left = []
for el in arr[1::]:
if el > pivot:
right.append(el)
else:
left.append(el)
return quicksort(left) +... |
f892b94cb660e3d61a39c7aca022d4f38b4ce0c2 | Shulik95/Python-Practice | /Hangman.py | 4,586 | 3.75 | 4 | HANGMAN_ASCII_ART = """
_ _
| | | |
| |__| | __ _ _ __ __ _ _ __ ___ __ _ _ __
| __ |/ _' | '_ \ / _' | '_ ' _ \ / _' | '_ \\
| | | | (_| | | | | (_| | | | | | | (_| | | | |
|_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_|
__/ |
|___/
"""
M... |
79a2b63047f6469472076a2274cea2b205cb0b06 | Idolnanib/Domashka1.0 | /alone_pract.py | 9,820 | 4.21875 | 4 | # Задание по переводу рублей в доллары.
# План выполнения: наинпутить рубли с курсом доллара и запринтовать ответ
# Rubl = float(input('Введи сколько рублей хочешь перевести в баксы, бро : '))
# print('17.10.2021 курс был такой: за 1$ дают 70.99 рублей')
# Kurs = float(input('Введи курс баксов к рублю , бро : '))
# im... |
577e6159eadade42ea06061c3fbe1a16536644f1 | Rayff-de-Souza/Python_Geek-University | /SECAO-6-EXERCICIO-2/index.py | 408 | 4.15625 | 4 | """
GEEK UNIVERSITY - Exercício
- Faça um programa que escreva de 1 até 100 duas vezes, sendo a primeira vez com o loop FOR e a
segunda com o loop WHILE.
"""
print('FOR'.center(20, '_'))
for n in range(1, 101):
print(n)
print('FOR'.center(20, '_'))
print('\n')
contador = 1
print('WHILE'.center(20, '_'))
while con... |
b1635245fc31d7551519a39e0e88458728a85378 | luisejv/autograder_demo | /Lab103/solutions/p1.py | 873 | 4 | 4 | def main():
phrase = input("Ingrese frase:")
print("Frase:" + phrase)
minus = 0
mayus = 0
caracs = 0
nums = 0
sumnums = 0
strnums = ""
for i in phrase:
if i >= 'a' and i <= 'z':
minus += 1
elif i >= 'A' and i <= 'Z':
mayus += 1
elif i >... |
c0b7a937dae740563aa68c938aed3627064121e3 | Kim280990/Kim | /kim4.py | 486 | 3.8125 | 4 | import math
a = float(input("informe valor de a: "))
b = float(input("informe valor de b: "))
c = float(input("informe valor de c: "))
if a>b>c:
print("o maior número é",a, "e o menor número é",c)
if a<b<c:
print("o menor número é",a, "e o maior número é",c)
if a>c>b:
print("o maior número é",a, "e o meno... |
495c17bd6c0fe83b618360a74c52333857610c51 | JuanmaGlez/Kata1 | /kata1/tabla_multiplicar.py | 430 | 3.75 | 4 | """
enunciado
"""
#tabla = 5
#tabla = int(input("Dime el númoro de la tabla "))
tabla = input("Dime el númoro de la tabla ")
try:
tabla = int(tabla)
# if (isinstance(tabla, int)):
# range(11) -> range(0, 11, 1) -> empieza por 0, y el numero llega hasta x-1
for i in range(11):
#print(i)
... |
02c80b5ca4a6ab3fe97c8acee0622928d30822eb | d3m0n-r00t/ML-algorithms-from-scratch | /rnn.py | 582 | 3.921875 | 4 | import numpy as np
class rnn():
def step(self,x):
#hidden layer
self.h=np.tanh(np.dot(self.W_hh,self.h)+np.dot(self.W_xh,x))
#output layer
y=np.dot(self.W_hy,self.h)
'''
3 matrices. W_hh,W_xh,W_hy
np.dot --> matrix multiplication with two inputs previous hid... |
bed2e86e2117862842cd49a96c65de758c2be985 | nikita-p/stepik_algorithms | /First Part/8.2.py | 510 | 3.65625 | 4 | #Последовательнократная подпоследовательность
def finder(arr):
indexes = [ -1 for i in range(len(arr)) ]
for i1 in range(len(arr)):
for i2 in range(i1+1, len(arr)):
if ( arr[i2]%arr[i1]==0 and indexes[i2]<indexes[i1]+1 ):
indexes[i2] = indexes[i1]+1
#print(indexes)
... |
6bec56ba2119b6eec776088aa5fec648808e9eb8 | ASR-99/new_repository | /1.py | 330 | 3.859375 | 4 | # האם אתה יכול לצאת עם בחורה בגיל הזה
#age = 24
number = int(input("בת כמה הבחורה שאתה שוקל לצאת איתה?\n"))
age = number
if age < 24:
print("מטריד היא יותר צעירה ")
else:
print("מספיק זקנה בשביל שזה לא יחשב מטריד...") |
d782eb2a181684f5fec0f24be28c07b2e749ba9a | mrnguyener21/Udemy-Python-for-Data-Science-and-Machine-Learning-Bootcamp | /section_7_python_for_data_analysis_pandas_exercises/sf_salaries_exercise.py | 2,108 | 4.0625 | 4 | #%%
import pandas as pd
# %%
#Read Salaries.csv as a dataframe called sal.
salaries = pd.read_csv('Salaries.csv')
salaries
# %%
#check the head of the DataFrame
salaries.head()
# %%
#use the info method to find out how many entries there are
salaries.info()
# %%
#what is the average BasePay?
salaries['BasePay'].mean()... |
2370c5e7c60495ff9ea67ff3bdfedcdc46d9a129 | mrnguyener21/Udemy-Python-for-Data-Science-and-Machine-Learning-Bootcamp | /section_5-10_exercises/1)numpy_exercise.py | 912 | 3.59375 | 4 | #%%
#import numpy as np
import numpy as np
# %%
np.zeros(10)
# %%
#createa an array of 10 ones
np.ones(10)
# %%
#create an array of 10 fives
np.ones(10) * 5
# %%
#create an array of the integers froom 10 to 50
np.arange(0,51)
# %%
#create an array of all the even integers from 10 to 60
np.arange(0,51,2)
# %%
#create ... |
3d3cfa287ae10160ad2cf6fcd3c7c98a0121bfe7 | mrnguyener21/Udemy-Python-for-Data-Science-and-Machine-Learning-Bootcamp | /section_8_python_for_data_visualization_matplotlib/Matplotlib_part_2.py | 1,241 | 3.984375 | 4 | #%%
import matplotlib.pyplot as plt
import numpy as np
# %%
x = np.linspace(0,5,11)
y = x ** 2
x
fig = plt.figure()
axes1 = fig.add_axes([0.1,0.1,0.8,0.8])
axes2 = fig.add_axes([0.2,0.5,0.4,0.3])
axes1.plot(x,y)
axes1.set_title('larger plot')
axes2.plot(y,x)
axes2.set_title('smaller plot')
# %%
#here we created two s... |
f63d44fba6261f1e0ecaf4d952b14fc9f8ac33db | alinedsoares/PythonMundo1 | /ex017.py | 276 | 3.8125 | 4 | from math import hypot
co = float(input("Digite o comprimneto do cateto oposto: "))
ca = float(input('Digite o comprimento do cateto adjacente: '))
print('Considerando cateto oposto {} e cateto adjacente {}, a hipotenusa vai medir {:.2f}'.format(co, ca, hypot(co, ca)))
|
bbc4a02307772175ed2d581313fc7f2bece0b3a0 | alinedsoares/PythonMundo1 | /ex014.py | 163 | 3.890625 | 4 | temperatura = float(input('Qual a temperatura em ºC: '))
print ('A temperatura de {} ºC corresponde a {} ºF'.format(temperatura, ((temperatura * 9/5) + 32)))
|
2721749795823dbd4651a805799510053dc76020 | alinedsoares/PythonMundo1 | /ex016.py | 161 | 4 | 4 | from math import trunc
decimal = float(input('Digite um número real: '))
print ('O número real {} tem a parte inteira {}.'.format(decimal, trunc(decimal)))
|
f9f7e86bd2bb9bd737b56659a001d9ec611871aa | ZASXCDFVA/LeetCodeAns | /single-number.py | 382 | 3.625 | 4 | from typing import List
class Solution:
def singleNumber(self, nums: List[int]) -> int:
nums.sort()
for i in range(len(nums)):
if (i - 1 < 0 or nums[i - 1] != nums[i]) and (i >= len(nums) - 1 or nums[i + 1] != nums[i]):
return nums[i]
return nums[0]
if __nam... |
ba5c4f27316d0adb0e12bc56c1f5e10195f6d53b | ZASXCDFVA/LeetCodeAns | /missing-number.py | 553 | 3.765625 | 4 | from typing import List
class Solution:
def missingNumber(self, nums: List[int]) -> int:
bits: int = 0
for n in nums:
bits |= 1 << n
index = 0
bits = ~bits
while bits != 0:
if bits & 0xFFFFFFFF != 0:
break
index += 32... |
63c050a1ca83ec3b2e980a0905fb4927e32947b6 | ZASXCDFVA/LeetCodeAns | /add-two-numbers.py | 1,015 | 3.78125 | 4 | # Definition for singly-linked list.
from typing import Optional
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def extractNumber(self, node: ListNode) -> int:
if node.next is not None:
return self.extractNumber(node.... |
e6a1daf5279736580841e4300db5ee0c2d61ba02 | gayatri-a-b/91R-fall-code | /algo.py | 16,745 | 3.640625 | 4 | import numpy
import pandas
import matplotlib.pyplot as plt
from matplotlib import animation
from scipy.stats import wasserstein_distance
from matplotlib.animation import FuncAnimation
# Threshold Classifier Agent
class Threshold_Classifier:
# constructor
def __init__( self,
pi_0 = [10, 10,... |
89753e911ea2dbbb7d45c011286cd46f2d069a71 | EMIKO548/Calculator | /Code3.py | 2,690 | 3.984375 | 4 |
# The author name is Emiko Okoturo
# The purpose of the game is to assess the accuracy of answers to certain literacy and numeracy questions
# The rules of the game is to answer one of the multiple choice questions to gain marks
# The name of the game is General Knowledge Quiz
# This is the 2021 first Release a... |
064bcdb98819d3c863f7e42e2e684d06d10bea70 | MichaelJamesHart/Python-File-Analyzer | /File_Analyzer.py | 1,680 | 4.03125 | 4 | #Michael Hart
#5/8/2019
# Create the class called FileAnalyzer.
class FileAnalyzer:
# Create the constructor for FileAnalyzer.
def __init__(self, filename):
# Set the filename argument as self.filename.
self.filename = filename
# Open the filename.
file = ... |
6f3b43520f517bb4cc63440ca841092653f06f07 | Anfercode/Codigos-Python | /Clase 1/Capitulo4/Problema/Ejercicio2.py | 275 | 3.703125 | 4 | ##Ejercicio2
Lista = list(range(1,11))
print(f'Los valores de la lista:')
for i in Lista:
print(i,end = '-')
print('\nIngrese un numero')
Numero = int(input('->'))
for Indice,i in enumerate(Lista):
Lista[Indice] *= Numero
Indice +=1
print(f'la lista actual {Lista}') |
db24639a70f71be144d74847e2c67757d29b4982 | Anfercode/Codigos-Python | /Clase 1/Capitulo5/Ejercicio2/Cadenas2.py | 197 | 3.75 | 4 | ### Cadenas
Cadena = 'Andres'
print(Cadena)
print(Cadena[1])
print(Cadena[2])
print(Cadena[5])
print(Cadena[-1])
print(Cadena[0:4])
Cadena = 'a' + Cadena[1:]
print(Cadena)
print(len(Cadena))
|
9c482b69b6342627c6d7aba6c38532efe1cb1de3 | Anfercode/Codigos-Python | /Clase 1/Capitulo1/Problemas/Parcial5.py | 197 | 3.71875 | 4 | #Parte 5
TotalCompra = float(input('Ingrese el valor total de la compra:'))
Descuento = TotalCompra * 0.15
PrecioTotal = int(TotalCompra - Descuento)
print(f'El valor a pagar es {PrecioTotal}') |
7c998ce93da1819233d0b38f9f395c662b41d40d | Anfercode/Codigos-Python | /Clase 1/Capitulo3/Ejercicio2/Listas2.py | 2,546 | 3.640625 | 4 | #Listas parte 2
# Metodo append
print('######### Append ################')
Lista = ['Lunes','Martes','Miercoles','Jueves','Viernes']
Lista.append('Sabado')
Lista.append('Domingo')
print(Lista)
print(len(Lista)) #Longitud lista
print('##################################')
#Metodo insert
print('############insert##... |
0cd0ee2d5346aad4ab1a2cd0eafca811e66b952d | Anfercode/Codigos-Python | /Clase 1/Capitulo5/problemas/Ejercicio3.py | 287 | 4 | 4 | ### Ejercicio3
print('Ingrese una cadena')
Palabra = input('->')
Palabra = Palabra.replace(' ','')
Palindromo = Palabra[::-1]
print(f'La palabra es palindroma {Palindromo}')
if Palabra == Palindromo:
print(f'La palabra es palindromo')
else:
print(f'La palabra no es palindromo')
|
d4839931f400486981a16ff65b571820f59339b8 | Anfercode/Codigos-Python | /Clase 1/Capitulo1/Ejercicio5/OperadoresLog.py | 681 | 3.859375 | 4 | '''
And = Multiplicacion logica
or = Suma Logica
Not = Negacion
^ = Xor(O Exclucivo)
Orden
1-not
2-and
3-or
'''
a = 10
b = 12
c = 13
d = 10
Resultado = ((a > b) or (a < c))and((a == c) or (a >= b))
print(Resultado)
'''
#####################################################################
Prioridad ejecucion ope... |
135af905c1f8e376476121b501069777489181f1 | Anfercode/Codigos-Python | /Clase 1/Capitulo4/Ejercicio3/BucleForRange.py | 156 | 3.65625 | 4 | ## For tipo range
for i in range(50):
print(f'{i+1} hola mundo')
print('##########################')
for i in range(10,0,-2):
print(f'{i} hola mundo') |
89c46932e554053b46bd1aee59151117e582df75 | Anfercode/Codigos-Python | /Clase 1/Capitulo4/Problema/Ejercicio3.py | 583 | 4 | 4 | ##Ejercicio 3
print('Inserte el numero en la lista')
valor = int(input('->'))
Lista = []
while valor != 0:
Lista.append(valor)
print('Inserte otro valor')
valor = int(input('->'))
Lista.sort()
print(f'La lista ordenada es {Lista}')
############################################
#Solucion Elegante
#############... |
18b51b8466ed986ae9f73762addf081c3a3cd932 | Anfercode/Codigos-Python | /Clase 1/Capitulo6/Problemas/Ejercicio5.py | 195 | 3.546875 | 4 | ## Ejercicio 5
def SumaRecursiva(Num):
if Num == 0:
f = 0
else:
f = SumaRecursiva(round(Num/10)) + (Num%10)
return f
a = int(input('Ingrese un numero -> '))
print(SumaRecursiva(a))
|
2f97a8cfd7d232be452f8297a9bb3d7f0d6bccf6 | Anfercode/Codigos-Python | /Clase 1/Capitulo3/Problemas/Ejercicio2.py | 540 | 4.03125 | 4 | #Ejercicio 2
ListaA = [1,2,3,4,5]
ListaB = [4,5,6,7,8]
print(f'valores lista 1 {ListaA}')
print(f'valores lista 2 {ListaB}')
#Conjuntos
Conjunto1 = set(ListaA)
Conjunto2 = set(ListaB)
#Lista unida
ListaU = list(Conjunto1 | Conjunto2)
print(f'Lista unida {ListaU}')
#Lista Left
ListaL = list(Conjunto1 - Conjunto... |
19317c08a5a8450948c644a342acec928123e855 | lyukov/computer_vision_intro | /07-Backprop/solution.py | 8,277 | 3.609375 | 4 | from interface import *
# ================================ 2.1.1 ReLU ================================
class ReLU(Layer):
def forward(self, inputs):
"""
:param inputs: np.array((n, ...)), input values,
n - batch size, ... - arbitrary input shape
:return: np.array((n, ...)),... |
733197a71573e6a06aa87f249e7e960e73f10a9e | luizlibardi/diagnostico | /diagnostico.py | 2,569 | 3.953125 | 4 | """
Diagnóstico proposto na aula de Estrutura de Dados 1 - UCL, pelo professor André Ribeiro para nivelar o conhecimento da turma.
"""
# Entrada de dados pelo Usuário
eleitores_consultados = int(input('Quantos eleitores foram consultados? '))
votos_branco = int(input('Quantos votos foram em branco? '))
indecisos = int... |
3daf750ca30fb29c006bc064fd5a2168bc7787ec | Yu4n/Algorithms | /LeetCode_in_py/levelOrder.py | 550 | 3.5625 | 4 | from definition import TreeNode
class Solution:
def levelOrder(self, root: TreeNode) -> [[int]]:
if not root:
return []
res = []
queue = [root]
while queue:
level = []
k = len(queue)
for i in range(k):
if queue[0].left... |
cd11542b28904b0865526267ec5db987183b714d | Yu4n/Algorithms | /CLRS/bubblesort.py | 647 | 4.25 | 4 | # In bubble sort algorithm, after each iteration of the loop
# largest element of the array is always placed at right most position.
# Therefore, the loop invariant condition is that at the end of i iteration
# right most i elements are sorted and in place.
def bubbleSort(ls):
for i in range(len(ls) - 1):
... |
c4c2d415fae659242f90496011427973f76442f4 | Yu4n/Algorithms | /CLRS/heapsort.py | 1,611 | 3.640625 | 4 | import math
def max_heapify(a, n, i):
heapSize = n
left = 2 * i + 1
right = 2 * i + 2
if left < heapSize and a[i] < a[left]:
largest = left
else:
largest = i
# if a[largest] < a[right] and right < heapSize:
# Be careful of the conditional statement above, which causes list ... |
0519e8f7b081b8a2aefff895109c1fb8900580fd | Yu4n/Algorithms | /LeetCode_in_py/reorderSpaces.py | 375 | 3.578125 | 4 | class Solution:
def reorderSpaces(self, text: str) -> str:
space_count = text.count(' ')
words = text.split()
if len(words) == 1:
return words[0] + ' ' * space_count
spaces, tail = divmod(space_count, len(words) - 1)
return (' ' * spaces).join(words) + ' ' * tail
... |
69fe06f4d308eca042f3bf0c30f4a207d65473ac | Yu4n/Algorithms | /CLRS/insertion_sort.py | 1,175 | 4.3125 | 4 | # Loop invariant is that the subarray A[0 to i-1] is always sorted.
def insertionSort(arr):
# Traverse through 1 to len(arr)
for i in range(1, len(arr)):
key = arr[i]
# Move elements of arr[0..i-1], that are
# greater than key, to one position ahead
# of their current position
... |
5de1abee9eb8659869f545a868aa9caaf747f517 | cjrokke/Prime-Time-Project | /GUI.py | 1,069 | 3.53125 | 4 | # Project Name: Prime-Time-Project
# File: GUI.py
# NOTE: this is our graphical user interface
import index
from Tkinter import * # Importing the Tkinter (tool box) library
#might need be "tkinter"
root = Tk() # Creats object root that has properties for the window. Access via .instr
# confi... |
27f4ba9581b020bdb3ade1e68b58fae844a26f84 | dmentipl/phantom-setup | /phantomsetup/sinks.py | 1,395 | 3.703125 | 4 | """Sink particles."""
from typing import Tuple
class Sink:
"""Sink particles.
Parameters
----------
mass
The sink particle mass.
accretion_radius
The sink particle accretion radius.
position
The sink particle position.
velocity
The sink particle velocity.
... |
cd1c431b1eb29a17410d8d584b89c8fdf65fd7c5 | Siaperas/Ternary-Huffman-Encoding-To-Store-DNA | /ternary_huffman.py | 6,981 | 3.59375 | 4 | import argparse
import csv
class Node:
def __init__(self, chara=None, number=None, child_1=None, child_2=None, child_3=None):
self.chara = chara
self.number = number
self.child_1 = child_1
self.child_2 = child_2
self.child_3 = child_3
def is_leaf(self):
... |
a844b9441a692e542d9c7b866a8f31fc92e0640a | sharifahblessing/practice | /agecal.py | 223 | 3.90625 | 4 | def ageCalculator(birth_year):
current = 2018
if isinstance(birth_year, int):
if birth_year <= current:
age = current - birth_year
return age
return None
print(ageCalculator(2000)) |
613a487676ab9af7df36d71a4a1cd4ca8c31c21c | Fer95/Ejercicios-de-recursividad | /MCD.py | 207 | 3.921875 | 4 | def mcd(a,b):
if b==0:
return a
else:
return mcd(b,a%b)
a= int(input("Ingrese el primer número"))
b= int (input("ingrese el segundo número"))
print ("El MCD ES :",mcd(a,b))
|
963cc758d023a6b1c526aee1f0404c9dd38cee60 | PG80/Training_and_Homework | /2019_03_27_some_works.py | 233 | 3.859375 | 4 | a=2
b=7
t=a
a=b
b=t
print(a,b)
print('load data')
side1 = float(input("Load side1: "))
side2 = float(input("Load side2: "))
side3 = float(input("Load side3: "))
p = side1 + side2 + side3
print(p)
abc=int(input())
print(abc * abc)
|
3b518e89e5fa903fcdbef5e2e33d7e1732f1d8e0 | PG80/Training_and_Homework | /2019_03_17_handling_exceptions.py | 501 | 4.0625 | 4 | while True:
try:
age = int(input('Enter your age: '))
if age > 21:
print('A Big answer!')
if age < 21:
print('A small answer!')
if age == 21:
print('Correct answer!')
if age < 0:
raise ValueError ('Incorrect age!')
exce... |
f8fdb0c0de904238599085e8af989d252ec137a2 | thepiyush13/ds-python | /queues.py | 888 | 3.921875 | 4 | import random
# Create a queue and implement it
class Queue:
def __init__(self):
self.data = []
def enqueue(self,item):
# put at end of the queue
self.data.insert(0,item)
def dequeue(self):
# pop from last element
return self.data.pop()
def isEmpty():
# length of current q... |
6d73c42b23c0933eae4ac3ead5f65520ed8de7d0 | mohamed-elrifai/Exploring-US-Bikeshare-Data | /bikeshare.py | 9,020 | 4.25 | 4 | import time
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
def get_filters():
"""
Asks user to specify a city, month, and day to analyze.
Returns:
(str) city - name ... |
ce1184176759a7fe316056610e5a3338a1b05128 | nwautomator/PyUrDHT | /services/chord/chordspacemath.py | 1,623 | 3.515625 | 4 |
"""
PLEASE READ THE FOLLOWING ASSUMPTIONS
Chord exists in a 1-d ring
All functions that do any useful math use the location of the node in this ring
the location is a base 10 int, not the actual hash
"""
import pymultihash as multihash
# TODO don't assume max is 160
KEYSIZE = 256
MAX = 2 ** KEYSIZE
def idToPoi... |
46fd209659f3dd4ca466d6ca7e7af8f23c661238 | mverini94/PythonProjects | /DesignWithFunctions.py | 2,401 | 4.65625 | 5 | '''
Author....: Matt Verini
Assignment: HW05
Date......: 3/23/2020
Program...: Notes from Chapter 6 on Design With Functions
'''
'''
Objectives for this Chapter
1.) Explain why functions are useful in structuring code in a program
2.) Employ a top-down design design to assign tasks to functions
3.) Define a recursiv... |
57655a927915dff5ff3ed3ca426573b3f3f156ca | mverini94/PythonProjects | /Lab09StudentClassBCS109Verini.py | 3,556 | 4.28125 | 4 | '''
Author....: Matt Verini
Assignment: Lab09 Student Class
Date......: 04/11/2020
Program...: Student Class with Methods
'''
'''
Add three methods to the Student class that compare two objects.
One method should test for equality. A second method should test
less than. The third method should test for greater than or... |
caaceae86ca5f9ac137756c98fccecba86b05c88 | mverini94/PythonProjects | /__repr__example.py | 540 | 4.34375 | 4 |
import datetime
class Car:
def __init__(self, color, mileage):
self.color = color
self.mileage = mileage
def __repr__(self):
return '__repr__ for Car'
def __str__(self):
return '__str__ for Car'
myCar = Car('red', 37281)
print(myCar)
'{}'.format(myCar)
print(str([myCa... |
2e0c3573ed6698fa45e56983fb5940dc57daeb94 | odai1990/madlib-cli | /madlib_cli/madlib.py | 2,673 | 4.3125 | 4 | import re
def print_wecome_mesage():
"""
Print wilcome and explane the game and how to play it and waht the result
Arguments:
No Arguments
Returns:
No return just printing
"""
print('\n\n"Welcome To The Game" \n\n In this game you will been asked for enter several adjectives,... |
530cb062f378fbb67b42eb07ac0f7c8e93e69399 | vasyllyashkevych/computer_vision_practics | /Project_25.py | 998 | 3.609375 | 4 | from PIL import Image
import numpy as np
class ImageFlipping:
"""
Image flipping class.
@param isHorizontally:
Allow flipping horizontally.
@param isVertically:
Allow flipping vertically.
"""
isHorizontally: bool
isVertically: bool
def __init__(sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.