Python practice-block-nested loops

Source: Internet
Author: User

For multiplier in range (5,8): For I in Range (1,11): Print I, "x", multiplier, "=", i*multiplier print

#

I tried to align the 2nd for with the first for, but the program gave an error.

I understand that if Lacy, it will represent the second block as a separate block to run, so the print calculation will not be able to get the value of Multplier, so the calculation can not be completed


#result

c:\python27\python.exe c:/users/hunk/pycharmprojects/untitled/guess-number.py1 x 5 =  52 x 5 = 103 x 5 = 154 x 5 = 205 x 5  = 256 x 5 = 307 x 5 = 358 x 5 = 409  x 5 = 4510 x 5 = 501 x 6 = 62 x 6  = 123 x 6 = 184 x 6 = 245 x 6 = 306 x  6 = 367 x 6 = 428 x 6 = 489 x 6 =  5410 x 6 = 601 x 7 = 72 x 7 = 143 x 7  = 214 x 7 = 285 x 7 = 356 x 7 = 427  x 7 = 498 x 7 = 569 x 7 = 6310 x 7  = 70


Python practice-block-nested loops

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.