Hallo allemaal,
Ik wil een python programma schrijven voor een opdracht.
Kan iemand mij a.u.b. helpen met het oplossen van deze opdracht?
ik heb al een deel geschreven, maar ik begrijp niet wat er fout is en welk deel ik nog mis.
Het gaat om de opdracht hieronder die ik voor een duidelijker weergave ook als bijlage heb toevoegd.
The file holds information on how well a program fared against other programs
of other students of different academic years. Each academic year is separated
by a . Each year starts off with a number, declaring which year the statistics
concern. After this, the file shows how well the program fared against students
of different studies. Each study is seperated by a . Next, each individual
match is declared. First, the name of the student is shown followed by a TAB
( ). The next number shows how long the program had to think against
this player. The last number is the percentage of pieces that the program has
conquered.
Write a program that makes a bar chart showing how often the program has
ended with 0-9%, 10-19%, . . . , 90-100% of the pieces. Do this by structural
parsing the input file.
Dit is wat ik geschreven heb:
Alvast heel erg bedankt!
Ik wil een python programma schrijven voor een opdracht.
Kan iemand mij a.u.b. helpen met het oplossen van deze opdracht?
ik heb al een deel geschreven, maar ik begrijp niet wat er fout is en welk deel ik nog mis.
Het gaat om de opdracht hieronder die ik voor een duidelijker weergave ook als bijlage heb toevoegd.
The file holds information on how well a program fared against other programs
of other students of different academic years. Each academic year is separated
by a . Each year starts off with a number, declaring which year the statistics
concern. After this, the file shows how well the program fared against students
of different studies. Each study is seperated by a . Next, each individual
match is declared. First, the name of the student is shown followed by a TAB
( ). The next number shows how long the program had to think against
this player. The last number is the percentage of pieces that the program has
conquered.
Write a program that makes a bar chart showing how often the program has
ended with 0-9%, 10-19%, . . . , 90-100% of the pieces. Do this by structural
parsing the input file.
Dit is wat ik geschreven heb:
Code:
my_file = open('statistics_input')
invoer = my_file.read()
academic_years = invoer.split('\n-\n')
def statistics_report(student_data):
student_data = student.split('\t')
program_numbers = student.split()
program_numbers = map(int, program_numbers.split())
time_thinks = program_numbers[0]
number_pieces = program_numbers[1]
percentage_groups = 10 * [0]
for pieces in number_pieces:
percentage_groups[pieces / 10] = + 1
return percentage_groups
def bar_chart(percentage_groups):
percentage_groups = 10*[0]
print percentage_groups
for academic_year in academic_years:
studies = academic_year.split('\n=\n')
for study in studies:
students = study.split('\n')
for student in students:
statistics_report(student_data)
data = statistics_report
barchart = BarChartUserInterface(10)
barchart.show()
Alvast heel erg bedankt!
Bijlagen
Laatst bewerkt door een moderator: