#### Video Demo: https://www.youtube.com/watch?v=yhMp2AJqAow
#### Description: This projects attempts to mimic the numerous admission calculators that attempt to calculate the approximate chance of being accpeted
into a certain university. These calculators often use standard information from the student to determine their chance of being accpeted, such as grades,
exctracurriculars, the major the student is applying to, the quality of their written essays, and so on.
The CS50 University Calculator attempts to do just that, by collected information from the user that would be used to best determine their chances of getting accepted into the imaginary CS50 University. The program known as project.py uses a set of seven different criteria, which are as follows: the majo that the student is applying to, their most recent semester grades, their extracurricular activities, their awards, their supplemental written essays, their letters of recommendation, and finally, the decision cycle that they are going to submit their application under. Each of the criteria was collected using input and then put as an argument into 7 different functions, one for each criteria. The main function prints the instruction for the user, collects input, and executes the different functions. Using a combination of try/catch blocks, if/else statements, and break statements, the program reprompts the user of input. The program starts out with a friendly message to the user and begins to ask for the different criteria.
The first function is the pick_major() function, which accepts the student's major as the inout out of a list of 4 options. The input is rendered case and space-insensitive and then based on the major that is picked, the chance of accpetance is returned. This number is obviously larger for the easier majors, such as art, and smaller for the more competitive majors, such as engineering. The phraee "Not valid" is returned if the major that the student picks is not contained within the list of 4 available options. This would then cause the main function to reprompt the user for their major using an if/else statement.
The second function is the enter_grades() function, which accepts a list of 7 grades from the user using the split function, which uses a comma as the punctuation to split from. A variable known as "chance" is initially instantiated at 0, representing the chance of acceptance. The function then loops through the list, adding a quantity to the chance variable based on the number grade, and finally returns the chance variable. Were the user to not use commas, or enter in more or less than 7 grades, or type in invalid values, such as negatives or even words, the function would return "Not valid" and the user would be reprompted for their list of grades.
The third function is the activities() function, which takes in 3 different arguments: the number of activities, the hours done per week, and the number of weeks per year. These 3 values are then multiplied, and based on the magnitude of the product, a chance of accpetance is returned. However, the user can only submit a total of 10 activities. Would the number to go over 10, the program would return "Not valid" and reprompt the user for the number of activities. Similarly, were the total number of hours per week to exceed 168, or the number of weeks per year to exceed 52, the program would reprompt the user for this information as well.
The fourth function is the awards() function, arguably one of the simplest functions. The user simply enters how many awards they have recieved, with a maximum of 10 awards, and a chance of acceptance is returned based on the number. Were the user to input a number more than 10 or not input an integer, the program would catch this and reprompt the user for information once the "Not valid" statement is returned.
The fifth function is the supp_essays() function, which takes in the user's self judged-quality of their essays, given as a percentage. If the input does not include a percent sign or is invalid in any other way, such as the percent exceeding 100%, the program reprompts the user. If it is valid, the string is removed of the percent sign, casted to an int, and thr returned, acting as the chance of acceptance.
The sixth function is the rec_letters() function, which takes in the number of recommendation letters being submitted as well as an estimate of how well the teacher knows the student, given as a percentage. In this function, only 3 rec letters are allowed to be submitted, and any more than that is considered invalid. The program also returns "Not valid" in other cases, like if the user does not submit a valid percentage or inputs a string instead of a number. If both arguments are considered valid, they are multiplied and a chance of acceptance is returned based off of the magnitude of the product.
The seventh and final function for the criteria is the decision_time() function, which is another function that is more on the simple side. The programs asks the user whether they are going to submit early or regular decision. The answer is rendered case and space-insensitive and the function tests whether the answer is a valid response using a list of valid responses, namely "early decision" or "ed" for short, and "regular decision" and "rd" for short. If the user selected some rendition of early decision, a higher chance of acceptance is returned. If the reponse is invalid, the function returns "Not valid" and the program reprompts the user for their decision cycle.
Lastly, another function is used to calculate the final chance of acceptance, known as the calculate_chance() function. This function takes in the 7 different criteria collected from the user and uses a set of 7 different multiplier. These multiplies are of varying quantity, according the the importance of different criteria. For example, the multiplier for the user's activities is higher than that of the user's letters of recommendation. The values returned by the 7 functions are all multiplied by their corresponding multipliers and added up, totaling the final chance of acceptance into CS50 University. A final message is then displaying using an fstring, thanking the user, giving them their chance of acceptance, and exiting the program.
The test_project.py file contains the testing functions for each of the 7 functions within project.py that take in the 7 different criteria. The file first imports the 7 different functions from project.py in order to test them. Each of the testing functions uses the "assert" statement in order to test the functions and pytest is used to see if all of the tests pass successfully.
The test_pick_major() project tests different inputs of majors as well as inputs that contains whitespace as well as different capitalizations to test the functionalities of the pick_major function.
The test_enter_grades() function tests different lists of grades that return different values, testing lists of grades of different values and even lists that contain more or less than 7 grades, which are considered invalid.
The test_activities() function tests different inputs of the number of actvities, the hours per week, and weeks per year, and also invalid inputs. These include number of activities which are greater than 10 and inputs that contain more than 52 weeks, which both return "Not valid".
The test_awards() function tests different inputs of number of awards, such as numbers of awards both in and out of the threshold of awards that are valid and invalid, respectively.
The test_supp_essays() function tests different percentage inputes of different values and eveninvaldi inputs including numbers without percent signs and conversely, string with a percent sign.
The test_rec_letters() function tests different numbers of rec letters inputed as well as different percentages that clarify how well the student's teachers know them. The function tests invalid quantities of rec letters, such as those above 3, as well as invalid percentages, such as numbers without the percent sign, and returns "Not valid". Of course, the function also tests valid inputs and returns the corresponding chance of acceptance for those certain inputs.
Finally, the test_decision_time() function tests different responses to the decicsion cycle question, and different arguments into the decision_time() function. This includes arguments that contain whitespace as well as answers with different capitalization. It also tests arguments that are not within the list of valid responses, for which the string "Not valid" is returned.
-
Notifications
You must be signed in to change notification settings - Fork 0
siddharth-d44/CS50-University-Admission-Calculator
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Displays the code for my CS50 University Admission Calculator!
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published