Hello I am very new to this and 0 experience with this.
I am building an app to calculate GPA
I already build an UI which ask for
course: [Input course name]
grade: [Pull up a listpicker which alphabetical grade from A-E which I also assigned numerical number through dictionary]
credit number: [List picker from 1-3]
Whenever you finish input, you can [Save} the data through a button, there is a button to [Reset] everything
When you click on [Calculate GPA], I plan to let the program calculate by multiplying the course's grade (already assigned to numerical value) with the input credit number = total grade point (you can take >1 course so it's not counterintuitive), then divide these sums by total credit you take (for example: math, A+=4.5, 3 credits; science, A=4.0, 2 credit -> GPA = (4.5 x 3 + 4 x 2)/(3+2) )
I believe it needs a loop as well. I have made progress this far but stuck at the calculating GPA as I do not know the blocks well enough.
Please ignore the TinyDB1 as it is for something else
You may want to review what this community knows about calculating GPA scores:
You will need one more dictionary, with key = course name, and value = product of course credits (1-3) times grade for that course (0-4.5)
You will also need a dictionary with key = course name, and value = credits.
Once you have gone through all the courses, their credits and grades, and have filled in those dictionaries, your GPA will be gotten by dividing the sum of the values of the first dictionary by the sum of the values of the second dictionary.
I believe there is a dictionary block to give the list of values of a dictionary.
I also believe there is a math or list block for the sum of a list.
hello sorry for the late reply
but I am a bit confused about this block, can you elaborate a bit
because I don't have a pre-assigned list of course, you can just make up a new course, the only pre-assigned value is the course grade (alphabetical) and the course credit (1-3 credit/ course)
You can do this without a dictionary if you create two subtotal variables
- Total of credits so far
- Total of products of credits and scores
Just add to each total as you enter each course and grade.
P.S. The Gallery has a search function. Search for GPA.