课堂练习
Posted 55卢思凯
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了课堂练习相关的知识,希望对你有一定的参考价值。
一、输出hello world
print(\'hello world’)
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================ RESTART: C:/Users/Administrator/Desktop/1.py ================ hello world >>>
二、求和运算 a1 = input("a1:") a2 = input("a2:") sum = float(a1)+float(a2) print(sum)
================ RESTART: C:/Users/Administrator/Desktop/1.py ================ a1:1 a2:2 3.0
三、求三角形的面积 import math a= input("a:") b= input("b:") c= input("c:") d=(float(a)+float(b)+float(c))/2 e=float(d) area =e*(e-float(a))*(e-float(b))*(e-float(c)) f=float(area) g=math.sqrt(f) print(f)
================ RESTART: C:/Users/Administrator/Desktop/1.py ================ a:4 b:5 c:6 98.4375
四、圆的面积 Circle = input("R :") area = 3.1415926 * float(Circle)*float(Circle) print(area)
================ RESTART: C:/Users/Administrator/Desktop/1.py ================ R :3 28.274333400000003
五、画五角星 import turtle a = 0 while a < 5: turtle.forward(200) turtle.left(144) a = a + 1
六、画黄色五角星 from turtle import * fillcolor("yellow") begin_fill() while True: forward(200) right(144) if abs(pos())< 1: break end_fill()
以上是关于课堂练习的主要内容,如果未能解决你的问题,请参考以下文章