Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Python List Creation
00:00
5 left

Python List Creation

EasyPython

Problem

Create a Python list of numbers from 1 through 1000.

Implement create_numbers(limit) so it returns every integer from 1 through limit, inclusive. The interview evaluation calls the function with limit = 1000; smaller limits are included for testing.

Input: An integer limit.

Output: A Python list containing the integers from 1 through limit in ascending order.

Constraints

  • 1 <= limit <= 1000
  • The output must be a Python list
  • The list must contain each integer from 1 through limit exactly once

Function Signature

def create_numbers(limit):
Interviewer

Your question is Python List Creation. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.