The first time Python wrote the code

Source: Internet
Author: User

#!/bin/bash/env python#-*-coding:utf-8-*-#function: Output 1-10 every 1 seconds import Timestart = 1flag = Truewhile Flag:print (start) if Start > 9:  breakelse:  start = start + 1time.sleep (1) Print (' End ')

  

#!/bin/bash/env python#-*-coding:utf-8-*-#function: Output 1-10 exclude 7import Timestart = 0while True:start = start + 1if start = = 7:continueelif start = 11:breakelse:print (start)        time.sleep (1) Print (' End ')

  

# !/bin/bash/env python # -*-coding:utf-8-*- # function: Sum of all numbers of 1-100 sum=0start=1 while True:    = sum + start    if start = =:        break = start + 1 print (sum)    

#!/bin/bash/env python#-*-coding:utf-8-*-#function: All the odd numbers in the output 1-100ImportTimestart=0 whileTrue:start= start + 1ifStart% 2 = =0:Continue    ifStart = = 99:         Break    Print(Start) time.sleep (0.2)Print('End')

#!/bin/bash/env python#-*-coding:utf-8-*-#function: Output 1-100 all even import Timestart = 1while True:start = start + 1if star T% 2! = 0:continueif start = = 102:breakprint (start) time.sleep (0.2) print (' End ')

  

#!/bin/bash/env python#-*-coding:utf-8-*-#sum of all the numbers of function:1-2+3-4+5.....99 (result is a)Start=0sum=0 sum1=0 sum2=0 whileTrue:start= start + 1ifStart% 2 = =0:sum1= Sum1-StartElse: sum2= sum2 +Start sum= Sum1 +sum2ifStart = = 99:         BreakPrint(sum)

#!/bin/bash/env python#-*-coding:utf-8-*-#function: Give the user three logon opportunities start = 0while True:start = start + 1user = Raw_input ("Use Rname: ") pwd = Raw_input (" Password: ") if user = =" Cairui "and pwd = =" 123 ":p rint (" Yes,you can Do it. ") Breakif start = = 3:break

  

The first time Python wrote the code

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.