Python input and output exercises, arithmetic exercises, turtle preliminary exercises

Source: Internet
Author: User

  1. Hello world!
    1. Print ('helloWorld')

  2. Simple Interactive (interactive, file-style) textbook P19
    1. Name=input ('name=')print('{} Shi ver handsome  '. Format (name)

  3. the user enters two numbers, calculates and outputs two digits of the sum:
    1.  a=input ( " a=   " ) b  =input ( " b=   " ) s  =float (a) +float (b)  print  ( " {}  "  . Format (s)) 

       

       

  4. the user enters a triangular three-edged length and calculates the area of the triangle: (Helen Formula)
    1.  a=float (input ( "  first edge:  "   =float ( Input ( "  second side length:   "  =float (input ( "  third side length:   " )) s  = (a+b+c)/2area  = (s* (s-a) * (s-b) * (S-C) ) **0.5print  ( "   "%area) 

       

       

  5. Enter a radius to calculate the area of the circle.
    1. radius= input ('radius=')area =3.1415 * FLOAT (RADIUS) * Float (RADIUS) Print (area) Print ('{:. 2f}'. Format (area))

  6. Draw a set of identical tangent circles
    1. Import turtleturtle.circle (8) turtle.circle(+) turtle.circle(+)turtle.circle ( 64)

  7. Draw a Pentagram
    1. Import Turtleturtle.begin_fill ()  for  in range (5):    turtle.forward (    turtle.left) (144) Turtle.end_fill ()

  8. Draw an all-yellow pentagram

Import Turtleturtle.begin_fill ()  for  in range (5):    turtle.forward (    turtle.left) (144) Turtle.end_ Fill ()

Thinking:

    1. Draw a set of concentric circles.

    2. Draw five pentagram on the national flag.

Python input and output exercises, arithmetic exercises, turtle preliminary exercises

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.