cpt 180 chapter 2 assignment 3
Directions
Using the following guidelines, create a python program.
1. Create a program named printRandomNumbers that gets input from the user and then produces
a list of random numbers.
2. Add four comment lines at the top of the program that contain:
a. Program Name
b. Program Description
c. Programmer's Name (You)
d. Current Date
3. Import the random module
4. Prompt the user for the following:
a. Number of random numbers required
b. Lower limit of random numbers
c. Upper limit of random numbers
5. Using a for loop and the random.randint() method, print out a list of random numbers in a single
line separated by a space. See Example Output.
6. At the end of the code, using comment lines, answer the following question:
a. When importing a module into a Python program, what is the difference between using
the import statement and using the from statement? Which is normally preferred? Why?
7. Submit the printRandomNumbers.py file into the Chapter 2 Assignment 3 Submission Folder.
Hints
1. See example of using the random.randint() method on page 47 and at
https://www.w3schools.com/python/ref_random_randint.asp.
2. Remember that the values entered by the user will be strings that must be converted to integers.
3. Look at the end attribute of the print() method.