Need help defining a function

I want to create a function that creates a string based on information passed to the function- can a function return a value? Can user-defined functions access top-level variables?

yes. but if you are passing data into the function then the function doesn’t need to access top-level (global) variables.

just do

def new_function( input1, input2 ):
    return input1+input2

then do

new_string = new_function("blah","gee")

Thanks so much! Appreciate it