0011 _ exercise questions, 0011 exercise questions

Source: Internet
Author: User

0011 _ exercise questions, 0011 exercise questions

_ Author _ = 'prop 93 '#! /Usr/bin/env python #-*-coding: UTF-8-*-# Use a while LOOP to input 1 2 3 4 5 6 8 9 10a = 1 while True: print () if (a = 10): break if (a = 7): a + = 1 continue a + = 1
_ Author _ = 'prop 93 '#! /Usr/bin/env python #-*-coding: UTF-8-*-# Calculate the sum of all numbers 1-100 and a = 1sum0 = 0 while (a <= ): sum0 = sum0 + a + = 1 print (sum0)
_ Author _ = 'prop 93 '#! /Usr/bin/env python #-*-coding: UTF-8-*-# output all odd numbers a = 1 while (a <101): if (a % 2! = 0): print (a) a + = 1
_ Author _ = 'prop 93 '#! /Usr/bin/env python #-*-coding: UTF-8-*-# output all the even numbers in 1-101 a = 1 while (a <): if (a % 2 = 0): print (a) a + = 1
_ Author _ = 'prop 93 '#! /Usr/bin/env python #-*-coding: UTF-8-*-# evaluate 1-2 + 3-4 + 5 .... sum of all numbers of 99 # method 1 # sumj = 0 # sumo = 0 # I = 1 # while (I <100): # if (I % 2 = 0 ): # sumo + = I # else: # sumj + = I # I + = 1 # print (sumj-sumo) # Method 2: I = 1he = 0 while (I <100): if (I % 2 = 1): he + = I else: he-= I + = 1 print (he)
_ Author _ = 'prop 93 '#! /Usr/bin/env python #-*-coding: UTF-8-*-# User Logon (three retries) wtime = 1 while (wtime <= 3 ): user = input ("Username:") pwd = input ("Password:") if (user! = "Xb" or pwd! = "123"): print ("Username or Password wrong, Please input again! (% D/3) "% wtime) wtime + = 1 else: print (" Login Succeed! ") Break

 

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.