Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Untitled.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@



Comment thread
agbragin marked this conversation as resolved.
def sheet_data(sheet):
Comment thread
agbragin marked this conversation as resolved.

Comment thread
StudentMAGe marked this conversation as resolved.
out = list()

Comment thread
StudentMAGe marked this conversation as resolved.
sheetIndex = 0
Comment thread
agbragin marked this conversation as resolved.
Comment thread
agbragin marked this conversation as resolved.
for X in range(1, s.nrows):
Comment thread
agbragin marked this conversation as resolved.
learner = s.row_values(X)
Comment thread
agbragin marked this conversation as resolved.
print(learner)
average=sum(learner)
Copy link
Copy Markdown
Owner Author

@StudentMAGe StudentMAGe Sep 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"learner" contains text data at position [1], so the sum should be impossible. Another name for the function is needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've redefined sum at line 17 so I'm not sure, that there will be some problems here. Have you tried to run the code?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the code works, but I thought, that's not what we are talking about here...

out.append([learner[1], average])

Comment thread
StudentMAGe marked this conversation as resolved.
return out

def sum(learner):
Comment thread
agbragin marked this conversation as resolved.
average = 0
for score in range(2, len(learner)) :
average = average+learner[score] // 2
Comment thread
agbragin marked this conversation as resolved.
Comment thread
agbragin marked this conversation as resolved.
Comment thread
agbragin marked this conversation as resolved.
if debug>0:
Comment thread
agbragin marked this conversation as resolved.
print(learner[score], average)
return average

import xlrd
Comment thread
agbragin marked this conversation as resolved.

a = xlrd.open_workbook("БИОЛОГИ_ таблица успеваемости осень 2018.xlsx")
debug = 1

for s in a.sheets():
Copy link
Copy Markdown
Owner Author

@StudentMAGe StudentMAGe Sep 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is a.sheets()? I just don't get it..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try to get it from xlrd package documentation / API reference.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

if (s.name == 'Python') == True:
Comment thread
agbragin marked this conversation as resolved.
out = sheet_data(s)
if debug == 1:
print(out)


class PRESENT_RESULT :
Comment thread
agbragin marked this conversation as resolved.
Comment thread
agbragin marked this conversation as resolved.
def __init__(self, a):
self.a=a
def __str__(self):
return self.a



Comment thread
agbragin marked this conversation as resolved.

print("RESULT:")

resultat = ''
Comment thread
agbragin marked this conversation as resolved.

for _ in range(1, len(out)):
resultat += str(out[_])

print(PRESENT_RESULT(resultat))
Comment thread
agbragin marked this conversation as resolved.