The team needs a simple way to generate two sequences of numbers to be used in their analysis projects. The lead has asked you to create a Python...
View the step-by-step solution to:

Question

The following is the criteria for a python class that is being required:

alt="Assignment-2.pdf 2019-11-05 19-12-45.png" />

qa.png

Assignment-2.pdf 2019-11-05 19-12-45.png

RE UEST You have just been hired as a data analyst and the lead of the analyst team has asked for your help. The team needs a simple
way to generate two sequences of numbers to be used in their analysis projects. The lead has asked you to create a Python
class to generate these two sequences of numbers. You have taken notes of the request, as follows: 1) I need to use a Python class, named getinumbers, so number sequences can be leveraged in all the department’s
projects 2) The basic idea is to simply call a class method, passing an integer argument, that generates one of two types of
sequences of integer numbers, as a Python list with the requested number sequences. The number of items (or
elements) in the Python list (which will have the requested numbers) will be equal to the integer argument being
passed on to the class method. 3) The first sequence of numbers selected are random numbers less or equal than one million. I need to do the
following: a. Name this method random gen that generates random numbers b. This method takes one inbound integer argument, that I need to name length c. The lead asked me to use the Python secrets class, due to its cryptographic strengths, to generate numbers, I was specifically asked to use the randbelow method of this Python secrets class for this project. (1. I need to use the randbelow method of this class to generate random numbers less or equal than one million
Such numbers will be stored in a list, that will be returned to the caller of the method, using the return
statement f. Thus, in summary, I will need to generate a loop of some sort, to generate the requested (this would be the length argument) random numbers, using the Python secrets class and its randbelow method, that are less or
equal to one million. The numbers will be returned as a list, to its method caller, using the Python return
statement.
4) The second sequence of numbers are Fibonacci numbers. I need to do the following:
Name this method fibigen that generates Fibonacci number.
This method takes one inbound integer argument, that I need to name length.
The generated numbers will be in a Python list, that is returned to the method caller using a return statement
The number of items in the Python list is equal to the length integer argument being passed to the class method
Thus, in summary, I will need to generate a loop of some sort, to generate the requested (this would be the
length argument) Fibonacci numbers, stored in a Python list, results to be returned using the Python return
statement. 5'” sip-Pg.»

qa.png

QUALITY ASSURANCE STEPS The quality assurance steps I was provided are as follows:
a 2 get_numbers()
print(a.randomfigen(5))
print(a.f1b_gen(5)) a.randomigen(5) will generate 5 random numbers (as outlined in section 3 above) in a list. Obviously, the numbers shown
here will not match what my class will produce, since every time this method is called, random numbers Will be generated.
Here is an example of output to the Python console: In [96]: print(a.random_gen(5))
[876692, 598656, 994386, 412278, 87674] a.fibigen(5) will generate 5 Fibonacci numbers (as outlined in section 4 above) in a list. In this case, the Fibonacci numbers
will match if I request a sequence of 5 numbers. Here is an example of output to the Python console: In [97]: print(a.fib_gen(5))
[1; 1: 2: 3: 5]

Top Answer

The solution is... View the full answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question