Update Python Ofensivo
This commit is contained in:
parent
159d9490a4
commit
d49859c627
30
python-ofensivo/00_ejercicios/07_modulos02/README.md
Normal file
30
python-ofensivo/00_ejercicios/07_modulos02/README.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Tan solo es un paquete de prueba
|
||||
|
||||
Esto sería la descripción del paquete
|
||||
|
||||
## Listas cursos
|
||||
|
||||
- "Introducción a Linux" 15 horas
|
||||
- "Introducción a Python" 25 horas
|
||||
- "Django en profundidad" 55 horas
|
||||
- "Personalización de Linux" 45 horas
|
||||
|
||||
## Instalación
|
||||
|
||||
Para instalar el paquete tan solo hay que ejecutar:
|
||||
|
||||
```bash
|
||||
pip install paquete
|
||||
```
|
||||
|
||||
## Uso
|
||||
|
||||
```python
|
||||
import paquete
|
||||
|
||||
paquete.saludar()
|
||||
```
|
||||
|
||||
## Créditos
|
||||
|
||||
- [Manuel](https://www.youtube.com/manuel)
|
@ -0,0 +1,2 @@
|
||||
from .courses import *
|
||||
from .utils import *
|
37
python-ofensivo/00_ejercicios/07_modulos02/hack4u/courses.py
Normal file
37
python-ofensivo/00_ejercicios/07_modulos02/hack4u/courses.py
Normal file
@ -0,0 +1,37 @@
|
||||
class Course:
|
||||
|
||||
def __init__(self, id, name, duration, link):
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.duration = duration
|
||||
self.link = link
|
||||
|
||||
def __repr__(self):
|
||||
return f"""[i] {self.id} {self.name}
|
||||
- Duration: {self.duration} horas
|
||||
- Link: {self.link}
|
||||
"""
|
||||
|
||||
|
||||
courses = [
|
||||
Course(1, "Introducción a Linux", 15, "https://www.python.org/"),
|
||||
Course(2, "Introducción a Python", 25, "https://www.python.org/"),
|
||||
Course(3, "Django en profundidad", 55, "https://www.python.org/"),
|
||||
Course(4, "Personalización de Linux", 45, "https://www.python.org/"),
|
||||
]
|
||||
|
||||
|
||||
def list_courses():
|
||||
|
||||
for course in courses:
|
||||
print(course)
|
||||
|
||||
def search_course_by_name(name):
|
||||
|
||||
for course in courses:
|
||||
if course.name == name:
|
||||
return course
|
||||
break
|
||||
else:
|
||||
print("No se encontró ningún curso")
|
||||
|
@ -0,0 +1,5 @@
|
||||
from .courses import courses
|
||||
|
||||
def total_duration():
|
||||
|
||||
return sum(course.duration for course in courses)
|
16
python-ofensivo/00_ejercicios/07_modulos02/setup.py
Normal file
16
python-ofensivo/00_ejercicios/07_modulos02/setup.py
Normal file
@ -0,0 +1,16 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(
|
||||
name='paquete_ejemplo',
|
||||
version='0.1.0',
|
||||
packages=find_packages(),
|
||||
install_requires=[],
|
||||
author='Manuel Vergara',
|
||||
description='Paquete de ejemplo',
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://vergaracarmona.es",
|
||||
)
|
Loading…
Reference in New Issue
Block a user