From de722603fb3e217c16a8c772c5b8f4ce16e8e61c Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:08:11 +0000 Subject: [PATCH] school.py update --- 1ano/fp/aula06/datafiles/school1.csv | 41 +++++++++++++------------ 1ano/fp/aula06/datafiles/schooldata.txt | 2 +- 1ano/fp/aula06/school.py | 7 ++--- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/1ano/fp/aula06/datafiles/school1.csv b/1ano/fp/aula06/datafiles/school1.csv index b059c86..eb43d84 100755 --- a/1ano/fp/aula06/datafiles/school1.csv +++ b/1ano/fp/aula06/datafiles/school1.csv @@ -1,20 +1,21 @@ -Numero Nome Curso Regime DataInscricao nota1 nota2 nota3 -42003 LUIS CARLOS FIGUEIREDO PAULO 8240 O 2006-10-03 16.6 16.5 16.8 -39652 FABIO ANDRE SABINO REAL 8040 O 2006-09-06 17.4 13.4 3.4 -34801 ABEL LUIS DIAS CARAPICHOSO 8220 O 2006-09-06 17.4 18.9 10.8 -30759 ELISABETE CLAUDIA SANTOS SILVA SOARES 8020 O 2006-09-05 17.6 17.6 14.3 -40747 JOEL DOS SANTOS MIRANDA 8220 O 2006-09-05 19.6 19.3 12.2 -39450 RUI BARBOSA SOARES FIGUEIREDO 8040 O 2006-09-05 16.8 14.1 7.7 -42847 NELSON MIGUEL BREDA COELHO 8204 O 2006-09-21 11.5 15.6 6.1 -36700 DAVID JOAO CASTILLO CARVALHO 8040 O 2006-09-06 13.6 11.7 5.4 -33955 NUNO JOSE SILVA DOS SANTOS MAGALHAES DA COSTA 8004 O 2006-11-21 12.3 9.8 6.3 -42304 JOAO PEDRO PEREIRA 8204 O 2006-09-19 20 16.9 15 -43021 NUNO MIGUEL MOGAS DA SILVA 8240 O 2006-10-16 17 16.4 11.4 -23973 BARBARA MARTINS BASTIAO PIRES 8240 O 2006-09-18 8.9 11.2 4.5 -35007 SANDRA CRISTINA LEAL DA GRACA 8220 O 2006-11-30 18.5 15.7 8.8 -38461 JOSE MANUEL VIEIRA DE ALMEIDA RAMOS 8004 O 2006-09-05 16.7 19.4 9.4 -10679 JOAO MANUEL MOREIRA CONCEICAO ANDRADE 8204 O 2006-11-21 15.4 15.5 6.5 -34385 NARCISO RESENDE SILVA 8028 T 2007-01-31 11.2 8.8 4.2 -38063 RUI MIGUEL ALVES FERNANDES PALHA 8004 O 2006-09-05 16.3 13 4.7 -37347 ROBERT DE FERNANDES 8028 O 2006-09-05 13.1 16.1 4.4 -24983 SANDRA ELISABETE PINHEIRO MORGADO CORREIA 8004 O 2006-09-05 10 7.6 7.5 +Numero Nome Curso Regime DataInscricao nota1 nota2 nota3 +40000 TIAGO ROCHA GARCIA 8000 O 2022-09-19 20 20 20 +42003 LUIS CARLOS FIGUEIREDO PAULO 8240 O 2006-10-03 16.6 16.5 16.8 +39652 FABIO ANDRE SABINO REAL 8040 O 2006-09-06 17.4 13.4 3.4 +34801 ABEL LUIS DIAS CARAPICHOSO 8220 O 2006-09-06 17.4 18.9 10.8 +30759 ELISABETE CLAUDIA SANTOS SILVA SOARES 8020 O 2006-09-05 17.6 17.6 14.3 +40747 JOEL DOS SANTOS MIRANDA 8220 O 2006-09-05 19.6 19.3 12.2 +39450 RUI BARBOSA SOARES FIGUEIREDO 8040 O 2006-09-05 16.8 14.1 7.7 +42847 NELSON MIGUEL BREDA COELHO 8204 O 2006-09-21 11.5 15.6 6.1 +36700 DAVID JOAO CASTILLO CARVALHO 8040 O 2006-09-06 13.6 11.7 5.4 +33955 NUNO JOSE SILVA DOS SANTOS MAGALHAES DA COSTA 8004 O 2006-11-21 12.3 9.8 6.3 +42304 JOAO PEDRO PEREIRA 8204 O 2006-09-19 20 16.9 15 +43021 NUNO MIGUEL MOGAS DA SILVA 8240 O 2006-10-16 17 16.4 11.4 +23973 BARBARA MARTINS BASTIAO PIRES 8240 O 2006-09-18 8.9 11.2 4.5 +35007 SANDRA CRISTINA LEAL DA GRACA 8220 O 2006-11-30 18.5 15.7 8.8 +38461 JOSE MANUEL VIEIRA DE ALMEIDA RAMOS 8004 O 2006-09-05 16.7 19.4 9.4 +10679 JOAO MANUEL MOREIRA CONCEICAO ANDRADE 8204 O 2006-11-21 15.4 15.5 6.5 +34385 NARCISO RESENDE SILVA 8028 T 2007-01-31 11.2 8.8 4.2 +38063 RUI MIGUEL ALVES FERNANDES PALHA 8004 O 2006-09-05 16.3 13 4.7 +37347 ROBERT DE FERNANDES 8028 O 2006-09-05 13.1 16.1 4.4 +24983 SANDRA ELISABETE PINHEIRO MORGADO CORREIA 8004 O 2006-09-05 10 7.6 7.5 diff --git a/1ano/fp/aula06/datafiles/schooldata.txt b/1ano/fp/aula06/datafiles/schooldata.txt index 3a97619..4436d69 100755 --- a/1ano/fp/aula06/datafiles/schooldata.txt +++ b/1ano/fp/aula06/datafiles/schooldata.txt @@ -36,6 +36,7 @@ Numero Nome Nota 39450 RUI BARBOSA SOARES FIGUEIREDO 12.9 39652 FABIO ANDRE SABINO REAL 11.4 39840 JOAO FILIPE MAGALHAES CARVALHO PINTO 17.7 + 40000 TIAGO GARCIA 20.0 40301 FILIPE MIGUEL FIGUEIREDO DA SILVA 9.5 40747 JOEL DOS SANTOS MIRANDA 17.0 41084 RICARDO JORGE MOREIRA SILVA MACHADO 11.4 @@ -57,4 +58,3 @@ Numero Nome Nota 43021 NUNO MIGUEL MOGAS DA SILVA 14.9 43222 MARCO RODRIGUES 10.3 43267 ELTON MONTEIRO GOMES 12.0 - diff --git a/1ano/fp/aula06/school.py b/1ano/fp/aula06/school.py index ab73d76..d56313a 100755 --- a/1ano/fp/aula06/school.py +++ b/1ano/fp/aula06/school.py @@ -23,10 +23,9 @@ def printPauta(lst, filename=""): text = f'{"Numero":>6} {"Nome":^50} {"Nota":>4}\n' for aluno in lst: text += f'{aluno[0]:>6} {aluno[1]:^50} {notaFinal(aluno):>4.1f}\n' - if filename == "": - print(text) - else: - print(text, file=open(filename, 'w')) + print(text) + with open(filename, 'w') as f: + f.write(text) # d)