Python Exercises (i)

Source: Internet
Author: User

First, using the while loop output 1, 2, 3, 4, 5, 6 8, 9, 10
Count = 0 while count<10:    + = 1    if count==7        :continue     Print(count)
Sum of all the numbers of the two and 1-100
Count = 1= 0 while Count <=:    = sum +count    + = 1< C18>print(SUM)
Three, all odd numbers of output 1-100
Count = 1 while Count <=:    if count%2!=0:        Print(count)    Count+=1
Iv. all even numbers of output 1-100
Count = 1 while Count <=:    if count%2==0:        Print (count)     + = 1
V. Output 1+2+3+...+99 and
Count = 1= 0 while Count <=:    = count + sum    + = 1print( Sum
Six, user login, three opportunities
Count =0username="Andraw_wu"Password="123" whileCount <= 2: _username= Input ("Enter user name") _password= Input ("Enter Password")    ifUsername = = _username andPassword = =_password:Print("Landing Success")         Break    Else:        Print('Logon Failure') Count+ = 1Else:    Print("too many logins, can only log on three times")

Python Exercises (i)

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.