Created
December 5, 2016 17:42
-
-
Save feriancek/436c3e38d2814df34c3c2dca1e51baa0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [] | |
students = "" | |
courses = "" | |
def loadFile(): | |
global students | |
global courses | |
print() | |
# name = input("Enter the name of the file to be loaded:").lower() | |
name = 'data.csv' #remove me | |
with open(name) as file: | |
[file loading stuff here] | |
print("The following data was loaded:") | |
for row in data: | |
print(row) | |
students += row.get('name') | |
courses += row.get('course') | |
######### | |
elif menuInput == 'x': | |
studentName = input("Enter a student's name").lower() | |
courseName = input("Enter a students's course").lower() | |
if studentName not in students.lower(): | |
print("Student not found") | |
menu() | |
if courseName not in courses.lower(): | |
print("Course not found") | |
menu() | |
for row in data: | |
if studentName in row.get("name").lower() and courseName in row.get("course").lower(): | |
marks = int(row.get("ass1")) + int(row.get("ass2")) + int(row.get("ass3")) + \ | |
int(row.get("ass4")) + int(row.get("exam")) | |
print("The sum of this student's marks is:", marks) | |
menu() | |
print("Student not enrolled in that course") | |
menu() | |
else: | |
print("Input not recognized, please try again") | |
menu() | |
menu() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment