Feb-05-2019, 04:01 PM
(This post was last modified: Feb-05-2019, 04:12 PM by Phynomeagle.)
I am attempting to obtain the weighted grade categories and their weight value; however, the number of categories are not defined (no pun intended). This means that the iteration will loop based on the number input by the user. For example, the program will ask "how many categories?". If the user indicates 5 categories, then I want the program to create 5 variables for those categories. If the user input 9 categories, then there will need to be 9. My question is there a way to program these variables based on the number of categories without having a fixed number of variables. I can easily tell my basic program to have 5 variables in a somewhat static state, but what if the weighted categories are 9, instead of 5. Hope this helps to understand my problem.
Sorry I cannot produce any code, because I haven't written the code yet...I am only in my 4th week of learning Python...professor is asking to develop pseudo code for calculating weighted grades; however, I cannot get to the next step in my planning if I don't understand the constraints of the language.
Something just came to me. Can I build a loop that has a range of available variables, for example a-z, and assign those variables to the user-input categories based on a number input by the user?
For example -
pseudo code:
define a-z as available variables
input "How many categories?"
#User inputs x number of categories
#x of the range of variables are assigned to the user input categories
What do you think?
Sorry I cannot produce any code, because I haven't written the code yet...I am only in my 4th week of learning Python...professor is asking to develop pseudo code for calculating weighted grades; however, I cannot get to the next step in my planning if I don't understand the constraints of the language.
Something just came to me. Can I build a loop that has a range of available variables, for example a-z, and assign those variables to the user-input categories based on a number input by the user?
For example -
pseudo code:
define a-z as available variables
input "How many categories?"
#User inputs x number of categories
#x of the range of variables are assigned to the user input categories
What do you think?