(╯°□°)╯︵ ┻━┻

RANGE FUNCTION

  1. In repl.it, create a new Python file and name it range (click the pencil icon at the top to rename a file).
    
    
  2. Type the following code into the editor (white panel) and run it.
for x in range(10):
    print(x)

RANGE FUNCTION

What does it do?  
3. A range can be defined with 2 values. Try replacing the previous range with this new one.

RANGE FUNCTION

for x in range(50, 100):
    print(x)
What does it do?  
4. Now let's add a third value.

RANGE FUNCTION

for x in range(50, 100, 5):
    print(x)
What does it do?  
4. Finally, rewrite the program to print every decade since 1880 until now.

RANGE FUNCTION

That's it. Make sure the file is named 'range' so you can get credit for your work.

Range

By Michelle Lim

Range

  • 1,058