A_list vs. a_string

Hi
I am doing this lesson:
image

My question: how does Python know what a_string is in the below code? We have only defined a_list.

def max(a_list):
a_string = “No max value returned”
return(a_string)

Thanks a lot for your help!

Hey @mrasmus5

you have defined a_string here!

by seeing the quotes "text goes here…" Python knows you are trying to declare a string type variable called a_string.

hope this helps

adding on to what Rucha has said, you have defined a_string in the max() function and the return value (in this case a_string) gets stored in the variable max_val_test_0.

Thanks @masterryan.prof. I had to recheck my post and realized I wrote a_list instead of a_string. I have updated it now.

Thanks.

no worries at all @Rucha!

Thanks a lot - I have gotten more familiar now and see that my question was actually quite silly :slight_smile:

1 Like