Skip to content

Instantly share code, notes, and snippets.

@Haylin-chama
Created November 6, 2014 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Haylin-chama/65d1fabcef9e06ed9d9d to your computer and use it in GitHub Desktop.
Save Haylin-chama/65d1fabcef9e06ed9d9d to your computer and use it in GitHub Desktop.
Actividad 2
def TotalConducido(CodigoConductor,txt):
horas=0
for linea in txt:
dato=linea.split("#")
if dato[2]==CodigoConductor:
horas=horas+dato[3]
return horas
def MostrarConductores(txt):
for linea in txt:
def main():
txt=open("Recorridos.txt","r")
CodigoConductor=raw_input("Codigo del Conductor: ")
print "Horas conducidas por ",CodigoConductor,": ",TotalConducido(CodigoConductor,txt)
102#01-10-2014#10200#5#32
102#01-10-2014#10210#7#30
102#01-10-2014#10220#4#30
102#01-10-2014#10350#6#32
103#01-10-2014#12350#8#32
103#01-10-2014#14578#2#30
102#02-10-2014#10200#3#32
102#02-10-2014#10210#5#30
102#02-10-2014#10220#8#30
102#02-10-2014#10350#1#32
103#02-10-2014#12350#6#32
103#02-10-2014#14578#5#30
104#03-10-2014#10200#4#30
104#03-10-2014#10210#6#32
102#03-10-2014#10220#8#30
103#03-10-2014#10350#2#30
104#03-10-2014#12350#3#32
104#03-10-2014#14578#5#32
103#03-10-2014#10200#8#30
102#04-10-2014#10350#1#30
102#04-10-2014#12350#6#32
102#04-10-2014#14578#5#30
103#04-10-2014#10200#4#30
103#04-10-2014#10210#6#32
102#04-10-2014#10220#8#32
102#04-10-2014#10350#2#30
102#04-10-2014#12350#2#30
102#05-10-2014#10210#8#32
103#05-10-2014#10220#2#30
103#05-10-2014#10350#3#30
102#06-10-2014#10200#5#32
102#06-10-2014#10210#7#30
102#06-10-2014#10220#4#30
102#06-10-2014#10350#6#32
103#06-10-2014#12350#8#32
103#07-10-2014#14578#2#30
102#07-10-2014#10200#3#32
102#07-10-2014#10210#5#30
102#07-10-2014#10220#8#30
102#07-10-2014#10350#1#32
103#08-10-2014#12350#6#32
103#08-10-2014#14578#5#30
104#08-10-2014#10200#4#30
104#08-10-2014#10210#6#32
102#08-10-2014#10220#8#30
103#09-10-2014#10350#2#30
104#09-10-2014#12350#3#32
104#09-10-2014#14578#5#32
103#09-10-2014#10200#8#30
102#10-10-2014#10350#1#30
102#10-10-2014#12350#6#32
102#10-10-2014#14578#5#30
103#10-10-2014#10200#4#30
103#11-10-2014#10210#6#32
102#11-10-2014#10220#8#32
102#11-10-2014#10350#2#30
102#11-10-2014#12350#2#30
102#12-10-2014#10210#8#32
103#12-10-2014#10220#2#30
103#12-10-2014#10350#3#30
102#13-10-2014#10200#5#32
102#13-10-2014#10210#7#30
102#13-10-2014#10220#4#30
102#13-10-2014#10350#6#32
103#14-10-2014#12350#8#32
103#14-10-2014#14578#2#30
102#14-10-2014#10200#3#32
102#14-10-2014#10210#5#30
102#15-10-2014#10220#8#30
102#15-10-2014#10350#1#32
103#15-10-2014#12350#6#32
103#16-10-2014#14578#5#30
104#16-10-2014#10200#4#30
104#17-10-2014#10210#6#32
102#17-10-2014#10220#8#30
103#17-10-2014#10350#2#30
104#18-10-2014#12350#3#32
104#18-10-2014#14578#5#32
103#18-10-2014#10200#8#30
102#19-10-2014#10350#1#30
102#19-10-2014#12350#6#32
102#19-10-2014#14578#5#30
103#20-10-2014#10200#4#30
103#20-10-2014#10210#6#32
102#20-10-2014#10220#8#32
102#20-10-2014#10350#2#30
102#21-10-2014#12350#2#30
102#21-10-2014#10210#8#32
103#21-10-2014#10220#2#30
103#21-10-2014#10350#3#30
103#22-10-2014#10200#4#30
103#22-10-2014#10210#6#32
102#22-10-2014#10220#8#32
102#22-10-2014#10350#2#30
102#23-10-2014#12350#2#30
102#23-10-2014#10210#8#32
103#23-10-2014#10220#2#30
103#23-10-2014#10350#3#30
103#24-10-2014#10200#4#30
103#24-10-2014#10210#6#32
102#24-10-2014#10220#8#32
102#24-10-2014#10350#2#30
102#25-10-2014#12350#2#30
102#25-10-2014#10210#8#32
103#25-10-2014#10220#2#30
103#25-10-2014#10350#3#30
103#26-10-2014#10200#4#30
103#26-10-2014#10210#6#32
102#26-10-2014#10220#8#32
102#27-10-2014#10350#2#30
102#28-10-2014#12350#2#30
102#28-10-2014#10210#8#32
103#28-10-2014#10220#2#30
103#29-10-2014#10350#3#30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment