Question: Given the following code: val = 9 def subtract _ one ( num ) : num = num - 1 print ( ' inside function:

Given the following code:
val =9
def subtract_one(num):
num = num -1
print('inside function: '+ str(num))
print('before function call: '+ str(val))
subtract_one(val)
print('after function call: '+ str(val))
The code will print out:
before function call: 9
inside function: 8
after function call: 9
Why does the value of val not become 8 after the function call? Select all that apply.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!