This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Cuando se requiere almacenar varios valores en una sola variable, se puede | |
utilizar un arreglo. | |
Un arreglo es una estructura de datos que permite almacenar varios valores | |
de un mismo tipo en una sola variable, a través de un índice que representa | |
la posición de cada valor. | |
Comúnmente, los arreglos se utilizan para almacenar colecciones de datos | |
homogéneos, es decir, del mismo tipo y tamaño fijo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
''' | |
big-o-notation.py: | |
Version: 0.2 | |
Python 3.6 | |
Date created: 22/03/2017 | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC, abstractmethod | |
from mixinMortalidad import MixinMortalidad | |
class Animal(ABC, MixinMortalidad): | |
def __init__(self, nombre="", edad=1): | |
self.nombre = nombre | |
self.edad = edad | |
@abstractmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
def __init__(self, nombre, edad): | |
self.nombre = nombre | |
self.edad = edad | |
def comer(self): | |
print(f'{self.nombre} esta comiendo') | |
def dormir(self): | |
print(f'{self.nombre} esta durmiendo') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Llanta: | |
def __init__(self, etiqueta): | |
self.etiqueta = etiqueta | |
self.presion = 0 | |
def inflar(self, presion=32): | |
self.presion = presion | |
print(f"Inflando llanta a {self.presion} PSI") | |
def __str__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multipledispatch import dispatch # pip install multipledispatch | |
class ContadorPasos: | |
pasos = -1 | |
def __init__(self, pasos=0): | |
self.pasos = pasos | |
def __del__(self): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.j2deme; | |
public class Ingrediente { | |
private String nombre; | |
private String sabor; | |
private boolean aportaOlor; | |
private boolean aportaTextura; | |
private boolean aportaColor; | |
public Ingrediente(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.j2deme; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
int altura; // Centímetros | |
double peso; // Kilogramos | |
int edad; // Años exactos | |
int opcion = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.j2deme; | |
public class ConsolaColor { | |
public static final String ANSI_RESET = "\u001B[0m"; | |
// Códigos ANSI para colores de letra | |
public static final String ANSI_BLACK = "\u001B[30m"; | |
public static final String ANSI_RED = "\u001B[31m"; | |
public static final String ANSI_GREEN = "\u001B[32m"; | |
public static final String ANSI_YELLOW = "\u001B[33m"; | |
public static final String ANSI_BLUE = "\u001B[34m"; |
NewerOlder