Skip to content

Instantly share code, notes, and snippets.

View j2deme's full-sized avatar

Jaime Jesús Delgado Meraz j2deme

  • TecNM Campus Ciudad Valles
  • Ciudad Valles, San Luis Potosi, México
  • 08:04 (UTC -06:00)
View GitHub Profile
@j2deme
j2deme / big-o-notation.py
Created January 21, 2024 04:29 — forked from niftycode/big-o-notation.py
big-o-notation graph with Python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
big-o-notation.py:
Version: 0.2
Python 3.6
Date created: 22/03/2017
'''
@j2deme
j2deme / animal.py
Last active October 24, 2023 01:28
Polimorfismo
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
@j2deme
j2deme / animal.py
Last active October 20, 2023 17:52
Herencia Simple, Múltiple y en Cascada
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')
@j2deme
j2deme / menu.py
Created October 9, 2023 17:31
Menú básico en Python
def main():
salir = False
while not salir:
print("1. Opción 1")
print("2. Opción 2")
print("3. Opción 3")
print("9. Salir")
opcion = int(input("Elige tu opción"))
@j2deme
j2deme / Llanta.py
Created September 27, 2023 16:01
Composición de Clases
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):
@j2deme
j2deme / ContadorPasos.py
Created September 27, 2023 15:56
Contador de Pasos POO
from multipledispatch import dispatch # pip install multipledispatch
class ContadorPasos:
pasos = -1
def __init__(self, pasos=0):
self.pasos = pasos
def __del__(self):
pass
@j2deme
j2deme / Ingrediente.java
Last active October 11, 2021 22:51
POO - Osos Escandalosos
package com.j2deme;
public class Ingrediente {
private String nombre;
private String sabor;
private boolean aportaOlor;
private boolean aportaTextura;
private boolean aportaColor;
public Ingrediente(){
@j2deme
j2deme / Main.java
Last active June 23, 2021 18:54
Cálculo de Tallas (con Funciones)
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;
@j2deme
j2deme / ConsolaColor.java
Last active June 8, 2021 03:49
Simulación de Dados y Monedas - Generación de números aleatorios
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";
@j2deme
j2deme / Main.java
Created May 26, 2021 20:56
Agenda y Búsqueda de Cazadores
package com.j2deme;
import java.util.Scanner;
import java.util.Vector;
public class Main {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
/*String msj;