Hello,

I need help to get all together. Pls see 2 different codes below .

1 code:
Represents format for final result paper called "vysvedcenie" (evaluation) for a particular student.

code:

``````def do_once(f):
f()

def do_twice(f):
f()
f()

def do_four(f):
do_twice(f)
do_twice(f)

def hlavicka():
print 'x',' '*40+'VYSVEDCENIE'+' '*46+'x'

def vertikal():
print 'x'+' '*98+'x'

def horizontal():
print 'xxxxx'*20

def udaje_student():
print 'x  Meno, Priezvisko:',' '*40,'Skolsky rok:',' '*24+'x'
print 'x  Kruzok:',' '*87,'x'

def hodnotenie():
print 'x  Predmety:', ' '*30,'Hodnotenie:',' '*43+'x'

def zaver():
print 'x  Celkovy prospech:',' '*77,'x'
print 'x  Menovany student presiel do dalsieho rocnika (ano/nie):',' '*39,'x'

def format_vysvedcenie():
horizontal()
hlavicka()
horizontal()
do_once(vertikal)
udaje_student()
horizontal()
do_once(vertikal)
hodnotenie()
do_four(vertikal)
do_four(vertikal)
horizontal()
do_once(vertikal)
zaver()
do_once(vertikal)
horizontal()

def main():
print format_vysvedcenie()

if __name__ == '__main__':
main()``````

output of this code is (attachement): output_vysvedcenie.doc

2 code:
Represents all information about students (who are defined inside Class). This code gives you all info about the particular student.

Here is a code:

``````class Cstudent():
def __init__(self, name):
self.name = name
self.predmety = []
self.priemer = []

'pridanie predmentu danemu studentovi'
self.predmety.append(predmet)

'pridanie znamky danemu studentovi'
for i in self.predmety:
if i.nazov == predmet:

def priemer_student(self):
'vytvorenie priemernej znamky zo vsetkyvh predmetov pre daneho studenta'
lstz=[]
for predmet in self.predmety:
for znamka in predmet.znamky:
lstz.append(znamka)
self.priemer= float(sum(lstz)) / float(len(lstz))

def get_predmet(self,predmet):
'nastroj, ktory vrati objekt predmetov'
for i in self.predmety:
if i.nazov==predmet:
return i

def __str__(self):
return 'Meno studenta: %s \nCelkovy priemer: %s' % (self.name,self.priemer)

def print_zoznam_predmetov(self):
lst = []
for prd in self.predmety:
lst.append(str(prd))
return '\n'.join(lst)

class Cpredmet():
def __init__(self, nazov):
self.nazov = nazov
self.znamky = []
self.absencia = 0

'prida znamky podla predmetu'
self.znamky.append(znamka)

'prida absent podla predmetu'
self.absencia=cislo

def average_predmet(self):
'vrati priemer podla predmetu'
if sum(self.znamky)==0:
pass
else:
return float(sum(self.znamky)) / float(len(self.znamky))

def __str__(self):
return 'Predmet: %s, Znamky: %s, Priemer: %s, Absencia: %s hod' % \
(self.nazov, str(self.znamky), self.average_predmet(), self.absencia)

def main():
# inicalizacia objektu student:
#-------------------------------
janko = Cstudent('Janko Mrkvicka')

# pridanie predmetu danemu objektu:
#-------------------------------

# pridanie znamky danemu objektu:
#-------------------------------

# pridelenie k objektu student absenciu podla objektu predmet

# celkovy priemer na studenta:
janko.priemer_student()
janka.priemer_student()

# output:
#-------------------------------------
print janko
print janko.print_zoznam_predmetov()
print '----------------------------------------------------------------------------------'
print janka
print janka.print_zoznam_predmetov()

if __name__ == '__main__':
main()``````

output of this code is:

Meno studenta: Janko Mrkvicka
Celkovy priemer: 2.0
Predmet: fyzika, Znamky: [4, 1], Priemer: 2.5, Absencia: 3 hod
Predmet: english, Znamky: [1], Priemer: 1.0, Absencia: 0 hod
Predmet: matematika, Znamky: [1], Priemer: 1.0, Absencia: 0 hod
----------------------------------------------------------------------------------
Celkovy priemer: 1.75
Predmet: dejepis, Znamky: [1, 2, 3], Priemer: 2.0, Absencia: 5 hod
Predmet: biologia, Znamky: [], Priemer: None, Absencia: 0 hod
Predmet: english, Znamky: [], Priemer: None, Absencia: 0 hod
Predmet: fyzika, Znamky: [1], Priemer: 1.0, Absencia: 0 hod

* just for explanation:
Name: Janko Mrkvicka
total average: 2.0
Subject: physic, marks: [4,1], average: 2.5, Absence: 5 hours
...etc

What I want to do is:
to put together this 2 codes with this result: pls see in the attachement (output_vysvedcenie2.doc) how it should look like.

Pls can you help me to get this desired output?