![]() ![]() What you did wrong in your code, is that you've put the two for loops by themselves. I picked up coding 2 months before ending my Masters degree (soon two years. Try to rewrite the code from scratch and tell what didn't go well I have a bachelor in Management and a Masters in Finance. This is probably an integrity violation in your class. This honour is given to students who obtain an average grade within the top 8 of the faculty of Engineering at the University of Nottingham, a world top 75. Remember, don't use this exact code for your submission. The general time management tips for students, such as sleeping. I have also added some error handling code (while loops), so if a user inputs a string instead of a grade, it will ask again: As a student, organizing your days will eliminate stress and ensure that you are productive. This is to elaborate on sshashank124's answer and add the user input function. Grade = eval(input("Enter the grades for the student: ")) Student = input("Enter the number of the student: ") ROWS = int(input("Enter the number of grades per student: ")) def avgavg(): How would I go about solving this? This is my latest attempt:ĬOLS = int(input("Enter the number of students: ")) I have tried to start this a few different ways and I cannot seem to get my inputs to connect to anything. The second line will contain just one number: the average class grade, defined as the average of all student average grades. The first line will contain a list containing every student’s average grade. The function avgavg() should print, on the screen, two lines. For example, here is an input list for a class of four students (you never know how many students you will have to process):, ,, ] Each three-number list represents the three grades a particular student received for a course. Print("".format(Īnd of course, we have to run main(): if _name_ = "_main_":Įrror handling would make this code longer, feel free to add it.The function avgavg() takes as input a list whose items are lists of three numbers. Print("Student name Exam1 Exam2 Exam3 Avg Grade") If I'm not wrong, only the last piece is missing: def printdata(data): However, we haven't defined the function yet. ![]() score and the actual grade letter as a result of a function call. Then, we've added a row to the resulting list where row item contains the original row items, the avg. def getgrade (grades:list): '''compute final grade based on scores and their weights''' result 0 for a in grades: result average (a.scores) a.weight return result I think you could simplify this with a bit more OOP. Result.append(item )Īs you can see, we've just converted list of exam results into a list of integers, then we've computed the average rating. Grades = list(map(int, item)) # List of exams Next, we should do some math: def processdata(data): I need to do this with a CSV file with all the student's information already detailed. Prerequisites: Open only to MBA, MSBAPM, and MS FinTech students, others with consent. So I need to create a program that displays: student name, exam 1, exam 2, exam 3, total grade and letter grade in the class. Data Management and Business Process Modeling. However, I still preffer csv.reader in this case since rows as list make further processing easier. I am fairly new to python and I have an assignment the I am having trouble with and need some help. If we know there is a header line in the CSV file, we can use csv.DictReader instead of csv.reader. Headerrow = False if headerrow else data.append(row) ![]() Reading data from CSV file is pretty straightforward: def readdata(filename): add grades to assignments enter name of student and assignment name then input the grade. add assignments add the name of the assignment and it appears for all students with a defalt grade of '-'. We want to read data from CSV file, process the data and print formatted output. creating a student and grade database in python. Also, I don't want to use pandas to get this work, I'm only using CSV. ![]() If anyone can help I would really appreciate it. I don't understand why am I not able to make the program work like the output I stated above. (Note Import include as from django. Step 6: Go to urls.py of studentmanagementproject and add the below path in urlpatterns. this is what I get:Ĭesar Ryan 80 97 95 Percent: 88.5 Letter Grade: B python manage.py startapp studentmanagementapp Step 5: Go to studentmanagementproject -> settings.py -> INSTALLEDAPPS and add our app ‘studentmanagementapp’. Print(first_name, last_name, exam1, exam2, exam3, ' Percent:', percent, ' Letter Grade:', gradeToReport) the CSV file looks like this:įor row in csvParsed: if readingHeaderLine:įor index in range(2,4): thisGrade = row\ So I need to create a program that displays: student name, exam 1, exam 2, exam 3, total grade and letter grade in the class. I am fairly new to python and I have an assignment the I am having trouble with and need some help. ![]()
0 Comments
Leave a Reply. |