Day1-python Foundation

Source: Internet
Author: User

For the first day of the course outline, the left for the understanding of the section, the right needs to focus on and practice (hand-hit).

Exercises:

  1. using while loop input 1 2 3 4 5 6     8 9
     1  count=12  while  count<11:  3  print   (count)  4  if  count ==6:  5  count +=16  print  ( " "  Span style= "COLOR: #000000" >)  7  count +=18< /span> 
    loop output
  2. the sum of all the numbers for 1-100 and
     1  count = 12  sum =< Span style= "COLOR: #000000" > 0  3  while  count<101:  4  sum= sum + count  5  count= count + 16  print  (sum) 
    1-100 all numbers and
  3. all odd numbers in output 1-100
     1  count=12  while  count<101:  3  4  print
           (count)  5  count +=2 
    output 1-100 all odd numbers
  4. all even in output 1-100
     1  count=0  2  while  count<101 :  3  4  print
           (count)  5  count +=2 
    all even
  5. in output 1-100
  6. Beg 1-2+3-4+5 ... 99 of all numbers of the and
    1 sum=02 i=03 while i<100:4     if i%2==0:5         Sum-=i6     else:7          sum + =I8     i +=19print(sum)
    Beg 1-2+3-4+5 ... 99 of all numbers of the and
  7. User Login (three chance retry)
    1t=02  whileT<3:3Show=input ("please start your show! ")4Dream=input ("What do you have in your dreams? ")5     ifShow = ="poping":6         ifdream=="Dancer":7             Print("give the towel, get the championship together.")8              Break 9         Else:Ten             Print("your dream is a little floating.") OneT +=1 A     Else: -         Print("Sorry, you're not good enough.") -T +=1 the     ifT==3: -         Print("Battle three times, sorry!") -     
    User Login (three chance retry)

Day1-python Foundation

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.