"Python programming-from getting started to practicing" defines a wide range of integer array range (from which integer, to which integer before ending, [every step of the integer from start to end])

Source: Internet
Author: User

Range (1,5) defines integers starting from 1 to 4 [1,2,3,4]

Scenario 1:

Numbers = range (1,5)

For num in numbers:

Print (num)

Results

1

2

3

4

5

Scenario 2:

Numbers = range (1,5)

Print (Numbers)

Results

Range (1, 5)

"Feel" feel Python's print () function cannot output an array, but does not error, directly as a string output?

Scenario 3:

Numbers = List (range (1,5))

Print (Numbers)

Results

[1, 2, 3, 4]

"Feel" why would the list () function let the print () function output an array as a string? The document says list () is converted to a list of numbers, is it not the same as the array?

"Python programming-from getting started to practicing" defines a wide range of integer array range (from which integer, to which integer before ending, [every step of the integer from start to end])

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.