The problem
I want get_scores to take tests and use it as an int for x > 0 but be able to print tests. I've tried fiddling around for awhile and I can't get what I want.
What I've tried
My problem is that I want the get_scores method to print "What percentage are tests weighted". Tests is assigned to an int so it can't print anything unless I do this which prints an int which I don't want it to do:
int(input("What percentage are" + str(x) + "weighted?"
I've tried a couple different things such as:
get_initial_input function ( like this: testsp = get_scores("tests") )
This makes it so x > 0 can't be processed because x is a string. I also tried:
int(x) > 0
... to see if it was as simple as changing it back to an int (didn't work).
The code
def main():
tests = get_initial_input("tests")
assignments = get_initial_input("assignments")
exercises = get_initial_input("exercises")
labs = get_initial_input("labs")
finals = get_initial_input("finals")
testsp = get_scores(tests)
assignmentsp = get_scores(assignments)
exercisesp = get_scores(exercises)
labsp = get_scores(labs)
finalsp = get_scores(finals)
def get_initial_input(x):
val = int(input("How many "+ x + " were there? "))
return val
def get_scores(x):
if x > 0:
xp = int(input("What percentage are "+ str(x) + " weighted?"))
return xp
main()
Is there anyway to get what I want?
Thanks for your help in advance.