Question: . Consider the following code, and answer the questions below: 1 def someFunction ( text , num ) : 2 for i in range (

. Consider the following code, and answer the questions below:
1 def someFunction(text, num):
2 for i in range(num):
3 print(text * i)
4
5 # Main Program
6 star ='*'
7 number =5
8 someFunction(star, number)
(a) In this code, is the variable star used as a parameter, or an argument? Is text an argument
or a parameter?
(b) What is the difference between parameters and arguments?
3. Trace the following code, writing the value assigned to each variable after each iteration of the
loop:
1 def my_func(x, y):
2 print(x + y)
3 return (x - y)**2
4
5 values =[1,5,9,7,2,4]
6 for i in range(len(values)):
7 a = values[i-1]
8 b = my_func(a, i)
Iteration # 123456
i Values
a Values
b Values
2

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!