Getting started with Python: 1-99 of the equations

Source: Internet
Author: User

1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 #1-99 a few and a few equations4 #Start (start, transliteration: Think two) sum (total, transliteration: Kuwagi) Temp (temporary employee, transliteration: Shanwa)5 """6 Assign value to s to a blank string, start assignment is 1,sum assignment is 0,start less than 100 while loop is true,7 the assignment of temp equals the remainder of start and 2, if temp equals 1, if start equals 1,s the assignment equals start8 and converted to a string type, otherwise the assignment of s equals s Plus + (connector) plus string Plus + + String type start,9 sum is assigned equal to sum plus start, otherwise the assignment of s equals s Plus + + string minus + + String type start,Ten The assignment of sum equals sum minus Start,start is equal to start plus 1, which is added to the 99,while loop as false!  One print S, print sum!  A """ -s ="" -Start = 1 thesum =0 -  whileStart < 100: -temp = start% 2 -     ifTemp ==1: +         ifStart ==1: -s =Str (START) +         Else: As = s +"+"+Str (START) atsum = sum +Start -     Else: -s = s +"-"+Str (START) -sum = Sum-Start -Start + = 1 - Print(s) in Print(sum)

Getting started with Python: 1-99 of the equations

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.