educoder training - process control [4]

Output non-negative integers less than n in ascending order

mission details

The task of this level: Write a small program that can output non-negative integers less than n on the same line.

related information

range

The range type represents an immutable sequence of numbers, typically used in a for loop to iterate a specified number of times.
The range parameter must be an integer, and if the step parameter is omitted, it defaults to 1. If the start parameter is omitted, it defaults to 0. If step is zero, ValueError is raised.
range objects support common sequence operations except concatenation and repetition

range(stop)
range(start, stop[, step])
output: 10

Integers generated by traversing the output range

Popular understanding, traversing the range is: output all the integers in the range.

Examples are as follows:

for i in range(10):
print(i)
输出:
0
1
2
3
4
5
6
7
8
9

for i in range(10):
print(i, end=' ') # no newline, each output has a space
output:
0 1 2 3 4 5 6 7 8 9

programming requirements

According to the prompt, supplement the code in the editor on the right, accept a positive integer input, and sequentially output non-negative integers smaller than n on the same line.

Test instructions
The platform will test the code you write:

Guess you like

Origin blog.csdn.net/qq_41234663/article/details/130151133