Python Exercise 28

Source: Internet
Author: User

No intention to see the old boy's blog: qualified Linux OPS personnel will be the 30-way shell programming surface questions and explanations

http://oldboy.blog.51cto.com/2561410/1632876

Try to use the first Python to answer some, right when practiced hand!

If there are errors, please criticize!


# Enterprise Face question 28, write a isosceles triangle (oldboy2_triangle.sh) with the shell or Python and receive the number entered by the user.

For example


# [email protected] ~]# sh oldboy2_triangle.sh

# please Enter a number:5

#0 *

#1 * * *

#2 * * *

#3 *******

#4 *********

#输入的数字表明有多少行数; #如果用户输入的是5 (0-4), M: the number of #第n行的 * is 2n-1# arrangement method is M-n space plus 2n-1 *m=int (input ("Plz input a num:")) for N in range (m ): s= (m-n) * "" + (2*n-1) * "*" Print (s)

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8C/F2/wKioL1h_RxvCeWMJAAAsxoUpTfQ899.png-wh_500x0-wm_3 -wmp_4-s_1751352481.png "title=" 1.png "alt=" Wkiol1h_rxvcewmjaaasxouptfq899.png-wh_50 "/>

Python Exercise 28

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.