86.4k views
3 votes
Write code to create a list of numbers from 0 to 67 and assign that list to the variable nums. Do not hard code the list. Save & RunLoad HistoryShow CodeLens

User Wiseland
by
5.5k points

1 Answer

1 vote

Answer:

The program written in Python is as follows

nums = []

for i in range(0,68):

-->nums.append(i)

print(nums)

Step-by-step explanation:

Please note that --> is used to denote indentation

The first line creates an empty list

nums = []

This line creates an iteration from 0 to 67, using iterating variable i

for i in range(0,68):

This line saves the current value of variable i into the empty list

nums.append(i)

At this point, the list has been completely filled with 0 to 67

This line prints the list

print(nums)

User Chetan Kapoor
by
6.3k points