Question: Use Python Programming Language Question 2 ( a ) A genRandomintSeq ( m ) function is defined as below, to generate a sequence of integers
Use Python Programming Language
Question
a
A genRandomintSeq m function is defined as below, to generate a sequence of
integers from until
# Importing random function from random module
# that generates a floating number from
# including but not
from random import random
def genRandomintSeq m :
# There are errors in the codes below
set
while True:
# Generate a random integer from
if i not in :
s add i
yield i
When the function is used in codes below, a sequence of five integers should be
printed in random order, for example, "RandomlntSeq
# There is no error in the codes below
print RandomIntSeq end
for in genRandomintseq :
print end
print
Since there are some errors in how the function is defined, the expected output is not
obtained. What is the output with the current erroneous codes? Explain why such
output is obtained instead. Give the corrected codes, how the function should be
defined, so that the correct output for example, "RandomintSeq can be
obtained.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
