l) I need to use a Python class, named get_numbers, so number sequences can be leveraged in all the department's projects 2) The basic idea is to...
View the step-by-step solution to:

Question

Python code that executes the following is required:



src="/qa/attachment/10844630/" alt="Assignment-2.pdf 2019-11-05 22-21-39.png" />

Assignment-2.pdf 2019-11-05 22-21-39.png

l) I need to use a Python class, named get_numbers, 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 fib_gen 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. .0 0999‘s

Top Answer

Please find the code and output below. Let me know if you have any doubt. import random class get_numbers () : def randbelow... View the full answer

Capture.PNG

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