A test script that is readily written in the Python learning process-testloop.py

Source: Internet
Author: User

# # defines the list array
Lstrs = [' T1 ', ' T2 ', ' T3 ', ' T4 ']
Print (' Lstrs is ', lstrs)

i = 0
# # Test for Loop
For LSTR in Lstrs:
Print (' lstrs[%d] is '% i,lstr)
i = i + 1
Print (' End for Loop ')

j = 0
# # Test While loop
While J <= 3:
Print (' lstrs[%d] is '% j,lstrs[j])
j = j + 1
Print (' End While Loop ')

K = 0
# Test Break and continue
Print (' K=0, k<=10, 1 continue, k>=4 break ')
While K <= 10:
if k = = 1:
K = k + 1
Continue
Print (' k is%d '% k)
If K >= 4:
Break
K = k + 1
Print (' End test for break and continue ')

A test script that is readily written in the Python learning process-testloop.py

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.