- Hello world!
Print ('helloWorld')
- Simple Interactive (interactive, file-style) textbook P19
Name=input ('name=')print('{} Shi ver handsome '. Format (name)
- the user enters two numbers, calculates and outputs two digits of the sum:
-
a=input ( " a= " ) b =input ( " b= " ) s =float (a) +float (b) print ( " {} " . Format (s))
- the user enters a triangular three-edged length and calculates the area of the triangle: (Helen Formula)
-
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)
- Enter a radius to calculate the area of the circle.
radius= input ('radius=')area =3.1415 * FLOAT (RADIUS) * Float (RADIUS) Print (area) Print ('{:. 2f}'. Format (area))
- Draw a set of identical tangent circles
Import turtleturtle.circle (8) turtle.circle(+) turtle.circle(+)turtle.circle ( 64)
- Draw a Pentagram
Import Turtleturtle.begin_fill () for in range (5): turtle.forward ( turtle.left) (144) Turtle.end_fill ()
- Draw an all-yellow pentagram
Import Turtleturtle.begin_fill () for in range (5): turtle.forward ( turtle.left) (144) Turtle.end_ Fill ()
Thinking:
- Draw a set of concentric circles.
- Draw five pentagram on the national flag.
Python input and output exercises, arithmetic exercises, turtle preliminary exercises