-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
68 lines (55 loc) · 2.18 KB
/
test.py
File metadata and controls
68 lines (55 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
lista = []
partes = ["867961-B21", "840369-A21", "777876-H55-H6"]
def grabarParte():
numero_parte = input("Ingrese numero el parte: ")
if partes.__contains__(numero_parte):
nombre_producto = input("Ingrese nombre del producto: ")
if len(nombre_producto) >= 6:
precio_producto = int(input("Ingrese precio del producto: "))
if precio_producto > 0:
producto = [numero_parte, nombre_producto, precio_producto]
lista.append(producto)
print(f"El producto '{nombre_producto}' se ha grabado correctamente.")
else:
print(f"El precio del producto tiene que ser mayor a cero.")
else:
print(f"El nombre del producto '{nombre_producto}' debe contener minimo 6 caracteres.")
else:
print(f"El numero del parte '{numero_parte}' no es valido.")
def buscarParte():
numero_parte = input("Ingrese el numero de parte a buscar: ")
if partes.__contains__(numero_parte):
for producto in lista:
if producto[0] == numero_parte:
print(f"Numero de parte: {producto[0]}")
print(f"Nombre del producto: {producto[1]}")
precio_producto = producto[2]
if precio_producto > 500:
print(f"Precio del producto: {precio_producto}")
else:
print(f"Precio del producto: Sin Stock")
else:
print(f"El numero de parte '{numero_parte}' no existe.")
def imprimirParte():
for producto in lista:
print(f"Numero de parte: {producto[0]}")
print(f"Nombre del producto: {producto[1]}")
print(f"Precio del producto: {producto[2]}")
print("")
while True:
print("Menu Principal")
print("1. Grabar Parte")
print("2. Buscar Parte")
print("3. Imprimir Partes")
print("4. Salir")
opcion = int(input("Ingrese una opcion: "))
if opcion == 1:
grabarParte()
elif opcion == 2:
buscarParte()
elif opcion == 3:
imprimirParte()
elif opcion == 4:
print("Gracias por usar el programa.")
print("Software desarrollado por: @RisasDev (v1.0)")
break