Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Iterators.py # # This program will create a collection of random numbers between 5 and 2 5 , # and then iterate through the

# Iterators.py
#
# This program will create a collection of random numbers between 5 and 25,
# and then iterate through the collection to print the items.
# Imports the necessary modules
import random
# Sets the size of the collection
SIZE =10
# Initializes an empty collection
collection =[]
# Populates the collection with random numbers between 5 and 25
for i in range(SIZE):
collection.append(random.randint(5,25))
# Iterates through the collection and prints the items
for item in collection:
print(item)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Understand the process of effective succession planning

Answered: 1 week ago

Question

=+j Improve the effectiveness of global and virtual teams.

Answered: 1 week ago