Python for loop (1)

Source: Internet
Author: User

For a beginner, the for loop may overwhelm many people, because the python for loop I'm looking for does not have a detailed description of what the For loop is and what it means to define after the for loop. First, let me give you a common example.

For I in Range (1,10):

Print I

The above two codes are used to print 1 to 9 on the screen. Here is not the range of this function is introduced, we can go to Baidu to check. Or I'll introduce you later in the article.

Here I is a variable of its own definition in the following range (1,10) is the condition. The loop from the beginning of execution to the end of execution is the first thing in the range to give me a value and then go into the loop to print out I was assigned the value of the thing after printing to see if the loop is complete without a loop, the second number generated by the range is assigned to I and then continues to print so that the range is not generating numbers The I'm going to use a lot of it on the other line.

For i in ' Hello,world ':

Print I

This line of code will print the Hello,world one on top of the screen. It's still like that. For the back, define an I variable to be printed to the screen via print when you assign the character of the string Hello,world to the value of one to I. The For loop about Python is here just a summary. There will be more knowledge about the For loop in the future.

You are also welcome to point out deficiencies in the comment area. I will improve it slowly.

Python for loop (1)

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.