First, the output Hello World
Print ("Hello Word")
Second, summation operation
A1 = input ("A1:"= input ("A2:"= float (A1) + float (A2) Print (" the first number {0} plus the second number {1} and is {2}". Format (a1,a2,sum))
Three sides of the input triangle to seek the area
Import= input ("A1:"= input ("A2:" = input ("A3:"= (float (A1) +float (A2) +float (A3))/2D == d* (d-float (A1)) * (D-float (A2)) * (D-float (A3)) b=float (area) c= Math.sqrt (b)print(c)
Four, the radius of the input circle, to calculate the area
Circle = input (" Circle Radius:"= 3.14 * FLOAT (circle) *float (circle)Print (area)
Five, no color of the pentagram
Import= 0 while a < 5: turtle.forward ($) Turtle.left (144) = a + 1
Six, painted yellow pentagram
From Turtle Import *
FillColor ("Yellow")
Begin_fill ()
While True:
Forward (200)
Left (144)
If ABS (POS ()) <1:
Break
End_fill ()
Seven, draw the same cut round
Import turtleturtle.pensize (8) turtle.circle (ten) turtle.circle(turtle.circle) (40 ) turtle.circle (turtle.circle) (160)
Eight, simple interaction
Name = input (" Enter name:")print("{} classmate, learn Python, promising!") ". Format (name))
Python input and output exercises, arithmetic exercises, turtle preliminary exercises