I am trying to get a (very) basic understanding of Python and its functions, and I found a way that it returns the text I want it to when used later within the script, but I cannot seem to have it output the solution to the math problem within the code and just the equation.
The code I am using is this:
def YearTime():
return "Minutes in a year: (60*24)*365 "
YT = YearTime()
print(YT, "!", "Hello 2024!")
What I want it to output is
"Minutes in a year: 525600 ! Hello 2024!
but it just outputs
Minutes in a year: (60*24)*365 ! Hello 2024!
(60*24)*365and store that in a variable, sayresult. STEP 2, figure out how to format a string with theresultvariable value. STEP 2 would lead you to the How do I put a variable’s value inside a string? These 2 steps are not just for solving math problems, but applies as well to any kind of values you want to put into a string.