Question: Question 4 (20 Points): Using the code below, with as much detail as possible: 1. Describe, line by the line, the execution of this code.
Question 4 (20 Points): Using the code below, with as much detail as possible: 1. Describe, line by the line, the execution of this code. Every line must be described. 10 points 2. The value of the variables at each step of the code, including the stacktrace with final output. 5 points Note: Every student will have different output. You must use your own student ID (emplid) number as the string (may start with 0 and it needs to be included). You will find your student ID on your id card. If you dont know it, email me asap. import random def getValue(maxVal): a = maxVal *2 return random.randrange(0,a) #make sure to describe the behavior of this line in detail! def func(val): output = set() for i in val: print(i) num = int(i) if num > 0: rndnum = getValue(num) output.add(rndnum) return output val=input('Please enter your 7 digit student id:') print(func(val))
PS: My number is 1936481
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
