Skip to content

Instantly share code, notes, and snippets.

View danielmoralesp's full-sized avatar
🎯
Focusing

Daniel M. danielmoralesp

🎯
Focusing
  • Software Engineer
  • Digital Nomad
View GitHub Profile
@danielmoralesp
danielmoralesp / SQL Project #1.md
Last active May 18, 2020 16:31
SQL Project #1
@danielmoralesp
danielmoralesp / ladoalado.py
Created November 13, 2019 00:01
Codigo para barras lado a lado
drinks = ["capucchino", "latte", "chai", "americano", "mocha", "expresso"]
sales1 = [91, 76, 56, 66, 52, 27]
sales2 = [65, 82, 36, 68, 28, 40]
# Datos de sales1 (barras azules)
n = 1 # el primer dataset
t = 2 # numero de datasets
d = 6 # numero de sets de barras
w = 0.8 # ancho de cada barra

Ejercicios Python Parte II

Hemos decidido perseguir el sueño de ser dueños de una pequeña empresa y abrir una tienda de muebles llamada Lovely Loveseats for Neat Suites en Fleet Street. Con nuestro nuevo conocimiento de la programación de Python, vamos a construir un sistema para ayudar a acelerar el proceso de creación de recibos para sus clientes.

En este proyecto, almacenaremos los nombres y precios del catálogo de una tienda de muebles en variables. A continuación, procesará el precio total y la lista de artículos de los clientes, imprimiéndolos en el terminal de salida.

Añadiendo el Catalogo

1- Añadamos en nuestro primer artículo, el Lovely Loveseat que es el nombre de la tienda. Cree una variable llamada lovely_loveseat_description y asígnele la siguiente cadena: "Lovely Loveseat. Tufted polyester blend on wood. 32 inches high x 40 inches wide x 30 inches deep. Red or white."

Ejercicios Python Parte I

1- Imprima su nombre usando el comando print().

2- Si su impresion uso comillas dobles " cambieles a comillas simples. Si usted uso comillas ' cambielas por comillas dobles.

3- Escriba la variable meal y asignele el valor de breakfast e imprimalo. Luego cambie el valor asignado por lunch e imprimalo.

4- Donde se encuentra el error de la siguiente linea de codigo? meal = "lunch, breakfast and "tea". Guarde en un string su respuesta y asignela a una variable llamada error_encontrado. Ahora en una nueva variabla llamada tipo_de_error asignele un string con el tipo de error: "sintax error" o "name error".

lines = []
class Perceptron:
def __init__(self, num_inputs=3, weights=[1,1,1]):
self.num_inputs = num_inputs
self.weights = weights
def weighted_sum(self, inputs):
weighted_sum = 0
for i in range(self.num_inputs):
We can't make this file beautiful and searchable because it's too large.
age, workclass, fnlwgt, education, education-num, marital-status, occupation, relationship, race, sex, capital-gain, capital-loss, hours-per-week, native-country, income
39, State-gov, 77516, Bachelors, 13, Never-married, Adm-clerical, Not-in-family, White, Male, 2174, 0, 40, United-States, <=50K
50, Self-emp-not-inc, 83311, Bachelors, 13, Married-civ-spouse, Exec-managerial, Husband, White, Male, 0, 0, 13, United-States, <=50K
38, Private, 215646, HS-grad, 9, Divorced, Handlers-cleaners, Not-in-family, White, Male, 0, 0, 40, United-States, <=50K
53, Private, 234721, 11th, 7, Married-civ-spouse, Handlers-cleaners, Husband, Black, Male, 0, 0, 40, United-States, <=50K
28, Private, 338409, Bachelors, 13, Married-civ-spouse, Prof-specialty, Wife, Black, Female, 0, 0, 40, Cuba, <=50K
37, Private, 284582, Masters, 14, Married-civ-spouse, Exec-managerial, Wife, White, Female, 0, 0, 40, United-States, <=50K
49, Private, 160187, 9th, 5, Married-spouse-absent, Other-service, Not-in-family, Black, Female, 0, 0, 16, Jama
Name Landmass Zone Area Population Language Religion Bars Stripes Colors Red Green Blue Gold White Black Orange Mainhue Circles Crosses Saltires Quarters Sunstars Crescent Triangle Icon Animate Text Topleft Botright
Afghanistan 5 1 648 16 10 2 0 3 5 1 1 0 1 1 1 0 green 0 0 0 0 1 0 0 1 0 0 black green
Albania 3 1 29 3 6 6 0 0 3 1 0 0 1 0 1 0 red 0 0 0 0 1 0 0 0 1 0 red red
Algeria 4 1 2388 20 8 2 2 0 3 1 1 0 0 1 0 0 green 0 0 0 0 1 1 0 0 0 0 green white
American-Samoa 6 3 0 0 1 1 0 0 5 1 0 1 1 1 0 1 blue 0 0 0 0 0 0 1 1 1 0 blue red
Andorra 3 1 0 0 6 0 3 0 3 1 0 1 1 0 0 0 gold 0 0 0 0 0 0 0 0 0 0 blue red
Angola 4 2 1247 7 10 5 0 2 3 1 0 0 1 0 1 0 red 0 0 0 0 1 0 0 1 0 0 red black
Anguilla 1 4 0 0 1 1 0 1 3 0 0 1 0 1 0 1 white 0 0 0 0 0 0 0 0 1 0 white blue
Antigua-Barbuda 1 4 0 0 1 1 0 1 5 1 0 1 1 1 1 0 red 0 0 0 0 1 0 1 0 0 0 black red
Argentina 2 3 2777 28 2 0 0 3 2 0 0 1 0 1 0 0 blue 0 0 0 0 0 0 0 0 0 0 blue blue
vhigh,vhigh,2,2,small,low,unacc
vhigh,vhigh,2,2,small,med,unacc
vhigh,vhigh,2,2,small,high,unacc
vhigh,vhigh,2,2,med,low,unacc
vhigh,vhigh,2,2,med,med,unacc
vhigh,vhigh,2,2,med,high,unacc
vhigh,vhigh,2,2,big,low,unacc
vhigh,vhigh,2,2,big,med,unacc
vhigh,vhigh,2,2,big,high,unacc
vhigh,vhigh,2,4,small,low,unacc
from collections import Counter
def split(dataset, labels, column):
data_subsets = []
label_subsets = []
counts = list(set([data[column] for data in dataset]))
counts.sort()
for k in counts:
new_data_subset = []
new_label_subset = []
vhigh,vhigh,2,2,small,low,unacc
vhigh,vhigh,2,2,small,med,unacc
vhigh,vhigh,2,2,small,high,unacc
vhigh,vhigh,2,2,med,low,unacc
vhigh,vhigh,2,2,med,med,unacc
vhigh,vhigh,2,2,med,high,unacc
vhigh,vhigh,2,2,big,low,unacc
vhigh,vhigh,2,2,big,med,unacc
vhigh,vhigh,2,2,big,high,unacc
vhigh,vhigh,2,4,small,low,unacc