1. Hello world!
2. Simple Interactive (interactive, file-style) textbook P19
3, the user input two numbers, calculate and output two numbers of the sum:
4, the user input triangle three-side length, and calculate the area of the triangle: (Helen Formula)
A=input ("Edge length of triangle a:") b=input ("side length B of the triangle:") C=input ("The edge length of the triangle C:") s=1/2*(float(a) +float(b) +float(c) area= (s* (float(s)-float(a)) *(float(s)-float(b)) *(float(s)-float(c))) **0.5Print ("the area of the triangle is: {}". Format (area)
5. Enter the radius to calculate the area of the circle.
The radius of the circle is 5, and the area of the circle is 78.54.
6, draw a group of same cut round
Import turtleturtle.pensize (2) turtle.circle(turtle.circle) ( turtle.circle (turtle.circle)
7. Draw a Pentagram
Import Turtle for in range (5): turtle.forward (+) turtle.left ( 144)
8. Draw a All-yellow pentagram
Import Turtleturtle.color ("yellow") Turtle.fillcolor (" Yellow") Turtle.begin_fill () for in range (5): Turtle.forward ( turtle.left) (144) Turtle.end_fill ()
Python input and output exercises, arithmetic exercises, turtle preliminary exercises