Advertisement
gsoriano

Corte de control

May 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. with open('movimientos.txt', 'rt') as movs:
  2.     linea = movs.readline()
  3.     nro_cta, importe = linea.rstrip().split(',') if linea else ('', '')
  4.     print (nro_cta, importe)
  5.     total = 0
  6.  
  7.     while linea:
  8.         cta_ant = nro_cta
  9.         tot_cta = 0
  10.         print ('cta',cta_ant)
  11.         print ('importe',importe)
  12.  
  13.         while linea and nro_cta == cta_ant:
  14.             print (importe)
  15.             tot_cta += int(importe)
  16.             print (nro_cta, importe)
  17.             linea = movs.readline()
  18.             nro_cta, importe = linea.rstrip().split(',') if linea else ('', '')
  19.  
  20.         print ('cierre')
  21.         print ('El total de la cuenta {} es {}:'.format(cta_ant, tot_cta))
  22.         total += tot_cta
  23.  
  24. print ('Total Gral:', total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement