輸入輸出練習
阿新 • • 發佈:2017-09-06
port war png .cn input put end span images
n1=input(‘輸入一個數字‘) n2=input(‘輸入一個數字‘) n3=float(n1) + float(n2) print (float(n3))
n1=float(input(‘輸入三角形邊長1‘)) n2=float(input(‘輸入三角形邊長2‘)) n3=float(input(‘輸入三角形邊長3‘)) s=(n1+n2+n3)/2 area = (s*(s-n1)*(s-n2)*(s-n3))**0.5 print(‘三角形面積:%0.2f‘ %area)
r=float(input(‘請輸入圓的半徑‘)) area=3.1415*r*r print(area)
import turtle turtle.color(‘red‘) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.right(144) turtle.forward(500)
import turtle turtle.pensize(3) turtle.circle(15) turtle.circle(35) turtle.circle(55) turtle.circle(75) turtle.circle(95) turtle.circle(115) turtle.circle(135)
import turtle turtle.color(‘red‘) turtle.begin_fill() turtle.fillcolor(‘red‘) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.right(144) turtle.forward(500) turtle.end_fill()
輸入輸出練習