Feb-17-2018, 06:58 PM
Hey all. I'm working on an assignment from an intro to Python course on Coursera and I'm trying to check all my functions. I have a function, shown below, that is supposed to return type NoneType. I am trying to test the function in the shell by creating a variable used in the function (player_info) and populating that variable with required information, and then seeing if my function changes the values stored in the variable. So far, I've had no luck. I referenced/looked up what a few other people have done for this function and I think that my code is good but I would ultimately like to know how I can test this function to be sure.
def update_score(player_info, word): """ ([str, int] list, str) -> NoneType player_info is a list with the player's name and score. Update player_info by adding the point value word earns to the player's score. >>> update_score(['Jonathan', 4], 'ANT') >>> update_score(['Anthony', 4], 'JOBS') """ ## How to test? In shell I tried to assign str and int values to ## player_info to see if this function would change the value stored at ## player_info[1] but had no luck player_info = player_info[1] + word_score(word)The function calls another function (word_score) and that function works correctly as far as I can tell (have messed with it in the shell a couple different ways). The other variable, player_info, is in another file that is supposed to be the driver for this word-search game, and is a file that I was provided with in the MOOC course materials.