Python learning notes (1), python learning notes

Source: Internet
Author: User

Python learning notes (1), python learning notes

#! /Usr/bin/eny python #! -*-Coding: UTF-8-*-"import timea1 = Truewhile a1: print ('1') time. sleep (3) a1 = Falseprint ('end') "" # an integer in 10 of the output ratio. # Break is used to jump out of a loop. "" A1 = Truenub = 1 while a1: print (nub) if nub = 10: a1 = False nub = nub + 1 print ('end ') "" # the first job of the food ratio, cyclically input an integer from 1 to 10, "" nub = 1 while True: print (nub) if nub = 10: break nub = nub + 1 print ('output 1-10 integers ') # The first job of the ratio of food to vegetable. The second method is a = 1 while a <= 11: if! = 10: print (a) a = 1 + a "" # The total number of all numbers in the ratio of "1" to "--100. "" Sum = 0nub = 1 while True: sum = sum + nub if nub = 100: break nub = nub + 1 print (sum) print ('sum of output values 1-') "" # an odd number of output values 1. Output an even number and set nub to 2. "" Sum = 0nub = 1 while True: print (nub) if nub> = 99: break nub = nub + 2 "# an odd number of 1-output from the ratio of food to vegetables, use the remainder. # Nub % 2 = 1 is the remainder, = 2 is the even number, after Division 2, the remainder is 1 is the odd number, except 2 is the even number. "Nub = 1 while nub <= 100: if nub % 2 = 1: print (nub) nub = nub + 1 """

 

Related Article

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.