Judgment statements in the 19:python

Source: Internet
Author: User

19.1 to find the area of a triangle

Problem Description:

give the three sides of the triangle, and ask for its area.

Tips:

650) this.width=650; "Src=" Https://s4.51cto.com/wyfs02/M02/9C/5C/wKioL1lvT5iQ-m1mAAAV5UrPxpc996.png-wh_                           500x0-wm_3-wmp_4-s_1156028022.png "title=" Untitled. png "alt=" wkiol1lvt5iq-m1maaav5urpxpc996.png-wh_50 "/>

the open root function of Python is sqrt.

you need to judge the triangular three-side relationship,a+b>c, that is, the sum of any two sides is greater than the third side.

19.2experimental results under command:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/9C/5C/wKioL1lvT7bAcpi5AAD5stf31KU466.png-wh_500x0-wm_ 3-wmp_4-s_2582768974.png "title=" Untitled. png "alt=" wkiol1lvt7bacpi5aad5stf31ku466.png-wh_50 "/>

19.3 PythonThe program is implemented as follows:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/9C/5C/wKiom1lvT9TSe_7hAADrH1EcLMM392.png-wh_500x0-wm_ 3-wmp_4-s_3054343876.png "title=" Untitled. png "alt=" wkiom1lvt9tse_7haadrh1eclmm392.png-wh_50 "/>

19.4How to add a triangle three side of the illegal judgment

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/9C/5C/wKioL1lvT_OxtMsoAAG66zv1zk8492.png-wh_500x0-wm_ 3-wmp_4-s_1904374805.png "title=" Untitled. png "alt=" wkiol1lvt_oxtmsoaag66zv1zk8492.png-wh_50 "/>

An unlawful judgment:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/9C/5C/wKioL1lvUA2g6ZbKAAIOh_Gq24s430.png-wh_500x0-wm_ 3-wmp_4-s_3214034400.png "title=" Untitled. png "alt=" wkiol1lvua2g6zbkaaioh_gq24s430.png-wh_50 "/>

After the program is changed

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9C/5C/wKioL1lvUCvQrXJ4AAIYN5yNV4o645.png-wh_500x0-wm_ 3-wmp_4-s_8299270.png "title=" Untitled. png "alt=" wkiol1lvucvqrxj4aaiyn5ynv4o645.png-wh_50 "/>

19.5 pythonConditional Statement Summary

Python A conditional statement is a result of execution of one or more statements ( True or False ) to determine the code block to execute.

you can easily understand the execution of conditional statements by :

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/9C/5C/wKioL1lvUEuix93yAABA8YWOdyU099.png-wh_500x0-wm_ 3-wmp_4-s_3052030681.png "title=" Untitled. png "alt=" wkiol1lvueuix93yaaba8ywodyu099.png-wh_50 "/>

PythonProgram language Specifies any non-0and non-null (NULL) value istrue,0orNULLto befalse.

Python in programming if statements are used for the execution of control programs in the following basic form:

if Judging Condition:

EXECUTE statement ...

Else :

EXECUTE statement ...


This article is from the "13088633" blog, please be sure to keep this source http://13098633.blog.51cto.com/13088633/1949087

Judgment statements in the 19:python

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.