qzgx.net
当前位置:首页 >> 用python打印三角形图案 >>

用python打印三角形图案

while true: a, b, c = eval(input('输入三角形三边长,以逗号分隔:')) if a+b>c and a+c>b and b+c>a: break; print('输入的三边长不合法,请重新输入')print('周长为')print('面积为')

public static void main(string[] args) { string prestr = " "; string dischar = "#"; for (int i = 0; i

for a in range(10): print a * '0' 看看像不像三角形?

for i in range(10): for j in range(0, 10 - i): print(end=" ") for k in range(10 - i, 10): print("$", end=" ") print("")

option explicitprivate sub form_click()dim n as byte, i as byte, j as byten = val(inputbox("n="))redim a(n, n) as longfor i = 1 to n print space(3 * (n - i + 1)); for j = 1 to i if i = j or j = 1 then a(i, j) = 1 else a(i, j) = a(i - 1, j - 1) + a(i - 1, j) end if print space

def Get_List(a,b,c): oList = [a,b,c] oList.sort() return oList a = raw_input('请输入三角形的第一条边长: ') b = raw_input('请输入三角形的第二条边长: ') c = raw_input('请输入三角形的第三条边长: ') if a.isdecimal() and b.isdecimal() and c.

base=int(input("Enter base number:")) print('1.') for i in range(0,base): print("%-*s"%(base,'*'*(base-i))) print('2.') for i in range(0,base): print("%*s"%(base,'*'*(base-i))) print('3.') for i in range(1,base+1): print("%*s"%(base,'*'*i))打印其他三个方向的直角等腰三角形

没学过Python,但了解过cpp,这个的话应该就是输出第一排,换行,再输出第二排,换行,再输出第三排

五角星+三角形=22 +五角星-三角形=18两个五角星=40五角星=20三角形=22-五角星三角形=2圆形=五角星+三角形+三角形 =20+2+2圆形=24

#打印倒立的正三角形 hang = int(input("请输入行数:")) y = 1 while y <= hang:space = 1 while space < y:print(" ",end="") space += 1 x = hang - y while x >= 0:print("* ",end="") x -= 1 print() y += 1 print("图形打印完成!")

网站首页 | 网站地图
All rights reserved Powered by www.qzgx.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com