
Programa que registra clientes y busque en un inventario
Publicado por KARINA (1 intervención) el 25/11/2019 00:30:59
MI PREGUNTA ES QUE NECESITO HACER UN PROGRAMA QUE REGISTRA CLIENTES Y BUSQUE EN UN INVENTARIO(ESTOS ESTAN EN OTRO ARCHIVO .TXT) AL PRINCIPIO EL DEL REGISTRO FUNCIONA PERO EL PROBLEMA EMPIEZA DESDE QUE AÑADI EL ELIF PARA BUSCAR EN EL INVENTARIO ESPERO ME AYUDEN :(
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
print("Bienvenido a la tienda")
class ropa:
def __init__(self):
self.codigo= 0
self.genero= " "
self.tipo=" "
self.talla=" "
self.color= " "
class cliente(ropa):
def __init__(self):
ropa.__init__(self)
self.clave= 0
self.nombre=" "
self.CP= 0
def Datos(self):
self.clave=input("Ingresa clave del cliente ")
self.nombre=input("Ingrese nombre del cliente ")
self.CP=input("Ingrese codigo postal")
def generar(self):
uno=open("CLIENTES.txt","r+")
linea=uno.readlines()
clave=str(len(linea)+1).zfill(4)
return clave
def altas(self,cl):
if cl=="1":
self.clave=self.generar()
self.Datos()
uno=open("CLIENTES.txt","r+")
uno.write(str(self.clave)+"\t"+self.nombre+"\t"+str(self.CP)+"\n")
uno.close()
print("Registro de cliente exitoso")
else:
uno=open("CLIENTES.txt","r+")
primero=uno.tell()
linea=uno.readline()
segundo=uno.tell()
verificar=False
while linea:
valores=linea.split("\t")
if cl==valores[0]:
uno.seek(primero-1)
cantidad=int(input("ingresa la cantidad adquirida:"))
uno.write(valores[0]+"\t"+valores[1]+"\t"+valores[2]+"\t"+valores[3]+"\t"+valores[4]+"\t"+str(cantidad+int(valores[5]))+"\t"+valores[6]+"\t"+valores[7]+"\t"+valores[8]+"\t"+valores[9]+"\t"+valores[10]+"\t"+valores[11]+"\t"+valores[12])
print("archivo actualizado")
verificar=True
break
else:
linea=uno.readline()
primero=segundo
segundo=uno.tell()
class vendedor(ropa):
def __init__(self,claveV,nombreV,puesto,CPV):
ropa.__init__(self,codigo,genero,tipo,talla,color)
self.claveV= 0
self.nombreV=" "
self.puesto=" "
self.CPV=0
class ticket(cliente,vendedor):
pass
Obj = cliente()
while True:
try:
c=input("Ingrese 1 para registrar el cliente, ingrese el codigo del objeto si desea comprar")
break
except:
print("No se pudo")
Obj.altas(c)
Valora esta pregunta


0