-
Notifications
You must be signed in to change notification settings - Fork 0
Python homework-0 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
|
|
||
|
|
||
|
|
||
| def sheet_data(sheet): | ||
|
agbragin marked this conversation as resolved.
|
||
|
|
||
|
StudentMAGe marked this conversation as resolved.
|
||
| out = list() | ||
|
|
||
|
StudentMAGe marked this conversation as resolved.
|
||
| sheetIndex = 0 | ||
|
agbragin marked this conversation as resolved.
agbragin marked this conversation as resolved.
|
||
| for X in range(1, s.nrows): | ||
|
agbragin marked this conversation as resolved.
|
||
| learner = s.row_values(X) | ||
|
agbragin marked this conversation as resolved.
|
||
| print(learner) | ||
| average=sum(learner) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've redefined
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]) | ||
|
|
||
|
StudentMAGe marked this conversation as resolved.
|
||
| return out | ||
|
|
||
| def sum(learner): | ||
|
agbragin marked this conversation as resolved.
|
||
| average = 0 | ||
| for score in range(2, len(learner)) : | ||
| average = average+learner[score] // 2 | ||
|
agbragin marked this conversation as resolved.
agbragin marked this conversation as resolved.
agbragin marked this conversation as resolved.
|
||
| if debug>0: | ||
|
agbragin marked this conversation as resolved.
|
||
| print(learner[score], average) | ||
| return average | ||
|
|
||
| import xlrd | ||
|
agbragin marked this conversation as resolved.
|
||
|
|
||
| a = xlrd.open_workbook("БИОЛОГИ_ таблица успеваемости осень 2018.xlsx") | ||
| debug = 1 | ||
|
|
||
| for s in a.sheets(): | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is a.sheets()? I just don't get it..
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can try to get it from
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
| if (s.name == 'Python') == True: | ||
|
agbragin marked this conversation as resolved.
|
||
| out = sheet_data(s) | ||
| if debug == 1: | ||
| print(out) | ||
|
|
||
|
|
||
| class PRESENT_RESULT : | ||
|
agbragin marked this conversation as resolved.
agbragin marked this conversation as resolved.
|
||
| def __init__(self, a): | ||
| self.a=a | ||
| def __str__(self): | ||
| return self.a | ||
|
|
||
|
|
||
|
|
||
|
agbragin marked this conversation as resolved.
|
||
|
|
||
| print("RESULT:") | ||
|
|
||
| resultat = '' | ||
|
agbragin marked this conversation as resolved.
|
||
|
|
||
| for _ in range(1, len(out)): | ||
| resultat += str(out[_]) | ||
|
|
||
| print(PRESENT_RESULT(resultat)) | ||
|
agbragin marked this conversation as resolved.
|
||
Uh oh!
There was an error while loading. Please reload this page.