1. 程式人生 > >輸入輸出練習

輸入輸出練習

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()

  技術分享

輸入輸出練習