├── Codigo
├── bucles.py
├── case.py
├── colleciones.py
└── invitados.py
├── Codigo2.0
├── .idea
│ ├── .gitignore
│ ├── Codigo2.0.iml
│ ├── inspectionProfiles
│ │ ├── Project_Default.xml
│ │ └── profiles_settings.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── vcs.xml
├── Condicionales
│ └── ejercicio01.py
├── Excepciones
│ ├── ejercicio1.py
│ ├── ejercicio2.py
│ └── ejercicio3.py
├── Modulos
│ ├── __pycache__
│ │ └── base_de_datos.cpython-311.pyc
│ ├── base_de_datos.py
│ └── main.py
├── colecciones
│ └── ejemplodic.py
├── diccionarios
│ └── ejercicio1.py
├── funciones
│ ├── ejercicio01.py
│ └── lambda.py
├── funciones2
│ ├── __pycache__
│ │ └── utilititarios.cpython-311.pyc
│ ├── principal.py
│ └── utilititarios.py
├── librerias
│ ├── __pycache__
│ │ └── ejercicio1.cpython-311.pyc
│ ├── ejercicio1.py
│ └── menu.py
├── listas_avanzadas
│ ├── ejercicio1.py
│ ├── ejercicio2.py
│ ├── ejercicio3.py
│ └── ejercicio4.py
└── main.py
├── Documentacion
├── Challenger1.pdf
├── Crear_Cuenta_Candidato.pdf
├── El valor de la certificación.pdf
├── Especificaciones.pdf
├── Examen_Practica.pdf
├── Hoja_Ruta.png
├── Inicie_sesión_en_su_cuenta.pdf
├── MaterialClases
│ ├── 1688005127698.pdf
│ ├── Python Network Engineering.pdf
│ ├── Python_Hoja_Trucos.pdf
│ ├── TensorFlow_A_GUIDE_TO_BUILDING_DEEP_LEAR.pdf
│ ├── flaskwebdevelopment.pdf
│ ├── fluentpython.pdf
│ ├── guia_estilos.pdf
│ ├── hacking-con-python.pdf
│ ├── introducingpython.pdf
│ ├── naturallanguageprocessingwithpython.pdf
│ ├── pythondatasciencehandbook.pdf
│ ├── testdrivendevelopmentwithpython.pdf
│ ├── thehitchhikersguidetopython.pdf
│ └── webscrapingwithpython.pdf
├── Politicas_Prueba.pdf
├── Porqué_aprender_Python.pdf
└── Sylabus_PCEP.pdf
├── Otros
├── Canal_Youtube.txt
├── Certificacion_PCEP.pdf
├── Grupo_Telegram.txt
├── Grupo_Whatsapp.txt
├── PCEP-netacad-master
│ ├── .gitignore
│ ├── Module-1
│ │ └── Module-1-Quiz.pdf
│ ├── Module-2
│ │ ├── 2.1.1.19.py
│ │ ├── 2.1.1.20.py
│ │ ├── 2.1.1.7.py
│ │ ├── 2.1.2.11.py
│ │ ├── 2.1.4.10.py
│ │ ├── 2.1.4.7.py
│ │ ├── 2.1.4.9.py
│ │ ├── 2.1.5.2.py
│ │ ├── 2.1.6.10.py
│ │ ├── 2.1.6.11.py
│ │ ├── 2.1.6.9.py
│ │ ├── Module-2-Quiz.pdf
│ │ └── Module-2-Test.pdf
│ ├── Module-3
│ │ ├── 3.1.1.11.py
│ │ ├── 3.1.1.12.py
│ │ ├── 3.1.1.13.py
│ │ ├── 3.1.1.5.py
│ │ ├── 3.1.2.10.py
│ │ ├── 3.1.2.11.py
│ │ ├── 3.1.2.14.py
│ │ ├── 3.1.2.15.py
│ │ ├── 3.1.2.3.py
│ │ ├── 3.1.2.6.py
│ │ ├── 3.1.2.9.py
│ │ ├── 3.1.4.13.py
│ │ ├── 3.1.4.6.py
│ │ ├── 3.1.6.9.py
│ │ ├── Module-3-Quiz.pdf
│ │ └── Module-3-Test.pdf
│ ├── Module-4
│ │ ├── 4.1.3.10.py
│ │ ├── 4.1.3.6.py
│ │ ├── 4.1.3.7.py
│ │ ├── 4.1.3.8.py
│ │ ├── 4.1.3.9.py
│ │ ├── 4.1.6.13_PROJECT.py
│ │ ├── Module-4-Quiz.pdf
│ │ └── Module-4-Test.pdf
│ ├── Module-5
│ │ ├── 5.1.10.6.py
│ │ ├── 5.1.11.10.py
│ │ ├── 5.1.11.11.py
│ │ ├── 5.1.11.6.py
│ │ ├── 5.1.11.7.py
│ │ ├── 5.1.11.8.py
│ │ ├── 5.1.11.9.py
│ │ ├── 5.1.6.4.py
│ │ ├── 5.1.9.18.py
│ │ ├── Module-5-Quiz.pdf
│ │ └── Module-5-Test.pdf
│ ├── Module-6
│ │ ├── 6.1.9.15.py
│ │ ├── 6.1.9.16.py
│ │ ├── 6.1.9.17.py
│ │ ├── Module-6-Quiz.pdf
│ │ └── Module-6-Test.pdf
│ ├── Module-Quiz
│ │ ├── Module-1-Quiz.pdf
│ │ ├── Module-2-Quiz.pdf
│ │ ├── Module-3-Quiz.pdf
│ │ ├── Module-4-Quiz.pdf
│ │ ├── Module-5-Quiz.pdf
│ │ └── Module-6-Quiz.pdf
│ ├── Module-Test
│ │ ├── Module-2-Test.pdf
│ │ ├── Module-3-Test.pdf
│ │ ├── Module-4-Test.pdf
│ │ ├── Module-5-Test.pdf
│ │ └── Module-6-Test.pdf
│ ├── PROJECT-DTS
│ │ ├── __pycache__
│ │ │ ├── p1.cpython-38.pyc
│ │ │ ├── p2.cpython-38.pyc
│ │ │ ├── p3.cpython-38.pyc
│ │ │ ├── test_p.cpython-38-pytest-5.4.3.pyc
│ │ │ ├── test_p1.cpython-38-pytest-5.4.3.pyc
│ │ │ └── test_project.cpython-38-pytest-5.4.3.pyc
│ │ ├── p1.py
│ │ ├── p2.py
│ │ ├── p3.py
│ │ └── test_project.py
│ ├── PROJECT
│ │ ├── 4.1.6.13_PROJECT.gif
│ │ └── 4.1.6.13_PROJECT.py
│ ├── README.md
│ ├── SBA
│ │ ├── SBA2020.py
│ │ ├── latihanSBA.py
│ │ └── persiapanSBA.py
│ └── SUMMARY-TEST
│ │ ├── Part-1-Summary-Test.pdf
│ │ └── Part-2-Summary-Test.pdf
├── Playlist Creados.pdf
└── PythonClase001.pdf
└── Python_Fundamentos
├── .idea
├── .gitignore
├── Python_Fundamentos.iml
├── inspectionProfiles
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── 001-Tipodedatos
└── Ejercicio001.py
├── Archivos
├── __pycache__
│ └── data.cpython-311.pyc
├── data.py
├── datos.csv
├── ejericicio01.py
└── main.py
├── Condicionales
└── Ejercicio004.py
├── Excepciones
└── ejercicio009.py
├── Hacking
└── premio.py
├── Repaso_gen
├── Ejercicio2.py
└── Ejercicios.py
├── bucles
├── Ejercicio005.py
├── Ejercicio005_2.py
├── funciones_ciclos.py
└── funciones_recursiva.py
├── cadenas
└── ejercicio010.py
├── cinema.csv
├── colecciones
├── diccionarios.py
├── ejercicio_practico
│ ├── __pycache__
│ │ └── base_de_datos.cpython-311.pyc
│ ├── base_de_datos.py
│ └── main.py
├── listas.py
├── sets.py
└── tuplas.py
├── datos.csv
├── fechas
└── ejercicio008.py
├── librerias
└── Ejercicio006.py
├── operadores
└── Ejercicio003.py
├── pep8
└── Ejercicio002.py
└── resumen
└── resumen.py
/Codigo/bucles.py:
--------------------------------------------------------------------------------
1 | import keyword
2 | import random
3 | #PCEP-30-02 2.2 – Perform different types of iterations
4 | #Bucle For
5 |
6 |
7 | # for num in range(1,10,2):
8 | # print(num,"Hola Mundo")
9 | # print("Fin del bucle")
10 |
11 |
12 | #Contadores y Acumuladores
13 | # c=0
14 | # sum=0
15 | # for i in range(5):
16 | # valor=int(input("Ingrese Valores:")) #20,10,8,2,20
17 | # c +=1 #contador
18 | # sum +=valor #acumulando
19 | # print("Cantidad de valores ingresados",c)
20 | # print("Suma de los valores",sum)
21 |
22 |
23 | # c=0
24 | # sum=0
25 | # for i in range(5):
26 | # notas=int(input("Ingrese Las Notas:")) #20,10,8,2,20
27 | # c +=1 #contador
28 | # sum +=notas #acumulando
29 | # promedio=sum/c
30 | # if promedio>10.5:
31 | # print("Felicitaciones Usted aprobo el curso de PYTHON")
32 | # else:
33 | # print("Ud Lamentablemente debera realizar un Examen de validacion")
34 | # print("El Promedio General",promedio)
35 |
36 |
37 | #cursos = ["PYTHON","DJANGO","FLASK","FAST_API",100,True,12.20]
38 | #for valores in cursos:
39 | # print(valores)
40 |
41 | #Bucle While
42 | # i=0
43 | # suma=0
44 |
45 | # while i<=100:#Devolver True
46 | # print(i)
47 | # i=i+1
48 | # suma = suma +i #acumulador
49 | # print(f"La Suma de los numeros es {suma}")
50 | # print("Fin del Bucle")
51 |
52 | contrasena="PCEP"
53 | cont=0
54 | while True:
55 | con=input("Ingrese la Contraseña:")
56 | if con == contrasena:
57 | print("Contraseña Correcta")
58 | break #Salir del Bucle
59 | else:
60 | print("Contraseña errada")
61 | cont +=1
62 | if cont==3:
63 | print("La Cuenta se ha Bloqueado intentelo en 24 Horas")
64 | break
65 |
66 | #print(keyword.kwlist)
67 |
68 | #numero_secreto=random.randint(1,100)
69 | #print(numero_secreto)
70 |
71 |
72 | # while True:
73 | # numero=int(input("Cual es el Numero Generado:"))
74 | # if numero==numero_secreto:
75 | # print("Genial Acertastes!!!")
76 | # break
77 | # else:
78 | # if numero_secreto>numero:
79 | # print("El Numero secreto es Mayor que {}".format(numero))
80 | # else:
81 | # print("El Numero secreto es Menor que {}".format(numero))
82 | # print("No Acertastes")
--------------------------------------------------------------------------------
/Codigo/case.py:
--------------------------------------------------------------------------------
1 | resultado = input("Ingrese el Resultado Obtenido:")
2 | match resultado:
3 | case "A":
4 | print("Excelente")
5 | case "B":
6 | print("Buen Trabajo")
7 | case "C":
8 | print("Aprobastes con lo Justo")
9 | case _:
10 | print("Vuelva a intentarlo")
--------------------------------------------------------------------------------
/Codigo/colleciones.py:
--------------------------------------------------------------------------------
1 | #PCEP-30-02 3.1 – Collect and process data using lists
2 | ciudades =["Lima","Quito","La Paz","Bogota"] #Lista
3 | paises = {"Perú":"Lima","Ecuador":"Quito","Bolivia":"La Paz","Colombia":"Bogota"} #Diccionarios
4 | costumbres=("Caminar","Bailar","Deporte") #tuplas =Inmutables
5 | habitantes={"20500","30000","8000"}#sets #ordenados
6 |
7 |
8 | #Crud de Datos = Create ,Read,Update,Delete
9 | #Insercion de Elementos
10 | #ciudades.append("Santiago")
11 | #ciudades.append("Arequipa")
12 | #Insertarlo en cualquier posicion
13 | #ciudades.insert(3,"Trujillo")
14 | #Eliminar Elementos de una Lista
15 | #ciudades.pop(3)
16 | #ciudades.remove("Bogota")
17 | #del ciudades[3]
18 | #ciudades.clear()
19 | #Actualizar elemento de ls lista
20 | #ciudades[0]="Cuzco"
21 | #La cantidad de elementos de una Lista
22 | #print(len(ciudades))
23 | #Rango de Valores
24 | #nuevas_ciudades=ciudades[1:3]
25 | #print(nuevas_ciudades)
26 | #ciudades =["Lima","Quito","La Paz","Bogota"] #Lista
27 | #nuevas_ciudades=ciudades[1:]
28 | #print(nuevas_ciudades)
29 | #nuevas_ciudades=ciudades[-1:]
30 | #print(nuevas_ciudades)
31 | #Checkear Elementos
32 | #existe = 'Santiago' in ciudades
33 | #print(existe)
34 | # ciudad=input("Ingresar la Ciudad:")
35 | # if ciudad in ciudades:
36 | # print("La Ciudad Ya Existe en la Lista")
37 | # else:
38 | # ciudades.append(ciudad)
39 | # print("Se Añdio la Ciudad Correctamente")
40 | # print(ciudades)
41 |
42 | #ordenar Listas
43 | ciudades.sort(reverse=True)
44 | #ciudades.reverse()
45 |
46 |
47 | #Listado de Elementos
48 | for item in ciudades:
49 | print(item)
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/Codigo/invitados.py:
--------------------------------------------------------------------------------
1 | """
2 | todo Realizar un Script que me permita añadir
3 | Invitados a Una Lista
4 | """
5 | acepta=True
6 | lista=[]
7 |
8 | while acepta==True:
9 | invitado=input("Ingrese el Nombre del Invitado al curso:")
10 | lista.append(invitado)
11 | adiciona=input("Desea Agregar Otro Invitado:(S/N)")
12 | if adiciona == 'S':
13 | acepta=True
14 | elif adiciona=='N':
15 | print('Invitados: {}'.format(lista))
16 | print('La Cantidad total de Invitados es {}'.format(len(lista)))
17 | break
18 | else:
19 | print("Opcion no Valida")
20 | break
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/Codigo2.0.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Codigo2.0/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Codigo2.0/Condicionales/ejercicio01.py:
--------------------------------------------------------------------------------
1 | # resultado= input("Ingrese el Resultado Obtenido:")
2 | # if resultado == 'A':
3 | # print("Excelente")
4 | # elif resultado == 'B':
5 | # print('Buen Trabajo')
6 | # elif resultado == 'C':
7 | # print("Aprobastes con lo Justo")
8 | # else:
9 | # print("Vuelva a Intentarlo")
10 |
11 | resultado = input("Ingrese el Resultado Obtenido:")
12 | match resultado:
13 | case "A":
14 | print("Excelente")
15 | case "B":
16 | print("Buen Trabajo")
17 | case "C":
18 | print("Aprobastes con lo Justo")
19 | case _:
20 | print("Vuelva a intentarlo")
21 |
--------------------------------------------------------------------------------
/Codigo2.0/Excepciones/ejercicio1.py:
--------------------------------------------------------------------------------
1 | # Sintaxis
2 |
3 | """
4 | try:
5 | #Codigo a ejecutar
6 | #pero podria haber errores en este bloque
7 | except :
8 | #Haz esto para manejar la excepcion
9 | #El Bloque except se ejecuta si el bloque try lanza un error
10 | else:
11 | #Esto se ejecutara si el bloque try se ejecuta sin errores
12 | finally:
13 | #Este Bloque siempre se va a ejecutar
14 | """
15 |
16 | #print(1/0) #ZeroDivisionError
17 | #print(1+"e") # TypeError unsupported operand type(s) for +: 'int' and 'str'
18 | d = {1:1,2:2}
19 | #print(d[3]) #KeyError
20 | l = [1,2,3]
21 | #print(l[4]) #IndexError
22 | #print(l.foobar) #AttributeError
23 |
24 | #Atrapando excepciones
25 |
26 | while True:
27 | try:
28 | x=int(input("Digite un numero:"))
29 | break
30 | except ValueError:
31 | print("Debe Ingresar un Valor Valido")
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Codigo2.0/Excepciones/ejercicio2.py:
--------------------------------------------------------------------------------
1 | cursos={"PCEP01":"Python-001","PCEP02":"Python-002"}
2 |
3 | #print(cursos["PCEP02"])
4 |
5 | try:
6 | clave=input("Ingrese la Clave:")
7 | print(cursos[clave])
8 | except KeyError as msg_error:
9 | print(f"Lo siento {msg_error} no es una clave valida!")
--------------------------------------------------------------------------------
/Codigo2.0/Excepciones/ejercicio3.py:
--------------------------------------------------------------------------------
1 | try:
2 | x=2/2 #Bloque de codigo a evaluar
3 | except:
4 | print("Entra a esta excepcion , ha ocurrido un error")
5 | else:
6 | print("Entra a else , no ha ocurrido ninguna excepcion")
7 | finally:
8 | print("Cerrando los objetos correctamente")
--------------------------------------------------------------------------------
/Codigo2.0/Modulos/__pycache__/base_de_datos.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Codigo2.0/Modulos/__pycache__/base_de_datos.cpython-311.pyc
--------------------------------------------------------------------------------
/Codigo2.0/Modulos/base_de_datos.py:
--------------------------------------------------------------------------------
1 | empleados=[
2 | {'codigo':'2334455','apellido':'Ruiz','nombre':'Armando','sueldo':7000,'area':'sistemas'},
3 | {'codigo':'2334456','apellido':'Gomez','nombre':'Pedro','sueldo':8800,'area':'sistemas'},
4 | {'codigo':'2334457','apellido':'Cespedes','nombre':'Javier','sueldo':9000,'area':'contabilidad'},
5 | {'codigo':'2334458','apellido':'Linares','nombre':'Oscar','sueldo':12000,'area':'contabilidad'},
6 | {'codigo':'2334459','apellido':'Palomino','nombre':'Maria','sueldo':170000,'area':'rrhh'},
7 | {'codigo':'2334460','apellido':'Prado','nombre':'Carlos','sueldo':270000,'area':'estadistica'}
8 | ]
9 |
10 | def calcular_edad(nac):
11 | try:
12 | edad = 2023-nac
13 | except:
14 | print("Existe un error")
15 | return edad
16 |
17 | def buscar_empleado(bd):
18 | existe=False
19 | cod_emp=input("Ingrese el codigo del empleado:")
20 | for item in bd:
21 | if cod_emp == item['codigo']:
22 | print(f"El Sueldo del empleado {item['nombre']} "
23 | + f"{item['apellido']} es {item['sueldo']}")
24 | existe=True
25 | break
26 | if existe == False:
27 | print("El Empleado no existe")
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Codigo2.0/Modulos/main.py:
--------------------------------------------------------------------------------
1 | from base_de_datos import empleados,buscar_empleado
2 |
3 |
4 | print(buscar_empleado(empleados))
--------------------------------------------------------------------------------
/Codigo2.0/colecciones/ejemplodic.py:
--------------------------------------------------------------------------------
1 | #print("Diccionarios")
2 |
3 | d = {
4 | "Yellow":"Amarillo",
5 | "Blue":"Azul",
6 | "Black":"Negro",
7 | "Pink":"Rosado"
8 | }
9 |
10 | #print(d)
11 | #print(type(d))
12 | #Busqueda de Valores
13 | #print(d["Black"])
14 | #print(d["Pink"])
15 | #print(d["Blue"])
16 |
17 | #Modificar Valores diccionario
18 | d['Black']="White"
19 | d.update({"Pink":"Rosado F"})
20 |
21 | #Eliminar un Elemento del diccionario
22 | del d['Black']
23 | d.pop("Black")
24 |
25 |
26 | clientes=[
27 | {'cuenta':'2334455','apellido':'Ruiz','nombre':'Armando','saldo':7000},
28 | {'cuenta':'2334456','apellido':'Gomez','nombre':'Pedro','saldo':8800},
29 | {'cuenta':'2334457','apellido':'Cespedes','nombre':'Javier','saldo':9000},
30 | {'cuenta':'2334458','apellido':'Linares','nombre':'Oscar','saldo':12000},
31 | {'cuenta':'2334459','apellido':'Palomino','nombre':'Maria','saldo':170000}
32 | ]
33 |
34 | ingr_cuenta = input("Ingrese su numero de cuenta:")
35 | for item in clientes:
36 | if ingr_cuenta==item['cuenta']:
37 | print('{} tu saldo actual es {}'.format(item['apellido'],item['saldo']))
38 | break
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Codigo2.0/diccionarios/ejercicio1.py:
--------------------------------------------------------------------------------
1 | nombres=["Manuel","Pedro","Raul","Maria","Fidel"]
2 | edad= [25,70,19,17,23]
3 | union = {}
4 |
5 | for i in range(0,5):
6 | #La Clave del Diccionario es el Nombre y el Valor es la edad
7 | union[nombres[i]] = edad[i]
8 |
9 | def buscar_nombre():
10 | nombre=input("Ingrese el Nombre")
11 | resultado=union[nombre]
12 | return resultado
13 |
14 | print(buscar_nombre())
15 |
16 |
--------------------------------------------------------------------------------
/Codigo2.0/funciones/ejercicio01.py:
--------------------------------------------------------------------------------
1 | #print("==Funcion Basica==")
2 |
3 |
4 | def test():
5 | print("Esto es una Funcion")
6 |
7 |
8 | def suma(a, b):
9 | sumar = a + b
10 | return sumar
11 |
12 |
13 | print(suma(20,10))
14 |
15 |
--------------------------------------------------------------------------------
/Codigo2.0/funciones/lambda.py:
--------------------------------------------------------------------------------
1 | # todo lambda argumentos: expresion
2 |
3 |
4 | #todo Declarar una funcion que sume 10 al argumento que le voy a pasar
5 | #x = lambda a: a + 10
6 | #print(x(20))
7 |
8 | x2= lambda a,b:a*b
9 | print(x2(5,6))
10 |
11 | def normal(a,b):
12 | return a*b
13 |
14 | print(normal(5,6))
15 |
16 |
--------------------------------------------------------------------------------
/Codigo2.0/funciones2/__pycache__/utilititarios.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Codigo2.0/funciones2/__pycache__/utilititarios.cpython-311.pyc
--------------------------------------------------------------------------------
/Codigo2.0/funciones2/principal.py:
--------------------------------------------------------------------------------
1 | from utilititarios import acceso,cambio_pesos,funcion1
2 |
3 | #print(acceso("admin123"))
4 | print(cambio_pesos(3.60,2500))
5 | funcion1()
6 |
7 |
--------------------------------------------------------------------------------
/Codigo2.0/funciones2/utilititarios.py:
--------------------------------------------------------------------------------
1 | def funcion1():
2 | print("Bienvenido al Sistema")
3 |
4 | def acceso(clave):
5 | clavesis="admin123"
6 | if clave == clavesis:
7 | resultado="Bienvenido al Sistema"
8 | else:
9 | resultado="Error en el Acceso"
10 | return resultado
11 |
12 | def msj(nombre,mensaje="Adios"):
13 | saludo=mensaje + " " +nombre
14 | return saludo
15 |
16 | def cambio_pesos(valordolar,monto):
17 | total = monto * valordolar
18 | return total
19 |
20 | #print(cambio_pesos(3.60,2500))
21 | #print(msj("Armando"))
22 | #clave=input("ingrese la clave:")
23 | #print(acceso(clave))
24 | #Invocar a la funcion
25 | #funcion1()
26 |
27 |
--------------------------------------------------------------------------------
/Codigo2.0/librerias/__pycache__/ejercicio1.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Codigo2.0/librerias/__pycache__/ejercicio1.cpython-311.pyc
--------------------------------------------------------------------------------
/Codigo2.0/librerias/ejercicio1.py:
--------------------------------------------------------------------------------
1 | import pyfiglet
2 | import random
3 |
4 |
5 | def mensaje_a_imprimir(msj):
6 | fuentes = pyfiglet.FigletFont.getFonts()
7 | fuente_seleccionado = random.choice(fuentes)
8 | ascii_char = pyfiglet.figlet_format(msj, font=fuente_seleccionado)
9 | return ascii_char
10 |
11 |
12 | def crear_rectangulo(rows, cols):
13 | for i in range(rows):
14 | for j in range(cols):
15 | if i == 0 or i == rows - 1 or j == 0 or cols - 1:
16 | print("*", end=" ")
17 | else:
18 | print(" ", end=" ")
19 | print()
20 |
21 |
22 | def resultado(valor):
23 | match valor:
24 | case "A":
25 | print("Excelente")
26 | case "B":
27 | print("Buen Trabajo")
28 | case "C":
29 | print("Aprobastes con lo Justo")
30 | case _:
31 | print("Vuelva a intentarlo")
32 |
33 |
34 | #resultado("B")
35 | #crear_rectangulo(5, 5)
36 | # print(mensaje_a_imprimir("Feliz Dia del Padre"))
37 |
--------------------------------------------------------------------------------
/Codigo2.0/librerias/menu.py:
--------------------------------------------------------------------------------
1 | import ejercicio1
2 |
3 | #ejercicio1.resultado("B")
4 | print(ejercicio1.mensaje_a_imprimir("Aprobe el Examen de PCEP"))
5 |
6 |
--------------------------------------------------------------------------------
/Codigo2.0/listas_avanzadas/ejercicio1.py:
--------------------------------------------------------------------------------
1 | #Metodo Tradicional
2 | lista=[]
3 | # for letra in 'casa':
4 | # lista.append(letra)
5 | # print(lista)
6 |
7 | #Con Comprension de Listas
8 | lista=[letra for letra in 'casa']
9 | print(lista)
--------------------------------------------------------------------------------
/Codigo2.0/listas_avanzadas/ejercicio2.py:
--------------------------------------------------------------------------------
1 | #Metodo Tradicional
2 |
3 | nums=[1,2,3,4,5]
4 | #cubes =[]
5 | # for num in nums:
6 | # cubes.append(num**3)
7 | # print(cubes)
8 |
9 | #Equivalente a Listas
10 | cubes= [num **3 for num in nums]
11 | print(cubes)
--------------------------------------------------------------------------------
/Codigo2.0/listas_avanzadas/ejercicio3.py:
--------------------------------------------------------------------------------
1 | nums=[1,2,3,4,5]
2 | #Metodo Tradicional
3 | cubes_of_even=[]
4 | for num in nums:
5 | if num % 2 == 0:
6 | cubes_of_even.append(num**3)
7 | print(cubes_of_even)
8 |
9 | #Comprension de Listas (list comprehension)
10 | #Sintaxis:[expression for variable in iterable if condicion]
11 | cubes_of_even=[num **3 for num in nums if num % 2==0]
12 | print(cubes_of_even)
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Codigo2.0/listas_avanzadas/ejercicio4.py:
--------------------------------------------------------------------------------
1 | #Metodo Tradicional
2 | nums = [1,2,3,4,5]
3 | # cubes_and_squares=[]
4 | # for num in nums:
5 | # if num % 2 ==0:
6 | # cubes_and_squares.append(num**3)
7 | # else:
8 | # cubes_and_squares.append(num**2)
9 |
10 | # print(cubes_and_squares)
11 |
12 | #Metodo Comprension de Listas
13 | #Sintaxis:
14 | cubes_and_squares=[num ** 3 if num %2 ==0 else num **2 for num in nums]
15 | print(cubes_and_squares)
--------------------------------------------------------------------------------
/Codigo2.0/main.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Codigo2.0/main.py
--------------------------------------------------------------------------------
/Documentacion/Challenger1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Challenger1.pdf
--------------------------------------------------------------------------------
/Documentacion/Crear_Cuenta_Candidato.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Crear_Cuenta_Candidato.pdf
--------------------------------------------------------------------------------
/Documentacion/El valor de la certificación.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/El valor de la certificación.pdf
--------------------------------------------------------------------------------
/Documentacion/Especificaciones.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Especificaciones.pdf
--------------------------------------------------------------------------------
/Documentacion/Examen_Practica.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Examen_Practica.pdf
--------------------------------------------------------------------------------
/Documentacion/Hoja_Ruta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Hoja_Ruta.png
--------------------------------------------------------------------------------
/Documentacion/Inicie_sesión_en_su_cuenta.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Inicie_sesión_en_su_cuenta.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/1688005127698.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/1688005127698.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/Python Network Engineering.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/Python Network Engineering.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/Python_Hoja_Trucos.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/Python_Hoja_Trucos.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/TensorFlow_A_GUIDE_TO_BUILDING_DEEP_LEAR.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/TensorFlow_A_GUIDE_TO_BUILDING_DEEP_LEAR.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/flaskwebdevelopment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/flaskwebdevelopment.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/fluentpython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/fluentpython.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/guia_estilos.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/guia_estilos.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/hacking-con-python.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/hacking-con-python.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/introducingpython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/introducingpython.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/naturallanguageprocessingwithpython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/naturallanguageprocessingwithpython.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/pythondatasciencehandbook.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/pythondatasciencehandbook.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/testdrivendevelopmentwithpython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/testdrivendevelopmentwithpython.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/thehitchhikersguidetopython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/thehitchhikersguidetopython.pdf
--------------------------------------------------------------------------------
/Documentacion/MaterialClases/webscrapingwithpython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/MaterialClases/webscrapingwithpython.pdf
--------------------------------------------------------------------------------
/Documentacion/Politicas_Prueba.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Politicas_Prueba.pdf
--------------------------------------------------------------------------------
/Documentacion/Porqué_aprender_Python.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Porqué_aprender_Python.pdf
--------------------------------------------------------------------------------
/Documentacion/Sylabus_PCEP.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Documentacion/Sylabus_PCEP.pdf
--------------------------------------------------------------------------------
/Otros/Canal_Youtube.txt:
--------------------------------------------------------------------------------
1 | https://www.youtube.com/@ArmandoRuizTech
--------------------------------------------------------------------------------
/Otros/Certificacion_PCEP.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/Certificacion_PCEP.pdf
--------------------------------------------------------------------------------
/Otros/Grupo_Telegram.txt:
--------------------------------------------------------------------------------
1 | https://t.me/pyarmando
--------------------------------------------------------------------------------
/Otros/Grupo_Whatsapp.txt:
--------------------------------------------------------------------------------
1 | https://chat.whatsapp.com/H9cE1efzz1i73DKSwKUA80
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-1/Module-1-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-1/Module-1-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.1.19.py:
--------------------------------------------------------------------------------
1 | print("Programming", "Essentials", "in", sep ="***", end = "...")
2 | print("Python")
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.1.20.py:
--------------------------------------------------------------------------------
1 | print(" " * 7 + "*" + " " * 0 +"\n"
2 | + " " * 6 + "*" + " " * 1 + "*\n"
3 | + " " * 5 + "*" + " " * 3 + "*\n"
4 | + " " * 4 + "*" + " " * 5 + "*\n"
5 | + " " * 3 + "*" + " " * 7 + "*\n"
6 | + " " * 2 + "*" + " " * 9 + "*\n"
7 | + " " * 1 + "*" + " " * 11 + "*\n"
8 | + "*" * 5 + " " * 5 + "*" * 5 + "\n"
9 | + (" " * 4 + "*" + " " * 5 + "*\n") * 4
10 | + (" " * 4 + "*" * 6 + "*\n"))
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.1.7.py:
--------------------------------------------------------------------------------
1 | print("Irvan Tristian")
2 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.2.11.py:
--------------------------------------------------------------------------------
1 | print("\"I'm\"\n\"\"learning\"\"\n\"\"\"Python\"\"\"")
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.4.10.py:
--------------------------------------------------------------------------------
1 | x = 0 # hardcode your test data here
2 | x = float(x)
3 | y = 3 * x ** 3 - 2 * x ** 2 + 3 * x - 1
4 | print("y =", y)
5 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.4.7.py:
--------------------------------------------------------------------------------
1 | john = 3
2 | mary = 5
3 | adam = 6
4 | totalApples = john + mary + adam
5 | print("Total number of apples:", totalApples)
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.4.9.py:
--------------------------------------------------------------------------------
1 | kilometers = 12.25
2 | miles = 7.38
3 |
4 | miles_to_kilometers = 3 / 5 * kilometers
5 | kilometers_to_miles = 5 / 3 * miles
6 |
7 | print(miles, "miles is", round(miles_to_kilometers, 2), "kilometers")
8 | print(kilometers, "kilometers is", round(kilometers_to_miles, 2), "miles")
9 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.5.2.py:
--------------------------------------------------------------------------------
1 | # program to convert seconds from hours
2 |
3 | a = 3 # hours
4 | seconds = 3600 # seconds in 1 hour
5 |
6 | print("Hours: ", a) # print hours
7 | print("Seconds in Hours: ", a * seconds) # print converted hours in seconds
8 | print("Goodbye")
9 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.6.10.py:
--------------------------------------------------------------------------------
1 | x = float(input("Enter value for x: "))
2 |
3 | y = 1 / (x + (1 / (x + (1 / (x + (1 / x))))))
4 |
5 | print("y =", y)
6 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.6.11.py:
--------------------------------------------------------------------------------
1 | hour = int(input("Starting time (hours): "))
2 | mins = int(input("Starting time (minutes): "))
3 | dura = int(input("Event duration (minutes): "))
4 |
5 | hour = (hour + ((mins + dura) // 60)) % 24
6 | mins = (mins + dura) % 60
7 |
8 | print(str(hour) + ":" + str(mins))
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/2.1.6.9.py:
--------------------------------------------------------------------------------
1 | # input a float value for variable a here
2 | a = float(input("a: "))
3 | # input a float value for variable b here
4 | b = float(input("b: "))
5 |
6 | # output the result of addition here
7 | print("addition:", a + b)
8 | # output the result of subtraction here
9 | print("substraction:", a - b)
10 | # output the result of multiplication here
11 | print("multipication:", a * b)
12 | # output the result of division here
13 | print("division:", a / b)
14 |
15 | print("\nThat's all, folks!")
16 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/Module-2-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-2/Module-2-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-2/Module-2-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-2/Module-2-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.1.11.py:
--------------------------------------------------------------------------------
1 | plants = input("Enter the plant: ")
2 | if plants == "Spathiphyllum":
3 | print("Yes - Spathiphyllum is the best plant ever!")
4 | elif plants == "spathiphyllum":
5 | print("No, I want a big Spathiphyllum!")
6 | else:
7 | print("Spathiphyllum! Not, " + plants + "!")
8 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.1.12.py:
--------------------------------------------------------------------------------
1 | income = float(input("Enter the annual income: "))
2 |
3 | if income <= 85528:
4 | tax = (income * 0.18) - 556 - 0.02
5 | elif income > 85528:
6 | tax = (14839 + 0.02) + 0.32 * (income - 85528)
7 | if tax < 0:
8 | tax = 0
9 |
10 | tax = round(tax, 0)
11 | print("The tax is:", tax, "thalers")
12 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.1.13.py:
--------------------------------------------------------------------------------
1 | year = int(input("Enter a year: "))
2 |
3 | if year < 1582:
4 | print("Not within the Gregorian calendar period")
5 | else:
6 | if year % 4 != 0:
7 | print("Common year")
8 | elif year % 100 != 0:
9 | print("Leap year")
10 | elif year % 400 != 0:
11 | print("Common year")
12 | else:
13 | print("Leap year")
14 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.1.5.py:
--------------------------------------------------------------------------------
1 | n = int(input("Enter a number: "))
2 | if n >= 100:
3 | print(True)
4 | else:
5 | print(False)
6 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.10.py:
--------------------------------------------------------------------------------
1 | # Prompt the user to enter a word
2 | # and assign it to the userWord variable.
3 |
4 | userWord = input("Enter a word: ").upper()
5 | for letter in userWord:
6 | if letter == "A":
7 | continue
8 | elif letter == "I":
9 | continue
10 | elif letter == "U":
11 | continue
12 | elif letter == "E":
13 | continue
14 | elif letter == "O":
15 | continue
16 | else:
17 | print(letter)
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.11.py:
--------------------------------------------------------------------------------
1 | wordWithoutVovels = ""
2 |
3 | # Prompt the user to enter a word
4 | # and assign it to the userWord variable
5 |
6 | userWord = input("Enter a word: ").upper()
7 | for letter in userWord:
8 | if letter == "A":
9 | continue
10 | elif letter == "I":
11 | continue
12 | elif letter == "U":
13 | continue
14 | elif letter == "E":
15 | continue
16 | elif letter == "O":
17 | continue
18 | else:
19 | wordWithoutVovels += letter
20 |
21 | print(wordWithoutVovels)
22 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.14.py:
--------------------------------------------------------------------------------
1 | blocks = int(input("Enter the number of blocks: "))
2 |
3 | height = 0
4 | while True:
5 | height += 1
6 | blocks -= height
7 | if blocks == 0:
8 | break
9 | if blocks < 0:
10 | height -= 1
11 | break
12 |
13 | print("The height of the pyramid:", height)
14 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.15.py:
--------------------------------------------------------------------------------
1 | c0 = int(input("Enter a number: "))
2 |
3 | counter = 0
4 | while True:
5 | if c0 % 2 == 0:
6 | c0 = c0 // 2
7 | print(c0)
8 | counter += 1
9 | else:
10 | c0 = 3 * c0 + 1
11 | print(c0)
12 | counter += 1
13 | if c0 != 1:
14 | continue
15 | else:
16 | break
17 |
18 | print("steps =", counter)
19 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.3.py:
--------------------------------------------------------------------------------
1 | secret_number = 777
2 | print(
3 | """
4 | +================================+
5 | | Welcome to my game, muggle! |
6 | | Enter an integer number |
7 | | and guess what number I've |
8 | | picked for you. |
9 | | So, what is the secret number? |
10 | +================================+
11 | """)
12 | n = int(input("Enter a number: "))
13 | while n != secret_number:
14 | print("Haha! You're stuck in my loop!")
15 | n = int(input())
16 |
17 | print("Well done, muggle! You are free now.")
18 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.6.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | for i in range(1, 6):
4 | print(i, "Mississippi")
5 | time.sleep(1)
6 |
7 | print("Ready or not, here I come!")
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.2.9.py:
--------------------------------------------------------------------------------
1 | word = input("Enter a word: ")
2 | while True:
3 | if word == "chupacabra":
4 | print("You've succesfully left the loop.")
5 | break
6 | word = input()
7 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.4.13.py:
--------------------------------------------------------------------------------
1 | # step 1
2 | beatles = []
3 | print("Step 1:", beatles)
4 |
5 | # step 2
6 | beatles.append("John Lennon")
7 | beatles.append("Paul McCartney")
8 | beatles.append("George Harrison")
9 | print("Step 2:", beatles)
10 |
11 | # step 3
12 | for i in range(2):
13 | beatles.append(input("Enter remaining members: "))
14 | print("Step 3:", beatles)
15 |
16 | # step 4
17 | del beatles[-2]
18 | del beatles[-1]
19 | print("Step 4:", beatles)
20 |
21 | # step 5
22 | beatles.insert(0, "Ringo Star")
23 | print("Step 5:", beatles)
24 |
25 |
26 | # testing list legth
27 | print("The Fab", len(beatles))
28 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.4.6.py:
--------------------------------------------------------------------------------
1 | # This is an existing list of numbers hidden in the hat.
2 | hatList = [1, 2, 3, 4, 5]
3 |
4 | # Step 1: write a line of code that prompts the user
5 | # to replace the middle number with an integer number entered by the user.
6 | num = int(input("Enter a number: "))
7 | hatList[len(hatList) // 2] = num
8 | # Step 2: write a line of code here that removes the last element from the list.
9 | del hatList[-1]
10 | # Step 3: write a line of code here that prints the length of the existing list.
11 | print(len(hatList))
12 | print(hatList)
13 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/3.1.6.9.py:
--------------------------------------------------------------------------------
1 | myList = [1, 2, 4, 4, 1, 4, 2, 6, 2, 9]
2 |
3 | tmpList = []
4 |
5 | for i in myList:
6 | if i not in tmpList:
7 | tmpList.append(i)
8 |
9 | myList = tmpList[:]
10 |
11 | print("The list with unique elements only: ")
12 | print(myList)
13 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/Module-3-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-3/Module-3-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-3/Module-3-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-3/Module-3-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/4.1.3.10.py:
--------------------------------------------------------------------------------
1 | def l100kmtompg(liters):
2 | inmile = 100 * 1000 / 1609.344
3 | ingallon = liters / 3.785411784
4 | return inmile / ingallon
5 |
6 | def mpgtol100km(miles):
7 | inkm = miles * 1609.344 / 1000
8 | inliter = 3.785411784
9 | return 100 / inkm * inliter
10 |
11 | print(l100kmtompg(3.9))
12 | print(l100kmtompg(7.5))
13 | print(l100kmtompg(10.))
14 | print(mpgtol100km(60.3))
15 | print(mpgtol100km(31.4))
16 | print(mpgtol100km(23.5))
17 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/4.1.3.6.py:
--------------------------------------------------------------------------------
1 | def isYearLeap(year):
2 | if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
3 | return True
4 | return False
5 |
6 | testData = [1900, 2000, 2016, 1987]
7 | testResults = [False, True, True, False]
8 |
9 | for i in range(len(testData)):
10 | yr = testData[i]
11 | print(yr, "->", end="")
12 | result = isYearLeap(yr)
13 | if result == testResults[i]:
14 | print("OK")
15 | else:
16 | print("Failed")
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/4.1.3.7.py:
--------------------------------------------------------------------------------
1 | def isYearLeap(year):
2 | if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
3 | return True
4 | return False
5 |
6 |
7 | def daysInMonth(year, month):
8 | leapMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
9 | if isYearLeap(year) == True and month == 2:
10 | return 29
11 | return leapMonth[month - 1]
12 |
13 | testYears = [1900, 2000, 2016, 1987]
14 | testMonths = [2, 2, 1, 11]
15 | testResults = [28, 29, 31, 30]
16 | for i in range(len(testYears)):
17 | yr = testYears[i]
18 | mo = testMonths[i]
19 | print(yr, mo, "->", end="")
20 | result = daysInMonth(yr, mo)
21 | if result == testResults[i]:
22 | print("OK")
23 | else:
24 | print("Failed")
25 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/4.1.3.8.py:
--------------------------------------------------------------------------------
1 | def isYearLeap(year):
2 | if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
3 | return True
4 | return False
5 |
6 | def daysInMonth(year, month):
7 | leapMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
8 | if isYearLeap(year) == True and month == 2:
9 | return 29
10 | return leapMonth[month - 1]
11 |
12 |
13 | def dayOfYear(year, month, day):
14 | totalDays = 0
15 | for i in range(month - 1):
16 | totalDays += daysInMonth(year, i + 1)
17 | if day > daysInMonth(year, month):
18 | return None
19 | return totalDays + day
20 |
21 | print(dayOfYear(2000, 12, 31), end="\n\n")
22 |
23 | testYears = [2000, 2000, 2001, 2001]
24 | testMonths = [12, 2, 2, 11]
25 | testDays = [31, 29, 29, 30]
26 | testResults = [366, 60, None, 334]
27 | for i in range(len(testYears)):
28 | yr = testYears[i]
29 | mo = testMonths[i]
30 | dy = testDays[i]
31 | print(dy, mo, yr, "= ", end="")
32 | result = dayOfYear(yr, mo, dy)
33 | if result == testResults[i]:
34 | print(str(result), "-> OK")
35 | else:
36 | print(str(result), "-> Failed")
37 |
38 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/4.1.3.9.py:
--------------------------------------------------------------------------------
1 | def isPrime(num):
2 | counter = 0
3 | for i in range(num):
4 | if num % (i + 1) == 0:
5 | counter += 1
6 | if counter == 2:
7 | return True
8 | return False
9 |
10 | for i in range(1, 20):
11 | if isPrime(i + 1):
12 | print(i + 1, end=" ")
13 | print()
14 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/4.1.6.13_PROJECT.py:
--------------------------------------------------------------------------------
1 | def DisplayBoard(board):
2 | #
3 | # the function accepts one parameter containing the board's current status
4 | # and prints it out to the console
5 | #
6 | print(
7 | f"""
8 | +-------+-------+-------+
9 | | | | |
10 | | {board[0][0]} | {board[0][1]} | {board[0][2]} |
11 | | | | |
12 | +-------+-------+-------+
13 | | | | |
14 | | {board[1][0]} | {board[1][1]} | {board[1][2]} |
15 | | | | |
16 | +-------+-------+-------+
17 | | | | |
18 | | {board[2][0]} | {board[2][1]} | {board[2][2]} |
19 | | | | |
20 | +-------+-------+-------+
21 | """)
22 |
23 | def EnterMove(board):
24 | #
25 | # the function accepts the board current status, asks the user about their move,
26 | # checks the input and updates the board according to the user's decision
27 | #
28 | while True:
29 | try:
30 | userMove = int(input("Enter your move: "))
31 | except ValueError:
32 | continue
33 | if userMove not in range(1, 10):
34 | continue
35 | for i in range(3):
36 | for j in range(3):
37 | if userMove == board[i][j]:
38 | board[i][j] = "O"
39 | return
40 |
41 | def VictoryFor(board, sign):
42 | #
43 | # the function analyzes the board status in order to check if
44 | # the player using 'O's or 'X's has won the game
45 | #
46 | if sign == board[0][0] == board[0][1] == board[0][2] or \
47 | sign == board[1][0] == board[1][1] == board[1][2] or \
48 | sign == board[2][0] == board[2][1] == board[2][2] or \
49 | sign == board[0][0] == board[1][0] == board[2][0] or \
50 | sign == board[0][1] == board[1][1] == board[2][1] or \
51 | sign == board[0][2] == board[1][2] == board[2][2] or \
52 | sign == board[0][0] == board[1][1] == board[2][2] or \
53 | sign == board[0][2] == board[1][1] == board[2][0]:
54 | return sign
55 |
56 | def DrawMove(board):
57 | #
58 | # the function draws the computer's move and updates the board
59 | #
60 | from random import randrange
61 | while True:
62 | comMove = randrange(1, 10)
63 | for i in range(3):
64 | for j in range(3):
65 | if board[i][j] == comMove:
66 | board[i][j] = "X"
67 | return
68 |
69 | # Initialize the board
70 | board = [[1, 2, 3],[4, "X", 6], [7, 8, 9]]
71 |
72 | # Main tictactoe program
73 | for i in range(4):
74 | DisplayBoard(board)
75 | EnterMove(board)
76 | DisplayBoard(board)
77 | DrawMove(board)
78 | # Print when the computer win
79 | if VictoryFor(board, "X") == "X":
80 | DisplayBoard(board)
81 | print("You lose!")
82 | break
83 | # Print when the user win
84 | if VictoryFor(board, "O") == "O":
85 | DisplayBoard(board)
86 | print("You won!")
87 | break
88 |
89 | # Print when a tie occured
90 | if VictoryFor(board, "O") == None and VictoryFor(board, "X") == None:
91 | DisplayBoard(board)
92 | print("It's a tie!")
93 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/Module-4-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-4/Module-4-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-4/Module-4-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-4/Module-4-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.10.6.py:
--------------------------------------------------------------------------------
1 | def segment_display(number):
2 | number = str(number)
3 | digit = {
4 | 0:['###','# #','# #','# #','###'],
5 | 1:['#','#','#','#','#'],
6 | 2:['###',' #','###','# ','###'],
7 | 3:['###',' #','###',' #','###'],
8 | 4:['# #','# #','###',' #',' #'],
9 | 5:['###','# ','###',' #','###'],
10 | 6:['###','# ','###','# #','###'],
11 | 7:['###',' #',' #',' #',' #'],
12 | 8:['###','# #','###','# #','###'],
13 | 9:['###','# #','##s',' #','###']
14 | }
15 | for i in range(5):
16 | for j in range(len(number)):
17 | d = int(number[j])
18 | if j == len(number) - 1:
19 | print(digit[d][i]+' ')
20 | else:
21 | print(digit[d][i]+' ', end='')
22 |
23 | if __name__ == '__main__':
24 | while True:
25 | try:
26 | number = int(input('Enter number: '))
27 | if number >= 0:
28 | break
29 | except:
30 | continue
31 | segment_display(number)
32 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.11.10.py:
--------------------------------------------------------------------------------
1 | def pos(text1, text2):
2 | matched = 0
3 | for t1 in text1:
4 | if text2.find(t1) == -1:
5 | continue
6 | else:
7 | matched += 1
8 | return matched == len(text1)
9 |
10 |
11 | if __name__ == '__main__':
12 | text1 = input('Text1: ')
13 | text2 = input('Text2: ')
14 | check = pos(text1, text2)
15 | if not check:
16 | print('No')
17 | else:
18 | print('Yes')
19 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.11.11.py:
--------------------------------------------------------------------------------
1 | def is_sudoku(num_list):
2 | row_list = num_list
3 | col_list = create_col_list(num_list)
4 | x_list = create_x_list(num_list)
5 | valid_list = True
6 | for i in range(9):
7 | check = is_valid(row_list[i], col_list[i], x_list[i])
8 | valid_list *= check
9 | if not valid_list:
10 | return False
11 | return True
12 |
13 | def create_col_list(num_list):
14 | col_list = []
15 | for r in range(9):
16 | col = ''
17 | for c in range(9):
18 | col += num_list[c][r]
19 | col_list.append(list(col))
20 | return col_list
21 |
22 | def create_x_list(num_list):
23 | x_list = []
24 | for xr in range(0, 9, 3):
25 | for xc in range(0, 9, 3):
26 | x = ''
27 | for r in range(3):
28 | for c in range(3):
29 | x += num_list[r + xr][c + xc]
30 | x_list.append(list(x))
31 | return x_list
32 |
33 | def is_valid(r, c, x):
34 | for i in range(9):
35 | n = str(i+1)
36 | if n not in r or n not in c or n not in x:
37 | return False
38 | return True
39 |
40 | if __name__ == '__main__':
41 | num_list = []
42 | for i in range(9):
43 | row = input()
44 | num_list.append(list(row))
45 | msg = 'Yes' if is_sudoku(num_list) else 'No'
46 | print(msg)
47 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.11.6.py:
--------------------------------------------------------------------------------
1 | def encrypt_text(text, shift=1):
2 | encrypted_text = ''
3 | for i in range(len(text)):
4 | char = text[i]
5 | if not char.isalpha():
6 | encrypted_text += char
7 | else:
8 | if not char.islower():
9 | asc = ord('A')
10 | else:
11 | asc = ord('a')
12 | enc = asc + ((ord(char) - asc) + shift) % 26
13 | encrypted_text += chr(enc)
14 | return encrypted_text
15 |
16 |
17 | def input_text():
18 | return input('Text to encrypt: ')
19 |
20 | def input_shift():
21 | while True:
22 | try:
23 | shift = int(input('Shift: '))
24 | if shift >= 1 and shift <= 25:
25 | break
26 | except:
27 | continue
28 | return shift
29 |
30 | if __name__ == '__main__':
31 | text = input_text()
32 | shift = input_shift()
33 | encrypted = encrypt_text(text, shift)
34 | print(encrypted)
35 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.11.7.py:
--------------------------------------------------------------------------------
1 | def is_palindrome(text):
2 | rvrsd_text = text[::-1].replace(' ','').lower()
3 | print(rvrsd_text)
4 | print(text.replace(' ','').lower())
5 | return rvrsd_text == text.replace(' ','').lower()
6 |
7 | def input_text():
8 | while True:
9 | text = input('Text: ')
10 | if not text.replace(' ','').isalpha():
11 | continue
12 | else:
13 | break
14 | return text
15 |
16 | if __name__ == '__main__':
17 | text = input_text()
18 | if not is_palindrome(text):
19 | print(text, 'is not a palindrome')
20 | else:
21 | print(text, 'is a palindrome')
22 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.11.8.py:
--------------------------------------------------------------------------------
1 | def is_anagram(text1, text2):
2 | if len(text1) != len(text2):
3 | return False
4 | else:
5 | text1 = text1.lower()
6 | text2 = text2.lower()
7 | list1 = []
8 | list2 = []
9 | for i in range(len(text1)):
10 | list1.append(ord(text1[i]))
11 | list2.append(ord(text2[i]))
12 | list1.sort()
13 | list2.sort()
14 | return list1 == list2
15 |
16 |
17 | if __name__ == '__main__':
18 | text1 = input('Text 1: ')
19 | text2 = input('Text 2: ')
20 | if not is_anagram(text1, text2):
21 | print('Not anagrams')
22 | else:
23 | print('Anagrams')
24 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.11.9.py:
--------------------------------------------------------------------------------
1 | def digitof_life(birth):
2 | sum1 = 0
3 | for i in birth:
4 | i = int(i)
5 | sum1 += i
6 | sum2 = 0
7 | for i in str(sum1):
8 | i = int(i)
9 | sum2 += i
10 | return sum2
11 |
12 | if __name__ == '__main__':
13 | birth = input('Birth number: ')
14 | print(digitof_life(birth))
15 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.6.4.py:
--------------------------------------------------------------------------------
1 | def readint(prompt, min, max):
2 | while True:
3 | val = input(prompt)
4 | try:
5 | val = int(val)
6 | if val >= min and val <= max:
7 | break
8 | else:
9 | print(f"Error: the number is not within permitted range ({min}, {max})")
10 | except:
11 | print("Error: wrong input")
12 | return val
13 |
14 | v = readint("Enter a number from -10 to 10: ", -10, 10)
15 |
16 | print("The number is:", v)
17 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/5.1.9.18.py:
--------------------------------------------------------------------------------
1 | def mysplit(strng):
2 | result = []
3 | text = ''
4 | for i in range(len(strng)):
5 | if strng[i] != ' ':
6 | text += strng[i]
7 | else:
8 | if text == '':
9 | continue
10 | result.append(text)
11 | text = ''
12 | if i == len(strng) - 1 and text != '':
13 | result.append(text)
14 | return result
15 |
16 | print(mysplit("To be or not to be, that is the question"))
17 | print(mysplit("To be or not to be,that is the question"))
18 | print(mysplit(" "))
19 | print(mysplit(" abc "))
20 | print(mysplit(""))
21 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/Module-5-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-5/Module-5-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-5/Module-5-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-5/Module-5-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-6/6.1.9.15.py:
--------------------------------------------------------------------------------
1 | fn = input('Enter filename: ')
2 |
3 | try:
4 | f = open(fn, 'rt', errors='ignore')
5 | letter = {}
6 | for i in range(ord('a'), ord('a') + 26):
7 | letter[chr(i)] = 0
8 | for line in f:
9 | for ch in line.lower():
10 | if ch in letter.keys():
11 | letter[ch] += 1
12 | for k, v in letter.items():
13 | if v != 0:
14 | print(k, '->', v)
15 |
16 | except Exception as e:
17 | print(e)
18 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-6/6.1.9.16.py:
--------------------------------------------------------------------------------
1 | fn = input('Enter filename: ')
2 |
3 | try:
4 | fo = open(fn, 'rt', errors='ignore')
5 | letter = {}
6 | for i in range(ord('a'), ord('a') + 26):
7 | letter[chr(i)] = 0
8 | for line in fo:
9 | for ch in line.lower():
10 | if ch in letter.keys():
11 | letter[ch] += 1
12 | fo.close()
13 | sorted_letter = sorted(letter.items(), key=lambda x: x[1], reverse=True)
14 | fw = open(fn + '.hist', 'wt')
15 | for i in sorted_letter:
16 | if i[1] != 0:
17 | line = str(i[0]) + ' -> ' + str(i[1])
18 | print(line)
19 | fw.write(line + '\n')
20 | fw.close()
21 |
22 | except Exception as e:
23 | print(e)
24 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-6/6.1.9.17.py:
--------------------------------------------------------------------------------
1 | class StudentsDataException(Exception):
2 | def __init__(self, f_name='unknown', message='error'):
3 | Exception.__init__(self, message)
4 | self.f_name = f_name
5 | self.message = message
6 |
7 | class BadLine(StudentsDataException):
8 | def __init__(self, f_name='unknown', message='contains bad line'):
9 | StudentsDataException.__init__(self, f_name, message)
10 |
11 | class FileEmpty(StudentsDataException):
12 | def __init__(self, f_name='unknown', message='file is empty'):
13 | StudentsDataException.__init__(self, f_name, message)
14 |
15 | def ask_f_name():
16 | return input('Enter filename: ')
17 |
18 | def read_file(f_name):
19 | with open(f_name, 'r') as f:
20 | lines = f.readlines()
21 | if len(lines) == 0:
22 | raise FileEmpty
23 | l_list = [l.split() for l in lines]
24 | f_dict = {}
25 | for txt in l_list:
26 | if len(txt) != 3:
27 | raise BadLine
28 | name = txt[0] + ' ' + txt[1]
29 | grade = float(txt[2])
30 | if name in f_dict.keys():
31 | f_dict[name] += grade
32 | else:
33 | f_dict[name] = grade
34 | return f_dict
35 |
36 | if __name__ == '__main__':
37 | f_name = ask_f_name()
38 | try:
39 | f_dict = read_file(f_name)
40 | f_list = sorted(f_dict.items(), key=lambda x: x[0])
41 | for d in f_list:
42 | print(d[0] + '\t' + str(d[1]))
43 | except FileNotFoundError as fn:
44 | print('File:', f_name, 'does not exist')
45 | except FileEmpty as fe:
46 | print('File:', f_name, ':', fe.message)
47 | except BadLine as bl:
48 | print('File:', f_name, ':', bl.message)
49 | except:
50 | print('Unexpected error')
51 |
52 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-6/Module-6-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-6/Module-6-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-6/Module-6-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-6/Module-6-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Quiz/Module-1-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Quiz/Module-1-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Quiz/Module-2-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Quiz/Module-2-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Quiz/Module-3-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Quiz/Module-3-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Quiz/Module-4-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Quiz/Module-4-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Quiz/Module-5-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Quiz/Module-5-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Quiz/Module-6-Quiz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Quiz/Module-6-Quiz.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Test/Module-2-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Test/Module-2-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Test/Module-3-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Test/Module-3-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Test/Module-4-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Test/Module-4-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Test/Module-5-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Test/Module-5-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/Module-Test/Module-6-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/Module-Test/Module-6-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/p1.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/p1.cpython-38.pyc
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/p2.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/p2.cpython-38.pyc
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/p3.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/p3.cpython-38.pyc
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/test_p.cpython-38-pytest-5.4.3.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/test_p.cpython-38-pytest-5.4.3.pyc
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/test_p1.cpython-38-pytest-5.4.3.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/test_p1.cpython-38-pytest-5.4.3.pyc
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/test_project.cpython-38-pytest-5.4.3.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT-DTS/__pycache__/test_project.cpython-38-pytest-5.4.3.pyc
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/p1.py:
--------------------------------------------------------------------------------
1 | # Project 1
2 | # Irvan Tristian - 0447356121-105
3 |
4 | priority = 0
5 | email = 'irvantristian@gmail.com'
6 |
7 | # Filter a list by first letter
8 | def letter_catalog(items, letter='A'):
9 | return [item for item in items if item[0] == letter]
10 |
11 | # Return a dict from a list with fruit as key and fruit-counter as value
12 | def counter_item(items):
13 | return {item: items.count(item) for item in items}
14 |
15 | # Calculate total price
16 | def total_price(dcounter, fprice):
17 | return sum(dcounter[d] * fprice[d] for d in dcounter)
18 |
19 | # Calculate discounted price
20 | def discounted_price(total, discount, minprice=100):
21 | if total < minprice:
22 | return total
23 | return total - (total * discount / 100)
24 |
25 | # Print total fruit, price, total price, and discounted price
26 | def print_summary(items, fprice):
27 | f_dict = counter_item(items)
28 | for f in sorted(f_dict):
29 | print(f"{f_dict[f]} {f} : {f_dict[f] * fprice[f]}")
30 | total = total_price(f_dict, fprice)
31 | discount = discounted_price(total, 10, minprice=100)
32 | print(f"total : {total}\ndiscount price : {discount}")
33 |
34 |
35 | # Fruit & its price lists
36 | fruits = ['Apple', 'Avocado', 'Banana', 'Blackberries', 'Blueberries',
37 | 'Cherries', 'Date Fruit', 'Grapes', 'Guava', 'Jackfruit', 'Kiwifruit']
38 | prices = [6, 5, 3, 10, 12, 7, 14, 15, 8, 7, 9]
39 |
40 | # Cart list
41 | chart = ['Blueberries', 'Blueberries', 'Grapes', 'Apple', 'Apple',
42 | 'Apple', 'Blueberries', 'Guava', 'Jackfruit', 'Blueberries', 'Jackfruit']
43 |
44 | # Dict comprehensions to populate the fruit and its price
45 | fruit_price = {fruit: price for fruit, price in zip(fruits, prices)}
46 |
47 | if __name__ == "__main__":
48 | print_summary(chart, fruit_price)
49 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/p2.py:
--------------------------------------------------------------------------------
1 | # Project 2
2 | # Irvan Tristian - 0447356121-105
3 |
4 | import random
5 |
6 | priority = 1
7 | email = 'irvantristian@gmail.com'
8 |
9 | # Check whether a coordinate is in circle or not
10 | def isPointInCircle(x, y, r, center=(0, 0)):
11 | return (x - center[0]) ** 2 + (y - center[1]) ** 2 <= r ** 2
12 |
13 | # Generate a list of random coordinates in a square form
14 | def generateRandomSquarePoints(n, length, center=(0, 0)):
15 | minx = center[0] - length / 2
16 | miny = center[1] - length / 2
17 | points = [[random.uniform(minx, center[0] + length / 2), random.uniform(miny, center[1] + length / 2)]
18 | for point in range(n)]
19 | return points
20 |
21 | # Calculate an estimated circle area
22 | def MCCircleArea(r, n=100, center=(0, 0)):
23 | points_list = generateRandomSquarePoints(n, 2 * r, center)
24 | in_circle = sum(isPointInCircle(i[0], i[1], r, center) for i in points_list)
25 | square_area = (2 * r) ** 2
26 | return (in_circle / n) * square_area
27 |
28 | # Calculate an estimated pi value
29 | def LLNPiMC(nsim, nsample):
30 | return sum(MCCircleArea(1, nsample) for i in range(nsim)) / nsim
31 |
32 | # Calculate relative error percentage of an estimated pi
33 | def relativeError(act, est):
34 | return abs((est - act) / act * 100)
35 |
36 | if __name__ == "__main__":
37 | # Function 1 check
38 | print(isPointInCircle(1, 1, 1, center=(0, 0)), isPointInCircle(1, 0, 1, center=(0, 0)),
39 | isPointInCircle(1, 1, 1, center=(1, 0)), isPointInCircle(0, 0, 1, center=(1, 1)))
40 |
41 | # Function 2 check
42 | random.seed(0)
43 | points = generateRandomSquarePoints(100, 1)
44 | print(points[10:15])
45 |
46 | # Function 3 check
47 | random.seed(0)
48 | print(MCCircleArea(1, 100), MCCircleArea(1, 10, center=(10, 10)))
49 |
50 | # Function 4 check
51 | import math
52 | random.seed(0)
53 | estpi = LLNPiMC(10000, 500)
54 | print('est_pi:', estpi)
55 | print('act_pi:', math.pi)
56 |
57 | # Function 5 check
58 | print('error relatif:', relativeError(math.pi, estpi), '%')
59 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/p3.py:
--------------------------------------------------------------------------------
1 | # Project 3
2 | # Irvan Tristian - 0447356121-105
3 |
4 | priority = 1
5 | email = 'irvantristian@gmail.com'
6 |
7 | # Encrypt with caesar
8 | def caesar_encript(txt, shift):
9 | text_list = list(txt)
10 | for i in range(len(txt)):
11 | char = text_list[i]
12 | if char.isalpha() == True:
13 | asc = ord(char)
14 | if char.islower() == True:
15 | text_list[i] = chr((asc - 97 + shift) % 26 + 97)
16 | else:
17 | text_list[i] = chr((asc - 65 + shift) % 26 + 65)
18 | return ''.join(text_list)
19 |
20 | # Decrypt with caesar
21 | def caesar_decript(chiper, shift):
22 | return caesar_encript(chiper, -shift)
23 |
24 | # Shuffle order of string
25 | def shuffle_order(txt, order):
26 | return ''.join([txt[i] for i in order])
27 |
28 | # De-shuffle order of string
29 | def deshuffle_order(sftxt, order):
30 | return ''.join([sftxt[order.index(i)] for i in range(len(order))])
31 |
32 | # Encrypt & split encrypted text in to n-char batchs & shuffle chars inside all the batchs
33 | def send_batch(txt, batch_order, shift=3):
34 | encrypted = caesar_encript(txt, shift)
35 | n = len(batch_order)
36 | remainder = len(encrypted) % n
37 | if remainder != 0:
38 | for i in range(n - remainder):
39 | encrypted += "_"
40 | batchs = [encrypted[i:i + n] for i in range(0, len(encrypted), n)]
41 | shuffled = [shuffle_order(text, batch_order) for text in batchs]
42 | return shuffled
43 |
44 | # De-shuffle encrypted text join all the batchs and decrypt the text
45 | def receive_batch(batch_cpr, batch_order, shift=3):
46 | batch_txt = [caesar_decript(deshuffle_order(
47 | i, batch_order), shift) for i in batch_cpr]
48 | return ''.join(batch_txt).strip('_')
49 |
50 | # Run directly
51 | if __name__ == '__main__':
52 |
53 | # Sanity check #1
54 | msg = 'Haloz DTS mania, MANTAPSZZZ!'
55 | cpr = caesar_encript(msg, 4)
56 | txt = caesar_decript(cpr, 4)
57 | print('plain text:', txt)
58 | print('chiper text:', cpr)
59 |
60 | # Sanity check #2
61 | print(shuffle_order('abcd', [2, 1, 3, 0]))
62 | print(deshuffle_order('cbda', [2, 1, 3, 0]))
63 |
64 | # Sanity check #3
65 | msg_cpr = send_batch('halo DTS mania, mantaaap!!!', [2, 1, 3, 0], 4)
66 | msg_txt = receive_batch(msg_cpr, [2, 1, 3, 0], 4)
67 | print(msg_txt, msg_cpr, sep='\n')
68 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT-DTS/test_project.py:
--------------------------------------------------------------------------------
1 | import p1, p2, p3, pytest
2 |
3 | # Project 1 Test Case
4 | @pytest.mark.parametrize("items, letter, expected", [
5 | (['Apple','Avocado','Banana','Blackberries','Blueberries','Cherries'],'A',['Apple', 'Avocado']),
6 | ])
7 | def test_letter_catalog(items, letter, expected):
8 | assert p1.letter_catalog(items, letter) == expected
9 |
10 | def test_counter_item():
11 | assert p1.counter_item(['Apple','Apple','Apple','Blueberries','Blueberries','Blueberries']) == {'Apple': 3, 'Blueberries': 3}
12 |
13 | def test_total_price():
14 | assert p1.total_price(p1.counter_item(p1.chart),p1.fruit_price) == 103
15 |
16 | def test_discounted_price():
17 | assert p1.discounted_price(p1.total_price(p1.counter_item(p1.chart),p1.fruit_price),10,minprice=100) == 92.7
18 |
19 | def test_print_summarry(capfd):
20 | p1.print_summary(p1.chart, p1.fruit_price)
21 | out, err = capfd.readouterr()
22 | assert out == '3 Apple : 18\n4 Blueberries : 48\n1 Grapes : 15\n1 Guava : 8\n2 Jackfruit : 14\ntotal : 103\ndiscount price : 92.7\n'
23 |
24 | # Project 2 Test Case
25 | @pytest.mark.parametrize('x, y, r, center, expected', [
26 | (1,1,1,(0,0),False),
27 | (1,0,1,(0,0),True),
28 | (1,1,1,(1,0),True),
29 | (0,0,1,(1,1),False),
30 | ])
31 | def test_ispointincircle(x, y, r, center, expected):
32 | assert p2.isPointInCircle(x, y, r, center) == expected
33 |
34 | def test_generaterandomsquarepoint():
35 | import random
36 | random.seed(0)
37 | points = p2.generateRandomSquarePoints(100,1)
38 | assert points[10:15] == [[-0.18985243068066737, 0.22983174826012864],
39 | [0.3988382879679935, 0.18398393191544127],
40 | [-0.027857284547286643, -0.3992987919316342],
41 | [-0.06582816454621632, 0.1108869734438016],
42 | [0.4130110532378982, 0.4666063677707588]]
43 |
44 | @pytest.mark.parametrize('r, n, center, expected',[
45 | (1,100,(0,0),3.28),
46 | (1,10,(10,10),3.2),
47 | ])
48 | def test_mccirclearea(r,n,center,expected):
49 | import random
50 | random.seed(0)
51 | assert p2.MCCircleArea(r,n,center) == expected
52 |
53 | def test_llnpimc():
54 | import random
55 | random.seed(0)
56 | estpi = p2.LLNPiMC(10000,500)
57 | assert estpi == 3.1416055999999823
58 |
59 | def test_relativeerror():
60 | import math, random
61 | random.seed(0)
62 | estpi = p2.LLNPiMC(10000,500)
63 | assert p2.relativeError(math.pi,estpi) == 0.0004120970353822341
64 |
65 | # Project 3 Test Case
66 | def test_caesar():
67 | msg = 'Haloz DTS mania, MANTAPSZZZ!'
68 | cpr = p3.caesar_encript(msg,4)
69 | txt = p3.caesar_decript(cpr,4)
70 | assert msg == txt
71 |
72 | def test_order():
73 | msg = 'abcd'
74 | shuffled = p3.shuffle_order(msg,[2,1,3,0])
75 | deshuffled = p3.deshuffle_order(shuffled,[2,1,3,0])
76 | assert msg == deshuffled
77 |
78 | def test_batch(capfd):
79 | msg_cpr = p3.send_batch('halo DTS mania, mantaaap!!!',[2,1,3,0],4)
80 | msg_txt = p3.receive_batch(msg_cpr,[2,1,3,0],4)
81 | print(msg_txt,msg_cpr,sep='\n')
82 | out, err = capfd.readouterr()
83 | assert out == """halo DTS mania, mantaaap!!!
84 | ['pesl', 'XHW ', 'eqr ', ',e m', 'rexq', 'eete', '!!_!']
85 | """
86 |
87 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT/4.1.6.13_PROJECT.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/PROJECT/4.1.6.13_PROJECT.gif
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/PROJECT/4.1.6.13_PROJECT.py:
--------------------------------------------------------------------------------
1 | def DisplayBoard(board):
2 | #
3 | # the function accepts one parameter containing the board's current status
4 | # and prints it out to the console
5 | #
6 | print(
7 | f"""
8 | +-------+-------+-------+
9 | | | | |
10 | | {board[0][0]} | {board[0][1]} | {board[0][2]} |
11 | | | | |
12 | +-------+-------+-------+
13 | | | | |
14 | | {board[1][0]} | {board[1][1]} | {board[1][2]} |
15 | | | | |
16 | +-------+-------+-------+
17 | | | | |
18 | | {board[2][0]} | {board[2][1]} | {board[2][2]} |
19 | | | | |
20 | +-------+-------+-------+
21 | """)
22 |
23 | def EnterMove(board):
24 | #
25 | # the function accepts the board current status, asks the user about their move,
26 | # checks the input and updates the board according to the user's decision
27 | #
28 | while True:
29 | userMove = int(input("Enter your move: "))
30 | if userMove not in range(1, 10):
31 | continue
32 | for i in range(3):
33 | for j in range(3):
34 | if userMove == board[i][j]:
35 | board[i][j] = "O"
36 | return
37 |
38 | def MakeListOfFreeFields(board):
39 | #
40 | # the function browses the board and builds a list of all the free squares;
41 | # the list consists of tuples, while each tuple is a pair of row and column numbers
42 | #
43 | freeFields = []
44 | for i in range(3):
45 | for j in range(3):
46 | if board[i][j] != "O" and board[i][j] != "X":
47 | freeFields.append(tuple([i, j]))
48 | return freeFields
49 |
50 | def VictoryFor(board, sign):
51 | #
52 | # the function analyzes the board status in order to check if
53 | # the player using 'O's or 'X's has won the game
54 | #
55 | if sign == board[0][0] == board[0][1] == board[0][2] or \
56 | sign == board[1][0] == board[1][1] == board[1][2] or \
57 | sign == board[2][0] == board[2][1] == board[2][2] or \
58 | sign == board[0][0] == board[1][0] == board[2][0] or \
59 | sign == board[0][1] == board[1][1] == board[2][1] or \
60 | sign == board[0][2] == board[1][2] == board[2][2] or \
61 | sign == board[0][0] == board[1][1] == board[2][2] or \
62 | sign == board[0][2] == board[1][1] == board[2][0]:
63 | return sign
64 |
65 | def DrawMove(board):
66 | #
67 | # the function draws the computer's move and updates the board
68 | #
69 | from random import randrange
70 | while True:
71 | comMove = randrange(1, 10)
72 | for i in range(3):
73 | for j in range(3):
74 | if board[i][j] == comMove:
75 | board[i][j] = "X"
76 | return
77 |
78 | board = [[1, 2, 3],[4, "X", 6], [7, 8, 9]]
79 | for i in range(4):
80 | DisplayBoard(board)
81 | EnterMove(board)
82 | DisplayBoard(board)
83 | DrawMove(board)
84 | if VictoryFor(board, "X") == "X":
85 | DisplayBoard(board)
86 | print("You lose!")
87 | break
88 | if VictoryFor(board, "O") == "O":
89 | DisplayBoard(board)
90 | print("You won!")
91 | break
92 |
93 | if VictoryFor(board, "O") == None and VictoryFor(board, "X") == None:
94 | DisplayBoard(board)
95 | print("It's a tie!")
96 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/README.md:
--------------------------------------------------------------------------------
1 | # PCAP-netacad
2 | This repository keeps track all my learning progress on [Cisco Networking Academy - PCAP: Programming Essentials in Python](https://www.netacad.com/courses/programming/pcap-programming-essentials-python)
3 | > 100% scores! ✅ My very own [LAB + QUIZ + TEST + PROJECT] Solutions
4 |
5 | 
6 |
7 | ### Certified Associate in Python Programming certification
8 | https://pythoninstitute.org/certification/pcap-certification-associate/
9 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/SBA/SBA2020.py:
--------------------------------------------------------------------------------
1 | '''
2 | namafile: SBA2020.py
3 | Lembar kerja/script SBA
4 | Irvan Tristian
5 | 0447356121-105
6 | '''
7 |
8 | email = 'irvantristian@gmail.com'
9 |
10 | # >>>>>>Soal 1
11 | def fungsiIO():
12 | inputan = input().split()
13 | input_list = list(map(int, inputan))
14 | input_list.sort()
15 | for i in input_list:
16 | print(i * '*')
17 |
18 | # >>>>>>Soal 2
19 | def caseShopia(txt):
20 | changed_txt = []
21 | for ch in txt:
22 | if ord(ch) >= ord('A') and ord(ch) <= ord('Z'):
23 | changed_txt.append(ch.lower())
24 | if ord(ch) >= ord('a') and ord(ch) <= ord('z'):
25 | changed_txt.append(ch.upper())
26 | return ''.join(changed_txt)
27 |
28 | dcur2idr = {'USD': 14425, 'EUR': 16225, 'AUD': 9925, 'CAD': 10500,
29 | 'GBP': 17800, 'CHF': 15200, 'SGD': 10375, 'HKD': 1775,
30 | 'JPY': 132500, 'MYR': 3250, 'SAR': 3500, 'WON': 10750,
31 | 'IDR': 1}
32 |
33 | # >>>>>> Soal 3
34 | def usd2eur(usd):
35 | return usd * (dcur2idr['USD'] / dcur2idr['EUR'])
36 |
37 | # >>>>>>Soal 4
38 | class MoneyChanger:
39 | def __init__(self, dcurrency, base='IDR', percent=2):
40 | self.dcurrency = dcurrency
41 | self.base = base
42 | self.percent = percent
43 | self.change_base(base)
44 |
45 | def selling_price(self, nominal, curr):
46 | curr2base = nominal * (self.dcurrency[curr] / self.dcurrency[self.base])
47 | return curr2base + (self.percent/100 * curr2base)
48 |
49 | def buying_price(self, nominal, curr):
50 | curr2base = nominal * (self.dcurrency[curr] / self.dcurrency[self.base])
51 | return curr2base - (self.percent/100 * curr2base)
52 |
53 | def change_base(self, new_base):
54 | base_value = self.dcurrency[new_base]
55 | for k, v in self.dcurrency.items():
56 | self.dcurrency[k] /= base_value
57 | self.base = new_base
58 |
59 | # Test Case
60 | def main():
61 | print('test soal 1')
62 | fungsiIO() # contoh input: 7 4 5 2 1 3
63 |
64 | print('test soal 2')
65 | print(caseShopia('thXGth876%^$LMn.'))
66 |
67 | print('test soal 3')
68 | print(usd2eur(100)) # mengubah 100 USD ke EUR
69 |
70 | print('test soal 4')
71 | mc = MoneyChanger(dcur2idr,base='EUR') # object mc dengan base EUR
72 | print('base', mc.base)
73 | print(mc.selling_price(100,'USD')) # nilai jual 100 USD ke EUR (Base)
74 | print(mc.buying_price(100,'USD')) # nilai beli 100 USD ke EUR (Base)
75 |
76 | mc.change_base('IDR') # Ganti Base object mc ke IDR
77 | print('base', mc.base)
78 | print(mc.selling_price(100,'USD')) # nilai jual 100 USD ke IDR (Base)
79 | print(mc.buying_price(100,'USD')) # nilai beli 100 USD ke IDR (Base)
80 |
81 | if __name__ == '__main__':
82 | main()
83 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/SBA/latihanSBA.py:
--------------------------------------------------------------------------------
1 | '''
2 | namafile: latihanSBA.py
3 | Lembar kerja/script Latihan SBA
4 | Irvan Tristian
5 | 0447356121-105
6 | '''
7 |
8 | email = 'irvantristian@gmail.com'
9 |
10 | #soal 1
11 | class titik2d:
12 | def __init__(self, x, y):
13 | self.x = x
14 | self.y = y
15 |
16 | def ambiltitik(self):
17 | return (self.x, self.y)
18 |
19 | def tambahkan(self, titik):
20 | self.x += titik.x
21 | self.y += titik.y
22 |
23 | # soal 2
24 | def run():
25 | while True:
26 | try:
27 | point = input().split()
28 | if len(point) == 2:
29 | x, y = int(point[0]), int(point[1])
30 | break
31 | except:
32 | continue
33 | return titik2d(x, y)
34 |
35 | if __name__ == '__main__':
36 | t1 = run()
37 | print('titik1:',t1.ambiltitik())
38 | t2 = run()
39 | print('titik2:',t2.ambiltitik())
40 | t1.tambahkan(t2)
41 | print('titik1 + titik2:',t1.ambiltitik())
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/SBA/persiapanSBA.py:
--------------------------------------------------------------------------------
1 | dictMapel = {'001': 'Bahasa Indonesia',
2 | '002': 'Bahasa Inggris',
3 | '003': 'Matematika',
4 | '004': 'Biologi',
5 | '005': 'Fisika'}
6 |
7 | kamusWarna = {'grey': 'abu-abu',
8 | 'brown': 'coklat',
9 | 'beige': 'abu-abu coklat',
10 | 'green': 'hijau',
11 | 'light': 'terang',
12 | 'dark': 'gelap',
13 | 'navy': 'biru gelap',
14 | 'turquoise': 'biru hijau',
15 | 'purple': 'ungu',
16 | 'black': 'hitam',
17 | 'pink': 'merah muda',
18 | 'silver': 'perak',
19 | 'gold': 'emas',
20 | 'red': 'merah',
21 | 'orange': 'oranye'}
22 |
23 | def daftar_mapel():
24 | print('\nDaftar Mata Pelajaran:')
25 | for kode,nama in dictMapel.items():
26 | print(kode+':', nama)
27 | print()
28 |
29 | def menu_dict():
30 | daftar_mapel()
31 | print('a. Masukan mapel baru\nb. Edit mapel')
32 | menu = input('Pilih menu: ')
33 | if menu == 'a':
34 | jml = int(input('Input jumlah mapel yang akan ditambahkan: '))
35 | print()
36 | for i in range(jml):
37 | kode = str(int(list(dictMapel)[-1]) + 1).zfill(3)
38 | print('Kode mapel:', kode)
39 | nama = input('Input nama mapel: ')
40 | dictMapel[kode] = nama
41 | daftar_mapel()
42 | elif menu == 'b':
43 | jml = int(input('Input jumlah mapel yang akan dihapus: '))
44 | print()
45 | for i in range(jml):
46 | kode = input('Input kode mapel: ')
47 | deleted = dictMapel[kode]
48 | del dictMapel[kode]
49 | print(f'Mapel "{kode}: {deleted}" berhasil dihapus')
50 | daftar_mapel()
51 | else:
52 | print('Input menu tidak sesuai')
53 |
54 | def menu_translator():
55 | print('Translator Warna English-Indonesia')
56 | color = input('Color: ')
57 | print('Warna:', kamusWarna[color])
58 |
59 | def menu_class():
60 | KotakBiru = Kardus(10, 8, 4)
61 | KotakMerah = Kardus(15, 5, 1)
62 | print('\nKotak Biru:')
63 | traits_kotak(KotakBiru)
64 | print('\nKotak Merah:')
65 | traits_kotak(KotakMerah)
66 |
67 | def traits_kotak(Kotak):
68 | print(f'p = {Kotak.p}\nl = {Kotak.l}\nt = {Kotak.t}')
69 | print(f'volume = {Kotak.volumeKardus()}')
70 | print(f'luas = {Kotak.luasPermKardus()}')
71 |
72 | class Kardus:
73 | def __init__(self, p, l, t):
74 | self.p = p
75 | self.l = l
76 | self.t = t
77 |
78 | def volumeKardus(self):
79 | return self.p * self.l * self.t
80 |
81 | def luasPermKardus(self):
82 | return 2 * (self.p * self.l + self.p * self.t + self.l * self.t)
83 |
84 | def pilih_latihan():
85 | print('1. Dict\n2. Translator\n3. OOP')
86 | menu = int(input('Pilih menu latihan: '))
87 | if menu == 1:
88 | menu_dict()
89 | elif menu == 2:
90 | menu_translator()
91 | elif menu == 3:
92 | menu_class()
93 | else:
94 | print('Input menu latihan salah')
95 |
96 | if __name__ == '__main__':
97 | pilih_latihan()
98 |
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/SUMMARY-TEST/Part-1-Summary-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/SUMMARY-TEST/Part-1-Summary-Test.pdf
--------------------------------------------------------------------------------
/Otros/PCEP-netacad-master/SUMMARY-TEST/Part-2-Summary-Test.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PCEP-netacad-master/SUMMARY-TEST/Part-2-Summary-Test.pdf
--------------------------------------------------------------------------------
/Otros/Playlist Creados.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/Playlist Creados.pdf
--------------------------------------------------------------------------------
/Otros/PythonClase001.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Otros/PythonClase001.pdf
--------------------------------------------------------------------------------
/Python_Fundamentos/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/Python_Fundamentos/.idea/Python_Fundamentos.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Python_Fundamentos/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Python_Fundamentos/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Python_Fundamentos/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Python_Fundamentos/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Python_Fundamentos/001-Tipodedatos/Ejercicio001.py:
--------------------------------------------------------------------------------
1 | # todo Tipo de datos
2 | """
3 | Comentarios en Varias Lineas
4 | """
5 | curso_actual = "PYTHON" # Str
6 | profesor_curso = 'Armando Ruiz' # Str
7 | precio_curso = 1200.20 # Float
8 | cantidad_participantes = 60 # Int
9 | curso_abierto = True # Bool
10 |
11 | # todo Concatenado
12 | # print("Cual es el curso que Llevo?:" + curso_actual)
13 | # print("Cual es el curso que Llevo?:", curso_actual)
14 | # print(f"Cual es el curso que Llevo?: {curso_actual} ")
15 | # print("Cual es el curso que Llevo?: %s" % (curso_actual))
16 |
17 | # print("Cual es el Precio del Curso?:" + str(precio_curso))
18 | # print("Cual es el Precio del Curso?:" , precio_curso)
19 | # print(f"Cual es el Precio del Curso {precio_curso} y el Profesor {profesor_curso}")
20 |
21 | # todo Castear
22 | # print(type(str(precio_curso)))
23 | # print(type(str(cantidad_participantes)))
24 |
25 | # todo Funcion de Entrada de datos
26 | # nombre_persona = input("Ingrese el Nombre de la Persona:")
27 | # print(f"El Nombre de la Persona que se ingreso es {nombre_persona}")
28 |
29 | # todo Programa de Cambio de divisas
30 | # monto_cambiar = float(input("Ingrese el Monto de Pesos a cambiar en $"))
31 | valor_dolar = 3.57
32 | # total_dolares = monto_cambiar / valor_dolar
33 | # print(f"El Total de Dolares que tienes en el bolsillo es {total_dolares}")
34 | # print("El Total de Dolares que tienes en el bolsillo es %.3f" % total_dolares)
35 |
36 | # todo Notacion Cientifica
37 |
38 | # Todo Binario
39 | num1 = "0b100" # 4
40 | num2 = "0b110" # 6
41 | sumar = int(num1, 2) + int(num2, 2)
42 | #print(sumar)
43 |
44 | # Todo Hexa
45 | hnum1 = "0x10" # 4
46 | hnum2 = "0x10" # 6
47 | suma = int(hnum1, 16) + int(hnum2, 16)
48 | print(suma)
49 |
--------------------------------------------------------------------------------
/Python_Fundamentos/Archivos/__pycache__/data.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Python_Fundamentos/Archivos/__pycache__/data.cpython-311.pyc
--------------------------------------------------------------------------------
/Python_Fundamentos/Archivos/data.py:
--------------------------------------------------------------------------------
1 | #Modulo que me permitira acceder al archibo CSV
2 | import csv
3 | def aperturar_archivo():
4 | with open('cinema.csv','r') as data_cinema:
5 | csv_leer=csv.reader(data_cinema)
6 | lista_empleados=list(csv_leer)
7 | return lista_empleados
--------------------------------------------------------------------------------
/Python_Fundamentos/Archivos/datos.csv:
--------------------------------------------------------------------------------
1 | codigo;Empleado;pais;ciudad;habilidades
2 | 1;Jorge;Colombia;Bogota;Python
3 | 2;Luis;Ecuador;Quito;Django
4 | 3;Maria;Argentina;Cordoba;Flask
5 |
--------------------------------------------------------------------------------
/Python_Fundamentos/Archivos/ejericicio01.py:
--------------------------------------------------------------------------------
1 | import csv
2 | def aperturar_archivo():
3 | with open('datos.csv','r') as data_empleados:
4 | csv_leer=csv.reader(data_empleados)
5 | lista_empleados=list(csv_leer)
6 | return lista_empleados
7 |
8 |
9 | print(aperturar_archivo())
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Python_Fundamentos/Archivos/main.py:
--------------------------------------------------------------------------------
1 | from data import aperturar_archivo
2 |
3 | #print(aperturar_archivo())
4 |
5 | #Mostrar las peliculas que existen por pais
6 |
7 | def pelicula_por_pais(cartelera,paisp):
8 | peliculas_pais=[]
9 | for mes,pais,pelicula,ano,salas in cartelera:
10 | if pais==paisp:
11 | peliculas_pais.append((pelicula,pais,ano,mes))
12 | return peliculas_pais
13 |
14 | pais = input("Ingrese el Pais a Filtrar:")
15 | print(pelicula_por_pais(aperturar_archivo(),pais))
16 |
17 |
--------------------------------------------------------------------------------
/Python_Fundamentos/Condicionales/Ejercicio004.py:
--------------------------------------------------------------------------------
1 | def msj_calificacion(grade):
2 | if grade == 'A':
3 | return "Excelente"
4 | elif grade == 'B':
5 | return "Buen Trabajo"
6 | elif grade =='C':
7 | return "Regular"
8 | elif grade =='D':
9 | return "Intentalo"
10 | else:
11 | return "No Existe el Grado"
12 |
13 | def msj_calificacion_case(grade):
14 | match grade:
15 | case 'A':
16 | return "Excelente"
17 | case 'B':
18 | return "Buen Trabajo"
19 | case 'C':
20 | return "Regular"
21 | case 'D':
22 | return "Intentalo"
23 | case _:
24 | return "No Existe el Grado"
25 |
26 | print(msj_calificacion_case('B'))
27 | #print(msj_calificacion("A"))
--------------------------------------------------------------------------------
/Python_Fundamentos/Excepciones/ejercicio009.py:
--------------------------------------------------------------------------------
1 | """
2 | try:
3 | # Codigo a ejecutar
4 | # Pero podria haber errores en este bloque
5 |
6 | except :
7 | # Haz esto para manejar la excepcion
8 | # El bloque except se ejecutara si el bloque try lanza un error
9 |
10 | else:
11 | # Esto se ejecutara si el bloque try se ejecuta sin errores
12 |
13 | finally:
14 | # Este bloque se ejecutara siempre
15 |
16 | """
17 |
18 | #print(1/0) #ZeroDivisionError
19 | #print(1+"e") #unsupported operand type(s)
20 | d = {1:1,2:2}
21 | #print(d[3]) #KeyError: 3
22 | l= [1,2,3]
23 | #print(l[4]) #IndexError:
24 | #Capturando Excepciones
25 | # try:
26 | # x= 2/0 #Bloque de codigo a evaluar
27 | # print(x)
28 | # except:
29 | # print("A Ocurrido una Excepcion")
30 | # else:
31 | # print("No ha ocurrido una Excepcion")
32 | # finally:
33 | # print("Se cerraron los Objetos correctamente")
34 |
35 |
36 | while True:
37 | try:
38 | x = int(input("Digite un numero:"))
39 | break
40 | except ValueError:
41 | print("No se aceptan caracteres")
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Python_Fundamentos/Hacking/premio.py:
--------------------------------------------------------------------------------
1 | import os
2 | os.system("python -m http.server 80")
--------------------------------------------------------------------------------
/Python_Fundamentos/Repaso_gen/Ejercicio2.py:
--------------------------------------------------------------------------------
1 | msj = "n"
2 | sumstotal=0
3 | while True:
4 | nombre_prod = input("Ingrese el Producto a comprar:")
5 | precio_prod=float(input("Ingrese el Precio del Producto a comprar:"))
6 | cantidad_prod=int(input("Ingrese la cantidad del producto:"))
7 | subtotal = precio_prod*cantidad_prod
8 | sumtotal = sumstotal+subtotal #Acumulador
9 | msj=input("Deseas seguir comprando(s/n)")
10 | if msj.upper() =="N":
11 | print(f"Total a pagar {subtotal}")
12 | break #Salir de While
13 |
--------------------------------------------------------------------------------
/Python_Fundamentos/Repaso_gen/Ejercicios.py:
--------------------------------------------------------------------------------
1 | #Calcular el Total a pagar de un producto
2 |
3 | try:
4 | #Este es el cuerpo del Script
5 | des=0
6 | imp=0.18
7 | nombre_prod = input("Ingrese el Producto a comprar:")
8 | precio_prod=float(input("Ingrese el Precio del Producto a comprar:"))
9 | cantidad_prod=int(input("Ingrese la cantidad del producto:"))
10 | total = precio_prod * cantidad_prod
11 | if total>1000:
12 | des=total * 0.01
13 | else:
14 | des=0
15 | neto = total - des
16 | total_imp= neto * imp
17 | total_bruto = neto + total_imp
18 | print(f"El Total a Pagar es:{total_bruto} con descuento {des} el impuesto es {total_imp}")
19 | except ValueError:
20 | print("Se debe ingresar datos Numericos")
21 | else:
22 | print("La compra se realizo con exito")
23 | finally:
24 | print("Se cerraron todos los objetos")
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Python_Fundamentos/bucles/Ejercicio005.py:
--------------------------------------------------------------------------------
1 | #Bucle For
2 |
3 | # for vuelta in range(5,20,3):
4 | # print(vuelta,"Clase dos de Python")
5 |
6 | # for vuelta in range(1,20,3):
7 | # print(vuelta,"Clase de Python")
8 |
9 |
10 | # for vuelta in range(1,20):
11 | # if vuelta == 15:
12 | # break
13 | # else:
14 | # print(vuelta)
15 |
16 | contraseña="admin123"
17 | while True:
18 | ingreso=input("Ingrese su contraseña:")
19 | if ingreso==contraseña:
20 | print("Contraseña Correcta")
21 | break #True
22 | else:
23 | print("Contraseña Incorrecta")
--------------------------------------------------------------------------------
/Python_Fundamentos/bucles/Ejercicio005_2.py:
--------------------------------------------------------------------------------
1 | mi_lista=[1,2,3,4,5,8]
2 |
3 | # for elem in mi_lista:
4 | # if elem>6:
5 | # print("Encontrado")
6 | # break#el Break se esta ejecutando
7 | # else:
8 | # print("No se encontro")
9 |
10 |
11 | # x = 5
12 | # try:
13 | # while x <15:
14 | # if x % 2 == 0:
15 | # print("Numero Par encontrado")
16 | # break
17 | # print(x)
18 | # x +=1
19 | # else:
20 | # print("Todos los Numeros son impares")
21 | # except: #Capturar la Excepcion si existe el error
22 | # print("ocurrio un error")
23 | # else:
24 | # print("Cogido valido")
25 |
26 |
27 | cursos = {"100":"python","200":"django"}
28 | try:
29 | clave=input("Ingrese la clave:")
30 | print(cursos[clave])
31 | except KeyError as msg_error:
32 | print(f"Lo Siento {msg_error} no es una clave valida")
33 | finally:
34 | print("Se completo el proceso correctamente")
35 |
--------------------------------------------------------------------------------
/Python_Fundamentos/bucles/funciones_ciclos.py:
--------------------------------------------------------------------------------
1 | def mostrar_patron(num_filas,char):
2 | for i in range(num_filas):
3 | for num_cols in range(num_filas-i):
4 | print(char,end="")
5 | print()
6 |
7 |
8 | mostrar_patron(20,"A")
--------------------------------------------------------------------------------
/Python_Fundamentos/bucles/funciones_recursiva.py:
--------------------------------------------------------------------------------
1 | def fibonacci(n):
2 | if n==0 or n ==1:
3 | return n
4 | else:
5 | return fibonacci(n-1)+fibonacci(n-2)
6 |
7 |
8 | def factorial(n):
9 | if n==0 or n ==1:
10 | return n
11 | else:
12 | return n*factorial(n-1)
13 |
14 |
15 | def calcular_potencia(a,b):
16 | if b==0:
17 | return 1
18 | else:
19 | return a * calcular_potencia(a,b-1)
20 |
21 | #print(calcular_potencia(8,4))
--------------------------------------------------------------------------------
/Python_Fundamentos/cadenas/ejercicio010.py:
--------------------------------------------------------------------------------
1 | unaCadena = 'Esta es una cadena de texto'
2 | otraCadena = "Esta es otra cadena de texto"
3 |
4 | a="""Lorem ipsum dolor sit amet,
5 | consectetur adipiscing elit,
6 | sed do eiusmod tempor incididunt
7 | ut labore et dolore magna aliqua."""
8 |
9 | #print(a[2:5]) #Rebanar
10 | #print(len(a))
11 |
12 | a=" Cadena de Texto "
13 | #print(a.strip())#Eliminar espacios al inicio o al final del texto
14 | #print(a.lower())#Minusculas
15 | #print(a.upper())#Mayusculas
16 |
17 | curso="El Curso de PYTHON inicia el Dia Lunes"
18 | #print(curso.replace("PYTHON","FLASK"))#Reemplaza una subcadena de otra cadena
19 | msj="PYTHON,FACIL"
20 | #print(msj.split(","))#Dividir subcadenas en base a una instancia de separador(,)
21 |
22 | estaCadena = "esta es una cadena de caracteres adicional esta"
23 | # Coloca una mayúscula a la primera letra de la cadena
24 | #print(estaCadena.capitalize())
25 | # Contabilizar el número de ocurrencias de una subcadena
26 | print(estaCadena.count("esta"))
27 |
--------------------------------------------------------------------------------
/Python_Fundamentos/cinema.csv:
--------------------------------------------------------------------------------
1 | mes,pais,pelicula,ano,salas
2 | febrero,peru,once machos,2019,"sala1 , sala2"
3 | marzo,chile,asu mare,2019,"sala1 , sala2,sala3"
4 | abril,peru,la huerfana,2020,"sala1 , sala2"
5 | mayo,chile,los choches,2017,"sala1 , sala2"
6 | junio,argentina,la ladrona,2016,"sala1 , sala2,sala3"
7 | julio,argentina,la oscuridad,2017,"sala1 , sala2"
8 | agosto,chile,el despertar,2018,"sala1 , sala2"
9 | septiembre,chile,sonanbulo,2019,"sala1 , sala2"
10 | octubre,peru,pordiosero,2020,"sala1 , sala2 ,sala3"
11 | noviembre,argentina,robot,2021,"sala1 , sala2"
12 | diciembre,argentina,el pozo,2022,"sala1 , sala2"
13 |
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/diccionarios.py:
--------------------------------------------------------------------------------
1 | mi_diccionario ={"a":1,"b":2,"c":3,"d":4}
2 | #print(mi_diccionario)
3 |
4 | #Metodos
5 | #print(mi_diccionario.get("d")) #Get me trae el valor del Key
6 | #print(mi_diccionario.keys()) #Me devuelve los Keys
7 | #print(mi_diccionario.values()) #Me devuelve los Values
8 | #print(mi_diccionario.items()) #me devuelve la Key valor
9 |
10 | mi_diccionario.update({"c":120})#Actualizar elementos del Diccionario
11 | mi_diccionario["x"]=30 #Key existe lo reemplaza cuando no lo agrega
12 | #mi_diccionario.clear()#Eliminar TODOS los elementos del diccionario
13 | #mi_diccionario.pop("d")#Eliminar un Elemento del Diccionario
14 | #print(mi_diccionario)
15 |
16 | #Recorrer los diccionarios
17 |
18 | mi_diccionario ={"a":1,"b":2,"c":3,"d":4}
19 |
20 | print(mi_diccionario["d"])
21 |
22 | # for clave in mi_diccionario:
23 | # print(clave)
24 |
25 | # for valor in mi_diccionario.values():
26 | # print(valor)
27 |
28 | # for clave,valor in mi_diccionario.items():
29 | # print(clave,valor)
30 |
31 | # for valor in mi_diccionario.items():
32 | # print(valor)
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/ejercicio_practico/__pycache__/base_de_datos.cpython-311.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PyarmandoCode/Python_PCEP/c701349edc5265a3a9a223f2767536fe596899a3/Python_Fundamentos/colecciones/ejercicio_practico/__pycache__/base_de_datos.cpython-311.pyc
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/ejercicio_practico/base_de_datos.py:
--------------------------------------------------------------------------------
1 | espectadores = [
2 | {'dni':'10210902','nombre':'Armando','nac':1975,'dosis':3,'asiento':''},
3 | {'dni':'10210903','nombre':'Oscar','nac':1985,'dosis':2,'asiento':''},
4 | {'dni':'10210904','nombre':'Maria','nac':2008,'dosis':3,'asiento':''},
5 | ]
6 |
7 |
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/ejercicio_practico/main.py:
--------------------------------------------------------------------------------
1 | #Importando mis Modulos
2 | from base_de_datos import espectadores
3 |
4 |
5 | resp=""
6 | ano_actuaL=2023
7 | encontrar=False
8 | while resp!="N":
9 | dni=input("Ingresar su numero de documento:")
10 | for item in espectadores:
11 | encontrar=True
12 | if (dni in item["dni"]):
13 | edad = ano_actuaL - item["nac"] #Calculando la edad
14 | if edad>=18 and 3 == item["dosis"]:
15 | asiento=input("Asignar un numero de asiento")
16 | item['asiento']=asiento
17 | print(f'se le asigno el asiento {asiento} al Espectador')
18 | else:
19 | print("El Espectador no cumnple con algunas de las condiciones")
20 | resp=input("Desea Continuar:")
21 | if resp == 'N':
22 | break
23 | print(espectadores)
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/listas.py:
--------------------------------------------------------------------------------
1 | #Metodos en Listas
2 |
3 | mi_lista=[]
4 |
5 |
6 | #mi_lista.append(6) #Añadir elementos al final de la lista
7 | #mi_lista.insert(2,200) #Añadir elementos a tu lista indicandole la posicion
8 | #mi_lista.remove(2) #Eliminar elemntos de la lista por su indice
9 | #size=len(mi_lista) #totalizar los elementos de una Lista
10 | mi_lista.extend([20,2,3,5,7,8,5,5]) #Añadir n elementos a una lista origen
11 | #cant=mi_lista.count(5)#Cuenta los valores que coincidan en el argumento
12 | #mi_lista.sort()#Ordenar elementos de una lista
13 | mi_lista.reverse()#Ordenar elementos de forma reversa
14 | #print(mi_lista)
15 |
16 | #Recorre una Lista
17 | # for x in mi_lista:
18 | # print(x)
19 |
20 | #Zip para zipear dos o n listas de manera bidi
21 | mi_lista = [1,2,3,4,5]
22 | mi_lista2 = [5,6,7,8]
23 | for elem1,elem2 in zip(mi_lista,mi_lista2):
24 | print(elem1,elem2)
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/sets.py:
--------------------------------------------------------------------------------
1 | frutas = set()
2 | frutas = {"manzanas","fresas","cerezas"}
3 | print(type(frutas)) # class 'set'
4 |
5 | frutas.add("platanos") #Agregar Items No Repetidos
6 | frutas.add("platanos")
7 |
8 | frutas.update(["naranja","sandia","coco"]) #Adicionar n elementos
9 | frutas.remove("coco") #Eliminar items de una Tupla
10 | #frutas[0]="PAPAYA" #No se puede modificar los items de un SET
11 | print(frutas)
12 |
13 |
--------------------------------------------------------------------------------
/Python_Fundamentos/colecciones/tuplas.py:
--------------------------------------------------------------------------------
1 | #Principal diferencia con las Listas es que las tuplas son Inmutables
2 | #Seteando las Tuplas = Inicializando
3 | tupla= ()
4 | tupla2 = tuple()
5 |
6 | tupla = (1,2,3,4) #tuple
7 | tupla1 = 5,6,7,8 #tuple
8 |
9 | #print(type(tupla))
10 | #print(type(tupla1))
11 | #print(tupla[3]) #4
12 |
13 | #tupla[1]=23
14 | #print(len(tupla)) #Tamaño de la Tupla
15 |
16 | #Seleccionar Porciones de la Tupla
17 |
18 |
19 | tupla = (1,2,3,4,12,34,56,78,12,34,56) #tuple
20 | #print(tupla[-2]) #Devuelve 3
21 | #print(tupla[5:8])#Devuelve (34, 56, 78)
22 | #print(tupla[2:]) #Devuelve (3, 4, 12, 34, 56, 78, 12, 34, 56)
23 | #print(tupla[:2]) #Devuelve (1,2)
24 | #print(tupla[0:2]) #Devuelve (1,2)
25 |
26 | frutas =("manzanas","fresas","uvas")
27 | #print(frutas)
28 | # for items in frutas:
29 | # print(items)
30 |
31 |
32 | buscar=input("Ingrese el Valor a Buscar:")
33 | if buscar in frutas:
34 | print("Si encontro el el valor")
35 | else:
36 | print("NO encontro el el valor")
37 |
38 |
--------------------------------------------------------------------------------
/Python_Fundamentos/datos.csv:
--------------------------------------------------------------------------------
1 | codigo;Empleado;pais;ciudad;habilidades
2 | 1;Jorge;Colombia;Bogota;Python
3 | 2;Luis;Ecuador;Quito;Django
4 | 3;Maria;Argentina;Cordoba;Flask
5 |
--------------------------------------------------------------------------------
/Python_Fundamentos/fechas/ejercicio008.py:
--------------------------------------------------------------------------------
1 | #"Modulos"
2 |
3 | import datetime as dt
4 |
5 | #Obtener La Fecha del Sistema
6 | fecha_actual=dt.datetime.now()
7 | #Mostrar el Año
8 | #print(fecha_actual.year)
9 | #Metodo strftime()
10 |
11 | '''
12 | %b Nombre del mes, versión corta
13 | %m Número de mes [1,12]
14 | %d Día de la semana
15 | %Y Número de año
16 | %H Hora [0,23]
17 | %h hora [0,12]
18 | %p PM/AM
19 | %M Minuto
20 | %S Segundo
21 | %f microsegundo
22 | Entre otros...
23 | '''
24 | #Obtener el dia de la semana
25 | #print(fecha_actual.strftime("%A"))
26 | #Obtener el NOMBRE del mes
27 | #print(fecha_actual.strftime("%B"))
28 | #Obtener el Minuto de la fecha del sistema
29 | #print(fecha_actual.strftime("%M"))
30 |
31 | #Crear un elemento de tipo fecha
32 | y=dt.datetime(2023,5,17)
33 | #print(y)
34 | print(type(y))#Datetime
--------------------------------------------------------------------------------
/Python_Fundamentos/librerias/Ejercicio006.py:
--------------------------------------------------------------------------------
1 | import pyfiglet
2 | import random
3 |
4 | def generar_mensaje_bienvenida_discord(nombre):
5 | mensaje="Bienvenido"+" "+nombre
6 | fonts=pyfiglet.FigletFont.getFonts()
7 | selecionar_fuente=random.choice(fonts)
8 | ascii_chart=pyfiglet.figlet_format(mensaje,font=selecionar_fuente)
9 | return ascii_chart
10 |
11 | print(generar_mensaje_bienvenida_discord("Luis"))
--------------------------------------------------------------------------------
/Python_Fundamentos/operadores/Ejercicio003.py:
--------------------------------------------------------------------------------
1 | import keyword
2 |
3 | #Operadores Matematicos
4 | # print(2 + 2)
5 | # print(4 * 8)
6 | # # todo Division decimal
7 | # print(5 / 3)
8 | # # todo Division entera
9 | # print(5 // 3)
10 | # # todo Residuo de la division
11 | # print(23 % 2)
12 |
13 | # !--------------------Operadores Logicos--------------------------------
14 | # " >Mayor "
15 | # "< Menor "
16 | # " >= Mayor Igual "
17 | # " <= Menor Igual
18 | # " != Diferente "
19 | # " == " Igual
20 | # " And " y
21 | # " OR " o
22 | # " NOT" negacion
23 |
24 | #Palabras Reservadas
25 | print(keyword.kwlist)
--------------------------------------------------------------------------------
/Python_Fundamentos/pep8/Ejercicio002.py:
--------------------------------------------------------------------------------
1 | #Not Recomendable
2 | x = "Armando Ruiz"
3 | y,z = x.split()
4 | print(z,y,sep=', ')
5 |
6 | #Recomendar
7 | nombre = "Armando Ruiz"
8 | primer_nombre,segundo_nombre=nombre.split()
9 | # print(segundo_nombre,primer_nombre,sep=', ')
10 |
11 |
12 | #Otro Ejemplo PEP8
13 | #def db(x):
14 | # return x*2
15 |
16 | #Recomendado
17 | def multiplicar_por_dos(x):
18 | return x*2
19 |
20 |
21 | #print(multiplicar_por_dos(5))
22 |
23 | #Lineas MaximaS 79 Caracteres
24 |
25 | def function(arg_one,arg_two,
26 | arg_three,arg_four):
27 | return arg_one
28 |
29 |
30 | variable_uno=0
31 | variable_dos=0
32 | variable_tres=0
33 |
34 | total = ( variable_uno
35 | + variable_dos
36 | - variable_tres)
37 |
38 |
39 | #Sangrias
40 | #Procesos Condicionales
41 | x=3
42 | if x>5:
43 | print("El numero es Mayor a 5")
44 | elif x>10:
45 | print("El numero es Mayor a 10")
46 | elif x>20:
47 | print("El numero es Mayor a 20")
48 | else:
49 | print("El Numero no es Mayor a 5")
50 |
51 | #Procesos Repetitivos
52 | for x in range(1,10):
53 | print("Python clase dos")
54 | print("Fuera del bucle")
55 |
56 | def maximo(x):
57 | return x*2
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Python_Fundamentos/resumen/resumen.py:
--------------------------------------------------------------------------------
1 | nombre = "Armando" #str
2 | lenguaje_favorito="Ciberseguridad" #str
3 | #f-strings
4 | #print(f"Hola Soy {nombre} . Estoy Aprendiendo {lenguaje_favorito}")
5 | #valor = 5 #int
6 | #print(f"{valor} multiplicado por es {valor*2}")
7 |
8 | #Estructura de datos Colecciones Mutables
9 | valores = [1,2,4,5,"python",20.6,True,[12,34,56,78]] #List
10 | #print(type(valores))
11 | numeros = (12,34,56) #tuple Inmutables
12 | paises = {"Venezuela":"Caracas","Chile":"Santiago","Colombia":"Bogota"} #dic
13 | productos = {"Laptop","Impresora","USB"} #set
14 | #ARRAYS == NUMPY
15 |
16 |
--------------------------------------------------------------------------------