Practice Difference Between Python 2 And Python 3 (11.3.1) - More about range()
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Difference between Python 2 and Python 3

Practice - Difference between Python 2 and Python 3

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

What does the range(5) function return in Python 3?

💡 Hint: Think about the starting point and the absence of a stopping point.

Question 2 Easy

How would you create a sequence counting down from 10 to 1?

💡 Hint: What must you include for the sequence to decrease?

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

In Python 2, what does range(5) return?

A list of numbers from 0 to 4
A range object
An error

💡 Hint: Think about the difference in output between the versions.

Question 2

True or False: range(1, 10, 2) generates 1, 3, 5, 7, 9.

True
False

💡 Hint: What does the step argument control?

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a function that accepts parameters for start, stop, and step to create a range in Python 3. Then demonstrate how this works with a real example.

💡 Hint: Focus on how to use the range function to output your desired sequence.

Challenge 2 Hard

Create a loop that counts down from 10 to 1 and print each number using range. What should the output be?

💡 Hint: Use the negative step to encourage the countdown creation.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.