Do print() functions evaluate the input before it prints?


#1

Question

In this exercise, we placed expressions and mathematical operations inside of the print() function. Is the input always evaluated first before anything is printed?

Answer

Yes, any expressions and operations inside the parentheses of the print() function is always evaluated first, with priority, then the result is printed out at the end. This can be seen to follow the general rule of the order of operations where anything inside of ( ) is evaluated with highest priority, which in this case would be anything inside the print() function’s ( ).